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)
commitbf5d870dfab3617f9dadb22e836503b88ba4c4af
treea6ef5155b5199e9cfb5ee64c67ff64ca3101cdf2
parent7eedd1c3815ebe8e2e31a0f70b8746e83e096e06
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

llvm-svn: 228586
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/incorrect-nsw.ll [new file with mode: 0644]