<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63358>63358</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM ERROR: Error while trying to spill X9 from class GPR64: Cannot scavenge register without an emergency spill slot!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
llvm:crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chfast
</td>
</tr>
</table>
<pre>
```
LLVM ERROR: Error while trying to spill X9 from class GPR64: Cannot scavenge register without an emergency spill slot!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@f'
#0 0x000055a7aa6cae0f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3575e0f)
#1 0x000055a7aa6c8564 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fdf53fc2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007fdf53a8f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007fdf53a6e859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x000055a7a7920bac llvm::SuffixTree::insertLeaf(llvm::SuffixTreeInternalNode&, unsigned int, unsigned int) (.cold) SuffixTree.cpp:0:0
#6 0x000055a7a9b63585 llvm::RegScavenger::spill(llvm::Register, llvm::TargetRegisterClass const&, int, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2a0e585)
#7 0x000055a7a9b63e39 llvm::RegScavenger::scavengeRegisterBackwards(llvm::TargetRegisterClass const&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, bool, int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2a0ee39)
#8 0x000055a7a9b64ea1 scavengeFrameVirtualRegsInBlock(llvm::MachineRegisterInfo&, llvm::RegScavenger&, llvm::MachineBasicBlock&) RegisterScavenging.cpp:0:0
#9 0x000055a7a9b652db llvm::scavengeFrameVirtualRegs(llvm::MachineFunction&, llvm::RegScavenger&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2a102db)
#10 0x000055a7a9ac9c58 (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) PrologEpilogInserter.cpp:0:0
#11 0x000055a7a995adae llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#12 0x000055a7a9ef1081 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c081)
#13 0x000055a7a9ef12c9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c2c9)
#14 0x000055a7a9ef1b42 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9cb42)
#15 0x000055a7a79ddca4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#16 0x000055a7a7925fa6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7d0fa6)
#17 0x00007fdf53a70083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#18 0x000055a7a79d3f9e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x87ef9e)
Compiler returned: 139
```
```llvm
target triple = "aarch64-unknown-linux-gnu"
@G = external global double
@G.1 = external global i1
@G.2 = external global i64
@G.3 = external global i16
@G.4 = external global i1
@G.5 = external global i64
@G.6 = external global i16
@G.7 = external global i16
@G.8 = external global float
@G.9 = external global double
@G.10 = external global i1
@G.11 = external global i8
@G.12 = external global i32
define i32 @f() {
BB:
%A10 = alloca ptr, align 8
%A9 = alloca i1, align 1
%G11 = getelementptr ptr, ptr %A9, i16 32767
%L15 = load i32, ptr %G11, align 4
%L10 = load i8, ptr %G11, align 1
%A13 = alloca float, align 4
%L13 = load i64, ptr %A13, align 4
%L11 = load i8, ptr %A13, align 1
store float undef, ptr %A13, align 4
%A12 = alloca i1, align 1
%B10 = sdiv i64 -1, -1
%G7 = getelementptr i8, ptr %A12, i64 %B10
%L18 = load float, ptr %G7, align 4
%L16 = load i64, ptr %G7, align 4
%A5 = alloca i1, align 1
%L19 = load float, ptr %A5, align 4
%L12 = load i64, ptr %A5, align 4
%B23 = fdiv float %L18, %L19
%G8 = getelementptr i16, ptr %A5, i16 256
store i1 undef, ptr %A5, align 1
%A7 = alloca i64, align 8
store i64 poison, ptr %A7, align 4
%LGV4 = load i64, ptr @G.5, align 4
%LGV2 = load i64, ptr @G.2, align 4
%LGV1 = load i1, ptr @G.1, align 1
%B18 = or i64 9223372036854775807, %L12
%B3 = or i1 true, false
%C7 = icmp sle i1 %LGV1, true
%A = alloca double, align 8
%L2 = load i64, ptr %A, align 4
%B4 = and i1 %B3, %LGV1
store i1 %C7, ptr %A12, align 1
%C14 = icmp sle i64 42, %L13
store i1 %C14, ptr @G.4, align 1
store ptr %G11, ptr %A12, align 8
%B15 = xor i8 %L10, %L11
store float %B23, ptr %A7, align 4
%B24 = urem i8 42, %L11
%LGV7 = load i1, ptr @G.10, align 1
%LGV5 = load double, ptr @G.9, align 8
%LGV6 = load float, ptr @G.8, align 4
%LGV3 = load i16, ptr @G.7, align 2
%B8 = mul i64 %LGV4, %B18
%B9 = fmul float 1.000000e+00, %LGV6
%G = getelementptr i1, ptr %A, i1 %B3
%L17 = load i64, ptr %G, align 4
%L5 = load i16, ptr %G, align 2
store double undef, ptr %G, align 8
%LGV = load double, ptr @G, align 8
%B1 = fdiv double %LGV, %LGV
%B2 = fmul double %LGV, %B1
%RP = alloca i32, align 4
%L7 = load i16, ptr %RP, align 2
%L9 = load i8, ptr %RP, align 1
%L6 = load i1, ptr %RP, align 1
%L4 = load float, ptr %RP, align 4
%B13 = udiv i16 %LGV3, %L5
%C8 = fcmp olt double %B1, %LGV5
%0 = load i32, ptr %RP, align 4
%B16 = urem i16 %LGV3, %L7
%B6 = srem i64 %L2, %LGV2
store i1 %B3, ptr %RP, align 1
%B = fsub double %B2, %LGV
store double %B, ptr %A, align 8
store i1 %B4, ptr @G.1, align 1
store i64 0, ptr %G8, align 4
%C9 = icmp ult i1 %L6, %LGV7
store i16 %B13, ptr @G.3, align 2
store i1 false, ptr @G.4, align 1
store i64 %B8, ptr %G7, align 4
%C1 = fcmp une float %L4, %L4
store i64 %B6, ptr %A7, align 4
store i1 %C1, ptr %A12, align 1
store float %B9, ptr %A13, align 4
store i1 %C8, ptr %A9, align 1
store i1 %C9, ptr @G.10, align 1
%G9 = getelementptr i16, ptr %A12, i1 true
%L8 = load i16, ptr %G9, align 2
%B19 = srem i16 %L5, %L8
%C19 = icmp sge i64 %L17, 1
%B14 = add i8 %L9, %B15
store i8 %B14, ptr @G.11, align 1
store i16 %B16, ptr @G.3, align 2
store ptr %G9, ptr %A10, align 8
store i16 %B19, ptr %A10, align 2
store i1 %C19, ptr %G9, align 1
store i8 %B24, ptr %A10, align 1
ret i32 %0
}
```
https://godbolt.org/z/anzfqW6e3
May be related to #63357.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWt1u47oRfhrlhrAhkfq9yIWdxGmAbE-QPdj2LqAkSlZDky5J7Sb79AVJ2SJtKXHboD3IQWJ5fr75Zjgz0gpL2bWMkOsgWQfJ7RXu1ZaL62rbYKmuSl6_XwdpOPyEt0G4enz88Q3cPT__8RygFbgTggvwa9tRApR471gLFAdy31EK_l6ARvAdqCiWEtw_PaexVrnBjHEFZIV_EtYSIEjbSUUE-NWpLe8VwA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