Bugfix: SCEV incorrectly marks certain add recurrences as nsw
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 9 Feb 2015 18:34:55 +0000 (18:34 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 9 Feb 2015 18:34:55 +0000 (18:34 +0000)
commit2ceba77dfa50c3b936963d4760c69e958e41febd
tree9b27760e701eabe13b6aa0a85f490b2ba7d7eab2
parent5a81520668d68a6f02f7490c4f5e7046854cc781
Bugfix: SCEV incorrectly marks certain add recurrences as nsw

When creating a scev for sext({X,+,Y}), scev checks if the expression
is equivalent to {sext X,+,zext Y}.  If it can prove that, it also
tags the original {X,+,Y} as <nsw>, which is not correct.

In the test case I run `-scalar-evolution` twice because the bug
manifests only once SCEV has run through and seen the `sext`
expressions (and then does a in-place mutation on {X,+,Y}).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228586 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/incorrect-nsw.ll [new file with mode: 0644]