[PATCH] D12637: [InstCombine] Recognize another bswap idiom.

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 12:15:23 PDT 2015


rengolin added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2211
@@ +2210,3 @@
+                    match(Op1, m_LogicalShift(m_Value(), m_Value()));
+  // (A & B) | (C & D)                              -> bswap if possible.
+  bool OrOfAnds = match(Op0, m_And(m_Value(), m_Value())) &&
----------------
chatur01 wrote:
> rengolin wrote:
> > You don't seem to have added tests for the AND case.
> The test I added checks for the OrOfAnds:
> %or6 = or i32 %shl3, %shr5
> Where the misnamed "shl3" and "shr5" are and instructions.
Oh, yeah, now I see it. The OR/shifts were already there, too. ok.

================
Comment at: test/Transforms/InstCombine/bswap.ll:4
@@ -3,3 +3,3 @@
 ; RUN: opt < %s -instcombine -S | \
-; RUN:    grep "call.*llvm.bswap" | count 6
+; RUN:    grep "call.*llvm.bswap" | count 7
 
----------------
chatur01 wrote:
> rengolin wrote:
> > Not related to this patch, but we stopped using grep a long time ago...
> > 
> > Maybe it'd be simple enough to add the CHECK lines?
> Please can such a change come in a different commit?
np


Repository:
  rL LLVM

http://reviews.llvm.org/D12637





More information about the llvm-commits mailing list