[PATCH] [SCEV] Improve Scalar Evolution's use of no {un, }signed wrap flags

Bradley Smith bradley.smith at arm.com
Mon Oct 27 09:09:02 PDT 2014


In a case where we have a no {un,}signed wrap flag on the increment of a loop and
RHS - Start is constant then we can avoid inserting a max operation between
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);
  }

This patch implements this optimization.

http://reviews.llvm.org/D6002

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/nsw.ll
  test/Transforms/LoopUnroll/nsw-tripcount.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6002.15495.patch
Type: text/x-patch
Size: 4275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141027/2cbfda99/attachment.bin>


More information about the llvm-commits mailing list