SCEVExpander incorrectly marks generated subtractions as nuw/nsw
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 26 Feb 2015 19:51:35 +0000 (19:51 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 26 Feb 2015 19:51:35 +0000 (19:51 +0000)
commite836f05d0070702049a6ef81a14bc4c67c469be7
tree545b2cb2de5fba5b678c277df2daf384717f8111
parent176a288a88676144672c9e13723b0a6eff0944f2
SCEVExpander incorrectly marks generated subtractions as nuw/nsw

It is not sound to mark the increment operation as `nuw` or `nsw`
based on a proof off of the add recurrence if the increment operation
we emit happens to be a `sub` instruction.

I could not come up with a test case for this -- the cases where
SCEVExpander decides to emit a `sub` instruction is quite small, and I
cannot think of a way I'd be able to get SCEV to prove that the
increment does not overflow in those cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230673 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolutionExpander.cpp