[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 17 16:06:01 PDT 2002


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.56 -> 1.57

---
Log message:

Fix bug: test/Regression/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
Thanks to Casey for finding it!



---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.56 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.57
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.56	Tue Sep 10 20:21:33 2002
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Sep 17 16:05:42 2002
@@ -669,7 +669,8 @@
                    *cast<Constant>(GEP.getOperand(1));
       assert(Indices[0] != 0 && "Constant folding of uint's failed!?");
 
-    } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy)) { 
+    } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy) &&
+               Src->getNumOperands() != 1) { 
       // Otherwise we can do the fold if the first index of the GEP is a zero
       Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end());
       Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end());





More information about the llvm-commits mailing list