[PATCH] D13717: [IndVars] Have `cloneArithmeticIVUser` guess better

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 19:49:05 PDT 2015


sanjoy created this revision.
sanjoy added reviewers: atrick, hfinkel, reames.
sanjoy added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

`cloneArithmeticIVUser` currently trips over expression like `add %iv,
-1` when `%iv` is being zero extended -- it tries to construct the
widened use as `add %iv.zext, zext(-1)` and (correctly) fails to prove
equivalence to `zext(add %iv, -1)` (here the SCEV for `%iv` is
`{1,+,1}`).

This change teaches `IndVars` to try sign extending the non-IV operand
if that makes the newly constructed IV use equivalent to the widened
narrow IV use.

http://reviews.llvm.org/D13717

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/iv-widen.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13717.37315.patch
Type: text/x-patch
Size: 5255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151014/92f56007/attachment.bin>


More information about the llvm-commits mailing list