<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 - [OptimizePHIs + Expensive Checks] Bad machine code: Virtual register killed in block, but needed live out."
href="https://bugs.llvm.org/show_bug.cgi?id=40683">40683</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[OptimizePHIs + Expensive Checks] Bad machine code: Virtual register killed in block, but needed live out.
</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>Linux
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>paulsson@linux.vnet.ibm.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=21465" name="attach_21465" title="reduced testcase">attachment 21465</a> <a href="attachment.cgi?id=21465&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase
bin/llc -mcpu=z10 -O3 tc_vregkill_liveout.ll -o -
*** Bad machine code: Virtual register killed in block, but needed live out.
***
- function: main
- basic block: %bb.2 (0x2aa66bceb88)
Virtual register %1 is used after the block.
LLVM ERROR: Found 1 machine code errors.
It seems that "Optimize machine instruction PHIs" is transforming this block,
which is inside a loop:
bb.2 (%ir-block.3):
; predecessors: %bb.1, %bb.3
successors: %bb.4(0x40000000), %bb.5(0x40000000); %bb.4(50.00%),
%bb.5(50.00%)
%3:gr32bit = PHI %1:gr32bit, %bb.1, %0:gr32bit, %bb.3
%4:gr32bit = IMPLICIT_DEF
CR killed %3:gr32bit, %4:gr32bit, implicit-def $cc
%5:gr32bit = LHI 0
%6:gr32bit = LHI -10
BRC 14, 4, %bb.4, implicit $cc
to
bb.2 (%ir-block.3):
; predecessors: %bb.1, %bb.3
successors: %bb.4(0x40000000), %bb.5(0x40000000); %bb.4(50.00%),
%bb.5(50.00%)
%4:gr32bit = IMPLICIT_DEF
CR killed %1:gr32bit, %4:gr32bit, implicit-def $cc
%5:gr32bit = LHI 0
%6:gr32bit = LHI -10
BRC 14, 4, %bb.4, implicit $cc
Both %1 and %0 are defined outside the loop, and %0 is a copy of %1. %1 should
not have the kill flag since it is used in the next iteration as well.</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>