summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-10 20:25:24 +0000
committerChris Lattner <sabre@nondot.org>2006-07-10 20:25:24 +0000
commitb7845d69dbb015acb449523d6989218f11f39603 (patch)
treec5ca23c7f854dfd6bdf98337155ae8f4c4882188 /llvm/lib/Transforms
parent3f8aee5fdfa6dd883261e0eefb8afd61531c0e76 (diff)
downloadbcm5719-llvm-b7845d69dbb015acb449523d6989218f11f39603.tar.gz
bcm5719-llvm-b7845d69dbb015acb449523d6989218f11f39603.zip
Recognize 16-bit bswaps by relaxing overconstrained pattern.
This implements Transforms/InstCombine/bswap.ll:test[34]. llvm-svn: 29087
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index ebefdb31a44..5273e958da2 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud