mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:54:41 +01:00
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:
+2
-2
@@ -71,9 +71,9 @@ fn Main() {
|
||||
// CHECK:STDOUT: fn @A() -> %empty_tuple.type {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc15_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc15_24.2: init %empty_tuple.type = tuple_init () to %return.param [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc15_24.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc15_25: init %empty_tuple.type = converted %.loc15_24.1, %.loc15_24.2 [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: return %.loc15_25 to %return.param
|
||||
// CHECK:STDOUT: return %.loc15_25
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Main() {
|
||||
|
||||
@@ -62,9 +62,9 @@ fn Main() {
|
||||
// CHECK:STDOUT: fn @Echo(%a.param: %empty_struct_type) -> %empty_struct_type {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %a.ref: %empty_struct_type = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc16_10: init %empty_struct_type = struct_init () to %return.param [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc16_10: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc16_11: init %empty_struct_type = converted %a.ref, %.loc16_10 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: return %.loc16_11 to %return.param
|
||||
// CHECK:STDOUT: return %.loc16_11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Main() {
|
||||
|
||||
@@ -62,9 +62,9 @@ fn Main() {
|
||||
// CHECK:STDOUT: fn @Echo(%a.param: %empty_tuple.type) -> %empty_tuple.type {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %a.ref: %empty_tuple.type = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc16_10: init %empty_tuple.type = tuple_init () to %return.param [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc16_10: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc16_11: init %empty_tuple.type = converted %a.ref, %.loc16_10 [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: return %.loc16_11 to %return.param
|
||||
// CHECK:STDOUT: return %.loc16_11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Main() {
|
||||
|
||||
@@ -112,7 +112,7 @@ fn Run() {
|
||||
// CHECK:STDOUT: %bound_method.loc15_29.2: <bound method> = bound_method %float, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.d77 = call %bound_method.loc15_29.2(%float) [concrete = constants.%float.d20]
|
||||
// CHECK:STDOUT: %.loc15_29: init %f64.d77 = converted %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.d20]
|
||||
// CHECK:STDOUT: return %.loc15_29 to %return.param
|
||||
// CHECK:STDOUT: return %.loc15_29
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Run() {
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ fn Main() {
|
||||
// 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.loc16_10.2: <bound method> = bound_method %a.ref, %specific_fn
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc16_10.2(%a.ref)
|
||||
// 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 @Main() {
|
||||
|
||||
@@ -131,7 +131,7 @@ fn Main() {
|
||||
// CHECK:STDOUT: %bound_method.loc18_22.2: <bound method> = bound_method %int_1, %specific_fn.loc18 [concrete = constants.%bound_method.38b]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i32 = call %bound_method.loc18_22.2(%int_1) [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc18_22.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc18_22.3: init %tuple.type.a1c = tuple_init (%.loc18_22.2) to %x.var [concrete = constants.%tuple.246]
|
||||
// CHECK:STDOUT: %.loc18_22.3: init %tuple.type.a1c = tuple_init (%.loc18_22.2) [concrete = constants.%tuple.246]
|
||||
// CHECK:STDOUT: %.loc18_3: init %tuple.type.a1c = converted %.loc18_22.1, %.loc18_22.3 [concrete = constants.%tuple.246]
|
||||
// CHECK:STDOUT: assign %x.var, %.loc18_3
|
||||
// CHECK:STDOUT: %.loc18_15.1: type = splice_block %.loc18_15.3 [concrete = constants.%tuple.type.a1c] {
|
||||
|
||||
@@ -177,7 +177,7 @@ fn Class(F:! type).Inner.G() -> i32 { return F(); }
|
||||
// CHECK:STDOUT: %bound_method.loc8_29.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc8_29.2(%int_0) [concrete = constants.%int_0.6a9]
|
||||
// CHECK:STDOUT: %.loc8_29: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
|
||||
// CHECK:STDOUT: return %.loc8_29 to %return.param
|
||||
// CHECK:STDOUT: return %.loc8_29
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -194,7 +194,7 @@ fn Class(F:! type).Inner.G() -> i32 { return F(); }
|
||||
// CHECK:STDOUT: %F.ref: @Inner.G.%Inner.F.type (%Inner.F.type) = name_ref F, %.loc13_46 [symbolic = %Inner.F (constants.%Inner.F)]
|
||||
// CHECK:STDOUT: %Inner.F.specific_fn.loc13_46.1: <specific function> = specific_function %F.ref, @Inner.F(constants.%F) [symbolic = %Inner.F.specific_fn.loc13_46.2 (constants.%Inner.F.specific_fn)]
|
||||
// CHECK:STDOUT: %Inner.F.call: init %i32 = call %Inner.F.specific_fn.loc13_46.1()
|
||||
// CHECK:STDOUT: return %Inner.F.call to %return.param.loc13
|
||||
// CHECK:STDOUT: return %Inner.F.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user