[llvm-bugs] [Bug 50545] New: Failure to optimize loop of and by progressively bigger operand to single and+select
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 31 15:37:05 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50545
Bug ID: 50545
Summary: Failure to optimize loop of and by progressively
bigger operand to single and+select
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
int f(int c)
{
int i = 1;
while ((c & i)) {
c &= i;
i <<= 1;
}
return c;
}
This can be optimized to `return (c & 1) == 0 ? c : (c & 1);`. This
transformation is done by GCC, but not by LLVM.
Godbolt comparison: https://godbolt.org/z/oTxbxv5fo
alive2 comparison: https://alive2.llvm.org/ce/z/oDxuS4
--
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/20210531/189af6ce/attachment.html>
More information about the llvm-bugs
mailing list