[PATCH] D22377: [SCEV] trip count calculation for loops with unknown stride
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 13:00:09 PDT 2016
eli.friedman added a subscriber: eli.friedman.
eli.friedman added a comment.
You have to be a bit more careful here... consider:
for (int i=0; i<16; i-=2) {
if (i < -2000) break;
}
Here, the backedge is taken 1000 times. (There are actually two related cases here: one, the case where there's an explicit break, and the case where some call in the loop throws an exception.)
It might be sufficient to show that the loop only has one exit and loopHasNoAbnormalExits() is true; not 100% sure about that.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8683
@@ +8682,3 @@
+ if (!PositiveStride)
+ return getCouldNotCompute();
+
----------------
I don't follow why this check is necessary.
https://reviews.llvm.org/D22377
More information about the llvm-commits
mailing list