Sema: delete bootstrap compiler bug workaround

This commit is contained in:
mlugg 2024-08-19 07:55:18 +01:00
parent 9cf8a7661f
commit 95fbfde9da
No known key found for this signature in database
GPG key ID: 3F5B7DCCBF4AF02E

View file

@ -7734,9 +7734,6 @@ fn analyzeCall(
} }));
}
// This `res2` is here instead of directly breaking from `res` due to a stage1
// bug generating invalid LLVM IR.
const res2: Air.Inst.Ref = res2: {
memoize: {
if (!should_memoize) break :memoize;
if (!is_comptime_call) break :memoize;
@ -7755,7 +7752,7 @@ fn analyzeCall(
break :memoize;
}
sema.branch_count += memoized_call.branch_count;
break :res2 Air.internedToRef(memoized_call.result);
break :res Air.internedToRef(memoized_call.result);
}
new_fn_info.return_type = sema.fn_ret_ty.toIntern();
@ -7832,25 +7829,22 @@ fn analyzeCall(
} });
}
break :res2 Air.internedToRef(result_transformed);
break :res Air.internedToRef(result_transformed);
}
if (try sema.resolveValue(result)) |result_val| {
const result_transformed = try sema.resolveAdHocInferredErrorSet(block, call_src, result_val.toIntern());
break :res2 Air.internedToRef(result_transformed);
break :res Air.internedToRef(result_transformed);
}
const new_ty = try sema.resolveAdHocInferredErrorSetTy(block, call_src, sema.typeOf(result).toIntern());
if (new_ty != .none) {
// TODO: mutate in place the previous instruction if possible
// rather than adding a bitcast instruction.
break :res2 try block.addBitCast(Type.fromInterned(new_ty), result);
break :res try block.addBitCast(Type.fromInterned(new_ty), result);
}
break :res2 result;
};
break :res res2;
break :res result;
} else res: {
assert(!func_ty_info.is_generic);