Skip to content

Commit d5cb4d4

Browse files
committed
Optimize access of array member in a structure.
1 parent aa13b8a commit d5cb4d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/codegen/llvm.zig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5858,17 +5858,13 @@ pub const FuncGen = struct {
58585858
const load_ptr = load_data.ty_op.operand;
58595859
const load_ptr_tag = self.air.instructions.items(.tag)[Air.refToIndex(load_ptr).?];
58605860
switch (load_ptr_tag) {
5861-
.struct_field_ptr,
5862-
.struct_field_ptr_index_0,
5863-
.struct_field_ptr_index_1,
5864-
.struct_field_ptr_index_2,
5865-
.struct_field_ptr_index_3 => {
5861+
.struct_field_ptr, .struct_field_ptr_index_0, .struct_field_ptr_index_1, .struct_field_ptr_index_2, .struct_field_ptr_index_3 => {
58665862
const load_ptr_inst = try self.resolveInst(load_ptr);
58675863
const gep = self.builder.buildInBoundsGEP(array_llvm_ty, load_ptr_inst, &indices, indices.len, "");
58685864
array_llvm_val.removeUnusedLoadArray();
58695865
return self.builder.buildLoad(elem_llvm_ty, gep, "");
58705866
},
5871-
else => {}
5867+
else => {},
58725868
}
58735869
}
58745870
const elem_ptr = self.builder.buildInBoundsGEP(array_llvm_ty, array_llvm_val, &indices, indices.len, "");

0 commit comments

Comments
 (0)