Issue |
89576
|
Summary |
LLVM ERROR: Error while trying to spill X8 from class GPR64: Cannot scavenge register without an emergency spill slot!
|
Labels |
new issue
|
Assignees |
|
Reporter |
DigOrDog
|
# Description
The following code crashes aarch64 backend with "Error while trying to spill X8 from class GPR64: Cannot scavenge register without an emergency spill slot!!".
It's interesting that the command with -mtriple=aarch64 -O=2 results in an error, but the command with **-mtriple=aarch64 -O=0 does not produce an error**.
# Minimal Reproduction
https://godbolt.org/z/KcWovEv7q
## code
```
define double @f(i8 %0, i32 %1, i1 %L1, ptr %G.4, ptr %G.2, ptr %G.6, ptr %A4, ptr %A, ptr %G.8, ptr %G.9, ptr %G.11, ptr %G.13, ptr %G2, ptr %G3, ptr %G7, ptr %G5, ptr %G) {
BB:
%A42 = alloca i1, i32 0, align 1
br label %BB1
BB1: ; preds = %BB1, %BB
store i8 %0, ptr %A, align 1
store i1 true, ptr %A4, align 1
store i32 65536, ptr %G.8, align 4
store i1 false, ptr %G.9, align 1
%G6 = getelementptr double, ptr %A42, i8 42
store ptr %G.13, ptr %G6, align 8
store i32 %1, ptr %G.6, align 4
store float 0.000000e+00, ptr %G.11, align 4
br i1 %L1, label %BB1, label %BB6
BB6: ; preds = %BB1
store i1 false, ptr %G.4, align 1
store i1 false, ptr %G2, align 1
store ptr %G3, ptr %G7, align 8
store i1 false, ptr %G.2, align 1
store ptr %G5, ptr %G, align 8
ret double 0.000000e+00
}
```
## Stack Trace
```
LLVM ERROR: Error while trying to spill X8 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 -mtriple=aarch64 -O=2 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@f'
#0 0x000000000394da58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x394da58)
#1 0x000000000394b1ac SignalHandler(int) Signals.cpp:0:0
#2 0x00007f0184842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007f01848969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007f0184842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007f01848287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000000000720037 (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x720037)
#7 0x0000000002b7af8e 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+0x2b7af8e)
#8 0x0000000002b7b862 llvm::RegScavenger::scavengeRegisterBackwards(llvm::TargetRegisterClass const&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, bool, int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2b7b862)
#9 0x0000000002b7c910 scavengeFrameVirtualRegsInBlock(llvm::MachineRegisterInfo&, llvm::RegScavenger&, llvm::MachineBasicBlock&) RegisterScavenging.cpp:0:0
#10 0x0000000002b7cda3 llvm::scavengeFrameVirtualRegs(llvm::MachineFunction&, llvm::RegScavenger&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2b7cda3)
#11 0x0000000002ae3047 (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) PrologEpilogInserter.cpp:0:0
#12 0x0000000002961c51 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#13 0x0000000002f20a13 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f20a13)
#14 0x0000000002f20c51 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f20c51)
#15 0x0000000002f214b5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f214b5)
#16 0x0000000000828c2c compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#17 0x0000000000727676 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x727676)
#18 0x00007f0184829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#19 0x00007f0184829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#20 0x000000000081f74e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x81f74e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs