<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113869>113869</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Poison value wrongly propagates through vector operations on an optimized code
</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>
https://github.com/llvm/llvm-project/blob/5d4a0d54b5269bad1410e6db957836fe98634069/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L1050-L1060
Alive2 report: https://alive2.llvm.org/ce/z/6tSdhb
```llvm
----------------------------------------
define <2 x i32> @uadd_sat_not_ugt_commute_add.2(<2 x i32> %x, <2 x i32> %yp) {
#0:
%#1 = sdiv <2 x i32> { 2442, 4242 }, %yp
%notx = xor <2 x i32> %x, { 4294967295, poison }
%a = add nuw <2 x i32> %#1, %notx
%c = icmp ugt <2 x i32> %#1, %x
%r = select <2 x i1> %c, <2 x i32> { 4294967295, 4294967295 }, <2 x i32> %a
ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_not_ugt_commute_add.2(<2 x i32> %x, <2 x i32> %yp) {
#0:
%#1 = sdiv <2 x i32> { 2442, 4242 }, %yp
%notx = xor <2 x i32> %x, { 4294967295, poison }
%r = uadd_sat <2 x i32> %#1, %notx
ret <2 x i32> %r
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
<2 x i32> %x = < poison, #x00000000 (0) >
<2 x i32> %yp = < #x00000008 (8), #x0000000e (14) >
Source:
<2 x i32> %#1 = < #x00000131 (305), #x0000012f (303) >
<2 x i32> %notx = < poison, poison >
<2 x i32> %a = < poison, poison >
<2 x i1> %c = < poison, #x1 (1) >
<2 x i32> %r = < poison, #xffffffff (4294967295, -1) >
Target:
<2 x i32> %#1 = < #x00000131 (305), #x0000012f (303) >
<2 x i32> %notx = < poison, poison >
<2 x i32> %r = < poison, poison >
Source value: < poison, #xffffffff (4294967295, -1) >
Target value: < poison, 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/eJzcVl9v66gT_TTkBTXCg_8--KH_Iv2kK_1W7X2vsJk4VLaxAKfp_fQrsJMmadLt1e7LrhU5MnDOnDkMaIS1qukRS5LckeRhIUa30aasdN-8jv3rotLyvdw4N1jCbwmsCKwa5TZjtax1R2DVttv9381g9CvWjsCqanVFYJXIWDCZxFUCaVEJGcURw1RWRZLlPF1jkac8ZmlxxKM87qcRvV1r01kCq__11t3rrlI9nn49Y4u1W9bDQID_iFjCbn5ELGWEPRB2O71vW7VFoAYHbRzht_Q0FRGmlz74UpuGwKr2QX4RWKXuWW6qYy6SsukXtIahm28-02qJa9UjJfwe6I4qDoQ_UhKzUUj5YoV76bV7GRv3UuuuGx2-CCmXQCA_Q0CyI3B_zgPJ-0CgoCS7m_UCZz7T8EH9AgI8ooQ_UCvV9hyf3VGIY_DMMcRASfYQogTeD45eu13g2GnzWcIkLLujMRRxkWZQJH5k0MrqPlB-MIlAI6Sk_fj2mcqLnQX4mDOQQFIHnKq7gY6N-xK4OwpnpsxD0RxA0YypLxj6KYuPr4M557HFPqDBC8rMvDF7Gwh_IPzxP1Ic_2htTJu1z_27xfE91w-3i3BK91RqtD2BzNEtGrV-JxAdn_rHp6f_P_mb46cwDTqqLO20wVm2Hi11G9FTq0dT4wlwJ7qhxYPJn_0IORK-t2DKh-_Y_FACOQubtq-RC5t64DhC5h6ZEyjOGNGPR_EpZXg_T-qvSj3UxkmkyA9CzllyHiuC9TTDv9Z_KJhTF_YlcRUnfgN0OOJX7A45RF_rNFew6_nxFKdVfRNdsHkqoX-PzZfSPgdNpUO3oh19Af0dk-YTdoXqk9op_Nh1wrwfXWWM1toYf8m7k4Nu9wsiqvq_WMLoWqgW5Y3TvqvZ4vWFc4eBxmhjzxqFhSy5LHghFlhGGWesyCCHxaYUkkvETBQJY3mR1QXDBAWvQUZZuk7ShSqBQRwxyFnK4xiWyRqBI2driKqYR0hihp1Q7aF3WShrRyyjiOdpsWhFha0NTR1Aj280zBIA3-OZMrRr1dhYErNWWWc_aJxyLZZ_TGaHraBvRvdN-04HowfRCIf-zjN6bDZ0i7XThuoBzWQM1T0VPdWDU536hZLWWuJiNO3vN5FBsu8A55y2JfwZAAD__21g2ng">