<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114738>114738</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SLPVectorizer] wrong aggregation of `or` of logical values due to poisonous value
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bongjunj
</td>
</tr>
</table>
<pre>
Alive2 report: https://alive2.llvm.org/ce/z/f8PDZj
```llvm
----------------------------------------
define i1 @test1.2(i32 %x, i32 %a, i32 %b, i32 %c, i32 %d) {
#0:
%cmp = icmp sgt i32 %x, 1
%cmp2 = icmp sgt i32 %b, 1
%cmp3 = icmp sgt i32 %c, 1
%cmp4 = icmp sgt i32 %d, 1
%sel2 = select i1 %cmp4, i1 1, i1 %cmp2
%sel3 = select i1 %sel2, i1 1, i1 %cmp3
%sel4 = select i1 %cmp, i1 1, i1 %cmp4
%ret = or i1 %sel3, %sel4
ret i1 %ret
}
=>
define i1 @test1.2(i32 %x, i32 %a, i32 %b, i32 %c, i32 %d) {
#0:
%#1 = insertelement <4 x i32> poison, i32 %d, i32 0
%#2 = insertelement <4 x i32> %#1, i32 %b, i32 1
%#3 = insertelement <4 x i32> %#2, i32 %c, i32 2
%#4 = insertelement <4 x i32> %#3, i32 %x, i32 3
%#5 = icmp sgt <4 x i32> %#4, { 1, 1, 1, 1 }
%#6 = reduce_or <4 x i1> %#5
ret i1 %#6
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i32 %x = #x00000000 (0)
i32 %a = poison
i32 %b = #x00000002 (2)
i32 %c = poison
i32 %d = #x00000000 (0)
Source:
i1 %cmp = #x0 (0)
i1 %cmp2 = #x1 (1)
i1 %cmp3 = poison
i1 %cmp4 = #x0 (0)
i1 %sel2 = #x1 (1)
i1 %sel3 = #x1 (1)
i1 %sel4 = #x0 (0)
i1 %ret = #x1 (1)
Target:
<4 x i32> %#1 = < #x00000000 (0), poison, poison, poison >
<4 x i32> %#2 = < #x00000000 (0), #x00000002 (2), poison, poison >
<4 x i32> %#3 = < #x00000000 (0), #x00000002 (2), poison, poison >
<4 x i32> %#4 = < #x00000000 (0), #x00000002 (2), poison, #x00000000 (0) >
<4 x i1> %#5 = < #x0 (0), #x1 (1), poison, #x0 (0) >
i1 %#6 = poison
Source value: #x1 (1)
Target value: poison
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVlFvqzgT_TXOi9XIHhsSHnhom-bpk76r3qt92JeVAxPiCnBkm9z2_vqVgRBI6KYrrXajCqbmnDNjezwe5ZwuasSURE8k2ixU4w_GpjtTF29N_bbYmfwjfSz1CYFaPBrriXikB--PjohHAlsCW9V-XpblqVoaWxDYZkhg-4vAdr_-tvn9jbANYY_9M2bdX4B3Qw9f_HXoHPe6Rqo5JZJ5dJ4vgcBaC6AEoncCz7S31cjejexsZOcEEkpWT31wIFiYVvsPbbHVkRKxoToYrvB07IdPgTCL3M0gxSwym0HKWWR-jXRYdt4dlpj5dnU6fjtXTnn_7iOdUsUtNQjOUsWUKme9zjLliGnRt0RjL_5EQPeqZ2jAdQCLvt-j1aY3xIaIl_8iKQgI3u1L7dB6LLHCOkzoWdL3IELECz0a7Uw9Ve1sNpWCu1K9y7nI-VRLfFEL5mYOUy35RS0x0hpW-pwmHSSaZvGcSpuoZPXUJc3oQYcNPwcWt2oW8ybDP4wd5PhFLbpNoEC8yqAfVtVub2ylvDY1zQ26msDK0xNavf8gwMeV6-X19f-vofr9ULYIso5WxmK_0aZx1B9UTZ1pbIYT4ruqjiUOOXReq3YaBMQ763-UwJoRSCYw1cL6bBp_2F3zw-garvnZZ_z8jv_u-b2bzhA7H1fFlnwVNZ9Uw4AII2t-ixC3kfFJ2ftUfih3n8oPVe2vEHe8nIvUjESfP20iDGsze2g7BfE8v9DwPKoT1x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