diff options
author | Michael Zolotukhin <mzolotukhin@apple.com> | 2014-05-26 14:49:46 +0000 |
---|---|---|
committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2014-05-26 14:49:46 +0000 |
commit | 265dfa411ca86864dbac3a7c2584e3ca3e376ea8 (patch) | |
tree | c5064bdf1000c9fd7b0afd8121f5b301d9606b27 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 1ae28dd7935a349ecfcdcf7eb250aad38907a646 (diff) | |
download | bcm5719-llvm-265dfa411ca86864dbac3a7c2584e3ca3e376ea8.tar.gz bcm5719-llvm-265dfa411ca86864dbac3a7c2584e3ca3e376ea8.zip |
Some cleanup for r209568.
llvm-svn: 209634
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 461fdac3c6c..1087e5df163 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -1208,11 +1208,10 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op, auto SMul = dyn_cast<SCEVMulExpr>(SA->getOperand(1)); if (SMul && SC1) { if (auto SC2 = dyn_cast<SCEVConstant>(SMul->getOperand(0))) { - APInt C1 = SC1->getValue()->getValue(); - APInt C2 = SC2->getValue()->getValue(); - APInt CDiff = C2 - C1; + const APInt &C1 = SC1->getValue()->getValue(); + const APInt &C2 = SC2->getValue()->getValue(); if (C1.isStrictlyPositive() && C2.isStrictlyPositive() && - CDiff.isStrictlyPositive() && C2.isPowerOf2()) + C2.ugt(C1) && C2.isPowerOf2()) return getAddExpr(getSignExtendExpr(SC1, Ty), getSignExtendExpr(SMul, Ty)); } @@ -1316,11 +1315,10 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op, auto SC1 = dyn_cast<SCEVConstant>(Start); auto SC2 = dyn_cast<SCEVConstant>(Step); if (SC1 && SC2) { - APInt C1 = SC1->getValue()->getValue(); - APInt C2 = SC2->getValue()->getValue(); - APInt CDiff = C2 - C1; - if (C1.isStrictlyPositive() && C2.isStrictlyPositive() && - CDiff.isStrictlyPositive() && C2.isPowerOf2()) { + const APInt &C1 = SC1->getValue()->getValue(); + const APInt &C2 = SC2->getValue()->getValue(); + if (C1.isStrictlyPositive() && C2.isStrictlyPositive() && C2.ugt(C1) && + C2.isPowerOf2()) { Start = getSignExtendExpr(Start, Ty); const SCEV *NewAR = getAddRecExpr(getConstant(AR->getType(), 0), Step, L, AR->getNoWrapFlags()); |