[SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags
authorBradley Smith <bradley.smith@arm.com>
Fri, 31 Oct 2014 11:40:32 +0000 (11:40 +0000)
committerBradley Smith <bradley.smith@arm.com>
Fri, 31 Oct 2014 11:40:32 +0000 (11:40 +0000)
commit9992b167aea97de3a13bf0f0b95189a4e5f4bf92
tree90c4c43d7668cb2d3185a26320e356db69a589bd
parentc8c2ea2854bb750374158ff1b9c3cd7ccd9481f1
[SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags

In a case where we have a no {un,}signed wrap flag on the increment, if
RHS - Start is constant then we can avoid inserting a max operation bewteen
the two, since we can statically determine which is greater.

This allows us to unroll loops such as:

 void testcase3(int v) {
   for (int i=v; i<=v+1; ++i)
     f(i);
 }

llvm-svn: 220960
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/nsw.ll
llvm/test/Transforms/LoopUnroll/nsw-tripcount.ll [new file with mode: 0644]