diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-23 06:05:41 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-23 06:05:41 +0000 |
commit | e4d87aa2de6e52952dca73716386db09aad5a8fd (patch) | |
tree | ce8c6e6ddc845de3585020c856118892f4206593 /lib/Analysis/LoopInfo.cpp | |
parent | add2bd7f5941537a97a41e037ae2277fbeed0b4f (diff) | |
download | external_llvm-e4d87aa2de6e52952dca73716386db09aad5a8fd.zip external_llvm-e4d87aa2de6e52952dca73716386db09aad5a8fd.tar.gz external_llvm-e4d87aa2de6e52952dca73716386db09aad5a8fd.tar.bz2 |
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
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
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 @@ Instruction *Loop::getCanonicalInductionVariableIncrement() const { /// 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 @@ Value *Loop::getTripCount() const { 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; } |