[PATCH] [InstCombine] Minor optimization for bswap with binary ops

Simon Pilgrim llvm-dev at redking.me.uk
Tue Nov 25 07:19:43 PST 2014


Hi qcolombet, andreadb,

Added inst combine patterns for BSWAP with and/or/xor OP:

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

Fixes PR15782

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))

http://reviews.llvm.org/D6407

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/Transforms/InstCombine/InstCombine.h
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/bswap-fold.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6407.16619.patch
Type: text/x-patch
Size: 9618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141125/4fbeaf48/attachment.bin>


More information about the llvm-commits mailing list