| Issue |
75995
|
| Summary |
WRONG code SLP vectorizer? InstCombine?
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
JonPsson1
|
```
int printf(const char *, ...);
unsigned char a = 255;
unsigned int b = 0;
unsigned short fun(unsigned char g) { return g - 1; }
int main() {
for (short c = 0; c < 8; c++)
b |= fun(--a);
printf("%X\n", b);
}
```
fun() is doing arithmetic with 8 bits, and extending the result to 16 bits. 'b' ORs itself with this result, which could never be more than 8 bits. Yet, I see:
```
clang -target s390x-linux-gnu -march=z14 -O3 wrong1.i -o ./a.out; ./a.out
FFFF
clang -target s390x-linux-gnu -march=z14 -O3 wrong1.i -mllvm -slp-vectorize-hor=false -o ./a.out; ./a.out;
FF
```
It seems SLP vectorizer is generating an @llvm.vector.reduce.or.v8i16 which is later removed by InstCombine...
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs