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 Jun 19, 2024
1 parent c0da783 commit 5a4098f
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 5a4098f

Please sign in to comment.