[SCEV] Re-enable "Use nw flag and symbolic iteration count to sharpen ranges of AddRe...
authorMax Kazantsev <mkazantsev@azul.com>
Wed, 28 Oct 2020 05:39:41 +0000 (12:39 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Wed, 28 Oct 2020 05:39:41 +0000 (12:39 +0700)
commit624fc63a0510d77dc9f08099aa1d2d9f1996775c
tree99e4492bf3060a26e3a61bbefeb9e8792fbf88b5
parent17c8251bca83072d2f3e00f936d6ce24500e6b02
[SCEV] Re-enable "Use nw flag and symbolic iteration count to sharpen ranges of AddRecs", attempt 3

We can sharpen the range of a AddRec if we know that it does not
self-wrap and know the symbolic iteration count in the loop. If we can
evaluate the value of AddRec on the last iteration and prove that at least
one its intermediate value lies between start and end, then no-wrap flag
allows us to conclude that all of them also lie between start and end. So
the estimate of range can be improved to union of ranges of start and end.

Switched off by default, can be turned on by flag.

Differential Revision: https://reviews.llvm.org/D89381
Reviewed By: lebedev.ri, nikic
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll