From 99f2af2dee68c4fe102b7b19d5ed9e565b2a4b23 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 25 May 2006 21:25:12 +0000 Subject: [PATCH] Revert a patch that is unsafe, due to out of range array accesses in inner array scopes possibly accessing valid memory in outer subscripts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28478 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/Local.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 3998923dd1a..f0da3e554c0 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -274,7 +274,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, } else if (ConstantInt *CI = dyn_cast(I.getOperand())) { if (const ArrayType *ATy = dyn_cast(*I)) { if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) - C = UndefValue::get(ATy->getElementType()); + return 0; if (ConstantArray *CA = dyn_cast(C)) C = CA->getOperand((unsigned)CI->getRawValue()); else if (isa(C)) @@ -285,7 +285,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, return 0; } else if (const PackedType *PTy = dyn_cast(*I)) { if ((uint64_t)CI->getRawValue() >= PTy->getNumElements()) - C = UndefValue::get(PTy->getElementType()); + return 0; if (ConstantPacked *CP = dyn_cast(C)) C = CP->getOperand((unsigned)CI->getRawValue()); else if (isa(C))