<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115454>115454</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] miscompilation
</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/ym5WV-
```llvm
----------------------------------------
define i32 @abs_abs_x18.2(i32 %x, i32 %y) {
#0:
%a = sub nsw i32 %x, %y
%b = sub nsw nuw i32 %y, %x
%cmp = icmp sgt i32 %x, 4294967295
%cond = select i1 %cmp, i32 %a, i32 %b
%sub16 = sub nsw i32 0, %cond
ret i32 %sub16
}
=>
define i32 @abs_abs_x18.2(i32 %x, i32 %y) {
#0:
%a = sub nsw i32 %x, %y
%b = sub nsw nuw i32 %y, %x
%cmp1 = icmp slt i32 %x, 0
%#1 = select i1 %cmp1, i32 %a, i32 %b
ret i32 %#1
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i32 %x = #x0000000d (13)
i32 %y = #x00000000 (0)
Source:
i32 %a = #x0000000d (13)
i32 %b = poison
i1 %cmp = #x1 (1)
i32 %cond = #x0000000d (13)
i32 %sub16 = #xfffffff3 (4294967283, -13)
Target:
i32 %a = #x0000000d (13)
i32 %b = poison
i1 %cmp1 = #x0 (0)
i32 %#1 = poison
Source value: #xfffffff3 (4294967283, -13)
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/eJzEVcFu4zYQ_ZrRhbBBDiXLOuiQjVdATwXSRXssSImyGUikQVJO3K8vKCm25G2R3UNRIpFp8b03nMehR3ivj0apErIvkB0SMYSTdaW05vg6mNdE2uZaPnX6opA4dbYuAH8ipxDOHvgTYAVYiXF523WXfmvdEbCqFWD1F2B17bM_ft8APQB9mp87Ov1F-PRq84NjQjeq1UYRzZFASoX0f8b_d7bfIuB-fI3ZO-AzmedXwIJA_mWOj5zGnY9fSFwXBPiB-EES49_IUmAkT0DATK5wZnhbBHieOHfRuj-PcB0n_hhWuikWabHLscju6rU1zRRAdaoORLNZZpGJWMzlIpgfJNt9lwWdtxWVZ7BTt42MnNmS_DBP-AH41__T5p_yefKHLXzu1j7ThSogZ__oL_vE4IVnUePBsm9OGN9a14ugrSGNVd4A5oFclNPtFZAti__ry8uvL_ECfRPuGHU96a1T5Gy1t8YOnoSTMMTbwdVqRXwX_blTN0c_shwzAuTvdBoNAdwzDliscNdHHI04eoNNz9-msA8xxA_GmI5tymReYMubEBXYSH1k3kr_8yD3So_Ydho8Yj_u1J7HM9wsqPNBjY7_B8mxu8Ta1EXRfMeerCYX0Q3R8J_IZq6cG3OpOmsPfS_cdXH7KKmtc7Hqw6pc_QeAEW0-gVDSCt2pZhPs5uzsRf07cG4Xyjnr_MOvftKUvCl4IRJVspwzumMMMTmVsuCp4vsG2S4v2mYnlRK5bHZCZm1eY5PoEimmjNE9o2yf4hZ3eynTpm4lzfNWZpBS1Qvd3RpRor0fVMlYlmZp0gmpOj_2OUSj3si4Coix7bkykjZyOHpIaad98HeZoEM3NshfjA_PtpfaKMgOpNe-tv1Zd6MByeC6ct0YjzqcBrmtbQ9Yjf1u-ogGvqo6AFbjJjxgNe_yUuLfAQAA__9buAf9">