diff options
author | Chris Lattner <sabre@nondot.org> | 2006-07-10 20:25:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-07-10 20:25:24 +0000 |
commit | 6423d4c64adc7db73206bbfd957256236bfaf2b4 (patch) | |
tree | 5f79b4e88ab9c9caafec7ba787528774dcda988b /lib/Transforms | |
parent | e5ff22e605d08b02f11394dfd7e71c0b25f256dd (diff) |
Recognize 16-bit bswaps by relaxing overconstrained pattern.
This implements Transforms/InstCombine/bswap.ll:test[34].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index ebefdb31a4..5273e958da 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2976,9 +2976,12 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { if (A == Op0 || B == Op0) // A | (A & ?) --> A return ReplaceInstUsesWith(I, Op0); - // (A | B) | C and A | (B | C) -> bswap if possible. + // (A | B) | C and A | (B | C) -> bswap if possible. + // (A >> B) | (C << D) and (A << B) | (B >> C) -> bswap if possible. if (match(Op0, m_Or(m_Value(), m_Value())) || - match(Op1, m_Or(m_Value(), m_Value()))) { + match(Op1, m_Or(m_Value(), m_Value())) || + (match(Op0, m_Shift(m_Value(), m_Value())) && + match(Op1, m_Shift(m_Value(), m_Value())))) { if (Instruction *BSwap = MatchBSwap(I)) return BSwap; } |