<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Ignoring to directly use EAX register while preserving it for the same return value"
href="https://bugs.llvm.org/show_bug.cgi?id=35745">35745</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Ignoring to directly use EAX register while preserving it for the same return value
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Mrrrgbl@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19602" name="attach_19602" title="Same testcase as on god bolt link">attachment 19602</a> <a href="attachment.cgi?id=19602&action=edit" title="Same testcase as on god bolt link">[details]</a></span>
Same testcase as on god bolt link
Here is the god bolt link with the short testcase <a href="https://godbolt.org/g/KZCFUC">https://godbolt.org/g/KZCFUC</a>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>