diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-06-12 17:45:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-12 17:45:57 -0400 |
| commit | ffa700ee58cd29dafe2bbdfe78a4bd4f7bab0674 (patch) | |
| tree | affe8b6dc716051f32259ad171f93d7009855c0f /src/arch/x86_64/CodeGen.zig | |
| parent | 6e42d45dccf4ba6fa07082db1cb820897d36924f (diff) | |
| parent | 0a9d6956e7cac96c870ad062b4125b0a0a3b0143 (diff) | |
| download | zig-ffa700ee58cd29dafe2bbdfe78a4bd4f7bab0674.tar.gz zig-ffa700ee58cd29dafe2bbdfe78a4bd4f7bab0674.zip | |
Merge pull request #11837 from Vexu/stage2
Fix (nearly) all stage2 crashes when testing stdlib
Diffstat (limited to 'src/arch/x86_64/CodeGen.zig')
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 5bda84c98c..c94eaa37af 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -1806,7 +1806,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { const operand = try self.resolveInst(ty_op.operand); const result: MCValue = result: { - if (err_ty.errorSetCardinality() == .zero) { + if (err_ty.errorSetIsEmpty()) { break :result MCValue{ .immediate = 0 }; } @@ -1857,14 +1857,8 @@ fn genUnwrapErrorUnionPayloadMir( err_union: MCValue, ) !MCValue { const payload_ty = err_union_ty.errorUnionPayload(); - const err_ty = err_union_ty.errorUnionSet(); const result: MCValue = result: { - if (err_ty.errorSetCardinality() == .zero) { - // TODO check if we can reuse - break :result err_union; - } - if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { break :result MCValue.none; } @@ -1991,15 +1985,10 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { } const error_union_ty = self.air.getRefType(ty_op.ty); - const error_ty = error_union_ty.errorUnionSet(); const payload_ty = error_union_ty.errorUnionPayload(); const operand = try self.resolveInst(ty_op.operand); const result: MCValue = result: { - if (error_ty.errorSetCardinality() == .zero) { - break :result operand; - } - if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { break :result operand; } @@ -4651,7 +4640,7 @@ fn isNonNull(self: *Self, inst: Air.Inst.Index, ty: Type, operand: MCValue) !MCV fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, ty: Type, operand: MCValue) !MCValue { const err_type = ty.errorUnionSet(); - if (err_type.errorSetCardinality() == .zero) { + if (err_type.errorSetIsEmpty()) { return MCValue{ .immediate = 0 }; // always false } @@ -6909,12 +6898,6 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { .ErrorUnion => { const error_type = typed_value.ty.errorUnionSet(); const payload_type = typed_value.ty.errorUnionPayload(); - - if (error_type.errorSetCardinality() == .zero) { - const payload_val = typed_value.val.castTag(.eu_payload).?.data; - return self.genTypedValue(.{ .ty = payload_type, .val = payload_val }); - } - const is_pl = typed_value.val.errorUnionIsPayload(); if (!payload_type.hasRuntimeBitsIgnoreComptime()) { |
