[llvm] r320144 - [NFC] Rename variable from Cond to Pred to make it more sound
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 04:54:32 PST 2017
Author: mkazantsev
Date: Fri Dec 8 04:54:32 2017
New Revision: 320144
URL: http://llvm.org/viewvc/llvm-project?rev=320144&view=rev
Log:
[NFC] Rename variable from Cond to Pred to make it more sound
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=320144&r1=320143&r2=320144&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Dec 8 04:54:32 2017
@@ -7069,18 +7069,18 @@ ScalarEvolution::computeExitLimitFromICm
bool ControlsExit,
bool AllowPredicates) {
// If the condition was exit on true, convert the condition to exit on false
- ICmpInst::Predicate Cond;
+ ICmpInst::Predicate Pred;
if (!L->contains(FBB))
- Cond = ExitCond->getPredicate();
+ Pred = ExitCond->getPredicate();
else
- Cond = ExitCond->getInversePredicate();
- const ICmpInst::Predicate OriginalCond = Cond;
+ Pred = ExitCond->getInversePredicate();
+ const ICmpInst::Predicate OriginalPred = Pred;
// Handle common loops like: for (X = "string"; *X; ++X)
if (LoadInst *LI = dyn_cast<LoadInst>(ExitCond->getOperand(0)))
if (Constant *RHS = dyn_cast<Constant>(ExitCond->getOperand(1))) {
ExitLimit ItCnt =
- computeLoadConstantCompareExitLimit(LI, RHS, L, Cond);
+ computeLoadConstantCompareExitLimit(LI, RHS, L, Pred);
if (ItCnt.hasAnyInfo())
return ItCnt;
}
@@ -7097,11 +7097,11 @@ ScalarEvolution::computeExitLimitFromICm
if (isLoopInvariant(LHS, L) && !isLoopInvariant(RHS, L)) {
// If there is a loop-invariant, force it into the RHS.
std::swap(LHS, RHS);
- Cond = ICmpInst::getSwappedPredicate(Cond);
+ Pred = ICmpInst::getSwappedPredicate(Pred);
}
// Simplify the operands before analyzing them.
- (void)SimplifyICmpOperands(Cond, LHS, RHS);
+ (void)SimplifyICmpOperands(Pred, LHS, RHS);
// If we have a comparison of a chrec against a constant, try to use value
// ranges to answer this query.
@@ -7110,13 +7110,13 @@ ScalarEvolution::computeExitLimitFromICm
if (AddRec->getLoop() == L) {
// Form the constant range.
ConstantRange CompRange =
- ConstantRange::makeExactICmpRegion(Cond, RHSC->getAPInt());
+ ConstantRange::makeExactICmpRegion(Pred, RHSC->getAPInt());
const SCEV *Ret = AddRec->getNumIterationsInRange(CompRange, *this);
if (!isa<SCEVCouldNotCompute>(Ret)) return Ret;
}
- switch (Cond) {
+ switch (Pred) {
case ICmpInst::ICMP_NE: { // while (X != Y)
// Convert to: while (X-Y != 0)
ExitLimit EL = howFarToZero(getMinusSCEV(LHS, RHS), L, ControlsExit,
@@ -7132,7 +7132,7 @@ ScalarEvolution::computeExitLimitFromICm
}
case ICmpInst::ICMP_SLT:
case ICmpInst::ICMP_ULT: { // while (X < Y)
- bool IsSigned = Cond == ICmpInst::ICMP_SLT;
+ bool IsSigned = Pred == ICmpInst::ICMP_SLT;
ExitLimit EL = howManyLessThans(LHS, RHS, L, IsSigned, ControlsExit,
AllowPredicates);
if (EL.hasAnyInfo()) return EL;
@@ -7140,7 +7140,7 @@ ScalarEvolution::computeExitLimitFromICm
}
case ICmpInst::ICMP_SGT:
case ICmpInst::ICMP_UGT: { // while (X > Y)
- bool IsSigned = Cond == ICmpInst::ICMP_SGT;
+ bool IsSigned = Pred == ICmpInst::ICMP_SGT;
ExitLimit EL =
howManyGreaterThans(LHS, RHS, L, IsSigned, ControlsExit,
AllowPredicates);
@@ -7158,7 +7158,7 @@ ScalarEvolution::computeExitLimitFromICm
return ExhaustiveCount;
return computeShiftCompareExitLimit(ExitCond->getOperand(0),
- ExitCond->getOperand(1), L, OriginalCond);
+ ExitCond->getOperand(1), L, OriginalPred);
}
ScalarEvolution::ExitLimit
More information about the llvm-commits
mailing list