From: Philip Reames Date: Wed, 19 Jun 2019 19:23:19 +0000 (+0000) Subject: [SCEV] Revise a method description to match actual behavior [NFC] X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d4872e62fe7efa418356cce61563412c0a188f2;p=llvm [SCEV] Revise a method description to match actual behavior [NFC] Reword the ScalarEvolution::getExitCount comment in the same terminology as used by getBackedgeTakenCount since they're equivelent for single exit loops. Also, strengthen the comment to indicate exiting on the exact iteration specified is guaranteed. Several transforms implicitly rely on this; and the actual implementation checks for it (via dominating latch checks). So, spell out the guarantee in the comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363867 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 476d6ea7569..0bd98ef37e7 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -746,9 +746,12 @@ public: unsigned getSmallConstantTripMultiple(const Loop *L, BasicBlock *ExitingBlock); - /// Get the expression for the number of loop iterations for which this loop - /// is guaranteed not to exit via ExitingBlock. Otherwise return - /// SCEVCouldNotCompute. + /// Return the number of times the backedge executes before the given exit + /// would be taken; if not exactly computable, return SCEVCouldNotCompute. + /// For a single exit loop, this value is equivelent to the result of + /// getBackedgeTakenCount. The loop is guaranteed to exit (via *some* exit) + /// before the backedge is executed (ExitCount + 1) times. Note that there + /// is no guarantee about *which* exit is taken on the exiting iteration. const SCEV *getExitCount(const Loop *L, BasicBlock *ExitingBlock); /// If the specified loop has a predictable backedge-taken count, return it,