From 8500e487c71276377a788bb0b7c439416bf06335 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Fri, 8 Dec 2017 12:54:32 +0000 Subject: [PATCH] [NFC] Rename variable from Cond to Pred to make it more sound git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320144 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScalarEvolution.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 8001d99603a..3ed7dde47bb 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -7069,18 +7069,18 @@ ScalarEvolution::computeExitLimitFromICmp(const Loop *L, 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(ExitCond->getOperand(0))) if (Constant *RHS = dyn_cast(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::computeExitLimitFromICmp(const Loop *L, 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::computeExitLimitFromICmp(const Loop *L, 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(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::computeExitLimitFromICmp(const Loop *L, } 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::computeExitLimitFromICmp(const Loop *L, } 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::computeExitLimitFromICmp(const Loop *L, return ExhaustiveCount; return computeShiftCompareExitLimit(ExitCond->getOperand(0), - ExitCond->getOperand(1), L, OriginalCond); + ExitCond->getOperand(1), L, OriginalPred); } ScalarEvolution::ExitLimit -- 2.11.0