mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Don't grab the condition of unconditional branches!
This fixes PR363 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8e6e7c90ce
commit
47c31a8248
@ -442,14 +442,15 @@ Value *Loop::getTripCount() const {
|
||||
IV->getIncomingBlock(contains(IV->getIncomingBlock(1)));
|
||||
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(BackedgeBlock->getTerminator()))
|
||||
if (SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition()))
|
||||
if (SCI->getOperand(0) == Inc)
|
||||
if (BI->getSuccessor(0) == getHeader()) {
|
||||
if (SCI->getOpcode() == Instruction::SetNE)
|
||||
if (BI->isConditional())
|
||||
if (SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition()))
|
||||
if (SCI->getOperand(0) == Inc)
|
||||
if (BI->getSuccessor(0) == getHeader()) {
|
||||
if (SCI->getOpcode() == Instruction::SetNE)
|
||||
return SCI->getOperand(1);
|
||||
} else if (SCI->getOpcode() == Instruction::SetEQ) {
|
||||
return SCI->getOperand(1);
|
||||
} else if (SCI->getOpcode() == Instruction::SetEQ) {
|
||||
return SCI->getOperand(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user