[llvm] [SLP][Revec] Consider revectorization of the following shuffle pattern (PR #206903)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 02:02:15 PDT 2026


sushgokh wrote:

> Some high-level question: can the same stuff be done in VectorCombine pass?

Yes, VectorCombine does this optimisation. 

But the story doesnt end there. I tried below 3 experiments. For every subtest that has changed due to this patch:
```
Set 1: old.ll (output IR before patch) , new.ll (output IR after patch)
Set 2: after-vector-combine-old.ll (output IR after running vector combine on old.ll), new.ll 
Set 3: after-vector-combine-old.ll (output IR after running vector combine on old.ll), after-vector-combine-new.ll (output IR after running vector combine on new.ll)
```
and I generated codegen with `-mtriple=aarch64 -mcpu=olympus --aarch64-sve-vector-bits-min=256` for the above sets.

Here are the results:
```
Set 1:  No difference observed
Set 2:  for test2 and test6 in revec-shufflevector.ll , new is better
Set 3:  for test6 in revec-shufflevector.ll, new is better
```
This means either 
1. vector-combine is not able to optimise like the patch here OR
2. SLP revec created a different revec pattern that vector combine cant optimise or poorly optimises 
3. Any other possibility?

Plus, its more work for vector-combine optimising 5 shuffles for a simple case like [this ](https://godbolt.org/z/qsnec3oT5). This pattern naturally fits in how SLP works.

https://github.com/llvm/llvm-project/pull/206903


More information about the llvm-commits mailing list