diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-10-23 01:33:23 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-10-23 01:33:23 -0400 |
| commit | 44d6f8ffd8eac02747fa0f915b925bb2112570dd (patch) | |
| tree | c639d5e548cf25e01255226821dc0245509e71de /src/codegen.cpp | |
| parent | d7a2b05a813a7badf0606726c9a4b1423befd437 (diff) | |
| download | zig-44d6f8ffd8eac02747fa0f915b925bb2112570dd.tar.gz zig-44d6f8ffd8eac02747fa0f915b925bb2112570dd.zip | |
IR supports variable assignment
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 8a81e62a1f..11e4903ded 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2808,6 +2808,9 @@ static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable, if (!type_has_bits(var->type)) return nullptr; + if (var->ref_count == 0) + return nullptr; + IrInstruction *init_value = decl_var_instruction->init_value; bool have_init_expr = false; @@ -4348,6 +4351,8 @@ static void do_code_gen(CodeGen *g) { if (!type_has_bits(var->type)) { continue; } + if (var->ref_count == 0) + continue; if (var->block_context->node->type == NodeTypeFnDef) { assert(var->gen_arg_index != SIZE_MAX); |
