aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-13 13:12:18 -0500
committerGitHub <noreply@github.com>2020-02-13 13:12:18 -0500
commit1675d4f82b94b4db0272aff483760cd526963a4c (patch)
tree1c2f56508d70b602d9520eb7a593a3079c54e540 /src
parentfa377dbd1510fc733607afe47dc04dfe55d5ff88 (diff)
parentf93c219f30b4b4f3bb9280d39be7b585ddcd8447 (diff)
downloadzig-1675d4f82b94b4db0272aff483760cd526963a4c.tar.gz
zig-1675d4f82b94b4db0272aff483760cd526963a4c.zip
Merge pull request #4443 from LemonBoy/werkzeug
A train of small patches
Diffstat (limited to 'src')
-rw-r--r--src/analyze.cpp4
-rw-r--r--src/ir.cpp14
-rw-r--r--src/link.cpp7
3 files changed, 15 insertions, 10 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index c8b63f4535..fc1a805d82 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -6937,9 +6937,9 @@ static void render_const_val_array(CodeGen *g, Buf *buf, Buf *type_name, ZigValu
return;
}
case ConstArraySpecialNone: {
- ZigValue *base = &array->data.s_none.elements[start];
- assert(base != nullptr);
assert(start + len <= const_val->type->data.array.len);
+ ZigValue *base = &array->data.s_none.elements[start];
+ assert(len == 0 || base != nullptr);
buf_appendf(buf, "%s{", buf_ptr(type_name));
for (uint64_t i = 0; i < len; i += 1) {
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:
diff --git a/src/link.cpp b/src/link.cpp
index d5722ac2f6..2771b694c1 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -2642,13 +2642,6 @@ void codegen_link(CodeGen *g) {
lj.rpath_table.init(4);
lj.codegen = g;
- if (g->verbose_llvm_ir) {
- fprintf(stderr, "\nOptimization:\n");
- fprintf(stderr, "---------------\n");
- fflush(stderr);
- LLVMDumpModule(g->module);
- }
-
if (g->out_type == OutTypeObj) {
lj.args.append("-r");
}