aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-15 14:16:12 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-16 01:44:49 -0500
commit72805fd66e732e29637872f540371c30cb9f8b27 (patch)
treea806bc971b52cb833c210a17f87e3eebb6f4dd2a /src/codegen.cpp
parent652efe38b40af8c2a98756e71c9e98fe339d059d (diff)
downloadzig-72805fd66e732e29637872f540371c30cb9f8b27.tar.gz
zig-72805fd66e732e29637872f540371c30cb9f8b27.zip
fix taking address of temporary async frame
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index fd6de466ba..0f6988f986 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -5018,6 +5018,12 @@ static LLVMValueRef ir_render_ref(CodeGen *g, IrExecutableGen *executable, IrIns
if (!type_has_bits(instruction->base.value->type)) {
return nullptr;
}
+ if (instruction->operand->id == IrInstGenIdCall) {
+ IrInstGenCall *call = reinterpret_cast<IrInstGenCall *>(instruction->operand);
+ if (call->result_loc != nullptr) {
+ return ir_llvm_value(g, call->result_loc);
+ }
+ }
LLVMValueRef value = ir_llvm_value(g, instruction->operand);
if (handle_is_ptr(instruction->operand->value->type)) {
return value;
@@ -6533,7 +6539,7 @@ static void ir_render(CodeGen *g, ZigFn *fn_entry) {
set_debug_location(g, instruction);
}
instruction->llvm_value = ir_render_instruction(g, executable, instruction);
- if (instruction->spill != nullptr) {
+ if (instruction->spill != nullptr && instruction->llvm_value != nullptr) {
LLVMValueRef spill_ptr = ir_llvm_value(g, instruction->spill);
gen_assign_raw(g, spill_ptr, instruction->spill->value->type, instruction->llvm_value);
instruction->llvm_value = nullptr;