[PATCH] D11860: [SCEV] Apply NSW and NUW flags via poison value analysis for sub, mul and shl

Bjarke Hammersholt Roune via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 21:34:38 PDT 2015


broune created this revision.
broune added reviewers: sanjoy, atrick.
broune added subscribers: eliben, jingyue, meheff, llvm-commits, hfinkel, majnemer.

http://reviews.llvm.org/D11212 made Scalar Evolution able to propagate NSW and NUW flags from instructions to SCEVs for add instructions. This patch expands that to sub, mul and shl instructions.

This change makes LSR able to generate pointer induction variables for loops like these, where the index is 32 bit and the pointer is 64 bit:

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[i - offset];

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[i * stride];

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[3 * (i << 7)];


http://reviews.llvm.org/D11860

Files:
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/Delinearization/a.ll
  test/Analysis/ScalarEvolution/flags-from-poison.ll
  test/Transforms/LoopStrengthReduce/sext-ind-var.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11860.31572.patch
Type: text/x-patch
Size: 18198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150808/384d2726/attachment.bin>


More information about the llvm-commits mailing list