<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115890>115890</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] Param attributes should be swapped/dropped after swapping operands of commutative intrinsics
</td>
</tr>
<tr>
<th>Labels</th>
<td>
miscompilation,
llvm:instcombine
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
```
; bin/opt -passes=instcombine test.ll -S
define i32 @test(i32 %x) {
%ret = call range(i32 -10, 0) i32 @llvm.umax.i32(i32 range(i32 -10, -8) -10, i32 %x)
ret i32 %ret
}
```
```
define i32 @test(i32 %x) {
%ret = call range(i32 -10, 0) i32 @llvm.umax.i32(i32 range(i32 -10, -8) %x, i32 -10)
ret i32 %ret
}
```
I found this with https://github.com/dtcxzyw/llvm-ub-aware-interpreter.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0U9GKpDoQ_Zr4EpSk0mr74MPMNMK8XbhfkGh1m0tMJCmnZ-7XL9phd3ZZFnZhQSRVqZOTc6qiU7I3j9iz-pkBTDS-__9xZwCsvhR6oznEPicLE6aPnjUif-LCxBNTz9xYz2AIK_Fy1SlhYupifaIxLMZ65ISJKud4-e8DM-F1T1sFnJ3EvsvgfERQvzPoOGufH5V7JiJxpi581M7xqP0Nc3UpBYMXLnZEPsu5t6XaFv1eWQW57CeQ8rxjcvCJOJPynTKnI1IW2l7y4gcDvg9_Q9tfFfege6g7Nv5M3PF_5dew-YnTbBO_W5r5TLQmpp4YDAyGm6V5M9UYFgbD1wka9vuWmyn1XUcsrSeMa0TCWD2OLaZeTZ3qdIG9bJU8QVu3XTH3jUBRt1q0MIIS5qTk-SrkqIRpdDeNprA9CDhJKUE2opFdpUU9GaOwuTaNmpRkJ4GLtq46PAvxVtiUNuylrM-dKJw26FIe-cWmMSyrdZps8PvkwwsD2JFMPX2a4_woYn8IM9st7U2xidI3GrLkjrf06hO9ZFx94f_oqBeuiaI1G2HiaQ6bm7hBnu56XXHarYthX3F9JYyPvPU3HlaM2k-Jhysfw7JspMm-IbeeovXJjqnYout_0ZNDS27IGsN_OBKD4bAkMRiyK289fAkAAP__KAovJg">