https://bugs.llvm.org/show_bug.cgi?id=45727
Bug ID: 45727
Summary: Failure to optimize out useless zero-ing after
register was already zero-ed
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
int f(bool b, int *p)
{
return b && *p;
}
LLVM generates this with -O3 for x86-64 :
f(bool, int*): # @f(bool, int*)
xor eax, eax
test dil, dil
je .LBB0_2
xor eax, eax ; This can be removed, since eax is already 0 here
cmp dword ptr [rsi], 0
setne al
.LBB0_2:
ret
This is also present on i686 :
f(bool, int*): # @f(bool, int*)
xor eax, eax
cmp byte ptr [esp + 4], 0
je .LBB0_2
mov ecx, dword ptr [esp + 8]
xor eax, eax ; This can be removed, since eax is already 0 here
cmp dword ptr [ecx], 0
setne al
.LBB0_2:
ret
Most likely this occurs because the second xor is inserted after any pass that
would remove it
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs