<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98113>98113</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `TFI->hasReservedCallFrame(MF) && "Cannot use SP to access the emergency spill slot in " "functions without a reserved call frame"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:codegen,
llvm:crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
thevinster
</td>
</tr>
</table>
<pre>
I'm debugging a crash that's happening in the Prologue/Epilogue Insertion & Frame Finalization backend with an assertion failure of the following:
```
virtual bool llvm::ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator, int, unsigned int, RegScavenger *) const: Assertion `TFI->hasReservedCallFrame(MF) && "Cannot use SP to access the emergency spill slot in " "functions without a reserved call frame"' failed.
```
I'm able to reduce the crash to this [IR](https://gist.github.com/thevinster/8eed8d9ac10986b13d24866db874d4b3). Running `llc` on this file with `-O0` on this input crashes on both LLVM main and on release/18.x.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUk9-O3CYUxp8G3xztCMP434UvZnZjaaSsGk2q3h_DsU3DwAjwJOnTV9ib7qrqC1SyjfkwnI-PnzFGMzuinlVnVr0UuKbFhz4t9DAuJgrF6PXP_sJEcwNN4zrPxs2AoALGBdKCiYkmwoL3O7k8ZBykheBL8NbPKzExfLqb7RUuLlJIxjtgooYh4I1gMA6t-Qs3eUT1jZyG7yYtgA4w_powobFrIPDTtvrkrfXfjZuZPAHjL4yfWM3frq37MCGtaGH03oK1jxuTJyZPp-vrGSNdaTZ5dxc3-X2ArLkZh4k2Wxen6QcT7SuqxTg6YzTqbL36tn9sEgVMPjDxDMal3KxuC1L_6l9p_qrwQW6mAEycmOhAeRdTdnz6Z1-s5r8PlycmPy0YrxQpPEg_o7WbjexgyDOZqHNkTIhndM4nWCPB1y-QPKBSFOOWCt0ozOTUT4h3Yy1E61M-DyZEvqfVqVw0bvn6NQFCeCsJCq2FaS8qmGi2xEkf_jPc_blDgaOl7COQXhVtPt7Y8JAWE4FV58uVVS9MtEtK95gjFAMTQz6Cw2zSso4H5W9MDO_YMTG0RLrVHaqSd209llKLY1vXemyboz6OkonuANfVbdSxmlurWM3Bu73sZCztILGaP_3GP44Zd1_TbpNiVkefFvj8-Y9XuKFxgE5nNZAljBnhsj38OEChe6k72WFBfdkIXnEpu65Y-mbCWjej7lTDuRRNpUcpy7KcymasZImF6QUXR97wjleylt2hPWpeVs1xqoTUvOnYkdMNjT1kVA8-zIWJcaW-a8tSFhZHsnH7R4V4g1l5TTO57bSeP8h5U1msXorQZ_FpXOfIjtyamOL7-skkS_3_iMRiDbb_N0Ef4NkC2June_B_kkpMDFuMkYlhT_LRi78DAAD__0Exl-w">