[llvm] [SLP]Vectorize unique scalars of splat gather nodes as separate subtrees (PR #220250)

Tomas Matheson via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 01:04:22 PDT 2026


tommat01 wrote:

> > We are seeing a 4.2% regression in SPEC2017 lbm and 3.6% regression in SPEC2026 lbm on graviton4 from this change. I suggest we revert it.
> 
> Reproducers are required

```c
/*
"$BEFORE/bin/clang" --target=aarch64-linux-gnu -O3 -mcpu=neoverse-v2 \
  -S reproducer.c -o before.s
"$AFTER/bin/clang" --target=aarch64-linux-gnu -O3 -mcpu=neoverse-v2 \
  -S reproducer.c -o after.s

After #220250 the code no longer vectorizes.
Adding -fno-slp-vectorize removes the difference between before/after.
*/
void mix4(unsigned *restrict out, const unsigned *restrict in) {
  unsigned a = in[0] + in[1];
  unsigned b = in[2] + in[3];
  unsigned c = in[4] + in[5];
  out[0] = ((in[6] + a) ^ b) + c;
  out[1] = ((in[7] + a) ^ b) + c;
  out[2] = ((in[8] + a) ^ b) + c;
  out[3] = ((in[9] + a) ^ b) + c;
  out[4] = a;
  out[6] = b;
  out[8] = c;
}
```

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


More information about the llvm-commits mailing list