Issue 114752
Summary [InstCombine] an element is overwritten as a `poison`
Labels new issue
Assignees
Reporter bongjunj
    The optimizer overwrites the second element of the second operand of `add` as `poison` for no reason.

Alive2 report: https://alive2.llvm.org/ce/z/qka3d8

```llvm
----------------------------------------
define <4 x i8> @sel_shuf_commute3.2(<4 x i8> %x, <4 x i8> %y, i1 %cmp) {
#0:
 %#1 = add <4 x i8> %x, { 0, 1, 2, 3 }
  %blend = shufflevector <4 x i8> %#1, <4 x i8> %y, 0, 5, 2, 3
  %r = select i1 %cmp, <4 x i8> %y, <4 x i8> %blend
  ret <4 x i8> %r
}
=>
define <4 x i8> @sel_shuf_commute3.2(<4 x i8> %x, <4 x i8> %y, i1 %cmp) {
#0:
  %#1 = add <4 x i8> %x, { 0, poison, 2, 3 }
  %sel = select i1 %cmp, <4 x i8> %y, <4 x i8> %#1
  %r = shufflevector <4 x i8> %sel, <4 x i8> %y, 0, 5, 2, 3
  ret <4 x i8> %r
}
Transformation doesn't verify!

ERROR: Target's return value is more undefined

Example:
<4 x i8> %x = < #x03 (3), #x00 (0)	[based on undef value], #x00 (0), #x00 (0) >
<4 x i8> %y = < undef, #x00 (0), #x03 (3), #x00 (0) >
i1 %cmp = undef

Source:
<4 x i8> %#1 = < #x03 (3), #x01 (1), #x02 (2), #x03 (3) >
<4 x i8> %blend = < #x03 (3), #x00 (0), #x02 (2), #x03 (3) >
<4 x i8> %r = < #x03 (3)	[based on undef value], #x00 (0), #x02 (2), #x03 (3) >

Target:
<4 x i8> %#1 = < #x03 (3), poison, #x02 (2), #x03 (3) >
<4 x i8> %sel = < #x54 (84), #x00 (0), #x03 (3), #x00 (0) >
<4 x i8> %r = < #x54 (84), #x00 (0), #x02 (2), #x03 (3) >
Source value: < #x03 (3), #x00 (0), #x02 (2), #x03 (3) >
Target value: < #x54 (84), #x00 (0), #x02 (2), #x03 (3) >

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