[llvm-bugs] [Bug 48406] Failure to optimize out abs when sign is known

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 13 06:04:26 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=48406

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Sanjay Patel <spatel+llvm at rotateright.com> ---
-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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210413/2e9c344a/attachment.html>


More information about the llvm-bugs mailing list