| ... | ... | @@ -547,10 +547,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 547 | 547 | } else if (handle_is_ptr(return_type) && |
| 548 | 548 | calling_convention_does_first_arg_return(fn_type->data.fn.fn_type_id.cc)) |
| 549 | 549 | { |
| 550 | | // We do not add the sret attribute, because it would require the return type to be void, |
| 551 | | // and we want the return value to return the sret pointer, to work around LLVM Coroutine |
| 552 | | // transformation passes not understanding the data dependency. |
| 553 | | //addLLVMArgAttr(fn_table_entry->llvm_value, 0, "sret"); |
| 550 | addLLVMArgAttr(fn_table_entry->llvm_value, 0, "sret"); |
| 554 | 551 | addLLVMArgAttr(fn_table_entry->llvm_value, 0, "nonnull"); |
| 555 | 552 | } |
| 556 | 553 | |
| ... | ... | @@ -1619,9 +1616,7 @@ static LLVMValueRef ir_render_return(CodeGen *g, IrExecutable *executable, IrIns |
| 1619 | 1616 | if (calling_convention_does_first_arg_return(g->cur_fn->type_entry->data.fn.fn_type_id.cc)) { |
| 1620 | 1617 | assert(g->cur_ret_ptr); |
| 1621 | 1618 | gen_assign_raw(g, g->cur_ret_ptr, get_pointer_to_type(g, return_type, false), value); |
| 1622 | | // as a workaround for LLVM coroutines not understanding instruction dependencies, |
| 1623 | | // we return the sret pointer argument instead of returning void |
| 1624 | | LLVMBuildRet(g->builder, g->cur_ret_ptr); |
| 1619 | LLVMBuildRetVoid(g->builder); |
| 1625 | 1620 | } else { |
| 1626 | 1621 | LLVMValueRef by_val_value = gen_load_untyped(g, value, 0, false, ""); |
| 1627 | 1622 | LLVMBuildRet(g->builder, by_val_value); |
| ... | ... | @@ -2774,9 +2769,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 2774 | 2769 | } else if (!ret_has_bits) { |
| 2775 | 2770 | return nullptr; |
| 2776 | 2771 | } else if (first_arg_ret) { |
| 2777 | | // instead of returning instruction->tmp_ptr here, we trust that the function returned the first arg. |
| 2778 | | // this is a workaround for llvm coroutines not understanding the data dependency |
| 2779 | | return result; |
| 2772 | return instruction->tmp_ptr; |
| 2780 | 2773 | } else { |
| 2781 | 2774 | return result; |
| 2782 | 2775 | } |