[all-commits] [llvm/llvm-project] 6f9e1e: [VectorCombine] Attempt to fold select shuffles fr...

David Green via All-commits all-commits at lists.llvm.org
Sun May 8 02:32:59 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f9e1ea0efb93388c9301e672b7a73e8216ffa44
  Author: David Green <david.green at arm.com>
  Date:   2022-05-08 (Sun, 08 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    M llvm/test/Transforms/VectorCombine/AArch64/select-shuffle.ll

  Log Message:
  [VectorCombine] Attempt to fold select shuffles from reductions

Given a commutative reduction leading from a shuffle, the order of the
lanes on the shuffle are not important for the result. This means we can
reorder the shuffle to something simpler, which we try shuffling the
first vector lanes first. This was D123494.

The new shuffle may not be profitable though, and if it is not we can
try the folding of select shuffles from D123911. This, with some
adjustment as the output lane ordering is now unimportant, can allow the
final shuffle to simplify given the inputs to the patterns from D123911.
Where as each transformation on their own are not profitable, the
combination is.

We can only support a single shuffle when called from reductions, but we
are able to sort the ReconstructMask, potentially allowing it to
simplify to an identity or concat mask.

Differential Revision: https://reviews.llvm.org/D125086

More information about the All-commits mailing list