<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 - PEI incorrectly moves emergency stack slot on targets where the stack grows upwards"
href="https://bugs.llvm.org/show_bug.cgi?id=49686">49686</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>PEI incorrectly moves emergency stack slot on targets where the stack grows upwards
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>sebastian.neubauer@amd.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=24680" name="attach_24680" title="Testcase that moves the spill slot offset to -8164">attachment 24680</a> <a href="attachment.cgi?id=24680&action=edit" title="Testcase that moves the spill slot offset to -8164">[details]</a></span>
Testcase that moves the spill slot offset to -8164
On systems, where the stack grows towards higher addresses (x86 and most others
grow towards lower addresses), the PrologEpilogInserter sometimes moves the
emergency spill slot to an offset, that is already occupied.
This behavior has been introduced in D89239, upwards growing stack were
probably an oversight.
Compiling the attached example leads to the following output:
$ llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs
-run-pass=prologepilog pei-scavenge-vgpr-spill.mir -debug
...
FP requires fallback spill to $vgpr2:0
alloc FI(0) at SP[0]
alloc FI(1) at SP[4]
alloc FI(3) at SP[8]
alloc FI(4) at SP[12]
Adjusting emergency spill slots!
Adjusting offset of emergency spill slot #4 from 12 to -8164
Where -8164 is the new offset (I guess that is a bit off the stack frame :)).
Another example, replacing the stack definitions in pei-scavenge-vgpr-spill.mir
with the following:
stack:
- { id: 0, type: default, offset: 0, size: 8192, alignment: 64 }
- { id: 1, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 2, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 3, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 4, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 5, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 6, type: default, offset: 0, size: 4, alignment: 4 }
- { id: 7, type: default, offset: 0, size: 4, alignment: 4 }
leads to
$ llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs
-run-pass=prologepilog pei-scavenge-vgpr-spill.mir -debug
...
FP requires fallback spill to $vgpr2:0
alloc FI(0) at SP[0]
alloc FI(1) at SP[8192]
alloc FI(2) at SP[8196]
alloc FI(3) at SP[8200]
alloc FI(4) at SP[8204]
alloc FI(5) at SP[8208]
alloc FI(6) at SP[8212]
alloc FI(7) at SP[8216]
alloc FI(9) at SP[8220]
alloc FI(10) at SP[8224]
Adjusting emergency spill slots!
Adjusting offset of emergency spill slot #10 from 8224 to 8196
where the new offset of the emergency spill slot 8196 overlaps with FI(2).</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>