<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93769>93769</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
foldFNegIntoConstant incorrectly preserves fast math flags for 0 constants
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:instcombine,
floating-point
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
arsenm
</td>
</tr>
</table>
<pre>
https://alive2.llvm.org/ce/z/MHShQY longer version
_Originally posted by @arsenm in https://github.com/llvm/llvm-project/pull/92512#discussion_r1619895371_
Some of the combines in foldFNegIntoConstant are unsafely taking the flags directly from the original fneg instruction, when the preservation logic requires dropping ninf in some cases.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUUk-vlDAQ_zTlMnmbtvzbHjg834boQY15J0-bAlOolhY7Zc366Q0sUWO8eBmSoZPfX01kR4_YsPINKy-ZXtMUYqMjoZ-zLgz3BqaUFmL5M5Mtk6129oby5NxtPoU4Mtn2yGT7g8n2_dvX6dNncMGPGOGGkWzwjF8Yf37M68doR-u1c3dYAiUcoLsDK_gDD6z_C2y0aVq7Ux9mJtsN8vg8LTF8wT4x2S6rc0y2SpZCMpkPlvqVNuBrFJVQZ1Xmtbj-yeIxX8OMEAykCaEPc2c90kbABDe0H3B851N4CZ6S9gl0RFg9aYPuDkl_tX7cD43TI8FgI_bJ3cHEMO_7cOgE43EE6ynFtU-bG_IFvk_o91dLRMJ409sPcGG0PUT8ttqIBEMMy7LBeOvNxos2vr0mpBNkQ5MPKlc6w0bUouZFoWqeTQ2ez2UtkHd1JcW5Mr0ZCl1VoiuHTlSSZ7aRXBa8zDkvykrwU8eVUKbUZYmdUEqxguOsrfsVcGaJVmxUXlcqc7pDR3tZpNzzyJ83dYeBTEomX5iUxgWdrB-flmB92tblJYvNHl23jsQK7iwl-o2SbHLY_NN86_sQD4cPy5DAaEow6zQdIZgQgUN_HFG2Rtf8d5l2rbTVaZd7a-TPAAAA___stQrL">