<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68227>68227</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] a ? (a < 0) : 1 --> (a <= 0)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
```llvm
define i32 @src(i32 %0) {
%1:
%2 = icmp eq i32 %0, 0
%3 = lshr i32 %0, 31
%4 = select i1 %2, i32 1, i32 %3
ret i32 %4
}
=>
define i32 @tgt(i32 %0) {
%1:
%2 = icmp slt i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
Transformation seems to be correct!
```
https://godbolt.org/z/evaE94d7o
https://alive2.llvm.org/ce/z/6ra3nj
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU01v2zAM_TX0RUggUf48-NDWMbD7_oBsM4k62cokJd366wcpTrp2OQ0IEFJ8j3oUn5X3-rAQtVA8Q9Fl6hyO1rU_Nso5--azwU6_Wyj59WfMZQbeAX-aaK8XYloig5x7NwLWKcGCAzYMqucrELAQIJ-uSSwjA9kxPc4nRj_ZB-eF8RUUD2RCGX90nyBS_IXJE8aToTEwLVLzCIoEcQtirxvHUbid5au6qlsD2YHcPZotHML_zOZN-KRc_DPcO_26y2bBRvQDofKL0O9OLX5v3ayCtgvzRLOP7IHYaJ2jMQCud93Xdk2PIZx8lIs9YH-w02BN2Fp3AOzfAXu6qF2TT5V9BFdGXwi30QArZaSVVzoll9dsauXUyEZl1IqyKXMpSsGzYysl1kIIMfK8kGJfDyiwnsRQTqimSlaZbpGjFJznouCcN9t6Uo0qhVS8oIpTDTmnWWlzvz3T3p-pLWvEKjNqIOOTfxEXemOpCIjRzq6NnM1wPnjIudE--I8uQQeTjP9t8eHFzoNeCIqOKQayZ4B1DKIt487lExNsswG5u1fiEmMxOzvTfnldHY7nYTvaGbBPX831b3Ny9jXtqE8yfXy_OMafAAAA__8_nfJX">