| ... | ... | @@ -4092,6 +4092,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4092 | 4092 | LLVMValueRef result_loc = instruction->result_loc ? ir_llvm_value(g, instruction->result_loc) : nullptr; |
| 4093 | 4093 | LLVMValueRef zero = LLVMConstNull(usize_type_ref); |
| 4094 | 4094 | bool need_frame_ptr_ptr_spill = false; |
| 4095 | ZigType *anyframe_type = nullptr; |
| 4095 | 4096 | LLVMValueRef frame_result_loc_uncasted = nullptr; |
| 4096 | 4097 | LLVMValueRef frame_result_loc; |
| 4097 | 4098 | LLVMValueRef awaiter_init_val; |
| ... | ... | @@ -4134,7 +4135,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4134 | 4135 | LLVMValueRef frame_ptr_ptr = LLVMBuildStructGEP(g->builder, frame_slice_ptr, slice_ptr_index, ""); |
| 4135 | 4136 | LLVMValueRef frame_ptr = LLVMBuildLoad(g->builder, frame_ptr_ptr, ""); |
| 4136 | 4137 | if (instruction->fn_entry == nullptr) { |
| 4137 | | ZigType *anyframe_type = get_any_frame_type(g, src_return_type); |
| 4138 | anyframe_type = get_any_frame_type(g, src_return_type); |
| 4138 | 4139 | frame_result_loc = LLVMBuildBitCast(g->builder, frame_ptr, get_llvm_type(g, anyframe_type), ""); |
| 4139 | 4140 | } else { |
| 4140 | 4141 | ZigType *frame_type = get_fn_frame_type(g, instruction->fn_entry); |
| ... | ... | @@ -4416,11 +4417,14 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4416 | 4417 | LLVMValueRef frame_ptr_ptr = LLVMBuildStructGEP(g->builder, frame_slice_ptr, slice_ptr_index, ""); |
| 4417 | 4418 | frame_result_loc_uncasted = LLVMBuildLoad(g->builder, frame_ptr_ptr, ""); |
| 4418 | 4419 | } |
| 4419 | | if (frame_result_loc_uncasted != nullptr && instruction->fn_entry != nullptr) { |
| 4420 | | // Instead of a spill, we do the bitcast again. The uncasted LLVM IR instruction will |
| 4421 | | // be an Alloca from the entry block, so it does not need to be spilled. |
| 4422 | | frame_result_loc = LLVMBuildBitCast(g->builder, frame_result_loc_uncasted, |
| 4423 | | LLVMPointerType(get_llvm_type(g, instruction->fn_entry->frame_type), 0), ""); |
| 4420 | if (frame_result_loc_uncasted != nullptr) { |
| 4421 | if (instruction->fn_entry != nullptr) { |
| 4422 | frame_result_loc = LLVMBuildBitCast(g->builder, frame_result_loc_uncasted, |
| 4423 | LLVMPointerType(get_llvm_type(g, instruction->fn_entry->frame_type), 0), ""); |
| 4424 | } else { |
| 4425 | frame_result_loc = LLVMBuildBitCast(g->builder, frame_result_loc_uncasted, |
| 4426 | get_llvm_type(g, anyframe_type), ""); |
| 4427 | } |
| 4424 | 4428 | } |
| 4425 | 4429 | |
| 4426 | 4430 | LLVMValueRef result_ptr = LLVMBuildStructGEP(g->builder, frame_result_loc, frame_ret_start + 2, ""); |