<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69928>69928</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CVP] Missed opportunity to do slt to ult conversion
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vladimirradosavljevic
</td>
</tr>
</table>
<pre>
For the following [example](https://godbolt.org/z/1PePcKve7), CVP is not converting `slt` to `ult`:
```
define i64 @test_select(i64 %arg, i64 %arg1) {
entry:
%cmp1 = icmp ult i64 %arg, 64424509440
%and = and i64 %arg1, 4294967295
%cmp2 = icmp slt i64 %arg, %and
%select = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %select, label %good, label %bad
bad:
ret i64 1
good:
ret i64 0
}
```
[Proof](https://alive2.llvm.org/ce/z/cq7ydm) that this transformation is valid.
On the other hand, it is [able](https://godbolt.org/z/44eq4o5vv) to convert it if there are 2 BBs and no select instruction.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEFvszgQ_TXmYjWCiU3gwKFJxGW12px6XRkYgitjU9vQzf76TzYkbb_28EkJMGbmveHNs4Vz8qoRK8KPhJ8TMfvB2GpRopOjtFZ0xolFveIi26Qx3a2qjaV-QNobpcy71FdK-BH_E-OkkPAzgWLwfnJk_0ygJlBfTdcY5XfGXgnU_xOoswte2r8WPBAoCZzo6eVCpaPaeNoavaD1ETVPnfIkT6k3IZhjEGDTM0mfw_P6i2GHvdRIZc4oYalH5_91qLD1BIq4CFyEBk70I8oIlJQcjisCam9vD_iQ0o5TRsn-TGU7TnRWnn5FyhkDxtOSsa0JGl_qLhaF-xeuE2VQsjI_QMk_5bfjBB8s7hvLCvmpYP2uWLI9yuzebvzAewRb1Avl8A7Q2C3hLs-JKtGgCktXY7ovC43YiNdrCB8CUYtrq9nnlAjxPWcTiBzOP06P8OPFGtP_5B-h5IKwU2oZNw-1uBmpfTvcujFM0Q_CUz9IR70V2vXGjsJLo4OvFqFkt1uJ_tHRu8YPaOkQdA0S-ZBG-FE0f2phxvCNGb4skdzcfRuh-kBhkQqLFOjx6KIVtHlMSztv5za0t0u6at-V-1IkWGV5WaSHtCjyZKiKohUlZh1Py67g0DeYFQdoeA_AsegxkRWksM_Cn0EG-a5HTPOW5ftsX_Q5Z4SlOAqpHsol0rkZq7wsoUjiiF3c9QAa32l8SQDCIWCrUPPUzFdHWKqk8-4DxUuv4nFxerkQfqZ_S-ewo2aajPWzlv4WBOlMtLI3cd-s8jhpdDJbVf2mrvTD3OxaMxKoA812e5qseY0WrWNzjkAdm_8VAAD__5YaZbc">