]> granicus.if.org Git - llvm/commitdiff
[SCEV] Revise a method description to match actual behavior [NFC]
authorPhilip Reames <listmail@philipreames.com>
Wed, 19 Jun 2019 19:23:19 +0000 (19:23 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 19 Jun 2019 19:23:19 +0000 (19:23 +0000)
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

include/llvm/Analysis/ScalarEvolution.h

index 476d6ea7569bad949895f376d18353ac0cc40342..0bd98ef37e7ab04b0a3ee195586c7d19458ca33e 100644 (file)
@@ -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,