diff options
| author | Philip Reames <listmail@philipreames.com> | 2019-06-19 20:41:28 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2019-06-19 20:41:28 +0000 |
| commit | f8104f01e6bf5c24a9c65ec8ce6788d565c1e153 (patch) | |
| tree | 048b91111622e944001a520dda1624bf4595a175 /llvm/lib/Transforms | |
| parent | 2742eeb78e3e93d2a29ccbc24233b8ef8b58972c (diff) | |
| download | bcm5719-llvm-f8104f01e6bf5c24a9c65ec8ce6788d565c1e153.tar.gz bcm5719-llvm-f8104f01e6bf5c24a9c65ec8ce6788d565c1e153.zip | |
[LFTR] Rename variable to minimize confusion [NFC]
(Recommit of r363293 which was reverted when a dependent patch was.)
As pointed out by Nikita in D62625, BackedgeTakenCount is generally used to refer to the backedge taken count of the loop. A conditional backedge taken count - one which only applies if a particular exit is taken - is called a ExitCount in SCEV code, so be consistent here.
llvm-svn: 363875
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 66b079f6b2e..14f80fa316f 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -151,7 +151,7 @@ class IndVarSimplify { bool hasHardUserWithinLoop(const Loop *L, const Instruction *I) const; bool linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, - const SCEV *BackedgeTakenCount, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter); bool sinkUnusedInvariants(Loop *L); @@ -2386,11 +2386,11 @@ static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB, /// broader range than just linear tests. bool IndVarSimplify:: linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, - const SCEV *BackedgeTakenCount, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter) { // Initialize CmpIndVar and IVCount to their preincremented values. Value *CmpIndVar = IndVar; - const SCEV *IVCount = BackedgeTakenCount; + const SCEV *IVCount = ExitCount; assert(L->getLoopLatch() && "Loop no longer in simplified form?"); @@ -2416,9 +2416,9 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, if (SafeToPostInc) { // Add one to the "backedge-taken" count to get the trip count. // This addition may overflow, which is valid as long as the comparison - // is truncated to BackedgeTakenCount->getType(). - IVCount = SE->getAddExpr(BackedgeTakenCount, - SE->getOne(BackedgeTakenCount->getType())); + // is truncated to ExitCount->getType(). + IVCount = SE->getAddExpr(ExitCount, + SE->getOne(ExitCount->getType())); // The BackedgeTaken expression contains the number of times that the // backedge branches to the loop header. This is one less than the // number of times the loop executes, so use the incremented indvar. @@ -2486,9 +2486,9 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, if (isa<SCEVConstant>(ARStart) && isa<SCEVConstant>(IVCount)) { const APInt &Start = cast<SCEVConstant>(ARStart)->getAPInt(); APInt Count = cast<SCEVConstant>(IVCount)->getAPInt(); - // Note that the post-inc value of BackedgeTakenCount may have overflowed + // Note that the post-inc value of ExitCount may have overflowed // above such that IVCount is now zero. - if (IVCount != BackedgeTakenCount && Count == 0) { + if (IVCount != ExitCount && Count == 0) { Count = APInt::getMaxValue(Count.getBitWidth()).zext(CmpIndVarSize); ++Count; } @@ -2715,21 +2715,21 @@ bool IndVarSimplify::run(Loop *L) { if (!needsLFTR(L, ExitingBB)) continue; - const SCEV *BETakenCount = SE->getExitCount(L, ExitingBB); - if (isa<SCEVCouldNotCompute>(BETakenCount)) + const SCEV *ExitCount = SE->getExitCount(L, ExitingBB); + if (isa<SCEVCouldNotCompute>(ExitCount)) continue; // Better to fold to true (TODO: do so!) - if (BETakenCount->isZero()) + if (ExitCount->isZero()) continue; - PHINode *IndVar = FindLoopCounter(L, ExitingBB, BETakenCount, SE, DT); + PHINode *IndVar = FindLoopCounter(L, ExitingBB, ExitCount, SE, DT); if (!IndVar) continue; // Avoid high cost expansions. Note: This heuristic is questionable in // that our definition of "high cost" is not exactly principled. - if (Rewriter.isHighCostExpansion(BETakenCount, L)) + if (Rewriter.isHighCostExpansion(ExitCount, L)) continue; // Check preconditions for proper SCEVExpander operation. SCEV does not @@ -2741,10 +2741,10 @@ bool IndVarSimplify::run(Loop *L) { // // FIXME: SCEV expansion has no way to bail out, so the caller must // explicitly check any assumptions made by SCEV. Brittle. - const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(BETakenCount); + const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(ExitCount); if (!AR || AR->getLoop()->getLoopPreheader()) Changed |= linearFunctionTestReplace(L, ExitingBB, - BETakenCount, IndVar, + ExitCount, IndVar, Rewriter); } } |

