Issue 98434
Summary Wrong splatting condition of vector select by InstCombine
Labels new issue
Assignees
Reporter bonjune
    

https://github.com/llvm/llvm-project/blob/7eae9bb856135136cddc4208a2b1546e9db44c9c/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L3568-L3569

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

```ll
----------------------------------------
define <2 x i16> @fun0(<1 x i1> %val0, <1 x i32> %val1, <4 x i1> %val2) {
entry:
  %val3 = extractelement <4 x i1> %val2, i32 3
  %val4 = select i1 %val3, <2 x i16> { 0, 0 }, <2 x i16> { 65535, 65535 }
  ret <2 x i16> %val4
}
=>
define <2 x i16> @fun0(<1 x i1> %val0, <1 x i32> %val1, <4 x i1> %val2) {
entry:
  %.splat = shufflevector <4 x i1> %val2, <4 x i1> poison, 3, 3
  %not..splat = xor <2 x i1> %.splat, { 1, 1 }
  %val4 = sext <2 x i1> %not..splat to <2 x i16>
  ret <2 x i16> %val4
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
<1 x i1> %val0 = < poison >
<1 x i32> %val1 = < poison >
<4 x i1> %val2 = < poison, poison, poison, undef >

Source:
i1 %val3 = #x0 (0)	[based on undef value]
<2 x i16> %val4 = < #xffff (65535, -1), #xffff (65535, -1) >

Target:
<2 x i1> %.splat = < #x0 (0), #x1 (1) >
<2 x i1> %not..splat = < #x1 (1), #x0 (0) >
<2 x i16> %val4 = < #xffff (65535, -1), #x0000 (0) >
Source value: < #xffff (65535, -1), #xffff (65535, -1) >
Target value: < #xffff (65535, -1), #x0000 (0) >

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to