File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -880,7 +880,8 @@ def kernel_fixup(kernel, debug):
880880 kernel .return_value = ir .ReturnValue (kernel , ir .VoidType ())
881881 kernel .args = kernel .args [1 :]
882882
883- # If debug metadata is present, remove the return value from it
883+ # If debug metadata is present, fix the return type to void by replacing
884+ # the first element of the types tuple with null (representing void).
884885
885886 if kernel_metadata := getattr (kernel , "metadata" , None ):
886887 if dbg_metadata := kernel_metadata .get ("dbg" , None ):
@@ -890,7 +891,8 @@ def kernel_fixup(kernel, debug):
890891 for tm_name , tm_value in type_metadata .operands :
891892 if tm_name == "types" :
892893 types = tm_value
893- types .operands = types .operands [1 :]
894+ null_metadata = ir .Constant (ir .MetaDataType (), None )
895+ types .operands = (null_metadata ,) + types .operands [1 :]
894896 if config .DUMP_LLVM :
895897 types ._clear_string_cache ()
896898
Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ def f(x, y):
291291 mdnode_id = match .group (1 )
292292
293293 # extract the metadata node ids from the flexible node of types
294- pat = rf"!{ mdnode_id } \s+=\s+!{{\s+!(\d+),\s+!(\d+)\s+}}"
294+ # The first element is null (void return type), followed by param types
295+ pat = rf"!{ mdnode_id } \s+=\s+!{{\s+null,\s+!(\d+),\s+!(\d+)\s+}}"
295296 match = re .compile (pat ).search (llvm_ir )
296297 self .assertIsNotNone (match , msg = llvm_ir )
297298 mdnode_id1 = match .group (1 )
You can’t perform that action at this time.
0 commit comments