[InstCombine] Don't miscompile safe increment idiom
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 4 Jun 2015 23:11:30 +0000 (23:11 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 4 Jun 2015 23:11:30 +0000 (23:11 +0000)
commitb0b8cde9d4148ebc98ae32ea9ff2607b808e0080
tree49df5fd1f0035c2fe325e365a0c4d069a65fc1c9
parentbb3883dfbab9a48176497066ed40911431e0fda8
[InstCombine] Don't miscompile safe increment idiom

We cleverly handle cases where computation done in one argument of a select
instruction is suitable for the other operand, thus obviating the need
of the select and the comparison.  However, the other operand cannot
have flags.

This fixes PR23757.

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