HomePhabricator

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

Description

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

Summary:
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)];

Reviewers: atrick, sanjoy

Subscribers: sanjoy, majnemer, hfinkel, llvm-commits, meheff, jingyue, eliben

Differential Revision: http://reviews.llvm.org/D11860

Details

Committed
brouneAug 14 2015, 3:45 PM
Differential Revision
D11860: [SCEV] Apply NSW and NUW flags via poison value analysis for sub, mul and shl
Parents
rL245117: Add hotel room block.
Branches
Unknown
Tags
Unknown