diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2017-08-31 05:58:15 +0000 | 
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-08-31 05:58:15 +0000 | 
| commit | a22742be5a2703c0773f9613c3e385ae3861ce15 (patch) | |
| tree | 1511db51c026506684bfe069e1d1bf8cc1d45fd4 | |
| parent | e42ac21499c103a4b1052e759618ecbd35207d6c (diff) | |
| download | bcm5719-llvm-a22742be5a2703c0773f9613c3e385ae3861ce15.tar.gz bcm5719-llvm-a22742be5a2703c0773f9613c3e385ae3861ce15.zip  | |
[IRCE][NFC] Rename IndVarNext to IndVarBase
Renaming as a preparation step to generalizing IRCE for comparison not only against
the next value of an indvar, but also against the current.
Differential Revision: https://reviews.llvm.org/D36509
llvm-svn: 312215
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | 42 | 
1 files changed, 21 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index ca6174ef8dc..9fa49fdf81f 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -452,10 +452,10 @@ struct LoopStructure {    // intN_ty inc = IndVarIncreasing ? 1 : -1;    // pred_ty predicate = IndVarIncreasing ? ICMP_SLT : ICMP_SGT;    // -  // for (intN_ty iv = IndVarStart; predicate(iv, LoopExitAt); iv = IndVarNext) +  // for (intN_ty iv = IndVarStart; predicate(iv, LoopExitAt); iv = IndVarBase)    //   ... body ... -  Value *IndVarNext; +  Value *IndVarBase;    Value *IndVarStart;    Value *IndVarStep;    Value *LoopExitAt; @@ -464,7 +464,7 @@ struct LoopStructure {    LoopStructure()        : Tag(""), Header(nullptr), Latch(nullptr), LatchBr(nullptr), -        LatchExit(nullptr), LatchBrExitIdx(-1), IndVarNext(nullptr), +        LatchExit(nullptr), LatchBrExitIdx(-1), IndVarBase(nullptr),          IndVarStart(nullptr), IndVarStep(nullptr), LoopExitAt(nullptr),          IndVarIncreasing(false), IsSignedPredicate(true) {} @@ -476,7 +476,7 @@ struct LoopStructure {      Result.LatchBr = cast<BranchInst>(Map(LatchBr));      Result.LatchExit = cast<BasicBlock>(Map(LatchExit));      Result.LatchBrExitIdx = LatchBrExitIdx; -    Result.IndVarNext = Map(IndVarNext); +    Result.IndVarBase = Map(IndVarBase);      Result.IndVarStart = Map(IndVarStart);      Result.IndVarStep = Map(IndVarStep);      Result.LoopExitAt = Map(LoopExitAt); @@ -832,17 +832,17 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE,    // `ICI` is interpreted as taking the backedge if the *next* value of the    // induction variable satisfies some constraint. -  const SCEVAddRecExpr *IndVarNext = cast<SCEVAddRecExpr>(LeftSCEV); +  const SCEVAddRecExpr *IndVarBase = cast<SCEVAddRecExpr>(LeftSCEV);    bool IsIncreasing = false;    bool IsSignedPredicate = true;    ConstantInt *StepCI; -  if (!IsInductionVar(IndVarNext, IsIncreasing, StepCI)) { +  if (!IsInductionVar(IndVarBase, IsIncreasing, StepCI)) {      FailureReason = "LHS in icmp not induction variable";      return None;    } -  const SCEV *StartNext = IndVarNext->getStart(); -  const SCEV *Addend = SE.getNegativeSCEV(IndVarNext->getStepRecurrence(SE)); +  const SCEV *StartNext = IndVarBase->getStart(); +  const SCEV *Addend = SE.getNegativeSCEV(IndVarBase->getStepRecurrence(SE));    const SCEV *IndVarStart = SE.getAddExpr(StartNext, Addend);    const SCEV *Step = SE.getSCEV(StepCI); @@ -1023,7 +1023,7 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE,    Result.LatchBrExitIdx = LatchBrExitIdx;    Result.IndVarStart = IndVarStartV;    Result.IndVarStep = StepCI; -  Result.IndVarNext = LeftValue; +  Result.IndVarBase = LeftValue;    Result.IndVarIncreasing = IsIncreasing;    Result.LoopExitAt = RightValue;    Result.IsSignedPredicate = IsSignedPredicate; @@ -1273,12 +1273,12 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(    Value *TakeBackedgeLoopCond = nullptr;    if (Increasing)      TakeBackedgeLoopCond = IsSignedPredicate -                        ? B.CreateICmpSLT(LS.IndVarNext, ExitSubloopAt) -                        : B.CreateICmpULT(LS.IndVarNext, ExitSubloopAt); +                        ? B.CreateICmpSLT(LS.IndVarBase, ExitSubloopAt) +                        : B.CreateICmpULT(LS.IndVarBase, ExitSubloopAt);    else      TakeBackedgeLoopCond = IsSignedPredicate -                        ? B.CreateICmpSGT(LS.IndVarNext, ExitSubloopAt) -                        : B.CreateICmpUGT(LS.IndVarNext, ExitSubloopAt); +                        ? B.CreateICmpSGT(LS.IndVarBase, ExitSubloopAt) +                        : B.CreateICmpUGT(LS.IndVarBase, ExitSubloopAt);    Value *CondForBranch = LS.LatchBrExitIdx == 1                               ? TakeBackedgeLoopCond                               : B.CreateNot(TakeBackedgeLoopCond); @@ -1293,12 +1293,12 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(    Value *IterationsLeft = nullptr;    if (Increasing)      IterationsLeft = IsSignedPredicate -                         ? B.CreateICmpSLT(LS.IndVarNext, LS.LoopExitAt) -                         : B.CreateICmpULT(LS.IndVarNext, LS.LoopExitAt); +                         ? B.CreateICmpSLT(LS.IndVarBase, LS.LoopExitAt) +                         : B.CreateICmpULT(LS.IndVarBase, LS.LoopExitAt);    else      IterationsLeft = IsSignedPredicate -                         ? B.CreateICmpSGT(LS.IndVarNext, LS.LoopExitAt) -                         : B.CreateICmpUGT(LS.IndVarNext, LS.LoopExitAt); +                         ? B.CreateICmpSGT(LS.IndVarBase, LS.LoopExitAt) +                         : B.CreateICmpUGT(LS.IndVarBase, LS.LoopExitAt);    B.CreateCondBr(IterationsLeft, RRI.PseudoExit, LS.LatchExit);    BranchInst *BranchToContinuation = @@ -1321,10 +1321,10 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(      RRI.PHIValuesAtPseudoExit.push_back(NewPHI);    } -  RRI.IndVarEnd = PHINode::Create(LS.IndVarNext->getType(), 2, "indvar.end", +  RRI.IndVarEnd = PHINode::Create(LS.IndVarBase->getType(), 2, "indvar.end",                                    BranchToContinuation);    RRI.IndVarEnd->addIncoming(LS.IndVarStart, Preheader); -  RRI.IndVarEnd->addIncoming(LS.IndVarNext, RRI.ExitSelector); +  RRI.IndVarEnd->addIncoming(LS.IndVarBase, RRI.ExitSelector);    // The latch exit now has a branch from `RRI.ExitSelector' instead of    // `LS.Latch'.  The PHI nodes need to be updated to reflect that. @@ -1425,7 +1425,7 @@ bool LoopConstrainer::run() {    SubRanges SR = MaybeSR.getValue();    bool Increasing = MainLoopStructure.IndVarIncreasing;    IntegerType *IVTy = -      cast<IntegerType>(MainLoopStructure.IndVarNext->getType()); +      cast<IntegerType>(MainLoopStructure.IndVarBase->getType());    SCEVExpander Expander(SE, F.getParent()->getDataLayout(), "irce");    Instruction *InsertPt = OriginalPreheader->getTerminator(); @@ -1700,7 +1700,7 @@ bool InductiveRangeCheckElimination::runOnLoop(Loop *L, LPPassManager &LPM) {    }    LoopStructure LS = MaybeLoopStructure.getValue();    const SCEVAddRecExpr *IndVar = -      cast<SCEVAddRecExpr>(SE.getMinusSCEV(SE.getSCEV(LS.IndVarNext), SE.getSCEV(LS.IndVarStep))); +      cast<SCEVAddRecExpr>(SE.getMinusSCEV(SE.getSCEV(LS.IndVarBase), SE.getSCEV(LS.IndVarStep)));    Optional<InductiveRangeCheck::Range> SafeIterRange;    Instruction *ExprInsertPt = Preheader->getTerminator();  | 

