[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jul 10 13:25:37 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.495 -> 1.496
---
Log message:

Recognize 16-bit bswaps by relaxing overconstrained pattern.
This implements Transforms/InstCombine/bswap.ll:test[34].


---
Diffs of the changes:  (+5 -2)

 InstructionCombining.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.495 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.496
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.495	Mon Jul 10 14:03:49 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Jul 10 15:25:24 2006
@@ -2976,9 +2976,12 @@
     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;
   }






More information about the llvm-commits mailing list