summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
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
commit08537005828d3187b5e2b2ad3cd0918aa67e0c7c (patch)
treeadce59dbd306407be6078d830dd8eae91190317d /llvm/lib/Transforms/Utils/Local.cpp
parent29ba01f214ebb912de873a06227ece1c7d8e393b (diff)
downloadbcm5719-llvm-08537005828d3187b5e2b2ad3cd0918aa67e0c7c.tar.gz
bcm5719-llvm-08537005828d3187b5e2b2ad3cd0918aa67e0c7c.zip
Revert a patch that is unsafe, due to out of range array accesses in inner
array scopes possibly accessing valid memory in outer subscripts. llvm-svn: 28478
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3998923dd1a..f0da3e554c0 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/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))
OpenPOWER on IntegriCloud