Invert and-of-or into or-of-and when doing so would allow us to clear bits of the...
authorOwen Anderson <resistor@mac.com>
Sat, 11 Sep 2010 05:48:06 +0000 (05:48 +0000)
committerOwen Anderson <resistor@mac.com>
Sat, 11 Sep 2010 05:48:06 +0000 (05:48 +0000)
commit26c5663283f89f1624304723ebe8c25d253463a3
tree896fb72e24c4e16fdfd238c9044e13789e7916db
parent1c4e934666b3fa672a3dd8f933671da4b95447db
Invert and-of-or into or-of-and when doing so would allow us to clear bits of the and's mask.
This can result in increased opportunities for store narrowing in code generation.  Update a number of
tests for this change.  This fixes <rdar://problem/8285027>.

Additionally, because this inverts the order of ors and ands, some patterns for optimizing or-of-and-of-or
no longer fire in instances where they did originally.  Add a simple transform which recaptures most of these
opportunities: if we have an or-of-constant-or and have failed to fold away the inner or, commute the order
of the two ors, to give the non-constant or a chance for simplification instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113679 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/and-or-inversion.ll [new file with mode: 0644]
test/Transforms/InstCombine/cast.ll
test/Transforms/InstCombine/or.ll
test/Transforms/InstCombine/xor2.ll