]> granicus.if.org Git - llvm/commit
Merging r278584:
authorHans Wennborg <hans@hanshq.net>
Mon, 15 Aug 2016 17:29:29 +0000 (17:29 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 15 Aug 2016 17:29:29 +0000 (17:29 +0000)
commit820848abb4dded80a4443252797d90cbf91fb5fc
tree3f4d942fd4564f246b86191d834ac24a5eaa308b
parent3e3f1602c5b13e6c861abb4044f9cefccca04e94
Merging r278584:
------------------------------------------------------------------------
r278584 | sanjoy | 2016-08-12 17:58:31 -0700 (Fri, 12 Aug 2016) | 15 lines

[IndVars] Ignore (s|z)exts that don't extend the induction variable

`IVVisitor::visitCast` used to have the invariant that if the
instruction it was passed was a sext or zext instruction, the result of
the instruction would be wider than the induction variable.  This is no
longer true after rL275037, so this change teaches `IndVarSimplify` s
implementation of `IVVisitor::visitCast` to work with the relaxed
invariant.

A corresponding change to SimplifyIndVar to preserve the said invariant
after rL275037 would also work, but given how `IVVisitor::visitCast` is
spelled (no indication of said invariant), I figured the current fix is
cleaner.

Fixes PR28935.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@278685 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/pr28935.ll [new file with mode: 0644]