| ... | ... | @@ -1163,6 +1163,17 @@ static LLVMValueRef get_return_err_fn(CodeGen *g) { |
| 1163 | 1163 | LLVMValueRef return_address_ptr = LLVMBuildCall(g->builder, get_return_address_fn_val(g), &zero, 1, ""); |
| 1164 | 1164 | LLVMValueRef return_address = LLVMBuildPtrToInt(g->builder, return_address_ptr, usize_type_ref, ""); |
| 1165 | 1165 | |
| 1166 | LLVMBasicBlockRef return_block = LLVMAppendBasicBlock(fn_val, "Return"); |
| 1167 | LLVMBasicBlockRef dest_non_null_block = LLVMAppendBasicBlock(fn_val, "DestNonNull"); |
| 1168 | |
| 1169 | LLVMValueRef null_dest_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, err_ret_trace_ptr, |
| 1170 | LLVMConstNull(LLVMTypeOf(err_ret_trace_ptr)), ""); |
| 1171 | LLVMBuildCondBr(g->builder, null_dest_bit, return_block, dest_non_null_block); |
| 1172 | |
| 1173 | LLVMPositionBuilderAtEnd(g->builder, return_block); |
| 1174 | LLVMBuildRetVoid(g->builder); |
| 1175 | |
| 1176 | LLVMPositionBuilderAtEnd(g->builder, dest_non_null_block); |
| 1166 | 1177 | LLVMValueRef args[] = { err_ret_trace_ptr, return_address }; |
| 1167 | 1178 | ZigLLVMBuildCall(g->builder, add_error_return_trace_addr_fn_val, args, 2, get_llvm_cc(g, CallingConventionUnspecified), ZigLLVM_FnInlineAlways, ""); |
| 1168 | 1179 | LLVMBuildRetVoid(g->builder); |
| ... | ... | @@ -5497,6 +5508,13 @@ static LLVMValueRef ir_render_cancel(CodeGen *g, IrExecutable *executable, IrIns |
| 5497 | 5508 | LLVMValueRef target_frame_ptr = ir_llvm_value(g, instruction->frame); |
| 5498 | 5509 | LLVMBasicBlockRef resume_bb = gen_suspend_begin(g, "CancelResume"); |
| 5499 | 5510 | |
| 5511 | // supply null for the awaiter return pointer (no copy needed) |
| 5512 | if (type_has_bits(result_type)) { |
| 5513 | LLVMValueRef awaiter_ret_ptr_ptr = LLVMBuildStructGEP(g->builder, target_frame_ptr, coro_ret_start + 1, ""); |
| 5514 | LLVMBuildStore(g->builder, LLVMConstNull(LLVMGetElementType(LLVMTypeOf(awaiter_ret_ptr_ptr))), |
| 5515 | awaiter_ret_ptr_ptr); |
| 5516 | } |
| 5517 | |
| 5500 | 5518 | // supply null for the error return trace pointer |
| 5501 | 5519 | if (codegen_fn_has_err_ret_tracing_arg(g, result_type)) { |
| 5502 | 5520 | LLVMValueRef err_ret_trace_ptr_ptr = LLVMBuildStructGEP(g->builder, target_frame_ptr, |