[llvm-bugs] [Bug 45727] New: Failure to optimize out useless zero-ing after register was already zero-ed
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 29 01:15:17 PDT 2020
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: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200429/31c24dfa/attachment.html>
More information about the llvm-bugs
mailing list