[llvm] [SLP]Improve/fix subvectors in gather/buildvector nodes handling (PR #104144)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 00:08:53 PDT 2024


mstorsjo wrote:

I also ran into assert failures due to this, on both aarch64 and i686 in the wild, and a reduced snippet also triggers on x86_64.

Reproducible with the following reduced snippet:
```c
union a {
  short b
};
int c, d, e;
int *f;
unsigned h(int i, int j) {
  if (i & ~j)
    return i & 1;
  return i;
}
void k(short *i) {
  int l, m, n;
  for (;;) {
    int o;
    e += f[d];
    n += o = c;
    m = h(e, 6);
    short g = m << 8;
    ((union a *)&i[0])->b = g;
    l = h(o, 6);
    g = l << 8;
    ((union a *)&i[1])->b = g;
    ((union a *)&i[2])->b = g = n << 8;
    ((union a *)&i[3])->b = g;
  }
}
```
Compiled with:
```
$ clang -target aarch64-linux-gnu -c -O2 repro.c 
```
Also reproduces with `i686-linux-gnu` and `x86_64-linux-gnu`.

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


More information about the llvm-commits mailing list