<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Failure to optimize out abs when sign is known"
href="https://bugs.llvm.org/show_bug.cgi?id=48406">bug 48406</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Failure to optimize out abs when sign is known"
href="https://bugs.llvm.org/show_bug.cgi?id=48406#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Failure to optimize out abs when sign is known"
href="https://bugs.llvm.org/show_bug.cgi?id=48406">bug 48406</a>
from <span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span></b>
<pre>-correlated-propagation seems to get this in all cases.
-instcombine tries to fold abs() too via a wrapper around computeKnownBits
called getKnownSign().
But notice that the compare is not a direct test of the sign-bit; it is "x <=
0", so that doesn't work.
Since we're getting the expected result through the typical optimization
pipeline, I wouldn't add more code to instcombine.
If there are still abs() patterns that escape optimization, we can revisit.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>