mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fix PR284: [indvars] Induction variable analysis violates LLVM invariants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12275 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a22ef48fee
commit
c6b0c4b9e2
@ -136,10 +136,14 @@ InductionVariable::InductionVariable(PHINode *P, LoopInfo *LoopInfo): End(0) {
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user