<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70204>70204</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missing fold for `a ? abs(a) : 0` --> abs(a)
</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>
The following function `f` is taken from GCC bugzilla.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111957
```cpp
int f(int a)
{
if (a)
return a > 0 ? a : -a;
return 0;
}
int g(int a)
{
return a > 0 ? a : -a;
}
```
Godbolt:
https://godbolt.org/z/nhvEa6srx
Alive2:
https://alive2.llvm.org/ce/z/YwTUnD
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMUk1vnDAQ_TXDZQQyY1iWA4dNNuTUW3roqTJgwI3XXtlmt82vr_hIdhW1VSWELb_xe543T3ivBiNlBfkD5MdITGG0rnqNhXP26qPGdr-ql1Fib7W2V2UG7CfTBmUNwo71sGOoPAbxKg32zp7w-fERm2l4U1qLBNgR2GEM4eyBH4BqoHpo22QwU2LdAFS_lwLVfrTX7800JO2ggNeqA35M07TMi5Vm--_Y-rXn83qiTMAeaD-vAqjc6oqHdYOoegTa3yBEJ8PkDAoE_oQMgdfL_oCxAP7wqYp9HEFxvH_KLDj8S_h_ZG6c743dSzzbrrE6zOb9ycoV3ax8A6rNeHkSO-9-3pMctLpI-guHWMBE68tp42nlRvbt-vLVHKOu4l3JSxHJKt2Ve-JFkfForDLeyJy3pSiF5E1WsDQrWNf0bM9ZLwSPVEWMeMooTykj4gmlRU8F54KlecpZDxmTJ6H0h3qkvJ9kVTBiWaRFI7Vfkklk5BUXEIjmoLpqvhM30-AhY1r54G8sQQUtqy_K-yWwVnfYWzcHVqxDaPwWiGUas-kYx_OQbkg0OV19sluFcWqS1p6A6llsW-Kzsz9kG4Dq5YkeqF5a-B0AAP__2hb1ZQ">