| Issue |
114181
|
| Summary |
[InstCombine] Wrong negation of vector selection with a poison value
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bongjunj
|
https://github.com/llvm/llvm-project/blob/9a7519fdb39f21a807189e1ed06826b43db929e1/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp#L327-L350
Alive2 report: https://alive2.llvm.org/ce/z/tdHHuq
```llvm
----------------------------------------
define <2 x i32> @negate_select_of_negation_poison.2(<2 x i1> %c, <2 x i32> %x) {
#0:
%#1 = srem <2 x i32> { poison, 0 }, %x
%neg = sub nsw <2 x i32> %#1, %x
%sel = select <2 x i1> %c, <2 x i32> %neg, <2 x i32> %x
%neg2 = sub <2 x i32> %x, %sel
ret <2 x i32> %neg2
}
=>
define <2 x i32> @negate_select_of_negation_poison.2(<2 x i1> %c, <2 x i32> %x) {
#0:
%neg = sub nsw <2 x i32> { 0, 0 }, %x
%#1 = select <2 x i1> %c, <2 x i32> %x, <2 x i32> %neg
%neg2 = add <2 x i32> %#1, %x
ret <2 x i32> %neg2
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
<2 x i1> %c = < #x0 (0), #x0 (0) >
<2 x i32> %x = < #x80000000 (2147483648, -2147483648), #x0000000d (13) >
Source:
<2 x i32> %#1 = < poison, #x00000000 (0) >
<2 x i32> %neg = < poison, #xfffffff3 (4294967283, -13) >
<2 x i32> %sel = < #x80000000 (2147483648, -2147483648), #x0000000d (13) >
<2 x i32> %neg2 = < #x00000000 (0), #x00000000 (0) >
Target:
<2 x i32> %neg = < poison, #xfffffff3 (4294967283, -13) >
<2 x i32> %#1 = < poison, #xfffffff3 (4294967283, -13) >
<2 x i32> %neg2 = < poison, #x00000000 (0) >
Source value: < #x00000000 (0), #x00000000 (0) >
Target value: < poison, #x00000000 (0) >
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs