diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-08 02:15:10 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-08 02:15:48 -0500 |
| commit | 0ab953acb2b7192c5907a1c9d9ed9cf850530af2 (patch) | |
| tree | 9bddba043688aa39c34601530f2db51d126f5e93 /src/ir.cpp | |
| parent | d4a93dbac5b38bda79dc26872fcb87980ab4d272 (diff) | |
| download | zig-0ab953acb2b7192c5907a1c9d9ed9cf850530af2.tar.gz zig-0ab953acb2b7192c5907a1c9d9ed9cf850530af2.zip | |
IR: better array len instruction
reference the "len" field directly instead of looking it up by
name since we already know exactly where the field metadata is
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index e4ca636ed9..f1df878f50 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -6572,8 +6572,7 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, len_val->data.x_bignum.data.x_uint, depends_on_compile_var); } } - TypeStructField *field = find_struct_type_field(canon_type, buf_create_from_str("len")); - assert(field); + TypeStructField *field = &canon_type->data.structure.fields[slice_len_index]; IrInstruction *len_ptr = ir_build_struct_field_ptr(&ira->new_irb, array_len_instruction->base.scope, array_len_instruction->base.source_node, array_value, field); len_ptr->type_entry = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_usize, true); |
