[InstCombine] Clear out nsw/nuw if we modify computation in the chain
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 22 Apr 2015 20:59:28 +0000 (20:59 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 22 Apr 2015 20:59:28 +0000 (20:59 +0000)
commit3bd87826e5a29b3d4870287bc16d03c52c451be8
tree4f3380c0219d2c16d6cb343472ee86c9ff6fce0d
parent62682bceb3a3291e26bb5958a5efa7a2c8b411c7
[InstCombine] Clear out nsw/nuw if we modify computation in the chain

An nsw/nuw operation relies on the values feeding into it to not
overflow if 'poison' is not to be produced.  This means that
optimizations which make modifications to the bottom of a chain (like
SimplifyDemandedBits) must strip out nsw/nuw if they cannot ensure that
they will be preserved.

This fixes PR23309.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235544 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
test/Transforms/InstCombine/cast.ll