[llvm] [SLP]Do extra analysis int minbitwidth if some checks return false. (PR #84363)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 20 01:41:57 PDT 2024
mstorsjo wrote:
I found two new cases that trigger failed asserts, based on the new relanded commit, in openh264 and libschroedinger. Those cases are:
```c
typedef int a;
short *b;
short c;
void d() {
a e, f;
e = 0;
for (; e < 16; e += 4) {
b[e] = (f ^ (f ^ b[e] - f) * c >> 16) - f;
f = b[e + 1] >> 1;
b[e + 1] = f ^ ((f ^ b[e + 1] - f) * c >> 16) - f;
b[e + 2] = f ^ ((f ^ b[e + 2] - f) * c >> 16) - f;
b[e + 3] = f ^ ((f ^ b[e + 3] - f) * c >> 16) - f;
}
}
```
```c
typedef struct {
short a
} b;
int c, d;
b *e;
b f, g;
short h, i, j;
void k() {
short l;
d = 0;
for (; d < 8; d++) {
f = e[d];
l = f.a < -1 ? -1 : f.a > 1 ? 1 : f.a;
h = f.a < 0 ? 0 : f.a;
i = h * c;
j = i >> 2;
g.a = j * l;
e[d] = g;
}
}
```
Both can be triggered with the following command - but they appear to trigger failed asserts on a couple different source lines:
```
$ clang -target x86_64-linux-gnu -c repro.c -O2
clang: ../lib/Transforms/Vectorize/SLPVectorizer.cpp:12545: llvm::Value* llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*, bool): Assertion `(getOperandEntry(E, 0)->State == TreeEntry::NeedToGather || getOperandEntry(E, 1)->State == TreeEntry::NeedToGather || MinBWs.contains(getOperandEntry(E, 0)) || MinBWs.contains(getOperandEntry(E, 1))) && "Expected item in MinBWs."' failed.
```
```
$ clang -target x86_64-linux-gnu -c repro.c -O2
clang: ../lib/Transforms/Vectorize/SLPVectorizer.cpp:12299: llvm::Value* llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*, bool): Assertion `(getOperandEntry(E, 0)->State == TreeEntry::NeedToGather || getOperandEntry(E, 1)->State == TreeEntry::NeedToGather || MinBWs.contains(getOperandEntry(E, 0)) || MinBWs.contains(getOperandEntry(E, 1))) && "Expected item in MinBWs."' failed.
```
https://github.com/llvm/llvm-project/pull/84363
More information about the llvm-commits
mailing list