[PATCH] D44676: [SCEV] Make exact taken count calculation more optimistic
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 20 03:46:14 PDT 2018
mkazantsev created this revision.
mkazantsev added reviewers: sanjoy, apilipenko, anna, skatkov, reames.
Currently, `getExact` fails if it sees two exit counts in different blocks. There is
no solid reason to do so, given that we only calculate exact non-taken count
for exiting blocks that dominate latch. Using this fact, we can simply take min
out of all exits of all blocks to get the exact taken count.
This patch makes the calculation more optimistic with enforcing our assumption
with asserts. It allows us to calculate exact backedge taken count in trivial loops
like
for (int i = 0; i < 100; i++) {
if (i > 50) break;
. . .
}
https://reviews.llvm.org/D44676
Files:
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/exact_iter_count.ll
test/Analysis/ScalarEvolution/max-trip-count.ll
test/Analysis/ScalarEvolution/trip-count14.ll
test/Transforms/IndVarSimplify/loop_evaluate10.ll
test/Transforms/LoopSimplify/preserve-scev.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44676.139096.patch
Type: text/x-patch
Size: 7888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180320/7d3df7ae/attachment.bin>
More information about the llvm-commits
mailing list