Teach InstructionSimplify to fold (A & B) & A -> A & B and (A | B) | A -> A | B.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Sep 2010 22:39:55 +0000 (22:39 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Sep 2010 22:39:55 +0000 (22:39 +0000)
commit6844c8ea5a67e551be7106d6b7b9e1a64eecbe51
treeb11daf32edb5ff3fbb9e4d75e0d12a14661da301
parente2d50046fd29cb3eb2483e080cb7c39b460fbb19
Teach InstructionSimplify to fold (A & B) & A -> A & B and (A | B) | A -> A | B.

Reassociate does this but it doesn't catch all cases (e.g. if the operands are i1).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113651 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstCombine/and2.ll
test/Transforms/InstCombine/or.ll