OSDN Git Service

[InstCombine] Minor optimization for bswap with binary ops
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 4 Dec 2014 09:44:01 +0000 (09:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 4 Dec 2014 09:44:01 +0000 (09:44 +0000)
commit94590ca4cfdc6ae0b7157829c559deea831c854f
treec0cf1e8d2cfe168db5e5d1ee22ac193e9eb71322
parent73ae1df82c09dfde3c7069def938c9638d6ff1e2
[InstCombine] Minor optimization for bswap with binary ops

Added instcombine optimizations for BSWAP with AND/OR/XOR ops:

OP( BSWAP(x), BSWAP(y) ) -> BSWAP( OP(x, y) )
OP( BSWAP(x), CONSTANT ) -> BSWAP( OP(x, BSWAP(CONSTANT) ) )

Since its just a one liner, I've also added BSWAP to the DAGCombiner equivalent as well:

fold (OP (bswap x), (bswap y)) -> (bswap (OP x, y))

Refactored bswap-fold tests to use FileCheck instead of just checking that the bswaps had gone.

Differential Revision: http://reviews.llvm.org/D6407

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223349 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Transforms/InstCombine/InstCombine.h
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/bswap-fold.ll