<html>
<head>
<base href="http://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 - [X86] Unnecessary GR32->GR32 created to zero upper 32-bits or GR64 for zext of basic block input"
href="http://bugs.llvm.org/show_bug.cgi?id=32544">32544</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] Unnecessary GR32->GR32 created to zero upper 32-bits or GR64 for zext of basic block input
</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>craig.topper@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=18233" name="attach_18233" title="Test case">attachment 18233</a> <a href="attachment.cgi?id=18233&action=edit" title="Test case">[details]</a></span>
Test case
Because we do isel one basic block at a time, if a basic block contains a zext
i32->i64 of a value produced in another basic block we lose the ability to
determine if the earlier instruction zeroed the upper bits. So we emit an extra
MOV32rr to zero out the bits.
This looks particularly bad when we use the same register for the src and dst
of the move.
The attached test case contains two functions that differ in the placement of
the zext. The one with the zext only in the final block generates an extra
move.
If you run the test through InstCombine you'll also see that even if the zext
starts in the earlier blocks it will get moved to the final block.
Should we teach InstCombine or CodeGenPrepare to hoist "free" zexts closer to
their defs instead of sinking them.</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>