diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-13 13:12:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-13 13:12:18 -0500 |
| commit | 1675d4f82b94b4db0272aff483760cd526963a4c (patch) | |
| tree | 1c2f56508d70b602d9520eb7a593a3079c54e540 /src/ir.cpp | |
| parent | fa377dbd1510fc733607afe47dc04dfe55d5ff88 (diff) | |
| parent | f93c219f30b4b4f3bb9280d39be7b585ddcd8447 (diff) | |
| download | zig-1675d4f82b94b4db0272aff483760cd526963a4c.tar.gz zig-1675d4f82b94b4db0272aff483760cd526963a4c.zip | |
Merge pull request #4443 from LemonBoy/werkzeug
A train of small patches
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 3fc2ddadeb..570fdd0b05 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -14840,6 +14840,16 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, } } + // @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 && + types_match_const_cast_only(ira, wanted_type->data.vector.elem_type, + actual_type->data.vector.elem_type, source_node, false).id == ConstCastResultIdOk) + { + return ir_analyze_bit_cast(ira, source_instr, value, wanted_type); + } + } + // *@Frame(func) to anyframe->T or anyframe // *@Frame(func) to ?anyframe->T or ?anyframe // *@Frame(func) to E!anyframe->T or E!anyframe @@ -16409,9 +16419,11 @@ static IrInstGen *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstSrcBinOp *bin_op_i case ZigTypeIdComptimeInt: case ZigTypeIdInt: case ZigTypeIdFloat: - case ZigTypeIdVector: zig_unreachable(); // handled with the type_is_numeric checks above + case ZigTypeIdVector: + // Not every case is handled by the type_is_numeric checks above, + // vectors of bool trigger this code path case ZigTypeIdBool: case ZigTypeIdMetaType: case ZigTypeIdVoid: |
