Issue 113869
Summary Poison value wrongly propagates through vector operations on an optimized code
Labels new issue
Assignees
Reporter bongjunj
    https://github.com/llvm/llvm-project/blob/5d4a0d54b5269bad1410e6db957836fe98634069/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L1050-L1060

Alive2 report: https://alive2.llvm.org/ce/z/6tSdhb

```llvm
----------------------------------------
define <2 x i32> @uadd_sat_not_ugt_commute_add.2(<2 x i32> %x, <2 x i32> %yp) {
#0:
  %#1 = sdiv <2 x i32> { 2442, 4242 }, %yp
  %notx = xor <2 x i32> %x, { 4294967295, poison }
  %a = add nuw <2 x i32> %#1, %notx
 %c = icmp ugt <2 x i32> %#1, %x
  %r = select <2 x i1> %c, <2 x i32> { 4294967295, 4294967295 }, <2 x i32> %a
  ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_not_ugt_commute_add.2(<2 x i32> %x, <2 x i32> %yp) {
#0:
  %#1 = sdiv <2 x i32> { 2442, 4242 }, %yp
 %notx = xor <2 x i32> %x, { 4294967295, poison }
  %r = uadd_sat <2 x i32> %#1, %notx
  ret <2 x i32> %r
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
<2 x i32> %x = < poison, #x00000000 (0) >
<2 x i32> %yp = < #x00000008 (8), #x0000000e (14) >

Source:
<2 x i32> %#1 = < #x00000131 (305), #x0000012f (303) >
<2 x i32> %notx = < poison, poison >
<2 x i32> %a = < poison, poison >
<2 x i1> %c = < poison, #x1 (1) >
<2 x i32> %r = < poison, #xffffffff (4294967295, -1) >

Target:
<2 x i32> %#1 = < #x00000131 (305), #x0000012f (303) >
<2 x i32> %notx = < poison, poison >
<2 x i32> %r = < poison, poison >
Source value: < poison, #xffffffff (4294967295, -1) >
Target value: < poison, poison >

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

Reply via email to