<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/160217>160217</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[X86] Using (SUB32ri GR32:$src1, -128) for (add X, 128) incorrectly preserves NUW flag
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
topperc
</td>
</tr>
</table>
<pre>
If the ADD instruction has an NUW flag, it is incorrectly copied into the MIR SUB instructions. If any MIR transforms use this flag, they may get incorrect information.
There are many such patterns like this with the same issue.
CC: @rksimon @phoebewang @arsenm
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxMkkFv4yAQhX8Nvowa4SFO7IMPaaOsetg9tBttrwSPDVsbLAY3yr9f4Y3anoBh-HiPh2Z2gydqRfUoqmOhl2RDbFOYZ4qmuITu1j73kCzB4XgE5znFxSQXPFjNoD38Ov-BftSDwCdwCRyD8ybESCaNNzBhdtSB8ymskJ_PL_B6fvwO4g0896D9bd1MUXvuQ5wYFiZI1vEnPlm6waRvMFD6ugWcz_06szZCHoQ8_LYUCXQkmDKXF2Nh1ilR9Ayje79zry7ZVRXricAxL3QHPD0JdQCxlfGd3RR8ns420IWu2g95pSOTn6DoWtU1qtEFteW-qqu62iEWtqVa7zq109g1prnoWmlT70tDjSrlTkssXIsSK9mgklLKUm0a2lfKbPe9osagKcVW0qTduBnHj2kT4lCsCttyJ7HcF6O-0Mhrboierv_1C8QcY2zzoYfLMrDYytFx4i9McmlcA3-rd6I6wpld9oT16_lRYXTw40WhUAeBW46mzC__UGItsIE-xNyouw7ecv1e_p74HIkpfhB__oxiiWNrU5p5hZ4EngaX7HLZmDAJPGVh9-FhjuEvmSTwtNphgae7348W_wUAAP__ZhPcow">