authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-11 22:48:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-11 22:48:35-07:00
logf6b479b81d3e893f1240a2fc03397d519987f850
tree42967bd3a09fedb70dfb9ce5f9bfae05b27cf8df
parent98c950827f9e57ab4736140eede61eac6858157f

LLVM: use hasRuntimeBitsIgnoreComptime instead of hasRuntimeBits

LLVM codegen doesn't care whether types are comptime or not. Comptime types aren't supposed to make it to codegen anyway.

1 files changed, 51 insertions(+), 51 deletions(-)

src/codegen/llvm.zig+51-51
......@@ -558,7 +558,7 @@ pub const Object = struct {
558558
559559 const param_offset: c_uint = @boolToInt(ret_ptr != null);
560560 for (fn_info.param_types) |param_ty| {
561 if (!param_ty.hasRuntimeBits()) continue;
561 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
562562
563563 const llvm_arg_i = @intCast(c_uint, args.items.len) + param_offset;
564564 try args.append(llvm_func.getParam(llvm_arg_i));
......@@ -878,7 +878,7 @@ pub const DeclGen = struct {
878878 // Set parameter attributes.
879879 var llvm_param_i: c_uint = @boolToInt(sret);
880880 for (fn_info.param_types) |param_ty| {
881 if (!param_ty.hasRuntimeBits()) continue;
881 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
882882
883883 if (isByRef(param_ty)) {
884884 dg.addArgAttr(llvm_fn, llvm_param_i, "nonnull");
......@@ -1078,7 +1078,7 @@ pub const DeclGen = struct {
10781078 .Optional => {
10791079 var buf: Type.Payload.ElemType = undefined;
10801080 const child_ty = t.optionalChild(&buf);
1081 if (!child_ty.hasRuntimeBits()) {
1081 if (!child_ty.hasRuntimeBitsIgnoreComptime()) {
10821082 return dg.context.intType(1);
10831083 }
10841084 const payload_llvm_ty = try dg.llvmType(child_ty);
......@@ -1095,7 +1095,7 @@ pub const DeclGen = struct {
10951095 const error_type = t.errorUnionSet();
10961096 const payload_type = t.errorUnionPayload();
10971097 const llvm_error_type = try dg.llvmType(error_type);
1098 if (!payload_type.hasRuntimeBits()) {
1098 if (!payload_type.hasRuntimeBitsIgnoreComptime()) {
10991099 return llvm_error_type;
11001100 }
11011101 const llvm_payload_type = try dg.llvmType(payload_type);
......@@ -1194,7 +1194,7 @@ pub const DeclGen = struct {
11941194 var big_align: u32 = 0;
11951195
11961196 for (struct_obj.fields.values()) |field| {
1197 if (field.is_comptime or !field.ty.hasRuntimeBits()) continue;
1197 if (field.is_comptime or !field.ty.hasRuntimeBitsIgnoreComptime()) continue;
11981198
11991199 const field_align = field.normalAlignment(target);
12001200 big_align = @maximum(big_align, field_align);
......@@ -1298,7 +1298,7 @@ pub const DeclGen = struct {
12981298 const fn_info = t.fnInfo();
12991299 const sret = firstParamSRet(fn_info, target);
13001300 const return_type = fn_info.return_type;
1301 const llvm_sret_ty = if (return_type.hasRuntimeBits())
1301 const llvm_sret_ty = if (return_type.hasRuntimeBitsIgnoreComptime())
13021302 try dg.llvmType(return_type)
13031303 else
13041304 dg.context.voidType();
......@@ -1312,7 +1312,7 @@ pub const DeclGen = struct {
13121312 }
13131313
13141314 for (fn_info.param_types) |param_ty| {
1315 if (!param_ty.hasRuntimeBits()) continue;
1315 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
13161316
13171317 const raw_llvm_ty = try dg.llvmType(param_ty);
13181318 const actual_llvm_ty = if (!isByRef(param_ty)) raw_llvm_ty else raw_llvm_ty.pointerType(0);
......@@ -1592,7 +1592,7 @@ pub const DeclGen = struct {
15921592 const llvm_i1 = dg.context.intType(1);
15931593 const is_pl = !tv.val.isNull();
15941594 const non_null_bit = if (is_pl) llvm_i1.constAllOnes() else llvm_i1.constNull();
1595 if (!payload_ty.hasRuntimeBits()) {
1595 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
15961596 return non_null_bit;
15971597 }
15981598 if (tv.ty.isPtrLikeOptional()) {
......@@ -1643,7 +1643,7 @@ pub const DeclGen = struct {
16431643 const payload_type = tv.ty.errorUnionPayload();
16441644 const is_pl = tv.val.errorUnionIsPayload();
16451645
1646 if (!payload_type.hasRuntimeBits()) {
1646 if (!payload_type.hasRuntimeBitsIgnoreComptime()) {
16471647 // We use the error type directly as the type.
16481648 const err_val = if (!is_pl) tv.val else Value.initTag(.zero);
16491649 return dg.genTypedValue(.{ .ty = error_type, .val = err_val });
......@@ -1677,7 +1677,7 @@ pub const DeclGen = struct {
16771677 var running_bits: u16 = 0;
16781678 for (field_vals) |field_val, i| {
16791679 const field = fields[i];
1680 if (!field.ty.hasRuntimeBits()) continue;
1680 if (!field.ty.hasRuntimeBitsIgnoreComptime()) continue;
16811681
16821682 const non_int_val = try dg.genTypedValue(.{
16831683 .ty = field.ty,
......@@ -1708,7 +1708,7 @@ pub const DeclGen = struct {
17081708
17091709 var need_unnamed = false;
17101710 for (struct_obj.fields.values()) |field, i| {
1711 if (field.is_comptime or !field.ty.hasRuntimeBits()) continue;
1711 if (field.is_comptime or !field.ty.hasRuntimeBitsIgnoreComptime()) continue;
17121712
17131713 const field_align = field.normalAlignment(target);
17141714 big_align = @maximum(big_align, field_align);
......@@ -1775,7 +1775,7 @@ pub const DeclGen = struct {
17751775 assert(union_obj.haveFieldTypes());
17761776 const field_ty = union_obj.fields.values()[field_index].ty;
17771777 const payload = p: {
1778 if (!field_ty.hasRuntimeBits()) {
1778 if (!field_ty.hasRuntimeBitsIgnoreComptime()) {
17791779 const padding_len = @intCast(c_uint, layout.payload_size);
17801780 break :p dg.context.intType(8).arrayType(padding_len).getUndef();
17811781 }
......@@ -1936,7 +1936,7 @@ pub const DeclGen = struct {
19361936 .Enum => {
19371937 const owner_decl = ty.getOwnerDecl();
19381938
1939 if (!ty.hasRuntimeBits()) {
1939 if (!ty.hasRuntimeBitsIgnoreComptime()) {
19401940 const enum_di_ty = try dg.makeEmptyNamespaceDIType(owner_decl);
19411941 // The recursive call to `lowerDebugType` via `makeEmptyNamespaceDIType`
19421942 // means we can't use `gop` anymore.
......@@ -2178,7 +2178,7 @@ pub const DeclGen = struct {
21782178 defer gpa.free(name);
21792179 var buf: Type.Payload.ElemType = undefined;
21802180 const child_ty = ty.optionalChild(&buf);
2181 if (!child_ty.hasRuntimeBits()) {
2181 if (!child_ty.hasRuntimeBitsIgnoreComptime()) {
21822182 gop.value_ptr.* = dib.createBasicType(name, 1, DW.ATE.boolean);
21832183 return gop.value_ptr.*;
21842184 }
......@@ -2260,7 +2260,7 @@ pub const DeclGen = struct {
22602260 .ErrorUnion => {
22612261 const err_set_ty = ty.errorUnionSet();
22622262 const payload_ty = ty.errorUnionPayload();
2263 if (!payload_ty.hasRuntimeBits()) {
2263 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
22642264 const err_set_di_ty = try dg.lowerDebugType(err_set_ty);
22652265 // The recursive call to `lowerDebugType` means we can't use `gop` anymore.
22662266 try dg.object.di_type_map.put(gpa, ty, err_set_di_ty);
......@@ -2415,7 +2415,7 @@ pub const DeclGen = struct {
24152415 }
24162416
24172417 const TODO_implement_this = true; // TODO
2418 if (TODO_implement_this or !ty.hasRuntimeBits()) {
2418 if (TODO_implement_this or !ty.hasRuntimeBitsIgnoreComptime()) {
24192419 const owner_decl = ty.getOwnerDecl();
24202420 const struct_di_ty = try dg.makeEmptyNamespaceDIType(owner_decl);
24212421 dib.replaceTemporary(fwd_decl, struct_di_ty);
......@@ -2454,7 +2454,7 @@ pub const DeclGen = struct {
24542454 //var big_align: u32 = 0;
24552455
24562456 //for (struct_obj.fields.values()) |field| {
2457 // if (field.is_comptime or !field.ty.hasRuntimeBits()) continue;
2457 // if (field.is_comptime or !field.ty.hasRuntimeBitsIgnoreComptime()) continue;
24582458
24592459 // const field_align = field.normalAlignment(target);
24602460 // big_align = @maximum(big_align, field_align);
......@@ -2504,7 +2504,7 @@ pub const DeclGen = struct {
25042504 gop.value_ptr.* = fwd_decl;
25052505
25062506 const TODO_implement_this = true; // TODO
2507 if (TODO_implement_this or !ty.hasRuntimeBits()) {
2507 if (TODO_implement_this or !ty.hasRuntimeBitsIgnoreComptime()) {
25082508 const union_di_ty = try dg.makeEmptyNamespaceDIType(owner_decl);
25092509 dib.replaceTemporary(fwd_decl, union_di_ty);
25102510 // The recursive call to `lowerDebugType` via `makeEmptyNamespaceDIType`
......@@ -2586,7 +2586,7 @@ pub const DeclGen = struct {
25862586 defer param_di_types.deinit();
25872587
25882588 // Return type goes first.
2589 const di_ret_ty = if (sret or !fn_info.return_type.hasRuntimeBits())
2589 const di_ret_ty = if (sret or !fn_info.return_type.hasRuntimeBitsIgnoreComptime())
25902590 Type.void
25912591 else
25922592 fn_info.return_type;
......@@ -2602,7 +2602,7 @@ pub const DeclGen = struct {
26022602 }
26032603
26042604 for (fn_info.param_types) |param_ty| {
2605 if (!param_ty.hasRuntimeBits()) continue;
2605 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
26062606
26072607 if (isByRef(param_ty)) {
26082608 var ptr_ty_payload: Type.Payload.ElemType = .{
......@@ -2793,7 +2793,7 @@ pub const DeclGen = struct {
27932793 const parent = try dg.lowerParentPtr(opt_payload_ptr, base_ty);
27942794 var buf: Type.Payload.ElemType = undefined;
27952795 const payload_ty = parent.ty.optionalChild(&buf);
2796 if (!payload_ty.hasRuntimeBits() or parent.ty.isPtrLikeOptional()) {
2796 if (!payload_ty.hasRuntimeBitsIgnoreComptime() or parent.ty.isPtrLikeOptional()) {
27972797 // In this case, we represent pointer to optional the same as pointer
27982798 // to the payload.
27992799 return ParentPtr{
......@@ -2816,7 +2816,7 @@ pub const DeclGen = struct {
28162816 const eu_payload_ptr = ptr_val.castTag(.eu_payload_ptr).?.data;
28172817 const parent = try dg.lowerParentPtr(eu_payload_ptr, base_ty);
28182818 const payload_ty = parent.ty.errorUnionPayload();
2819 if (!payload_ty.hasRuntimeBits()) {
2819 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
28202820 // In this case, we represent pointer to error union the same as pointer
28212821 // to the payload.
28222822 return ParentPtr{
......@@ -2865,7 +2865,7 @@ pub const DeclGen = struct {
28652865 }
28662866
28672867 const is_fn_body = decl.ty.zigTypeTag() == .Fn;
2868 if (!is_fn_body and !decl.ty.hasRuntimeBits()) {
2868 if (!is_fn_body and !decl.ty.hasRuntimeBitsIgnoreComptime()) {
28692869 return self.lowerPtrToVoid(tv.ty);
28702870 }
28712871
......@@ -3298,7 +3298,7 @@ pub const FuncGen = struct {
32983298 } else {
32993299 for (args) |arg, i| {
33003300 const param_ty = fn_info.param_types[i];
3301 if (!param_ty.hasRuntimeBits()) continue;
3301 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
33023302
33033303 try llvm_args.append(try self.resolveInst(arg));
33043304 }
......@@ -3318,7 +3318,7 @@ pub const FuncGen = struct {
33183318 return null;
33193319 }
33203320
3321 if (self.liveness.isUnused(inst) or !return_type.hasRuntimeBits()) {
3321 if (self.liveness.isUnused(inst) or !return_type.hasRuntimeBitsIgnoreComptime()) {
33223322 return null;
33233323 }
33243324
......@@ -3364,7 +3364,7 @@ pub const FuncGen = struct {
33643364 _ = self.builder.buildRetVoid();
33653365 return null;
33663366 }
3367 if (!ret_ty.hasRuntimeBits()) {
3367 if (!ret_ty.hasRuntimeBitsIgnoreComptime()) {
33683368 _ = self.builder.buildRetVoid();
33693369 return null;
33703370 }
......@@ -3377,7 +3377,7 @@ pub const FuncGen = struct {
33773377 const un_op = self.air.instructions.items(.data)[inst].un_op;
33783378 const ptr_ty = self.air.typeOf(un_op);
33793379 const ret_ty = ptr_ty.childType();
3380 if (!ret_ty.hasRuntimeBits() or self.ret_ptr != null) {
3380 if (!ret_ty.hasRuntimeBitsIgnoreComptime() or self.ret_ptr != null) {
33813381 _ = self.builder.buildRetVoid();
33823382 return null;
33833383 }
......@@ -3415,7 +3415,7 @@ pub const FuncGen = struct {
34153415 .Int, .Bool, .Pointer, .ErrorSet => operand_ty,
34163416 .Optional => blk: {
34173417 const payload_ty = operand_ty.optionalChild(&opt_buffer);
3418 if (!payload_ty.hasRuntimeBits() or operand_ty.isPtrLikeOptional()) {
3418 if (!payload_ty.hasRuntimeBitsIgnoreComptime() or operand_ty.isPtrLikeOptional()) {
34193419 break :blk operand_ty;
34203420 }
34213421 // We need to emit instructions to check for equality/inequality
......@@ -3540,7 +3540,7 @@ pub const FuncGen = struct {
35403540
35413541 // If the block does not return a value, we dont have to create a phi node.
35423542 const is_body = inst_ty.zigTypeTag() == .Fn;
3543 if (!is_body and !inst_ty.hasRuntimeBits()) return null;
3543 if (!is_body and !inst_ty.hasRuntimeBitsIgnoreComptime()) return null;
35443544
35453545 const raw_llvm_ty = try self.dg.llvmType(inst_ty);
35463546
......@@ -3571,7 +3571,7 @@ pub const FuncGen = struct {
35713571 // If the break doesn't break a value, then we don't have to add
35723572 // the values to the lists.
35733573 const operand_ty = self.air.typeOf(branch.operand);
3574 if (operand_ty.hasRuntimeBits() or operand_ty.zigTypeTag() == .Fn) {
3574 if (operand_ty.hasRuntimeBitsIgnoreComptime() or operand_ty.zigTypeTag() == .Fn) {
35753575 const val = try self.resolveInst(branch.operand);
35763576
35773577 // For the phi node, we need the basic blocks and the values of the
......@@ -3685,7 +3685,7 @@ pub const FuncGen = struct {
36853685 const llvm_usize = try self.dg.llvmType(Type.usize);
36863686 const len = llvm_usize.constInt(array_ty.arrayLen(), .False);
36873687 const slice_llvm_ty = try self.dg.llvmType(self.air.typeOfIndex(inst));
3688 if (!array_ty.hasRuntimeBits()) {
3688 if (!array_ty.hasRuntimeBitsIgnoreComptime()) {
36893689 return self.builder.buildInsertValue(slice_llvm_ty.getUndef(), len, 1, "");
36903690 }
36913691 const operand = try self.resolveInst(ty_op.operand);
......@@ -3816,7 +3816,7 @@ pub const FuncGen = struct {
38163816 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
38173817 const ptr_ty = self.air.typeOf(bin_op.lhs);
38183818 const elem_ty = ptr_ty.childType();
3819 if (!elem_ty.hasRuntimeBits()) return self.dg.lowerPtrToVoid(ptr_ty);
3819 if (!elem_ty.hasRuntimeBitsIgnoreComptime()) return self.dg.lowerPtrToVoid(ptr_ty);
38203820
38213821 const base_ptr = try self.resolveInst(bin_op.lhs);
38223822 const rhs = try self.resolveInst(bin_op.rhs);
......@@ -3863,7 +3863,7 @@ pub const FuncGen = struct {
38633863 const struct_llvm_val = try self.resolveInst(struct_field.struct_operand);
38643864 const field_index = struct_field.field_index;
38653865 const field_ty = struct_ty.structFieldType(field_index);
3866 if (!field_ty.hasRuntimeBits()) {
3866 if (!field_ty.hasRuntimeBitsIgnoreComptime()) {
38673867 return null;
38683868 }
38693869 const target = self.dg.module.getTarget();
......@@ -4152,7 +4152,7 @@ pub const FuncGen = struct {
41524152
41534153 var buf: Type.Payload.ElemType = undefined;
41544154 const payload_ty = optional_ty.optionalChild(&buf);
4155 if (!payload_ty.hasRuntimeBits()) {
4155 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
41564156 if (invert) {
41574157 return self.builder.buildNot(operand, "");
41584158 } else {
......@@ -4184,7 +4184,7 @@ pub const FuncGen = struct {
41844184 const err_set_ty = try self.dg.llvmType(Type.initTag(.anyerror));
41854185 const zero = err_set_ty.constNull();
41864186
4187 if (!payload_ty.hasRuntimeBits()) {
4187 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
41884188 const loaded = if (operand_is_ptr) self.builder.buildLoad(operand, "") else operand;
41894189 return self.builder.buildICmp(op, loaded, zero, "");
41904190 }
......@@ -4207,7 +4207,7 @@ pub const FuncGen = struct {
42074207 const optional_ty = self.air.typeOf(ty_op.operand).childType();
42084208 var buf: Type.Payload.ElemType = undefined;
42094209 const payload_ty = optional_ty.optionalChild(&buf);
4210 if (!payload_ty.hasRuntimeBits()) {
4210 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
42114211 // We have a pointer to a zero-bit value and we need to return
42124212 // a pointer to a zero-bit value.
42134213 return operand;
......@@ -4231,7 +4231,7 @@ pub const FuncGen = struct {
42314231 var buf: Type.Payload.ElemType = undefined;
42324232 const payload_ty = optional_ty.optionalChild(&buf);
42334233 const non_null_bit = self.context.intType(1).constAllOnes();
4234 if (!payload_ty.hasRuntimeBits()) {
4234 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
42354235 // We have a pointer to a i1. We need to set it to 1 and then return the same pointer.
42364236 _ = self.builder.buildStore(non_null_bit, operand);
42374237 return operand;
......@@ -4268,7 +4268,7 @@ pub const FuncGen = struct {
42684268 const operand = try self.resolveInst(ty_op.operand);
42694269 const optional_ty = self.air.typeOf(ty_op.operand);
42704270 const payload_ty = self.air.typeOfIndex(inst);
4271 if (!payload_ty.hasRuntimeBits()) return null;
4271 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) return null;
42724272
42734273 if (optional_ty.isPtrLikeOptional()) {
42744274 // Payload value is the same as the optional value.
......@@ -4290,7 +4290,7 @@ pub const FuncGen = struct {
42904290 const result_ty = self.air.getRefType(ty_op.ty);
42914291 const payload_ty = if (operand_is_ptr) result_ty.childType() else result_ty;
42924292
4293 if (!payload_ty.hasRuntimeBits()) return null;
4293 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) return null;
42944294 if (operand_is_ptr or isByRef(payload_ty)) {
42954295 return self.builder.buildStructGEP(operand, 1, "");
42964296 }
......@@ -4311,7 +4311,7 @@ pub const FuncGen = struct {
43114311 const err_set_ty = if (operand_is_ptr) operand_ty.childType() else operand_ty;
43124312
43134313 const payload_ty = err_set_ty.errorUnionPayload();
4314 if (!payload_ty.hasRuntimeBits()) {
4314 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
43154315 if (!operand_is_ptr) return operand;
43164316 return self.builder.buildLoad(operand, "");
43174317 }
......@@ -4332,7 +4332,7 @@ pub const FuncGen = struct {
43324332 const error_ty = error_set_ty.errorUnionSet();
43334333 const payload_ty = error_set_ty.errorUnionPayload();
43344334 const non_error_val = try self.dg.genTypedValue(.{ .ty = error_ty, .val = Value.zero });
4335 if (!payload_ty.hasRuntimeBits()) {
4335 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
43364336 // We have a pointer to a i1. We need to set it to 1 and then return the same pointer.
43374337 _ = self.builder.buildStore(non_error_val, operand);
43384338 return operand;
......@@ -4363,7 +4363,7 @@ pub const FuncGen = struct {
43634363 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
43644364 const payload_ty = self.air.typeOf(ty_op.operand);
43654365 const non_null_bit = self.context.intType(1).constAllOnes();
4366 if (!payload_ty.hasRuntimeBits()) return non_null_bit;
4366 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) return non_null_bit;
43674367 const operand = try self.resolveInst(ty_op.operand);
43684368 const optional_ty = self.air.typeOfIndex(inst);
43694369 if (optional_ty.isPtrLikeOptional()) return operand;
......@@ -4391,7 +4391,7 @@ pub const FuncGen = struct {
43914391 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
43924392 const payload_ty = self.air.typeOf(ty_op.operand);
43934393 const operand = try self.resolveInst(ty_op.operand);
4394 if (!payload_ty.hasRuntimeBits()) {
4394 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
43954395 return operand;
43964396 }
43974397 const inst_ty = self.air.typeOfIndex(inst);
......@@ -4422,7 +4422,7 @@ pub const FuncGen = struct {
44224422 const err_un_ty = self.air.typeOfIndex(inst);
44234423 const payload_ty = err_un_ty.errorUnionPayload();
44244424 const operand = try self.resolveInst(ty_op.operand);
4425 if (!payload_ty.hasRuntimeBits()) {
4425 if (!payload_ty.hasRuntimeBitsIgnoreComptime()) {
44264426 return operand;
44274427 }
44284428 const err_un_llvm_ty = try self.dg.llvmType(err_un_ty);
......@@ -5235,7 +5235,7 @@ pub const FuncGen = struct {
52355235 const fn_info = self.dg.decl.ty.fnInfo();
52365236 var i: u32 = 0;
52375237 for (fn_info.param_types) |param_ty, src_index| {
5238 if (!param_ty.hasRuntimeBits()) continue;
5238 if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
52395239 if (i == runtime_index) return @intCast(u32, src_index);
52405240 i += 1;
52415241 } else unreachable;
......@@ -6021,7 +6021,7 @@ pub const FuncGen = struct {
60216021
60226022 const llvm_union_ty = t: {
60236023 const payload = p: {
6024 if (!field.ty.hasRuntimeBits()) {
6024 if (!field.ty.hasRuntimeBitsIgnoreComptime()) {
60256025 const padding_len = @intCast(c_uint, layout.payload_size);
60266026 break :p self.context.intType(8).arrayType(padding_len);
60276027 }
......@@ -6377,7 +6377,7 @@ pub const FuncGen = struct {
63776377 const union_obj = union_ty.cast(Type.Payload.Union).?.data;
63786378 const field = &union_obj.fields.values()[field_index];
63796379 const result_llvm_ty = try self.dg.llvmType(self.air.typeOfIndex(inst));
6380 if (!field.ty.hasRuntimeBits()) {
6380 if (!field.ty.hasRuntimeBitsIgnoreComptime()) {
63816381 return null;
63826382 }
63836383 const target = self.dg.module.getTarget();
......@@ -6811,7 +6811,7 @@ fn llvmFieldIndex(
68116811
68126812 var llvm_field_index: c_uint = 0;
68136813 for (ty.structFields().values()) |field, i| {
6814 if (field.is_comptime or !field.ty.hasRuntimeBits()) continue;
6814 if (field.is_comptime or !field.ty.hasRuntimeBitsIgnoreComptime()) continue;
68156815
68166816 const field_align = field.normalAlignment(target);
68176817 big_align = @maximum(big_align, field_align);
......@@ -6887,7 +6887,7 @@ fn isByRef(ty: Type) bool {
68876887 .AnyFrame,
68886888 => return false,
68896889
6890 .Array, .Frame => return ty.hasRuntimeBits(),
6890 .Array, .Frame => return ty.hasRuntimeBitsIgnoreComptime(),
68916891 .Struct => {
68926892 // Packed structs are represented to LLVM as integers.
68936893 if (ty.containerLayout() == .Packed) return false;
......@@ -6906,7 +6906,7 @@ fn isByRef(ty: Type) bool {
69066906 var count: usize = 0;
69076907 const fields = ty.structFields();
69086908 for (fields.values()) |field| {
6909 if (field.is_comptime or !field.ty.hasRuntimeBits()) continue;
6909 if (field.is_comptime or !field.ty.hasRuntimeBitsIgnoreComptime()) continue;
69106910
69116911 count += 1;
69126912 if (count > max_fields_byval) return true;
......@@ -6914,7 +6914,7 @@ fn isByRef(ty: Type) bool {
69146914 }
69156915 return false;
69166916 },
6917 .Union => return ty.hasRuntimeBits(),
6917 .Union => return ty.hasRuntimeBitsIgnoreComptime(),
69186918 .ErrorUnion => return isByRef(ty.errorUnionPayload()),
69196919 .Optional => {
69206920 var buf: Type.Payload.ElemType = undefined;