[llvm] r316614 - Add a comment to clarify a future change
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 14:40:59 PDT 2017
Author: sanjoy
Date: Wed Oct 25 14:40:59 2017
New Revision: 316614
URL: http://llvm.org/viewvc/llvm-project?rev=316614&view=rev
Log:
Add a comment to clarify a future change
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=316614&r1=316613&r2=316614&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Wed Oct 25 14:40:59 2017
@@ -1744,9 +1744,12 @@ private:
/// Compute the maximum backedge count based on the range of values
/// permitted by Start, End, and Stride. This is for loops of the form
/// {Start, +, Stride} LT End.
+ ///
+ /// Precondition: the induction variable is known to be positive. We *don't*
+ /// assert these preconditions so please be careful.
const SCEV *computeMaxBECountForLT(const SCEV *Start, const SCEV *Stride,
- const SCEV *End, unsigned BitWidth,
- bool IsSigned);
+ const SCEV *End, unsigned BitWidth,
+ bool IsSigned);
/// Verify if an linear IV with positive stride can overflow when in a
/// less-than comparison, knowing the invariant term of the comparison,
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=316614&r1=316613&r2=316614&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Oct 25 14:40:59 2017
@@ -9710,8 +9710,9 @@ const SCEV *ScalarEvolution::computeMaxB
StrideForMaxBECount =
IsSigned ? getSignedRangeMin(Stride) : getUnsignedRangeMin(Stride);
else
- // Using a stride of 1 is safe when computing max backedge taken count for
- // a loop with unknown stride.
+ // Using a stride of 1 is safe when computing max backedge taken count for a
+ // loop with unknown stride, since the precondition for this function is
+ // that it is positive.
StrideForMaxBECount = APInt(BitWidth, 1, IsSigned);
APInt MaxValue = IsSigned ? APInt::getSignedMaxValue(BitWidth)
More information about the llvm-commits
mailing list