From aef8b25a8e8787759839eb6f02fea61390dc25bc Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 23 Nov 2022 23:54:12 +0000 Subject: Listen to past Bill's wisdom --- src/llvm_backend_proc.cpp | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'src/llvm_backend_proc.cpp') diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index b47168541..d330c90a5 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -588,30 +588,16 @@ void lb_begin_procedure_body(lbProcedure *p) { if (e->token.string != "") { GB_ASSERT(!is_blank_ident(e->token)); - lbAddr res = {}; - - lbFunctionType *ft = p->abi_function_type; - if (ft->multiple_return_original_type && - i < results->variables.count-1) { - isize ret_offset = param_offset + ft->original_arg_count + i; - lbValue ptr = {}; - ptr.value = LLVMGetParam(p->value, cast(unsigned)ret_offset); - ptr.type = alloc_type_pointer(e->type); - res = lb_addr(ptr); - - lb_add_entity(p->module, e, ptr); - lb_add_debug_local_variable(p, ptr.value, e->type, e->token); - } else { - - // NOTE(bill): Don't even bother trying to optimize this with the return ptr value - // This will violate the defer rules if you do: - // foo :: proc() -> (x, y: T) { - // defer x = ... // defer is executed after the `defer` - // return // the values returned should be zeroed - // } - // NOTE(bill): REALLY, don't even bother. - res = lb_add_local(p, e->type, e); - } + // NOTE(bill): Don't even bother trying to optimize this with the return ptr value + // This will violate the defer rules if you do: + // foo :: proc() -> (x, y: T) { + // defer x = ... // defer is executed after the `defer` + // return // the values returned should be zeroed + // } + // NOTE(bill): REALLY, don't even bother. + // + // IMPORTANT NOTE(bill): REALLY, don't even bother!!!!!! + lbAddr res = lb_add_local(p, e->type, e); if (e->Variable.param_value.kind != ParameterValue_Invalid) { lbValue c = lb_handle_param_value(p, e->type, e->Variable.param_value, e->token.pos); -- cgit v1.2.3