| ... | @@ -2906,12 +2906,18 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -2906,12 +2906,18 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2906 | const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl; | 2906 | const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl; |
| 2907 | const agg_ty = orig_ty_pl.ty.toType(); | 2907 | const agg_ty = orig_ty_pl.ty.toType(); |
| 2908 | const agg_field_count = agg_ty.structFieldCount(zcu); | 2908 | const agg_field_count = agg_ty.structFieldCount(zcu); |
| | 2909 | var opv_field_count: u32 = 0; |
| | 2910 | for (0..agg_field_count) |field_idx| { |
| | 2911 | const field_ty = agg_ty.fieldType(field_idx, zcu); |
| | 2912 | const field_bits: u16 = @intCast(field_ty.bitSize(zcu)); |
| | 2913 | if (field_bits == 0) opv_field_count += 1; |
| | 2914 | } |
| 2909 | | 2915 | |
| 2910 | var bfa_buf: [4 * 32 + 2]Air.Inst.Index = undefined; | 2916 | var bfa_buf: [4 * 32 + 2]Air.Inst.Index = undefined; |
| 2911 | var bfa_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), gpa); | 2917 | var bfa_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), gpa); |
| 2912 | const bfa = bfa_state.allocator(); | 2918 | const bfa = bfa_state.allocator(); |
| 2913 | | 2919 | |
| 2914 | const inst_buf = try bfa.alloc(Air.Inst.Index, 4 * agg_field_count + 2); | 2920 | const inst_buf = try bfa.alloc(Air.Inst.Index, 4 * (agg_field_count - opv_field_count) + 2); |
| 2915 | defer bfa.free(inst_buf); | 2921 | defer bfa.free(inst_buf); |
| 2916 | | 2922 | |
| 2917 | var main_block: Block = .init(inst_buf); | 2923 | var main_block: Block = .init(inst_buf); |
| ... | @@ -2927,6 +2933,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro | ... | @@ -2927,6 +2933,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2927 | field_idx -= 1; | 2933 | field_idx -= 1; |
| 2928 | const field_ty = agg_ty.fieldType(field_idx, zcu); | 2934 | const field_ty = agg_ty.fieldType(field_idx, zcu); |
| 2929 | const field_bits: u16 = @intCast(field_ty.bitSize(zcu)); | 2935 | const field_bits: u16 = @intCast(field_ty.bitSize(zcu)); |
| | 2936 | if (field_bits == 0) continue; |
| 2930 | assert(field_bits < num_bits); | 2937 | assert(field_bits < num_bits); |
| 2931 | const field_uint_ty = try pt.intType(.unsigned, field_bits); | 2938 | const field_uint_ty = try pt.intType(.unsigned, field_bits); |
| 2932 | const field_bit_size_ref: Air.Inst.Ref = .fromValue(try pt.intValue(shift_ty, field_bits)); | 2939 | const field_bit_size_ref: Air.Inst.Ref = .fromValue(try pt.intValue(shift_ty, field_bits)); |