Closed
Description
The following LLVM-IR will crash the llc
backend when run at O0
. See also the godbolt link.
target triple = "amdgcn-amd-amdhsa"
define internal i32 @foo() {
ret i32 0
}
Invoking llc
with -O0
gives us the following failures.
$ llc <source> -O0 -march=amdgcn -mcpu=gfx1030
llc: /root/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp:154: virtual bool llvm::AMDGPUResourceUsageAnalysis::runOnModule(llvm::Module&): Assertion `MF && "function must have been generated already"' failed.
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 -O0 -march=amdgcn -mcpu=gfx1030 <source>
1. Running pass 'Function register usage analysis' on module '<source>'.
#0 0x00000000033ba0e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33ba0e8)
#1 0x00000000033b781c SignalHandler(int) Signals.cpp:0:0
#2 0x00007ff09e1b1420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007ff09dc7400b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007ff09dc53859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007ff09dc53729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007ff09dc64fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000000000bed37a (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xbed37a)
#8 0x0000000002c179b2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2c179b2)
#9 0x000000000075ee42 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#10 0x000000000069a6c6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x69a6c6)
#11 0x00007ff09dc55083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#12 0x00000000007557fe _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7557fe)
This is apparently a regression since the LLVM 16.0.0 release as changing the llc
on godbolt to llc 16.0.0
or older does not reproduce the issue.