| Issue |
58157
|
| Summary |
Bad codegen after e1dd2cd06 with optimizations enabled
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
dyung
|
We have a bunch of internal tests that started to fail which I bisected one down to the commit e1dd2cd063785ea3a6004c8d173f13113b1b8265. The tests produce the wrong output when compiled with optimizations.
Consider the code test.cpp:
```c++
#include <stdio.h>
typedef char __attribute__((ext_vector_type(4))) char4;
typedef char __attribute__((ext_vector_type(16))) char16;
#define char4_wxxy(__A) (__A.wxxy)
#define char4_yywz(__A) (__A.yywz)
char4 main_id6650{(char)-97930665};
int main() {
for (char id6651_idx = 0; id6651_idx < 2; ++id6651_idx) {
char4 id6652{(char)-10402671, (char)-30075058};
main_id6650 ^= id6652;
}
char4 id6649 char4_wxxy(main_id6650);
char4 id6648 char4_yywz(id6649);
char16 id6647 = __builtin_shufflevector(id6648, id6648, 2, 3, 3, 6, 5, 0, 1,
3, 7, 0, 4, 1, 6, 4, 3, 0);
printf("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", id6647[0],
id6647[1], id6647[2], id6647[3], id6647[4], id6647[5], id6647[6],
id6647[7], id6647[8], id6647[9], id6647[10], id6647[1], id6647[12],
id6647[13], id6647[4], id6647[5]);
}
```
Before e1dd2cd063785ea3a6004c8d173f13113b1b8265, when compiled with optimizations, the code would produce the following output:
```
$ ~/src/upstream/16f9c5577d2f498ba459de1862f8474882ea0690-linux/bin/clang -O2 -mavx test.cpp -o test.good.out
$ ./test.good.out
0 57 57 0 57 57 57 57 57 57 57 57 0 57 57 57
```
But after e1dd2cd063785ea3a6004c8d173f13113b1b8265, compiling the same code with optimizations now produces the following output:
```
$ ~/src/upstream/e1dd2cd063785ea3a6004c8d173f13113b1b8265-linux/bin/clang -O2 -mavx test.cpp -o test.bad.out
$ ./test.bad.out
4e ffffffc6 ffffffc6 4e ffffffc6 ffffffc6 ffffffc6 ffffffc6 ffffffc6 ffffffc6 ffffffc6 ffffffc6 4e ffffffc6 ffffffc6 ffffffc6
```
I realize that this change was reverted in d7592bbb0362b38d82bdf6e97294f54059e3f456 (for a different reason), but if it will be resubmitted, it will contain the problem I have described here and it should be fixed before resubmitting.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs