Issue 113866
Summary Wrong folding of `select` and `shufflevector` (commutativity check)
Labels new issue
Assignees
Reporter bongjunj
    https://github.com/llvm/llvm-project/blob/5d4a0d54b5269bad1410e6db957836fe98634069/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L2618-L2623

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


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

ERROR: Value mismatch

Example:
<4 x i8> %y = < #x00 (0), #x00 (0), undef, #xff (255, -1) >
i1 %cmp = undef

Source:
<4 x i8> %blend = < #x00 (0), #x00 (0), #x00 (0), #x00 (0) >
<4 x i8> %r = < #x00 (0), #x00 (0), #x00 (0), #x00 (0) >

Target:
<4 x i8> %sel = < #x00 (0), poison, #x00 (0), #x00 (0) >
<4 x i8> %r = < #x00 (0), #x00 (0), #x02 (2), #x00 (0) >
Source value: < #x00 (0), #x00 (0), #x00 (0), #x00 (0) >
Target value: < #x00 (0), #x00 (0), #x02 (2), #x00 (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

Reply via email to