summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2017-10-26 22:02:16 +0000
committerPhilip Reames <listmail@philipreames.com>2017-10-26 22:02:16 +0000
commit29dd40b38eec726b0250b0bdc9951db628852773 (patch)
tree045dca6660d1d36ac0dbbb5099c63f89efffd9de /llvm/lib/Transforms/Utils
parentd5dfb62de78c60750af9c9fcf2b552cdcbddbc0e (diff)
downloadbcm5719-llvm-29dd40b38eec726b0250b0bdc9951db628852773.tar.gz
bcm5719-llvm-29dd40b38eec726b0250b0bdc9951db628852773.zip
[SimplifyIndVars] Shorten code by using SCEV helper [NFC]
llvm-svn: 316709
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyIndVar.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 08b84927c67..5263e8ccc6d 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -174,14 +174,11 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) {
Pred = ICmpInst::getSwappedPredicate(Pred);
}
- // Get the SCEVs for the ICmp operands.
- const SCEV *S = SE->getSCEV(ICmp->getOperand(IVOperIdx));
- const SCEV *X = SE->getSCEV(ICmp->getOperand(1 - IVOperIdx));
-
- // Simplify unnecessary loops away.
+ // Get the SCEVs for the ICmp operands (in the specific context of the
+ // current loop)
const Loop *ICmpLoop = LI->getLoopFor(ICmp->getParent());
- S = SE->getSCEVAtScope(S, ICmpLoop);
- X = SE->getSCEVAtScope(X, ICmpLoop);
+ const SCEV *S = SE->getSCEVAtScope(ICmp->getOperand(IVOperIdx), ICmpLoop);
+ const SCEV *X = SE->getSCEVAtScope(ICmp->getOperand(1 - IVOperIdx), ICmpLoop);
ICmpInst::Predicate InvariantPredicate;
const SCEV *InvariantLHS, *InvariantRHS;
OpenPOWER on IntegriCloud