<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58391>58391</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Invalid transformation in SLPVectorizer: Target is more poisonous than source
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fhahn
</td>
</tr>
</table>
<pre>
`SLPVectorizer` transforms the following input `@src` into `@tgt`. According to Alive2, the target is more poisonous than source.
```
define <4 x double> @src(i32 %a2, i32 %a3) #0 {
%cvt2 = sitofp i32 %a2 to double
%cvt3 = sitofp i32 %a3 to double
%res2 = insertelement <4 x double> undef, double %cvt2, i32 0
%res3 = insertelement <4 x double> %res2, double %cvt3, i32 1
ret <4 x double> %res3
}
define <4 x double> @tgt(i32 %a2, i32 %a3) #0 {
%1 = insertelement <2 x i32> poison, i32 %a2, i32 0
%2 = insertelement <2 x i32> %1, i32 %a3, i32 1
%3 = sitofp <2 x i32> %2 to <2 x double>
%4 = shufflevector <2 x double> %3, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
ret <4 x double> %4
}
```
https://alive2.llvm.org/ce/z/ZCaBMX
```
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i32 %a2 = poison
i32 %a3 = poison
Source:
double %cvt2 = poison
double %cvt3 = poison
<4 x double> %res2 = < poison, NaN [based on undef value], NaN, NaN >
<4 x double> %res3 = < poison, poison, NaN, NaN >
Target:
<2 x i32> %1 = < poison, poison >
<2 x i32> %2 = < poison, poison >
<2 x double> %3 = < poison, poison >
<4 x double> %4 = < poison, poison, poison, poison >
Source value: < poison, poison, NaN, NaN >
Target value: < poison, poison, poison, poison >
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVduO2jAQ_RrnxSpKbBLIQx5YditVarfVblVVfTPJhLgKNrId9vL1ndyAEKCsBI7tmTlzPclKZ28Jifznrz9-Qeq0ke9g8EydEcrm2mwsdQXQXJelfpFqTaXaVo6iCpn61qS1rlROdzdu7XAzoYs01Sar9VG0KOUOGGHLBsoJswZHpaUbbYButbRa6ar2IxS1ujIpTIh_T_zFmRW9tL_mmEEuFVDCl1P6SjNdrUog_IF2sbG55IwSForGe3_ghMW44T4ls7sWiNaCdOdQgd9TK53Ot3t9VifRgQ-0-TltflbbgG2xpbJgHJSwAeXGkVcKc6qDba_6sPrw_SEkvwWy8z4C5T1o0IMauGjOu_rP7o_bcaX-9SR8sP7B-WwYQqNpjdsOyzHW2cpcqPQRUO3tJKSTWuDtoL0j-2Yqutt95kfW09a6qPK8hF1DrpF646V2PRIcMu2K2zvmyzbbfbzdZj84h8MhnEuNnZ52dUivdi2c21rCF4R9xp9oyDwpy91mos0ab1LA5R3_f5bi7tvvK3T92b9UhJNaYShgMcWZozswMn8jLDg2fnh6-v6EfunPG94YA8NXsdnWOXbnA4_rjnSVHUj4SNKuzy12DzTk5MhmyK4x5AViNoooPOr5o3gkfkzCu5WwkFGsVdNRuhNlBSS873XaB913-hJ5z7gYOhsBtf1qCr9Pf0yhi7iDkE55c7PRkCe32Y1n_Gryl7Ha3nclxyn8SPm6if2v7ZVMeuZ4kARRFMZszv25lyU8i3ksPCddCckXhS5kdvhat8SSig4_6DeSyKtMmQzpvpauqFaTVG_wUJO-e3zaGv0XHeBRWluBxU0453HgFQnLASBgccDz2QwgZ_E8DFkWpmIV-XHGvFKsoLQJzjdhTMELbSBwj6PtyYT5jAV-EAU8DKazSQ7TNAImolkUzbM8xo8LbIQs9-8gzyRNSKtqbVFYSuvsQSislWsF0LhDfFG5QpskL0ShvMZx0gT-DyO1lIw">