[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)
commit8cff277de2400451755c835348f036733978eac6
treed37a83c148747a7937c5311eb34a983a8d34cb58
parent8a9c531e9adfdd7fee915fbcfb9ecad18da5674c
[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);
 }

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220960 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/nsw.ll
test/Transforms/LoopUnroll/nsw-tripcount.ll [new file with mode: 0644]