Issue |
134417
|
Summary |
[SPIR-V] Returning undef from a function with a `spirv.Type` return type crashes
|
Labels |
new issue
|
Assignees |
|
Reporter |
cassiebeckley
|
When running
```
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
%literal_8 = type target("spirv.Literal", 8)
%literal_false = type target("spirv.Literal", 0)
%uint8_t = type target("spirv.Type", %literal_8, %literal_false, 21, 1, 8)
define %uint8_t @foo() {
entry:
ret %uint8_t undef
}
```
the output is
```
llc: /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:999: Register llvm::SPIRVGlobalRegistry::getSPIRVTypeID(const SPIRVType *) const: Assertion `SpirvType && "Attempting to get type id for nullptr type."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./bin/llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown ../llvm/test/CodeGen/SPIRV/inline/type.undef.ll -o -
1. Running pass 'Function Pass Manager' on module '../llvm/test/CodeGen/SPIRV/inline/type.undef.ll'.
2. Running pass 'InstructionSelect' on function '@foo'
#0 0x000055d3922d77ed llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:11
#1 0x000055d3922d7cab PrintStackTraceSignalHandler(void*) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:1
#2 0x000055d3922d5e4f llvm::sys::RunSignalHandlers() /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Support/Signals.cpp:105:5
#3 0x000055d3922d8389 SignalHandler(int, siginfo_t*, void*) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Support/Unix/Signals.inc:418:7
#4 0x00007f044ac49e20 (/lib/x86_64-linux-gnu/libc.so.6+0x3fe20)
#5 0x00007f044ac9de5c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0x00007f044ac49d82 raise ./signal/../sysdeps/posix/raise.c:27:6
#7 0x00007f044ac324f0 abort ./stdlib/abort.c:81:7
#8 0x00007f044ac32418 _nl_load_domain ./intl/loadmsgcat.c:1177:9
#9 0x00007f044ac42692 (/lib/x86_64-linux-gnu/libc.so.6+0x38692)
#10 0x000055d38f6e23dd llvm::SPIRVGlobalRegistry::getSPIRVTypeID(llvm::MachineInstr const*) const /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1000:7
#11 0x000055d38f762190 (anonymous namespace)::SPIRVInstructionSelector::selectOpUndef(llvm::Register, llvm::MachineInstr const*, llvm::MachineInstr&) const /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:2734:18
#12 0x000055d38f755a79 (anonymous namespace)::SPIRVInstructionSelector::spvSelect(llvm::Register, llvm::MachineInstr const*, llvm::MachineInstr&) const /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:603:5
#13 0x000055d38f7552be (anonymous namespace)::SPIRVInstructionSelector::select(llvm::MachineInstr&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:554:7
#14 0x000055d393113566 llvm::InstructionSelect::selectInstr(llvm::MachineInstr&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:387:3
#15 0x000055d393112713 llvm::InstructionSelect::selectMachineFunction(llvm::MachineFunction&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:216:13
#16 0x000055d3931122aa llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:156:3
#17 0x000055d390cbfb12 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:108:8
#18 0x000055d391438fcf llvm::FPPassManager::runOnFunction(llvm::Function&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1406:23
#19 0x000055d39143d68b llvm::FPPassManager::runOnModule(llvm::Module&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1452:16
#20 0x000055d391439849 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1521:23
#21 0x000055d3914393f6 llvm::legacy::PassManagerImpl::run(llvm::Module&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:16
#22 0x000055d39143d931 llvm::legacy::PassManager::run(llvm::Module&) /usr/local/google/home/cbeckley/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1648:3
#23 0x000055d38db298e6 compileModule(char**, llvm::LLVMContext&) /usr/local/google/home/cbeckley/llvm-project/llvm/tools/llc/llc.cpp:739:9
#24 0x000055d38db27b85 main /usr/local/google/home/cbeckley/llvm-project/llvm/tools/llc/llc.cpp:397:13
#25 0x00007f044ac33d68 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#26 0x00007f044ac33e25 call_init ./csu/../csu/libc-start.c:128:20
#27 0x00007f044ac33e25 __libc_start_main ./csu/../csu/libc-start.c:347:5
#28 0x000055d38db27361 _start (./bin/llc+0x6239361)
Aborted (core dumped)
```
This was run on Linux with a build of [`70a1445e401f6d7b531933ab157fba98ec84f69f`](https://github.com/llvm/llvm-project/tree/70a1445e401f6d7b531933ab157fba98ec84f69f).
This issue can be assigned to me.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs