Issue 208899
Summary [SPIRV] error lowering function with array return type
Labels new issue
Assignees
Reporter simeonschaub
    Compiling the following function to SPIRV using LLVM 22.1.8, I get an error:

```llvm
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
target triple = "spirv64-unknown-unknown-unknown"

define fastcc [1 x float] @f() {
top:
  %oldret = extractvalue [1 x [1 x float]] zeroinitializer, 0
 ret [1 x float] %oldret
}
```

```
> /home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc reduced.ll -o backend.spv
Function return type does not match operand type of return inst!
  ret [1 x float] %oldret
 i32in function f
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: /home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc reduced.ll -o backend.spv
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'Module Verifier' on function '@f'
 #0 0x0000000001dccf48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x1dccf48)
 #1 0x0000000001dca414 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f346b30a0b0 __restore_rt (/lib64/libc.so.6+0x1a0b0)
 #3 0x00007f346b364dcc __pthread_kill_implementation (/lib64/libc.so.6+0x74dcc)
 #4 0x00007f346b309f8e gsignal (/lib64/libc.so.6+0x19f8e)
 #5 0x00007f346b2f17b3 abort (/lib64/libc.so.6+0x17b3)
 #6 0x000000000076c5a5 llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
 #7 0x0000000001d127a8 (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x1d127a8)
 #8 0x0000000001458152 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) Verifier.cpp:0:0
 #9 0x000000000139d300 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x139d300)
#10 0x000000000139d57c llvm::FPPassManager::runOnModule(llvm::Module&) (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x139d57c)
#11 0x000000000139ed9b llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x139ed9b)
#12 0x000000000084f85e compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#13 0x0000000000780a6c main (/home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/llc+0x780a6c)
#14 0x00007f346b2f3681 __libc_start_call_main (/lib64/libc.so.6+0x3681)
#15 0x00007f346b2f3798 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3798)
#16 0x0000000000845dd6 _start /workspace/srcdir/glibc-2.17/csu/../sysdeps/x86_64/start.S:126:0
zsh: IOT instruction (core dumped) /home/simeon/.julia/artifacts/9f098be7d8fea2b85cc958243d5693d97176e419/bin/ll
```

The Khronos SPIR-V LLVM translator handles this case just fine. Originally reported in https://github.com/JuliaGPU/OpenCL.jl/issues/422
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to