[llvm-commits] CVS: llvm/lib/Transforms/Utils/Local.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu May 25 14:25:25 PDT 2006



Changes in directory llvm/lib/Transforms/Utils:

Local.cpp updated: 1.56 -> 1.57
---
Log message:

Revert a patch that is unsafe, due to out of range array accesses in inner
array scopes possibly accessing valid memory in outer subscripts.


---
Diffs of the changes:  (+2 -2)

 Local.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Utils/Local.cpp
diff -u llvm/lib/Transforms/Utils/Local.cpp:1.56 llvm/lib/Transforms/Utils/Local.cpp:1.57
--- llvm/lib/Transforms/Utils/Local.cpp:1.56	Wed May 24 12:34:30 2006
+++ llvm/lib/Transforms/Utils/Local.cpp	Thu May 25 16:25:12 2006
@@ -274,7 +274,7 @@
     } 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 @@
           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))






More information about the llvm-commits mailing list