I had to revert r208848 [http://reviews.llvm.org/D3717] due to assertion during builds :(
"include/llvm/ADT/APInt.h:960: bool llvm::APInt::operator==(const llvm::APInt&) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed."
I have updated patch to fix this issue. Now I am using APInt::isSameValue for comparison, which should be ok as these numbers are used in bitwise operations.
Is it ok now?
Summary from http://reviews.llvm.org/D3717
This patch adds transforms for
Single bit tests [http://nondot.org/sabre/LLVMNotes/InstCombine.txt]:
if ((x & C) == 0) x |= C becomes x |= C
if ((x & C) != 0) x ^= C becomes x &= ~C
if ((x & C) == 0) x ^= C becomes x |= C
if ((x & C) != 0) x &= ~C becomes x &= ~C
if ((x & C) == 0) x &= ~C becomes nothing
Z3 Verifications code for above transform