diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index e7fef20a4fbce2b66583b75f98ba66ad600fc7ca..818b04f890e31c7f9899be50ab8e8e76ef9fd5d1 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -4177,8 +4177,10 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { } fn airArg(self: *Self, inst: Air.Inst.Index) !void { - const arg_index = self.arg_index; - self.arg_index += 1; + // skip zero-bit arguments as they don't have a corresponding arg instruction + var arg_index = self.arg_index; + while (self.args[arg_index] == .none) arg_index += 1; + self.arg_index = arg_index + 1; const ty = self.air.typeOfIndex(inst); const tag = self.air.instructions.items(.tag)[inst]; diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index 01a1d6b7eb091009434618ea0ea8cd828f07ed62..ceabe7043816b7074068e4d118fc7876c64012e3 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -4125,8 +4125,10 @@ fn genInlineMemsetCode( } fn airArg(self: *Self, inst: Air.Inst.Index) !void { - const arg_index = self.arg_index; - self.arg_index += 1; + // skip zero-bit arguments as they don't have a corresponding arg instruction + var arg_index = self.arg_index; + while (self.args[arg_index] == .none) arg_index += 1; + self.arg_index = arg_index + 1; const ty = self.air.typeOfIndex(inst); const tag = self.air.instructions.items(.tag)[inst]; diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 20e443b83ca9abc8732456e69e5e0848808a0466..53d38f520a0cbd753c6aac9ca37b8fd49c0c1ef8 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -3827,8 +3827,10 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M } fn airArg(self: *Self, inst: Air.Inst.Index) !void { - const arg_index = self.arg_index; - self.arg_index += 1; + // skip zero-bit arguments as they don't have a corresponding arg instruction + var arg_index = self.arg_index; + while (self.args[arg_index] == .none) arg_index += 1; + self.arg_index = arg_index + 1; const ty = self.air.typeOfIndex(inst); const mcv = self.args[arg_index];