[llvm-bugs] [Bug 35745] New: Ignoring to directly use EAX register while preserving it for the same return value
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Dec 25 09:36:24 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35745
Bug ID: 35745
Summary: Ignoring to directly use EAX register while preserving
it for the same return value
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: Mrrrgbl at gmail.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19602
--> https://bugs.llvm.org/attachment.cgi?id=19602&action=edit
Same testcase as on god bolt link
Here is the god bolt link with the short testcase https://godbolt.org/g/KZCFUC
struct mrgl_hashmap_node* pNode = pMainNode->pNext;
while(pNode != NULL){
if(pNode->key == key){
return pNode;
}
pNode = pNode->pNext;
}
return pNode;
mov edx, dword ptr [edx + esi + 12]
xor eax, eax
test edx, edx
jne .LBB0_3
jmp .LBB0_5
.LBB0_6: # in Loop: Header=BB0_3 Depth=1
mov edx, dword ptr [edx + 4]
test edx, edx
je .LBB0_5
.LBB0_3: # =>This Inner Loop Header: Depth=1
cmp dword ptr [edx], ecx
jne .LBB0_6
mov eax, edx
.LBB0_5:
pop esi
ret
Instead of loading pointer in edx, codegen could use eax directly so we will
not need to "xor eax, eax" and "mov eax, edx" which is clang did perfectly with
previous if statement (row 44) in test case where is mask used directly as
return result. Gcc 7.2.0 does perfect job with it and use eax directly.
--
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/20171225/15ad96ce/attachment.html>
More information about the llvm-bugs
mailing list