[llvm-bugs] [Bug 37750] New: Missed range based optimizations
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 8 06:14:06 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37750
Bug ID: 37750
Summary: Missed range based optimizations
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
Hello,
int g2(unsigned a, unsigned b) {
if (a > 0 && b > 0)
return b + a != 0;
// return b == 0;
// return a + b > 0;
return -1;
}
Long/suboptimal code for cases above ^ - clang/llvm trunk:
g2(unsigned int, unsigned int): # @g2(unsigned int, unsigned int)
xor ecx, ecx
mov eax, esi
add eax, edi
setne cl
cmp esi, 1
sbb edx, edx
cmp edi, 1
sbb eax, eax
or eax, edx
or eax, ecx
ret
GCC:
g2(unsigned int, unsigned int):
test edi, edi
je .L3
test esi, esi
je .L3
xor eax, eax
add edi, esi
setne al
ret
.L3:
mov eax, -1
ret
--
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/20180608/c3590220/attachment.html>
More information about the llvm-bugs
mailing list