Skip to content

Commit

Permalink
Always return unit as void in SPIRV.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Feb 28, 2024
1 parent 06db54a commit 4ce9118
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ struct CCallingConv {
#if LLVM_VERSION >= 150
case Triple::ArchType::spirv32:
case Triple::ArchType::spirv64: {
return_empty_struct_as_void = true;
spirv_cconv = true;
} break;
#endif
Expand Down Expand Up @@ -1147,7 +1148,7 @@ struct CCallingConv {
int zero = 0;
info->returntype = ClassifyArgument(&returntype, &zero, &zero, true);

if (return_empty_struct_as_void || cconv == CallingConv::SPIR_KERNEL) {
if (return_empty_struct_as_void) {
// windows classifies empty structs as pass by pointer, but we need a return
// value of unit (an empty tuple) to be translated to void. So if it is unit,
// force the return value to be void by overriding the normal classification
Expand Down

0 comments on commit 4ce9118

Please sign in to comment.