<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 - [RegisterScavenging] Scavenging results in "Using an undefined physical register""
href="https://bugs.llvm.org/show_bug.cgi?id=38211">38211</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[RegisterScavenging] Scavenging results in "Using an undefined physical register"
</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=20569" name="attach_20569" title="reduced testcase (llc .mir input)">attachment 20569</a> <a href="attachment.cgi?id=20569&action=edit" title="reduced testcase (llc .mir input)">[details]</a></span>
reduced testcase (llc .mir input)
This test case involves an MVC (mem-2-mem move) between two spill slots:
MVC %stack.180, 0, 16, %stack.1, 0 :: (store 16 into %stack.180, align 8),
(load 16 from %stack.1, align 8)
PrologEpilogInserter eliminates these frame indexes, and while doing so (since
the offset from SP to %stack.1 is too big) a virtual register is created to
load SP + 4096:
%12:addr64bit = LAY $r15d, 4096, $noreg
Then, $r14d is scavenged for %12. This results in:
STG killed $r14d, $r15d, 168, $noreg :: (store 8 into %stack.329)
$r14d = LAY $r15d, 4096, $noreg
MVC $r15d, 1824, 16, killed $r14d, 592 :: (store 16 into %stack.180, align 8),
(load 16 from %stack.1, align 8)
$r14d = LG $r15d, 168, $noreg :: (load 8 from %stack.329)
It seems that $14d was actually not live, so it wouldn't have needed to be
spilled and restored:
*** Bad machine code: Using an undefined physical register ***
- function: main
- basic block: %bb.1 bb146 (0x2aa4cf914e8)
- instruction: STG killed $r14d, $r15d, 168, $noreg :: (store 8 into
%stack.329)
- operand 0: killed $r14d
LLVM ERROR: Found 1 machine code errors.
I am not sure exactly how this works, but it seems that
RegScavenger::scavengeRegisterBackwards() has somehow reported that $14d should
be spilled, while the MachineVerifier thinks that is not live.
bin/llc -mcpu=z13 ./tc_undefpreg_pei.mir -run-pass=prologepilog
-verify-machineinstrs</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>