[all-commits] [llvm/llvm-project] 768754: [InstCombine] Optimistically allow multiple shuffl...

Matthias Braun via All-commits all-commits at lists.llvm.org
Thu Dec 12 17:21:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 768754807f17754fb450ec672779b827ad5df4b4
      https://github.com/llvm/llvm-project/commit/768754807f17754fb450ec672779b827ad5df4b4
  Author: Matthias Braun <matze at braunis.de>
  Date:   2024-12-12 (Thu, 12 Dec 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    A llvm/test/Transforms/InstCombine/vec_shuffle-phi-multiuse.ll

  Log Message:
  -----------
  [InstCombine] Optimistically allow multiple shufflevector uses in foldOpPhi (#114278)

We would like to optimize situations of the form that happen after loop
vectorization+SROA:
```
loop:
    %phi = phi zeroinitializer, %interleaved

    %deinterleave_a = shufflevector %phi, poison ; pick half of the lanes
    %deinterleave_b = shufflevector %phi, posion ; pick remaining lanes

    ... %a = ... %b = ...

    %interleaved = shufflevector %a, %b ; interleave lanes of a+b
```
where the interleave and de-interleave shuffle operations cancel each
other out.
This could be handled by `foldOpPhi` but does not currently work because
it does
not proceed when there are multiple uses of the `Phi` operation.

This extends `foldOpPhi` to allow multiple `shufflevector` uses when
they are
shown to simplify for all `Phi` input values.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list