<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64937>64937</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
InstCombine breaks Min/Max Cmp&Select idiom
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:instcombine
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
nikic
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aymanmusa
</td>
</tr>
</table>
<pre>
Commit [cbca9ce9](https://github.com/llvm/llvm-project/commit/cbca9ce91c6440f8815742b8a73a27aa81e806e6) removes a chunk of code that guards cases where the select implements a min/max idiom.
In the following reproducer, we can see that the select instruction in the original IR implemented a minimum (fmin) semantics, while the one in the output IR doesn't.
https://godbolt.org/z/PxY5xh65d
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkk1vnDwUhX-N2VjvCC5gYMEimQgpi0iv2lWXF_sCbvwx8kcy6a-vYKZN1V03YFm65zy-52CMenVEI2sfGYDTr1oyANY-FZjT5sOIHxadzRGL2auP8eyt1Ymz9lHOEgdJA2ufGPRbSpfI6gcGE4Np1WnL80l6y2Ay5u3X779L8N9JJgaTPIT2w12nkqJpyqXvq7ZrYO6xqxE6xL6ivhQkGAw8kPVvFDlyuWX3yv3CpVfE04aJrxmDilxipMjfNwr7PfFIhmTi2l4MWXJpn7baMZgsXrlW2tsTK59Y-XD7PrtjbPHG-HftVh7oErzKkgKDM38nLtHxSHfXPy1cTCHLpL3j-qbig161Q8Ofv3wSkLohaJstZ9AvB87AI1l0Sct4-Gza3B7gHf2Wy-mS0y6mPEXHoEt39r_279XsTTr5sDKYfjCY_r9-a6-baFWhxloN9YAFjZUYoC_7FspiG2Gu6qrqyhLqpcK5laqaEYBkLYRol6XQI5RQlz3UlahbKE-dgKaDrqVBiUFVwJqSLGpz2qPevQsdY6ZRNEPdFQZnMvFetKMT9cO-MentrB3dWxfGoydzXiNrSqNjip9ySSdD47OL6Xwb4nMgfI385cjzBa_8bC8MxNd7IHu4RQ5m_Od6HuSRwXTA_wwAAP__UQ8HIA">