diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-25 21:25:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-25 21:25:12 +0000 |
commit | 08537005828d3187b5e2b2ad3cd0918aa67e0c7c (patch) | |
tree | adce59dbd306407be6078d830dd8eae91190317d /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 29ba01f214ebb912de873a06227ece1c7d8e393b (diff) | |
download | bcm5719-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.cpp | 4 |
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)) |