[PATCH] Reorder shuffle and binary operation.

Serge Pavlov sepavloff at gmail.com
Thu May 1 11:29:30 PDT 2014


Updated patch, added new pattern.

With this patch instcombiner tries making transformation like:

    BinOp(shuffle(v1), const1) -> shuffle(BinOp(V1, const2))

This reordering allows removal of extra shuffles, for instance the code:

    %t1 = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
    %t2 = mul <4 x i32> %t1, %t1
    %r = shufflevector <4 x i32> %t2, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>

transforms to:

    %1 = mul <4 x i32> %v, %v

http://reviews.llvm.org/D3525

Files:
  lib/Transforms/InstCombine/InstCombine.h
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  lib/Transforms/InstCombine/InstCombineShifts.cpp
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/vec_shuffle.ll
  test/Transforms/LoopVectorize/store-shuffle-bug.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3525.9016.patch
Type: text/x-patch
Size: 20925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/02a32f93/attachment.bin>


More information about the llvm-commits mailing list