[llvm-bugs] [Bug 46133] New: Failure to optimize compare and bitwise and with same operands properly (stuck at intermediate transformation)
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 29 08:35:49 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46133
Bug ID: 46133
Summary: Failure to optimize compare and bitwise and with same
operands properly (stuck at intermediate
transformation)
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
bool f(int x, int y)
{
if ((unsigned)x >= y)
return false;
return (x & 1) == 0;
}
This can be optimized to `return ~x & ((unsigned)x < y);`, but is only
optimized to `return ((unsigned)x < y) & !(x & 1);`. Furthermore, `return
((unsigned)x < y) & !(x & 1);` by itself gets optimized to `return ~x &
((unsigned)x < y);`, so the code above should also get optimized to that.
--
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/20200529/72eb2d57/attachment.html>
More information about the llvm-bugs
mailing list