diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2020-06-15 17:04:32 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-16 18:24:45 -0400 |
| commit | 04c3fae720b57e72dedbaf28982e7e9bfed47db6 (patch) | |
| tree | 9c45fc0de517c0f5952435390595ab8cc13ed983 /src/ir.cpp | |
| parent | f595545c10a35b85879edfa3c002ce308ffeb6c2 (diff) | |
| download | zig-04c3fae720b57e72dedbaf28982e7e9bfed47db6.tar.gz zig-04c3fae720b57e72dedbaf28982e7e9bfed47db6.zip | |
Remove obsolete branch in ir_analyze_cast
Branch handling `*[N]T` to `E![]T` is already handled in a more complete
branch handling `*[N]T` to `[]T` *and* `*[N]T` to `E![]T` so it seems
safe to remove this one.
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index d28648e128..71e3b473b2 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15257,46 +15257,6 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, } } - // *[N]T to E![]T - if (wanted_type->id == ZigTypeIdErrorUnion && - is_slice(wanted_type->data.error_union.payload_type) && - actual_type->id == ZigTypeIdPointer && - actual_type->data.pointer.ptr_len == PtrLenSingle && - actual_type->data.pointer.child_type->id == ZigTypeIdArray) - { - ZigType *slice_type = wanted_type->data.error_union.payload_type; - ZigType *slice_ptr_type = slice_type->data.structure.fields[slice_ptr_index]->type_entry; - assert(slice_ptr_type->id == ZigTypeIdPointer); - ZigType *array_type = actual_type->data.pointer.child_type; - bool const_ok = (slice_ptr_type->data.pointer.is_const || array_type->data.array.len == 0 - || !actual_type->data.pointer.is_const); - if (const_ok && types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type, - array_type->data.array.child_type, source_node, - !slice_ptr_type->data.pointer.is_const).id == ConstCastResultIdOk) - { - // If the pointers both have ABI align, it works. - bool ok_align = slice_ptr_type->data.pointer.explicit_alignment == 0 && - actual_type->data.pointer.explicit_alignment == 0; - if (!ok_align) { - // If either one has non ABI align, we have to resolve them both - if ((err = type_resolve(ira->codegen, actual_type->data.pointer.child_type, - ResolveStatusAlignmentKnown))) - { - return ira->codegen->invalid_inst_gen; - } - if ((err = type_resolve(ira->codegen, slice_ptr_type->data.pointer.child_type, - ResolveStatusAlignmentKnown))) - { - return ira->codegen->invalid_inst_gen; - } - ok_align = get_ptr_align(ira->codegen, actual_type) >= get_ptr_align(ira->codegen, slice_ptr_type); - } - if (ok_align) { - return ir_resolve_ptr_of_array_to_slice(ira, source_instr, value, slice_type, nullptr); - } - } - } - // @Vector(N,T1) to @Vector(N,T2) if (actual_type->id == ZigTypeIdVector && wanted_type->id == ZigTypeIdVector) { if (actual_type->data.vector.len == wanted_type->data.vector.len && |
