[PATCH] D22377: [SCEV] trip count calculation for loops with unknown stride
Pankaj Chawla via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 15:21:46 PDT 2016
pankajchawla added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8731
@@ -8704,2 +8730,3 @@
// Avoid negative or zero stride values
- if (!isKnownPositive(Stride))
+ // We can assume stride to be positive if NoWrap is true and loop does not
+ // have abnormal exits or side effects.
----------------
sanjoy wrote:
> As we discussed, it isn't that given the conditions you're testing we can prove that the stride is non-negative, but that the math below is correct even if the stride is negative.
>
> Also, I'd separate out the `!NoWrap || !loopHasNoAbnormalExits(L) || !loopHasNoSideEffects(L)` check into it's own `if` and have a small comment describing why they're necessary / sufficient (the example you had in the llvm-dev thread would be nice to add too).
The check for abnormal exits seems redundant now because loopHasNoSideEffects() is more conservative than it. I am removing this check as well.
https://reviews.llvm.org/D22377
More information about the llvm-commits
mailing list