mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Add a check if the initial value of the induction variable is 0 (the method comment says it should be).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46907 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
63a18c491a
commit
402689d11a
@ -360,12 +360,16 @@ public:
|
||||
// Loop over all of the PHI nodes, looking for a canonical indvar.
|
||||
for (typename BlockT::iterator I = H->begin(); isa<PHINode>(I); ++I) {
|
||||
PHINode *PN = cast<PHINode>(I);
|
||||
if (Instruction *Inc =
|
||||
dyn_cast<Instruction>(PN->getIncomingValueForBlock(Backedge)))
|
||||
if (Inc->getOpcode() == Instruction::Add && Inc->getOperand(0) == PN)
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Inc->getOperand(1)))
|
||||
if (CI->equalsInt(1))
|
||||
return PN;
|
||||
if (ConstantInt *CI =
|
||||
dyn_cast<ConstantInt>(PN->getIncomingValueForBlock(Incoming)))
|
||||
if (CI->isNullValue())
|
||||
if (Instruction *Inc =
|
||||
dyn_cast<Instruction>(PN->getIncomingValueForBlock(Backedge)))
|
||||
if (Inc->getOpcode() == Instruction::Add &&
|
||||
Inc->getOperand(0) == PN)
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Inc->getOperand(1)))
|
||||
if (CI->equalsInt(1))
|
||||
return PN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user