Give ReturnExpr a target only when initialization is in-place (#6570)

Also clarify and enforce that `ConversionTarget::init_id` is used only
as storage for in-place initialization, and correspondingly rename it to
`storage_id`.
This commit is contained in:
Geoff Romer
2026-01-13 01:20:15 +00:00
committed by GitHub
parent 93c7c9ad96
commit e1ec8d42d1
194 changed files with 575 additions and 556 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ fn F() -> array(i32, 1) {
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc6_15.2(%.loc6_15.2)
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc6_12.2, constants.%DestroyOp
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc6_12.2)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @DestroyOp(%self.param: %array_type) = "no_op";
+4 -4
View File
@@ -118,7 +118,7 @@ fn F(a: array({}, 3)) -> {} {
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc4_15.2: <bound method> = bound_method %.loc4_15.3, %specific_fn
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc4_15.2(%.loc4_15.3)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() -> %i32 {
@@ -171,7 +171,7 @@ fn F(a: array({}, 3)) -> {} {
// CHECK:STDOUT: %F.call: init %i32 = call %F.ref(%.loc10_20.15, %.loc10_23.2)
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc10_20.14, constants.%DestroyOp
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc10_20.14)
// CHECK:STDOUT: return %F.call to %return.param
// CHECK:STDOUT: return %F.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @DestroyOp(%self.param: %array_type) = "no_op";
@@ -230,8 +230,8 @@ fn F(a: array({}, 3)) -> {} {
// CHECK:STDOUT: %.loc6_30.2: ref %empty_struct_type = array_index %.loc6_30.1, %.loc6_24.3
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc6_30.3: %empty_struct_type = converted %.loc6_30.2, %empty_struct [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc6_30.4: init %empty_struct_type = struct_init () to %return.param [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc6_30.4: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc6_31: init %empty_struct_type = converted %.loc6_30.3, %.loc6_30.4 [concrete = constants.%empty_struct]
// CHECK:STDOUT: return %.loc6_31 to %return.param
// CHECK:STDOUT: return %.loc6_31
// CHECK:STDOUT: }
// CHECK:STDOUT: