[llvm-bugs] [Bug 45688] New: Missed optimization on comparison after knowing __builtin_uadd_overflow didn't overflow
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 26 19:43:32 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45688
Bug ID: 45688
Summary: Missed optimization on comparison after knowing
__builtin_uadd_overflow didn't overflow
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(unsigned a, unsigned b)
{
unsigned result;
bool overflowed = __builtin_uadd_overflow(a, b, &result);
__builtin_assume(!overflowed);
return result >= b;
}
This can be optimized to `return 1;`. This transformation is done by GCC, but
not by LLVM.
Comparison here : https://godbolt.org/z/i44m2a
--
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/20200427/44fbd747/attachment.html>
More information about the llvm-bugs
mailing list