1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Don't grab the condition of unconditional branches!

This fixes PR363

llvm-svn: 14076
This commit is contained in:
Chris Lattner 2004-06-08 21:50:30 +00:00
parent 91a3d0f55f
commit 9579beadfe

View File

@ -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;
}