summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-25 21:25:12 +0000
committerChris Lattner <sabre@nondot.org>2006-05-25 21:25:12 +0000
commit99f2af2dee68c4fe102b7b19d5ed9e565b2a4b23 (patch)
treefc0300ad7d54d75561f89004013d3b1a78073ba5 /lib/Transforms/Utils
parent392b821fa4c4435c3e35963e8114a0a203f76696 (diff)
downloadexternal_llvm-99f2af2dee68c4fe102b7b19d5ed9e565b2a4b23.zip
external_llvm-99f2af2dee68c4fe102b7b19d5ed9e565b2a4b23.tar.gz
external_llvm-99f2af2dee68c4fe102b7b19d5ed9e565b2a4b23.tar.bz2
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
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/Local.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 3998923..f0da3e5 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<ConstantInt>(I.getOperand())) {
if (const ArrayType *ATy = dyn_cast<ArrayType>(*I)) {
if ((uint64_t)CI->getRawValue() >= ATy->getNumElements())
- C = UndefValue::get(ATy->getElementType());
+ return 0;
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
C = CA->getOperand((unsigned)CI->getRawValue());
else if (isa<ConstantAggregateZero>(C))
@@ -285,7 +285,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
return 0;
} else if (const PackedType *PTy = dyn_cast<PackedType>(*I)) {
if ((uint64_t)CI->getRawValue() >= PTy->getNumElements())
- C = UndefValue::get(PTy->getElementType());
+ return 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C))
C = CP->getOperand((unsigned)CI->getRawValue());
else if (isa<ConstantAggregateZero>(C))