Replace GetCurrentReturnSlot with GetReturnedVarParam (#6571)

Not all functions have a return slot, and once we have composite forms,
functions will be able to have any number of return slots. Obtaining a
unique return slot for a function only makes sense in `returned var`
handling.
This commit is contained in:
Geoff Romer
2026-01-10 01:56:32 +00:00
committed by GitHub
parent 3c70a9f59b
commit 6985ecb1d4
219 changed files with 1097 additions and 1089 deletions
@@ -110,7 +110,7 @@ fn G() -> str {
// CHECK:STDOUT: %return.patt: %pattern_type.461 = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type.461 = out_param_pattern %return.patt, call_param0 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc13_11: form = init_form constants.%str.ee0, call_param0 [concrete = constants.%.a70]
// CHECK:STDOUT: %.loc13_11.2: form = init_form constants.%str.ee0, call_param0 [concrete = constants.%.a70]
// CHECK:STDOUT: %return.param: ref %str.ee0 = out_param call_param0
// CHECK:STDOUT: %return: ref %str.ee0 = return_slot %return.param
// CHECK:STDOUT: }
@@ -133,10 +133,10 @@ fn G() -> str {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Produce.ref: %Produce.cpp_overload_set.type = name_ref Produce, imports.%Produce.cpp_overload_set.value [concrete = constants.%Produce.cpp_overload_set.value]
// CHECK:STDOUT: %.loc13_8: ref %str.ee0 = splice_block %return {}
// CHECK:STDOUT: %addr: %ptr.85f = addr_of %.loc13_8
// CHECK:STDOUT: %.loc13_11.1: ref %str.ee0 = splice_block %return.param {}
// CHECK:STDOUT: %addr: %ptr.85f = addr_of %.loc13_11.1
// CHECK:STDOUT: %Produce__carbon_thunk.call: init %empty_tuple.type = call imports.%Produce__carbon_thunk.decl(%addr)
// CHECK:STDOUT: %.loc14: init %str.ee0 = in_place_init %Produce__carbon_thunk.call, %.loc13_8
// CHECK:STDOUT: return %.loc14 to %return
// CHECK:STDOUT: %.loc14: init %str.ee0 = in_place_init %Produce__carbon_thunk.call, %.loc13_11.1
// CHECK:STDOUT: return %.loc14 to %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: