For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index b33e414..27f1750 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -536,7 +536,7 @@
/// returns null.
///
Value *Loop::getTripCount() const {
- // Canonical loops will end with a 'setne I, V', where I is the incremented
+ // Canonical loops will end with a 'cmp ne I, V', where I is the incremented
// canonical induction variable and V is the trip count of the loop.
Instruction *Inc = getCanonicalInductionVariableIncrement();
if (Inc == 0) return 0;
@@ -546,15 +546,17 @@
IV->getIncomingBlock(contains(IV->getIncomingBlock(1)));
if (BranchInst *BI = dyn_cast<BranchInst>(BackedgeBlock->getTerminator()))
- if (BI->isConditional())
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition()))
- if (SCI->getOperand(0) == Inc)
+ if (BI->isConditional()) {
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
+ if (ICI->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);
+ if (ICI->getPredicate() == ICmpInst::ICMP_NE)
+ return ICI->getOperand(1);
+ } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) {
+ return ICI->getOperand(1);
}
+ }
+ }
return 0;
}