diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 13:37:50 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 13:37:50 -0500 |
| commit | a76b048354e5754b18ecd83ad21cf45c5a34e276 (patch) | |
| tree | e00401d93ff2a1d2e189577d6573d6e5d6f22d19 /src/codegen.cpp | |
| parent | b59841a80f564c63c667f6142832407086b67b56 (diff) | |
| download | zig-a76b048354e5754b18ecd83ad21cf45c5a34e276.tar.gz zig-a76b048354e5754b18ecd83ad21cf45c5a34e276.zip | |
IR: phi instruction handles unreachable values correctly
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 6dfa2520bc..dd734cbf63 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -401,10 +401,14 @@ static LLVMValueRef get_int_overflow_fn(CodeGen *g, TypeTableEntry *type_entry, } static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, TypeTableEntry *type) { - if (handle_is_ptr(type)) { - return ptr; + if (type_has_bits(type)) { + if (handle_is_ptr(type)) { + return ptr; + } else { + return LLVMBuildLoad(g->builder, ptr, ""); + } } else { - return LLVMBuildLoad(g->builder, ptr, ""); + return nullptr; } } |
