[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jul 3 01:43:01 PDT 2003
Changes in directory llvm/lib/Analysis:
BasicAliasAnalysis.cpp updated: 1.11 -> 1.12
---
Log message:
Reuse the values if they are constants: this is important so that we index into the right structure field
This fixes bug: BasicAA/2003-07-03-BasicAACrash.ll
---
Diffs of the changes:
Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.11 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.12
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.11 Tue Jun 17 10:25:37 2003
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Thu Jul 3 01:42:38 2003
@@ -288,8 +288,13 @@
const Value *Op1 = GEP1->getOperand(i);
const Value *Op2 = GEP2->getOperand(i);
if (Op1 == Op2) { // If they are equal, use a zero index...
- Indices1.push_back(Constant::getNullValue(Op1->getType()));
- Indices2.push_back(Indices1.back());
+ if (!isa<Constant>(Op1)) {
+ Indices1.push_back(Constant::getNullValue(Op1->getType()));
+ Indices2.push_back(Indices1.back());
+ } else {
+ Indices1.push_back((Value*)Op1);
+ Indices2.push_back((Value*)Op2);
+ }
} else {
if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
// If this is an array index, make sure the array element is in range...
More information about the llvm-commits
mailing list