[llvm-commits] CVS: llvm/lib/Analysis/InductionVariable.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Mar 10 15:43:10 PST 2004
Changes in directory llvm/lib/Analysis:
InductionVariable.cpp updated: 1.34 -> 1.35
---
Log message:
Fix PR284: [indvars] Induction variable analysis violates LLVM invariants
---
Diffs of the changes: (+5 -1)
Index: llvm/lib/Analysis/InductionVariable.cpp
diff -u llvm/lib/Analysis/InductionVariable.cpp:1.34 llvm/lib/Analysis/InductionVariable.cpp:1.35
--- llvm/lib/Analysis/InductionVariable.cpp:1.34 Tue Dec 23 02:04:02 2003
+++ llvm/lib/Analysis/InductionVariable.cpp Wed Mar 10 15:42:19 2004
@@ -136,10 +136,14 @@
if (Constant *CV = dyn_cast<Constant>(V))
Step = ConstantExpr::get(Instruction::Sub, Zero, CV);
else if (Instruction *I = dyn_cast<Instruction>(V)) {
+ BasicBlock::iterator InsertPt = I;
+ for (++InsertPt; isa<PHINode>(InsertPt); ++InsertPt)
+ /*empty*/;
Step = BinaryOperator::create(Instruction::Sub, Zero, V,
- V->getName()+".neg", I->getNext());
+ V->getName()+".neg", InsertPt);
} else {
+ // Must be loop invariant
Step = BinaryOperator::create(Instruction::Sub, Zero, V,
V->getName()+".neg",
Phi->getParent()->getParent()->begin()->begin());
More information about the llvm-commits
mailing list