[llvm-bugs] [Bug 47507] New: Failure to optimize pointer comparison related to pointer arithmetic
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 12 12:23:44 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47507
Bug ID: 47507
Summary: Failure to optimize pointer comparison related to
pointer arithmetic
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(char *a, char *b)
{
return (a + 16 <= b) || (b + 16 <= a);
}
This can be optimized to `return (uintptr_t)((a + 15) - b) > 30;`. This
optimization is done by GCC, but not LLVM.
Comparison here : https://godbolt.org/z/Pex9Er
--
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/20200912/d3e456fd/attachment.html>
More information about the llvm-bugs
mailing list