diff --git a/examples/sieve.carbon b/examples/sieve.carbon index 21fc616dde3c..466d477b43fb 100644 --- a/examples/sieve.carbon +++ b/examples/sieve.carbon @@ -85,26 +85,40 @@ impl i32 as Core.Dec { // --- -fn Run() -> i32 { - var is_prime: [bool; 1000]; +class Sieve { + fn Make() -> Sieve { + returned var s: Sieve; - // TODO: `for` loop. - var n: i32 = 0; - while (n < 1000) { - is_prime[n] = true; - ++n; + // TODO: `for` loop. + var n: i32 = 0; + while (n < 1000) { + s.is_prime[n] = true; + ++n; + } + + return var; } + fn MarkMultiplesNotPrime[addr self: Self*](p: i32) { + var n: i32 = 2 * p; + while (n < 1000) { + self->is_prime[n] = false; + n += p; + } + } + + var is_prime: [bool; 1000]; +} + +fn Run() -> i32 { + var s: Sieve = Sieve.Make(); + var number_of_primes: i32 = 0; - n = 2; + var n: i32 = 2; while (n < 1000) { - if (is_prime[n]) { + if (s.is_prime[n]) { ++number_of_primes; - var k: i32 = 2 * n; - while (k < 1000) { - is_prime[k] = false; - k += n; - } + s.MarkMultiplesNotPrime(n); } ++n; } diff --git a/toolchain/check/call.cpp b/toolchain/check/call.cpp index 47f7e6a9bc75..841bb156e948 100644 --- a/toolchain/check/call.cpp +++ b/toolchain/check/call.cpp @@ -6,6 +6,7 @@ #include "toolchain/check/context.h" #include "toolchain/check/convert.h" +#include "toolchain/check/function.h" #include "toolchain/sem_ir/inst.h" #include "toolchain/sem_ir/typed_insts.h" @@ -45,7 +46,7 @@ auto PerformCall(Context& context, Parse::NodeId node_id, return diagnose_not_callable(); } auto function_id = function_decl->function_id; - const auto& callable = context.functions().Get(function_id); + auto& callable = context.functions().Get(function_id); // For functions with an implicit return type, the return type is the empty // tuple type. @@ -56,11 +57,30 @@ auto PerformCall(Context& context, Parse::NodeId node_id, // If there is a return slot, build storage for the result. SemIR::InstId return_storage_id = SemIR::InstId::Invalid; - if (callable.return_slot_id.is_valid()) { - // Tentatively put storage for a temporary in the function's return slot. - // This will be replaced if necessary when we perform initialization. - return_storage_id = context.AddInst( - {node_id, SemIR::TemporaryStorage{callable.return_type_id}}); + { + DiagnosticAnnotationScope annotate_diagnostics( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteReturnTypeHere, Note, + "Return type declared here."); + builder.Note(callable.return_storage_id, IncompleteReturnTypeHere); + }); + CheckFunctionReturnType(context, callee_id, callable); + } + switch (callable.return_slot) { + case SemIR::Function::ReturnSlot::Present: + // Tentatively put storage for a temporary in the function's return slot. + // This will be replaced if necessary when we perform initialization. + return_storage_id = context.AddInst( + {node_id, SemIR::TemporaryStorage{callable.return_type_id}}); + break; + case SemIR::Function::ReturnSlot::Absent: + break; + case SemIR::Function::ReturnSlot::Error: + // Don't form an initializing expression with an incomplete type. + type_id = SemIR::TypeId::Error; + break; + case SemIR::Function::ReturnSlot::NotComputed: + CARBON_FATAL() << "Missing return slot category in call to " << callable; } // Convert the arguments to match the parameters. diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 6ee4f65b764f..c2483595d952 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -627,7 +627,9 @@ auto Context::FinalizeGlobalInit() -> void { .implicit_param_refs_id = SemIR::InstBlockId::Empty, .param_refs_id = SemIR::InstBlockId::Empty, .return_type_id = SemIR::TypeId::Invalid, - .return_slot_id = SemIR::InstId::Invalid, + .return_storage_id = SemIR::InstId::Invalid, + .is_extern = false, + .return_slot = SemIR::Function::ReturnSlot::Absent, .body_block_ids = {SemIR::InstBlockId::GlobalInit}}); } else { inst_block_stack().PopGlobalInit(); diff --git a/toolchain/check/function.cpp b/toolchain/check/function.cpp index 80eca50f7b8d..5247142c6659 100644 --- a/toolchain/check/function.cpp +++ b/toolchain/check/function.cpp @@ -294,6 +294,28 @@ static auto CheckIsAllowedRedecl(Context& context, SemIR::LocId loc_id, } } +// Returns the return slot usage for a function given the computed usage for two +// different declarations of the function. +static auto MergeReturnSlot(SemIR::Function::ReturnSlot a, + SemIR::Function::ReturnSlot b) + -> SemIR::Function::ReturnSlot { + if (a == SemIR::Function::ReturnSlot::NotComputed) { + return b; + } + if (b == SemIR::Function::ReturnSlot::NotComputed) { + return a; + } + if (a == SemIR::Function::ReturnSlot::Error) { + return b; + } + if (b == SemIR::Function::ReturnSlot::Error) { + return a; + } + CARBON_CHECK(a == b) + << "Different return slot usage computed for the same function."; + return a; +} + auto MergeFunctionRedecl(Context& context, SemIR::LocId loc_id, SemIR::Function& new_function, bool new_is_import, bool new_is_definition, @@ -315,8 +337,11 @@ auto MergeFunctionRedecl(Context& context, SemIR::LocId loc_id, prev_function.implicit_param_refs_id = new_function.implicit_param_refs_id; prev_function.param_refs_id = new_function.param_refs_id; prev_function.return_type_id = new_function.return_type_id; - prev_function.return_slot_id = new_function.return_slot_id; + prev_function.return_storage_id = new_function.return_storage_id; } + // The new function might have return slot information if it was imported. + prev_function.return_slot = + MergeReturnSlot(prev_function.return_slot, new_function.return_slot); if ((prev_import_ir_inst_id.is_valid() && !new_is_import) || (prev_function.is_extern && !new_function.is_extern)) { prev_function.is_extern = new_function.is_extern; @@ -327,4 +352,39 @@ auto MergeFunctionRedecl(Context& context, SemIR::LocId loc_id, return true; } +auto CheckFunctionReturnType(Context& context, SemIRLoc loc, + SemIR::Function& function) -> void { + // If we have already checked the return type, we have nothing to do. + if (function.return_slot != SemIR::Function::ReturnSlot::NotComputed) { + return; + } + + if (!function.return_type_id.is_valid()) { + // Implicit `-> ()` has no return slot. + function.return_slot = SemIR::Function::ReturnSlot::Absent; + return; + } + + // Check the return type is complete. Only diagnose incompleteness if we've + // not already done so. + auto diagnose_incomplete_return_type = [&] { + CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Error, + "Function returns incomplete type `{0}`.", SemIR::TypeId); + return context.emitter().Build(loc, IncompleteTypeInFunctionReturnType, + function.return_type_id); + }; + if (!context.TryToCompleteType( + function.return_type_id, + function.return_slot == SemIR::Function::ReturnSlot::Error + ? std::nullopt + : std::optional(diagnose_incomplete_return_type))) { + function.return_slot = SemIR::Function::ReturnSlot::Error; + } else if (SemIR::GetInitRepr(context.sem_ir(), function.return_type_id) + .has_return_slot()) { + function.return_slot = SemIR::Function::ReturnSlot::Present; + } else { + function.return_slot = SemIR::Function::ReturnSlot::Absent; + } +} + } // namespace Carbon::Check diff --git a/toolchain/check/function.h b/toolchain/check/function.h index c0ff7841dda6..cbac2e0a5c94 100644 --- a/toolchain/check/function.h +++ b/toolchain/check/function.h @@ -48,6 +48,12 @@ auto MergeFunctionRedecl(Context& context, SemIR::LocId loc_id, SemIR::FunctionId prev_function_id, SemIR::ImportIRInstId prev_import_ir_inst_id) -> bool; +// Checks that the return type of the specified function is complete, issuing an +// error if not. This computes the return slot usage for the function if +// necessary. +auto CheckFunctionReturnType(Context& context, SemIRLoc loc, + SemIR::Function& function) -> void; + } // namespace Carbon::Check #endif // CARBON_TOOLCHAIN_CHECK_FUNCTION_H_ diff --git a/toolchain/check/handle_function.cpp b/toolchain/check/handle_function.cpp index e7a90b800e7c..badb823f4a06 100644 --- a/toolchain/check/handle_function.cpp +++ b/toolchain/check/handle_function.cpp @@ -79,26 +79,16 @@ static auto BuildFunctionDecl(Context& context, auto decl_block_id = context.inst_block_stack().Pop(); auto return_type_id = SemIR::TypeId::Invalid; - auto return_slot_id = SemIR::InstId::Invalid; - if (auto [return_node, return_storage_id] = + auto return_storage_id = SemIR::InstId::Invalid; + auto return_slot = SemIR::Function::ReturnSlot::NotComputed; + if (auto [return_node, maybe_return_storage_id] = context.node_stack().PopWithNodeIdIf(); - return_storage_id) { - return_type_id = context.insts().Get(*return_storage_id).type_id(); - - return_type_id = context.AsCompleteType(return_type_id, [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Error, - "Function returns incomplete type `{0}`.", - SemIR::TypeId); - return context.emitter().Build( - return_node, IncompleteTypeInFunctionReturnType, return_type_id); - }); - - if (!SemIR::GetInitRepr(context.sem_ir(), return_type_id) - .has_return_slot()) { - // The function only has a return slot if it uses in-place initialization. - } else { - return_slot_id = *return_storage_id; - } + maybe_return_storage_id) { + return_type_id = context.insts().Get(*maybe_return_storage_id).type_id(); + return_storage_id = *maybe_return_storage_id; + } else { + // If there's no return type, there's no return slot. + return_slot = SemIR::Function::ReturnSlot::Absent; } SemIR::InstBlockId param_refs_id = @@ -144,8 +134,9 @@ static auto BuildFunctionDecl(Context& context, .implicit_param_refs_id = implicit_param_refs_id, .param_refs_id = param_refs_id, .return_type_id = return_type_id, - .return_slot_id = return_slot_id, - .is_extern = is_extern}; + .return_storage_id = return_storage_id, + .is_extern = is_extern, + .return_slot = return_slot}; if (is_definition) { function_info.definition_id = function_info.decl_id; } @@ -201,9 +192,9 @@ static auto BuildFunctionDecl(Context& context, // TODO: Update this once valid signatures for the entry point are decided. if (!context.inst_blocks().Get(implicit_param_refs_id).empty() || !context.inst_blocks().Get(param_refs_id).empty() || - (return_slot_id.is_valid() && + (return_type_id.is_valid() && return_type_id != - context.GetBuiltinType(SemIR::BuiltinKind::BoolType) && + context.GetBuiltinType(SemIR::BuiltinKind::IntType) && return_type_id != context.GetTupleType({}))) { CARBON_DIAGNOSTIC(InvalidMainRunSignature, Error, "Invalid signature for `Main.Run` function. Expected " @@ -236,6 +227,9 @@ static auto HandleFunctionDefinitionAfterSignature( context.scope_stack().Push(decl_id); context.AddCurrentCodeBlockToFunction(); + // Check the return type is complete. + CheckFunctionReturnType(context, function.return_storage_id, function); + // Check the parameter types are complete. for (auto param_id : llvm::concat( context.inst_blocks().Get(function.implicit_param_refs_id), diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 55ebad3c8430..80d404c3c284 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -687,10 +687,6 @@ class ImportRefResolver { if (function.return_type_id.is_valid()) { return_type_const_id = GetLocalConstantId(function.return_type_id); } - auto return_slot_const_id = SemIR::ConstantId::Invalid; - if (function.return_slot_id.is_valid()) { - return_slot_const_id = GetLocalConstantId(function.return_slot_id); - } auto enclosing_scope_id = GetLocalNameScopeId(function.enclosing_scope_id); llvm::SmallVector implicit_param_const_ids = GetLocalParamConstantIds(function.implicit_param_refs_id); @@ -716,13 +712,14 @@ class ImportRefResolver { return_type_const_id.is_valid() ? context_.GetTypeIdForTypeConstant(return_type_const_id) : SemIR::TypeId::Invalid; - auto new_return_slot = SemIR::InstId::Invalid; - if (function.return_slot_id.is_valid()) { - auto import_ir_inst_id = context_.import_ir_insts().Add( - {.ir_id = import_ir_id_, .inst_id = function.return_slot_id}); - new_return_slot = context_.AddInstInNoBlock({SemIR::ImportRefLoaded{ - context_.GetTypeIdForTypeConstant(return_slot_const_id), - import_ir_inst_id}}); + auto new_return_storage = SemIR::InstId::Invalid; + if (function.return_storage_id.is_valid()) { + // Recreate the return slot from scratch. + // TODO: Once we import function definitions, we'll need to make sure we + // use the same return storage variable in the declaration and definition. + new_return_storage = context_.AddInstInNoBlock( + {AddImportIRInst(function.return_storage_id), + SemIR::VarStorage{new_return_type_id, SemIR::NameId::ReturnSlot}}); } function_decl.function_id = context_.functions().Add( {.name_id = GetLocalNameId(function.name_id), @@ -733,8 +730,9 @@ class ImportRefResolver { .param_refs_id = GetLocalParamRefsId(function.param_refs_id, param_const_ids), .return_type_id = new_return_type_id, - .return_slot_id = new_return_slot, + .return_storage_id = new_return_storage, .is_extern = function.is_extern, + .return_slot = function.return_slot, .builtin_kind = function.builtin_kind, .definition_id = function.definition_id.is_valid() ? function_decl_id diff --git a/toolchain/check/return.cpp b/toolchain/check/return.cpp index 69915d54df46..4b27d77f7969 100644 --- a/toolchain/check/return.cpp +++ b/toolchain/check/return.cpp @@ -39,9 +39,8 @@ static auto NoteReturnType(Context::DiagnosticBuilder& diag, const SemIR::Function& function) { CARBON_DIAGNOSTIC(ReturnTypeHereNote, Note, "Return type of function is `{0}`.", SemIR::TypeId); - // TODO: This is using the location of the `fn` keyword. Find the location of - // the return type. - diag.Note(function.decl_id, ReturnTypeHereNote, function.return_type_id); + diag.Note(function.return_storage_id, ReturnTypeHereNote, + function.return_type_id); } // Produces a note pointing at the currently in scope `returned var`. @@ -82,8 +81,8 @@ auto CheckReturnedVar(Context& context, Parse::NodeId returned_node, // The variable aliases the return slot if there is one. If not, it has its // own storage. - if (function.return_slot_id.is_valid()) { - return function.return_slot_id; + if (function.has_return_slot()) { + return function.return_storage_id; } return context.AddInst({name_node, SemIR::VarStorage{type_id, name_id}}); } @@ -136,8 +135,11 @@ auto BuildReturnWithExpr(Context& context, Parse::ReturnStatementId node_id, NoteReturnedVar(diag, returned_var_id); diag.Emit(); expr_id = SemIR::InstId::BuiltinError; - } else if (function.return_slot_id.is_valid()) { - expr_id = Initialize(context, node_id, function.return_slot_id, expr_id); + } else if (function.has_return_slot()) { + expr_id = Initialize(context, node_id, function.return_storage_id, expr_id); + } else if (function.return_slot == SemIR::Function::ReturnSlot::Error) { + // Don't produce a second error complaining the return type is incomplete. + expr_id = SemIR::InstId::BuiltinError; } else { expr_id = ConvertToValueOfType(context, node_id, expr_id, function.return_type_id); @@ -158,7 +160,7 @@ auto BuildReturnVar(Context& context, Parse::ReturnStatementId node_id) returned_var_id = SemIR::InstId::BuiltinError; } - if (!function.return_slot_id.is_valid()) { + if (!function.has_return_slot()) { // If we don't have a return slot, we're returning by value. Convert to a // value expression. returned_var_id = ConvertToValueExpr(context, returned_var_id); diff --git a/toolchain/check/testdata/alias/fail_local_in_namespace.carbon b/toolchain/check/testdata/alias/fail_local_in_namespace.carbon index 05580f18fdbf..9b8cae2e90de 100644 --- a/toolchain/check/testdata/alias/fail_local_in_namespace.carbon +++ b/toolchain/check/testdata/alias/fail_local_in_namespace.carbon @@ -37,7 +37,7 @@ fn F() -> bool { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/local.carbon b/toolchain/check/testdata/alias/local.carbon index 8dfc7bf3253c..aa4d65eba0cb 100644 --- a/toolchain/check/testdata/alias/local.carbon +++ b/toolchain/check/testdata/alias/local.carbon @@ -23,7 +23,7 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index 88de03039e12..a903a4ef6aa5 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -15,9 +15,9 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, (i32, i32, i32) [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: type = array_type %.3, (i32, i32, i32) [template] +// CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] // CHECK:STDOUT: %.6: type = ptr_type [(i32, i32, i32); 2] [template] // CHECK:STDOUT: %.7: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] @@ -39,14 +39,14 @@ fn G() { // CHECK:STDOUT: %G: = fn_decl @G [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); +// CHECK:STDOUT: fn @F() -> (i32, i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_25.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc10_25.2: type = converted %.loc10_25.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.4] // CHECK:STDOUT: %v.var: ref [(i32, i32, i32); 2] = var v // CHECK:STDOUT: %v: ref [(i32, i32, i32); 2] = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_34: = name_ref F, file.%F [template = file.%F] diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index 8ead77f68904..87473f6f338f 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -32,7 +32,7 @@ fn Run() { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %return.var: ref (i32,) = var +// CHECK:STDOUT: @F.%return: ref (i32,) = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run: = fn_decl @Run [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index 8b1fd4e6fd14..c3b80a86d197 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -34,7 +34,7 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index 167b07b22c14..8aaedfa96abb 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -28,7 +28,7 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %n.loc7_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc7_11.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 26813a7f57f9..7af813c02ebf 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -39,10 +39,10 @@ fn G() -> i32 { // CHECK:STDOUT: @F.%arr: [i32; 3] = bind_name arr, %arr.loc7_6.1 // CHECK:STDOUT: %i.loc7_21.1: i32 = param i // CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc7_21.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 71bb5fa98b09..5358a9401c0a 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -21,7 +21,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index d53280e152e5..c11b3261c591 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -89,7 +89,7 @@ fn Initializing() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Make() -> %return: X; +// CHECK:STDOUT: fn @Make() -> X; // CHECK:STDOUT: // CHECK:STDOUT: fn @Initializing() { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/as/tuple.carbon b/toolchain/check/testdata/as/tuple.carbon index 5146b5900ba0..2120e0df22e8 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -25,10 +25,10 @@ fn Var() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.5: type = tuple_type (X, X) [template] +// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (X, X) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: type = tuple_type ({}*, {}*) [template] // CHECK:STDOUT: %.7: type = ptr_type ({}*, {}*) [template] // CHECK:STDOUT: } @@ -56,14 +56,14 @@ fn Var() { // CHECK:STDOUT: .Self = constants.%X // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Make() -> %return: X; +// CHECK:STDOUT: fn @Make() -> X; // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc15_15.1: (type, type) = tuple_literal (%X.ref.loc15_11, %X.ref.loc15_14) -// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc15_24.1: ref X = temporary_storage // CHECK:STDOUT: %.loc15_24.2: init X = call %Make.ref.loc15_20() to %.loc15_24.1 @@ -74,7 +74,7 @@ fn Var() { // CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc15_44.1: (type, type) = tuple_literal (%X.ref.loc15_40, %X.ref.loc15_43) -// CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %.loc15_24.3: ref X = temporary %.loc15_24.1, %.loc15_24.2 // CHECK:STDOUT: %.loc15_24.4: X = bind_value %.loc15_24.3 // CHECK:STDOUT: %.loc15_32.3: ref X = temporary %.loc15_32.1, %.loc15_32.2 @@ -90,7 +90,7 @@ fn Var() { // CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc20_15.1: (type, type) = tuple_literal (%X.ref.loc20_11, %X.ref.loc20_14) -// CHECK:STDOUT: %.loc20_15.2: type = converted %.loc20_15.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_15.2: type = converted %.loc20_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref (X, X) = var b // CHECK:STDOUT: %b: ref (X, X) = bind_name b, %b.var // CHECK:STDOUT: %Make.ref.loc20_20: = name_ref Make, file.%Make [template = file.%Make] @@ -103,7 +103,7 @@ fn Var() { // CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc20_44.1: (type, type) = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) -// CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%.loc20_24, %.loc20_32) to %b.var // CHECK:STDOUT: %.loc20_34.5: init (X, X) = converted %.loc20_34.3, %.loc20_34.4 // CHECK:STDOUT: assign %b.var, %.loc20_34.5 diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index 41cd4a63f223..86c491fc8c98 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -16,8 +16,8 @@ fn Run() -> String {} // CHECK:STDOUT: --- fail_bad_run.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %.2: type = ptr_type String [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon index 27d87bcedd67..0a6314946984 100644 --- a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon @@ -17,18 +17,18 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: sem_ir: // CHECK:STDOUT: import_irs_size: 2 // CHECK:STDOUT: name_scopes: -// CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope, has_error: false, extended_scopes: [], names: {name0: inst+15}} +// CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope, has_error: false, extended_scopes: [], names: {name0: inst+14}} // CHECK:STDOUT: bind_names: // CHECK:STDOUT: bindName0: {name: name1, enclosing_scope: name_scope} // CHECK:STDOUT: functions: -// CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_slot: inst+13, body: [block6]} +// CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_storage: inst+13, return_slot: present, body: [block6]} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} // CHECK:STDOUT: type1: {constant: template inst+1, value_rep: {kind: none, type: type1}} -// CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type3}} -// CHECK:STDOUT: type3: {constant: template inst+14, value_rep: {kind: copy, type: type3}} -// CHECK:STDOUT: type4: {constant: template instFunctionType, value_rep: {kind: copy, type: type4}} +// CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type4}} +// CHECK:STDOUT: type3: {constant: template instFunctionType, value_rep: {kind: copy, type: type3}} +// CHECK:STDOUT: type4: {constant: template inst+15, value_rep: {kind: copy, type: type4}} // CHECK:STDOUT: type_blocks: // CHECK:STDOUT: typeBlock0: {} // CHECK:STDOUT: typeBlock1: {} @@ -62,8 +62,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: inst+11: {kind: Converted, arg0: inst+7, arg1: inst+1, type: typeTypeType} // CHECK:STDOUT: inst+12: {kind: Converted, arg0: inst+9, arg1: inst+8, type: typeTypeType} // CHECK:STDOUT: inst+13: {kind: VarStorage, arg0: nameReturnSlot, type: type2} -// CHECK:STDOUT: inst+14: {kind: PointerType, arg0: type2, type: typeTypeType} -// CHECK:STDOUT: inst+15: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type4} +// CHECK:STDOUT: inst+14: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type3} +// CHECK:STDOUT: inst+15: {kind: PointerType, arg0: type2, type: typeTypeType} // CHECK:STDOUT: inst+16: {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} // CHECK:STDOUT: inst+17: {kind: TupleLiteral, arg0: empty, type: type1} // CHECK:STDOUT: inst+18: {kind: TupleLiteral, arg0: block7, type: type2} @@ -99,7 +99,7 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: -// CHECK:STDOUT: 0: inst+15 +// CHECK:STDOUT: 0: inst+14 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: // CHECK:STDOUT: 0: inst+5 @@ -145,7 +145,7 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 1: inst+21 // CHECK:STDOUT: block13: // CHECK:STDOUT: 0: inst+0 -// CHECK:STDOUT: 1: inst+15 +// CHECK:STDOUT: 1: inst+14 // CHECK:STDOUT: ... // CHECK:STDOUT: // CHECK:STDOUT: --- raw_and_textual_ir.carbon diff --git a/toolchain/check/testdata/basics/raw_identifier.carbon b/toolchain/check/testdata/basics/raw_identifier.carbon index 1c7a6ca6862b..a63b1c9ae057 100644 --- a/toolchain/check/testdata/basics/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/raw_identifier.carbon @@ -39,7 +39,7 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: @A.%n: () = bind_name n, %n.loc11_6.1 // CHECK:STDOUT: %.loc11_17.1: () = tuple_literal () // CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var.loc11: ref () = var +// CHECK:STDOUT: @A.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { // CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () @@ -48,7 +48,7 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: @B.%n: () = bind_name n, %n.loc15_6.1 // CHECK:STDOUT: %.loc15_19.1: () = tuple_literal () // CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var.loc15: ref () = var +// CHECK:STDOUT: @B.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %C: = fn_decl @C [template] { // CHECK:STDOUT: %.loc19_13.1: () = tuple_literal () @@ -57,7 +57,7 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: @C.%if: () = bind_name r#if, %if.loc19_6.1 // CHECK:STDOUT: %.loc19_20.1: () = tuple_literal () // CHECK:STDOUT: %.loc19_20.2: type = converted %.loc19_20.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var.loc19: ref () = var +// CHECK:STDOUT: @C.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/raw_ir.carbon b/toolchain/check/testdata/basics/raw_ir.carbon index 67c972c62a92..c3591c6ea319 100644 --- a/toolchain/check/testdata/basics/raw_ir.carbon +++ b/toolchain/check/testdata/basics/raw_ir.carbon @@ -17,18 +17,18 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: sem_ir: // CHECK:STDOUT: import_irs_size: 2 // CHECK:STDOUT: name_scopes: -// CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope, has_error: false, extended_scopes: [], names: {name0: inst+15}} +// CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope, has_error: false, extended_scopes: [], names: {name0: inst+14}} // CHECK:STDOUT: bind_names: // CHECK:STDOUT: bindName0: {name: name1, enclosing_scope: name_scope} // CHECK:STDOUT: functions: -// CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_slot: inst+13, body: [block6]} +// CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_storage: inst+13, return_slot: present, body: [block6]} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} // CHECK:STDOUT: type1: {constant: template inst+1, value_rep: {kind: none, type: type1}} -// CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type3}} -// CHECK:STDOUT: type3: {constant: template inst+14, value_rep: {kind: copy, type: type3}} -// CHECK:STDOUT: type4: {constant: template instFunctionType, value_rep: {kind: copy, type: type4}} +// CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type4}} +// CHECK:STDOUT: type3: {constant: template instFunctionType, value_rep: {kind: copy, type: type3}} +// CHECK:STDOUT: type4: {constant: template inst+15, value_rep: {kind: copy, type: type4}} // CHECK:STDOUT: type_blocks: // CHECK:STDOUT: typeBlock0: {} // CHECK:STDOUT: typeBlock1: {} @@ -62,8 +62,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: inst+11: {kind: Converted, arg0: inst+7, arg1: inst+1, type: typeTypeType} // CHECK:STDOUT: inst+12: {kind: Converted, arg0: inst+9, arg1: inst+8, type: typeTypeType} // CHECK:STDOUT: inst+13: {kind: VarStorage, arg0: nameReturnSlot, type: type2} -// CHECK:STDOUT: inst+14: {kind: PointerType, arg0: type2, type: typeTypeType} -// CHECK:STDOUT: inst+15: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type4} +// CHECK:STDOUT: inst+14: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type3} +// CHECK:STDOUT: inst+15: {kind: PointerType, arg0: type2, type: typeTypeType} // CHECK:STDOUT: inst+16: {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} // CHECK:STDOUT: inst+17: {kind: TupleLiteral, arg0: empty, type: type1} // CHECK:STDOUT: inst+18: {kind: TupleLiteral, arg0: block7, type: type2} @@ -99,7 +99,7 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: -// CHECK:STDOUT: 0: inst+15 +// CHECK:STDOUT: 0: inst+14 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: // CHECK:STDOUT: 0: inst+5 @@ -145,5 +145,5 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 1: inst+21 // CHECK:STDOUT: block13: // CHECK:STDOUT: 0: inst+0 -// CHECK:STDOUT: 1: inst+15 +// CHECK:STDOUT: 1: inst+14 // CHECK:STDOUT: ... diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index 06a3ae3f3e4b..b6ecf335226f 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -19,7 +19,7 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Run: = fn_decl @Run [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/bool/make_type.carbon b/toolchain/check/testdata/builtins/bool/make_type.carbon index 05a6c4e71233..ff4d8bbdcc0e 100644 --- a/toolchain/check/testdata/builtins/bool/make_type.carbon +++ b/toolchain/check/testdata/builtins/bool/make_type.carbon @@ -27,7 +27,7 @@ var b: Bool() = false; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Bool: = fn_decl @Bool [template] { -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @Bool.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 77935578b5ef..1af1999e9a8d 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -51,7 +51,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Float: = fn_decl @Float [template] { // CHECK:STDOUT: %size.loc4_10.1: i32 = param size // CHECK:STDOUT: @Float.%size: i32 = bind_name size, %size.loc4_10.1 -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @Float.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,7 +83,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %GetFloat: = fn_decl @GetFloat [template] { // CHECK:STDOUT: %dyn_size.loc8_13.1: i32 = param dyn_size // CHECK:STDOUT: @GetFloat.%dyn_size: i32 = bind_name dyn_size, %dyn_size.loc8_13.1 -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @GetFloat.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/add.carbon b/toolchain/check/testdata/builtins/int/add.carbon index 2c65c5917ac1..f2ad6b236a6d 100644 --- a/toolchain/check/testdata/builtins/int/add.carbon +++ b/toolchain/check/testdata/builtins/int/add.carbon @@ -108,7 +108,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.1] @@ -128,7 +128,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -172,7 +172,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { // CHECK:STDOUT: %a.loc8_11.1: i32 = param a // CHECK:STDOUT: @TooFew.%a: i32 = bind_name a, %a.loc8_11.1 -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a @@ -181,21 +181,21 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 // CHECK:STDOUT: %c.loc13_28.1: i32 = param c // CHECK:STDOUT: @TooMany.%c: i32 = bind_name c, %c.loc13_28.1 -// CHECK:STDOUT: %return.var.loc13: ref i32 = var +// CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: %b.loc18_26.1: i32 = param b // CHECK:STDOUT: @BadReturnType.%b: i32 = bind_name b, %b.loc18_26.1 -// CHECK:STDOUT: %return.var.loc18: ref bool = var +// CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: %b.loc19_22.1: i32 = param b // CHECK:STDOUT: @JustRight.%b: i32 = bind_name b, %b.loc19_22.1 -// CHECK:STDOUT: %return.var.loc19: ref i32 = var +// CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] // CHECK:STDOUT: %.loc25_27: i32 = int_literal 1 [template = constants.%.1] @@ -226,7 +226,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 -// CHECK:STDOUT: %return.var.loc46: ref i32 = var +// CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { // CHECK:STDOUT: %a.loc50_23.1: i32 = param a @@ -235,14 +235,14 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc50_31.1 // CHECK:STDOUT: %c.loc50_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc50_39.1 -// CHECK:STDOUT: %return.var.loc50: ref i32 = var +// CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { // CHECK:STDOUT: %a.loc54_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc54_29.1 // CHECK:STDOUT: %b.loc54_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc54_37.1 -// CHECK:STDOUT: %return.var.loc54: ref bool = var +// CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -307,7 +307,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Add.ref.loc6: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 2147483647 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 81cc02f9938c..cc582ad026ae 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -38,7 +38,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] @@ -58,7 +58,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index 417de1dd5fe5..69ee5310e974 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -39,14 +39,14 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %Complement: = fn_decl @Complement [template] { // CHECK:STDOUT: %a.loc2_15.1: i32 = param a // CHECK:STDOUT: @Complement.%a: i32 = bind_name a, %a.loc2_15.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Complement.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %And: = fn_decl @And [template] { // CHECK:STDOUT: %a.loc3_8.1: i32 = param a // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc3_8.1 // CHECK:STDOUT: %b.loc3_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc3_16.1 -// CHECK:STDOUT: %return.var.loc3: ref i32 = var +// CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] // CHECK:STDOUT: %Complement.ref: = name_ref Complement, %Complement [template = %Complement] @@ -68,7 +68,7 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { // CHECK:STDOUT: %a.loc8_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc8_16.1 -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/div.carbon b/toolchain/check/testdata/builtins/int/div.carbon index 2504c39c3b7f..9bd0fe548ae1 100644 --- a/toolchain/check/testdata/builtins/int/div.carbon +++ b/toolchain/check/testdata/builtins/int/div.carbon @@ -76,7 +76,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Div.ref: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] @@ -96,7 +96,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -136,19 +136,19 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var.loc4: ref i32 = var +// CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 -// CHECK:STDOUT: %return.var.loc6: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] @@ -227,7 +227,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 9ad2b3d33dab..b89dd359dbb5 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -58,7 +58,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: @Eq.%a: i32 = bind_name a, %a.loc2_7.1 // CHECK:STDOUT: %b.loc2_15.1: i32 = param b // CHECK:STDOUT: @Eq.%b: i32 = bind_name b, %b.loc2_15.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @Eq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -75,7 +75,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc12_24.1 -// CHECK:STDOUT: %return.var.loc12: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -158,7 +158,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: @WrongResult.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @WrongResult.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @WrongResult.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index f5989369059f..02e03884a61b 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -56,12 +56,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @Greater.%a: i32 = bind_name a, %a.loc2_12.1 // CHECK:STDOUT: %b.loc2_20.1: i32 = param b // CHECK:STDOUT: @Greater.%b: i32 = bind_name b, %b.loc2_20.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @Greater.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 -// CHECK:STDOUT: %return.var.loc3: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -78,7 +78,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index f312be103af9..160ae97f810b 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -56,12 +56,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @GreaterEq.%a: i32 = bind_name a, %a.loc2_14.1 // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @GreaterEq.%b: i32 = bind_name b, %b.loc2_22.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @GreaterEq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 -// CHECK:STDOUT: %return.var.loc3: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -78,7 +78,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 82dc896f0109..ed002fe5309a 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -82,7 +82,7 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc2_14.1 // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc2_22.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %LeftShift.ref: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc4_26: i32 = int_literal 5 [template = constants.%.1] @@ -102,7 +102,7 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -144,12 +144,12 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc4_14.1 // CHECK:STDOUT: %b.loc4_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc4_22.1 -// CHECK:STDOUT: %return.var.loc4: ref i32 = var +// CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %LeftShift.ref.loc8: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index 2ac43adf2c17..e0a0e994dab9 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -56,12 +56,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @Less.%a: i32 = bind_name a, %a.loc2_9.1 // CHECK:STDOUT: %b.loc2_17.1: i32 = param b // CHECK:STDOUT: @Less.%b: i32 = bind_name b, %b.loc2_17.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @Less.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 -// CHECK:STDOUT: %return.var.loc3: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -78,7 +78,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 6d07a58c359e..f0b0d9b3f644 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -56,12 +56,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @LessEq.%a: i32 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: %b.loc2_19.1: i32 = param b // CHECK:STDOUT: @LessEq.%b: i32 = bind_name b, %b.loc2_19.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @LessEq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 -// CHECK:STDOUT: %return.var.loc3: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -78,7 +78,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_32.carbon b/toolchain/check/testdata/builtins/int/make_type_32.carbon index bcd9928d87ec..4824d71c1356 100644 --- a/toolchain/check/testdata/builtins/int/make_type_32.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_32.carbon @@ -27,7 +27,7 @@ var i: Int() = 0; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int: = fn_decl @Int [template] { -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @Int.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 15e533ef2855..af611117f2c6 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -76,7 +76,7 @@ var m: Int(1000000000); // CHECK:STDOUT: %Int: = fn_decl @Int [template] { // CHECK:STDOUT: %n.loc4_8.1: i32 = param n // CHECK:STDOUT: @Int.%n: i32 = bind_name n, %n.loc4_8.1 -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @Int.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -115,7 +115,7 @@ var m: Int(1000000000); // CHECK:STDOUT: %.loc6_24.1: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.2] // CHECK:STDOUT: %.loc6_27: type = value_of_initializer %.loc6_24.1 [template = constants.%.2] // CHECK:STDOUT: %.loc6_24.2: type = converted %.loc6_24.1, %.loc6_27 [template = constants.%.2] -// CHECK:STDOUT: %return.var.loc6: ref i64 = var +// CHECK:STDOUT: @F.%return: ref i64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %Int.ref.loc10_9: = name_ref Int, %import_ref [template = imports.%Int] @@ -130,7 +130,7 @@ var m: Int(1000000000); // CHECK:STDOUT: %.loc10_24.1: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.4] // CHECK:STDOUT: %.loc10_27: type = value_of_initializer %.loc10_24.1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, %.loc10_27 [template = constants.%.4] -// CHECK:STDOUT: %return.var.loc10: ref i13 = var +// CHECK:STDOUT: @G.%return: ref i13 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { // CHECK:STDOUT: %N.loc14_13.1: i32 = param N @@ -147,7 +147,7 @@ var m: Int(1000000000); // CHECK:STDOUT: %.loc14_39.1: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.5] // CHECK:STDOUT: %.loc14_41: type = value_of_initializer %.loc14_39.1 [symbolic = constants.%.5] // CHECK:STDOUT: %.loc14_39.2: type = converted %.loc14_39.1, %.loc14_41 [symbolic = constants.%.5] -// CHECK:STDOUT: %return.var.loc14: ref Core.Int(N) = var +// CHECK:STDOUT: @Symbolic.%return: ref Core.Int(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -215,7 +215,7 @@ var m: Int(1000000000); // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 275a194ebafe..7c568ab6ca28 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -76,7 +76,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: %UInt: = fn_decl @UInt [template] { // CHECK:STDOUT: %n.loc4_9.1: i32 = param n // CHECK:STDOUT: @UInt.%n: i32 = bind_name n, %n.loc4_9.1 -// CHECK:STDOUT: %return.var: ref type = var +// CHECK:STDOUT: @UInt.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -115,7 +115,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: %.loc6_26.1: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.2] // CHECK:STDOUT: %.loc6_29: type = value_of_initializer %.loc6_26.1 [template = constants.%.2] // CHECK:STDOUT: %.loc6_26.2: type = converted %.loc6_26.1, %.loc6_29 [template = constants.%.2] -// CHECK:STDOUT: %return.var.loc6: ref u64 = var +// CHECK:STDOUT: @F.%return: ref u64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %UInt.ref.loc10_9: = name_ref UInt, %import_ref [template = imports.%UInt] @@ -130,7 +130,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: %.loc10_26.1: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.4] // CHECK:STDOUT: %.loc10_29: type = value_of_initializer %.loc10_26.1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, %.loc10_29 [template = constants.%.4] -// CHECK:STDOUT: %return.var.loc10: ref u13 = var +// CHECK:STDOUT: @G.%return: ref u13 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { // CHECK:STDOUT: %N.loc14_13.1: i32 = param N @@ -147,7 +147,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: %.loc14_41.1: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.5] // CHECK:STDOUT: %.loc14_43: type = value_of_initializer %.loc14_41.1 [symbolic = constants.%.5] // CHECK:STDOUT: %.loc14_41.2: type = converted %.loc14_41.1, %.loc14_43 [symbolic = constants.%.5] -// CHECK:STDOUT: %return.var.loc14: ref Core.UInt(N) = var +// CHECK:STDOUT: @Symbolic.%return: ref Core.UInt(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -215,7 +215,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] diff --git a/toolchain/check/testdata/builtins/int/mod.carbon b/toolchain/check/testdata/builtins/int/mod.carbon index 37d9ff9b8fe8..759b5be0795a 100644 --- a/toolchain/check/testdata/builtins/int/mod.carbon +++ b/toolchain/check/testdata/builtins/int/mod.carbon @@ -79,7 +79,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Mod.ref: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.1] @@ -99,7 +99,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -140,19 +140,19 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var.loc4: ref i32 = var +// CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 -// CHECK:STDOUT: %return.var.loc6: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Mod.ref.loc9: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] @@ -231,7 +231,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/mul.carbon b/toolchain/check/testdata/builtins/int/mul.carbon index 16f0b8cee42c..11540e1c7904 100644 --- a/toolchain/check/testdata/builtins/int/mul.carbon +++ b/toolchain/check/testdata/builtins/int/mul.carbon @@ -50,7 +50,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Mul.ref: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] @@ -70,7 +70,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -108,7 +108,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Mul.ref.loc6: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/negate.carbon b/toolchain/check/testdata/builtins/int/negate.carbon index d1a96f9940a9..da0a5857ed83 100644 --- a/toolchain/check/testdata/builtins/int/negate.carbon +++ b/toolchain/check/testdata/builtins/int/negate.carbon @@ -134,7 +134,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc2_11.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.ref.loc4_16: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc4_23: = name_ref Negate, %Negate [template = %Negate] @@ -163,7 +163,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc9_16.1 // CHECK:STDOUT: %b.loc9_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc9_24.1 -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -203,24 +203,24 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 -// CHECK:STDOUT: %return.var.loc13: ref i32 = var +// CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 -// CHECK:STDOUT: %return.var.loc18: ref bool = var +// CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 -// CHECK:STDOUT: %return.var.loc19: ref i32 = var +// CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] // CHECK:STDOUT: %.loc25: init i32 = call %TooFew.ref() @@ -247,7 +247,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 -// CHECK:STDOUT: %return.var.loc46: ref i32 = var +// CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { // CHECK:STDOUT: %a.loc57_23.1: i32 = param a @@ -256,14 +256,14 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc57_31.1 // CHECK:STDOUT: %c.loc57_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc57_39.1 -// CHECK:STDOUT: %return.var.loc57: ref i32 = var +// CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { // CHECK:STDOUT: %a.loc68_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc68_29.1 // CHECK:STDOUT: %b.loc68_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc68_37.1 -// CHECK:STDOUT: %return.var.loc68: ref bool = var +// CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -327,14 +327,14 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc4_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc4_11.1 -// CHECK:STDOUT: %return.var.loc4: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.ref.loc8_14: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: = name_ref Negate, %Negate [template = %Negate] diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index 6594ff2ada31..f1d4b7dcd71a 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -49,7 +49,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @Neq.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Neq.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref bool = var +// CHECK:STDOUT: @Neq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} @@ -66,7 +66,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc12_24.1 -// CHECK:STDOUT: %return.var.loc12: ref bool = var +// CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 16af2b368dd7..80b250cbdfc6 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -38,7 +38,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @Or.%a: i32 = bind_name a, %a.loc2_7.1 // CHECK:STDOUT: %b.loc2_15.1: i32 = param b // CHECK:STDOUT: @Or.%b: i32 = bind_name b, %b.loc2_15.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Or.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Or.ref: = name_ref Or, %Or [template = %Or] // CHECK:STDOUT: %.loc4_19: i32 = int_literal 12 [template = constants.%.1] @@ -58,7 +58,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 6c7ffac3ebaf..ea8089e8a849 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -83,7 +83,7 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc2_15.1 // CHECK:STDOUT: %b.loc2_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc2_23.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RightShift.ref: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc4_27: i32 = int_literal 22 [template = constants.%.1] @@ -103,7 +103,7 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -150,12 +150,12 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc6_15.1 // CHECK:STDOUT: %b.loc6_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc6_23.1 -// CHECK:STDOUT: %return.var.loc6: ref i32 = var +// CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc7_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc7_11.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.ref.loc10_17: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %RightShift.ref.loc10: = name_ref RightShift, %RightShift [template = %RightShift] @@ -228,12 +228,12 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc4_15.1 // CHECK:STDOUT: %b.loc4_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc4_23.1 -// CHECK:STDOUT: %return.var.loc4: ref i32 = var +// CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %RightShift.ref.loc8: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/sub.carbon b/toolchain/check/testdata/builtins/int/sub.carbon index 9fbbe0297c07..9bae30d759d9 100644 --- a/toolchain/check/testdata/builtins/int/sub.carbon +++ b/toolchain/check/testdata/builtins/int/sub.carbon @@ -51,7 +51,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] @@ -71,7 +71,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -110,7 +110,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc4_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Sub.ref.loc6: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.1] diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index c7f9f86f533b..b7bc6d29f21b 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -38,7 +38,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @Xor.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Xor.%b: i32 = bind_name b, %b.loc2_16.1 -// CHECK:STDOUT: %return.var.loc2: ref i32 = var +// CHECK:STDOUT: @Xor.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Xor.ref: = name_ref Xor, %Xor [template = %Xor] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] @@ -58,7 +58,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 3868b6ecf880..7951d0826bd7 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -55,7 +55,7 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: %p.loc20_11.1: Derived* = param p // CHECK:STDOUT: @Access.%p: Derived* = bind_name p, %p.loc20_11.1 // CHECK:STDOUT: %.loc20_30: type = ptr_type i32 [template = constants.%.8] -// CHECK:STDOUT: %return.var: ref i32* = var +// CHECK:STDOUT: @Access.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_qualified.carbon b/toolchain/check/testdata/class/base_method_qualified.carbon index 452c9e8c80fb..73c11914f7ac 100644 --- a/toolchain/check/testdata/class/base_method_qualified.carbon +++ b/toolchain/check/testdata/class/base_method_qualified.carbon @@ -67,27 +67,27 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc21_9.1: Derived = param a // CHECK:STDOUT: @Call.%a: Derived = bind_name a, %a.loc21_9.1 -// CHECK:STDOUT: %return.var.loc21: ref i32 = var +// CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallIndirect: = fn_decl @CallIndirect [template] { // CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %.loc25: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc25_17.1: Derived* = param p // CHECK:STDOUT: @CallIndirect.%p: Derived* = bind_name p, %p.loc25_17.1 -// CHECK:STDOUT: %return.var.loc25: ref i32 = var +// CHECK:STDOUT: @CallIndirect.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %PassDerivedToBase: = fn_decl @PassDerivedToBase [template] { // CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc29_22.1: Derived = param a // CHECK:STDOUT: @PassDerivedToBase.%a: Derived = bind_name a, %a.loc29_22.1 -// CHECK:STDOUT: %return.var.loc29: ref i32 = var +// CHECK:STDOUT: @PassDerivedToBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %PassDerivedToBaseIndirect: = fn_decl @PassDerivedToBaseIndirect [template] { // CHECK:STDOUT: %Derived.ref.loc33: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %.loc33: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc33_30.1: Derived* = param p // CHECK:STDOUT: @PassDerivedToBaseIndirect.%p: Derived* = bind_name p, %p.loc33_30.1 -// CHECK:STDOUT: %return.var.loc33: ref i32 = var +// CHECK:STDOUT: @PassDerivedToBaseIndirect.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index 1807bd695ab1..1c4fb648851a 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -42,10 +42,10 @@ fn Run() -> i32 { // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %n.loc17_12.1: i32 = param n // CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc17_12.1 -// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run: = fn_decl @Run [template] { -// CHECK:STDOUT: %return.var.loc21: ref i32 = var +// CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/compound_field.carbon b/toolchain/check/testdata/class/compound_field.carbon index 80877564ca41..3f986035bd45 100644 --- a/toolchain/check/testdata/class/compound_field.carbon +++ b/toolchain/check/testdata/class/compound_field.carbon @@ -68,13 +68,13 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: %Derived.ref.loc20: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc20_18.1: Derived = param d // CHECK:STDOUT: @AccessDerived.%d: Derived = bind_name d, %d.loc20_18.1 -// CHECK:STDOUT: %return.var.loc20: ref i32 = var +// CHECK:STDOUT: @AccessDerived.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessBase: = fn_decl @AccessBase [template] { // CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc24_15.1: Derived = param d // CHECK:STDOUT: @AccessBase.%d: Derived = bind_name d, %d.loc24_15.1 -// CHECK:STDOUT: %return.var.loc24: ref i32 = var +// CHECK:STDOUT: @AccessBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessDerivedIndirect: = fn_decl @AccessDerivedIndirect [template] { // CHECK:STDOUT: %Derived.ref.loc28: type = name_ref Derived, %Derived.decl [template = constants.%Derived] @@ -82,7 +82,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: %p.loc28_26.1: Derived* = param p // CHECK:STDOUT: @AccessDerivedIndirect.%p: Derived* = bind_name p, %p.loc28_26.1 // CHECK:STDOUT: %.loc28_45: type = ptr_type i32 [template = constants.%.11] -// CHECK:STDOUT: %return.var.loc28: ref i32* = var +// CHECK:STDOUT: @AccessDerivedIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessBaseIndirect: = fn_decl @AccessBaseIndirect [template] { // CHECK:STDOUT: %Derived.ref.loc32: type = name_ref Derived, %Derived.decl [template = constants.%Derived] @@ -90,7 +90,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: %p.loc32_23.1: Derived* = param p // CHECK:STDOUT: @AccessBaseIndirect.%p: Derived* = bind_name p, %p.loc32_23.1 // CHECK:STDOUT: %.loc32_42: type = ptr_type i32 [template = constants.%.11] -// CHECK:STDOUT: %return.var.loc32: ref i32* = var +// CHECK:STDOUT: @AccessBaseIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 4b643f44711f..d87e50bdef9e 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -92,7 +92,7 @@ fn ConvertInit() { // CHECK:STDOUT: @ConvertCToB.%p: C* = bind_name p, %p.loc21_16.1 // CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.14] -// CHECK:STDOUT: %return.var.loc21: ref B* = var +// CHECK:STDOUT: @ConvertCToB.%return: ref B* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA [template] { // CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B] @@ -101,7 +101,7 @@ fn ConvertInit() { // CHECK:STDOUT: @ConvertBToA.%p: B* = bind_name p, %p.loc22_16.1 // CHECK:STDOUT: %A.ref.loc22: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc22_27: type = ptr_type A [template = constants.%.18] -// CHECK:STDOUT: %return.var.loc22: ref A* = var +// CHECK:STDOUT: @ConvertBToA.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA [template] { // CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] @@ -110,7 +110,7 @@ fn ConvertInit() { // CHECK:STDOUT: @ConvertCToA.%p: C* = bind_name p, %p.loc23_16.1 // CHECK:STDOUT: %A.ref.loc23: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc23_27: type = ptr_type A [template = constants.%.18] -// CHECK:STDOUT: %return.var.loc23: ref A* = var +// CHECK:STDOUT: @ConvertCToA.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue [template] { // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] @@ -124,7 +124,7 @@ fn ConvertInit() { // CHECK:STDOUT: @ConvertRef.%c: C* = bind_name c, %c.loc29_15.1 // CHECK:STDOUT: %A.ref.loc29: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc29_26: type = ptr_type A [template = constants.%.18] -// CHECK:STDOUT: %return.var.loc29: ref A* = var +// CHECK:STDOUT: @ConvertRef.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/extend_adapt.carbon b/toolchain/check/testdata/class/extend_adapt.carbon index 7be81f3dfb4a..43818cdd95ac 100644 --- a/toolchain/check/testdata/class/extend_adapt.carbon +++ b/toolchain/check/testdata/class/extend_adapt.carbon @@ -255,7 +255,7 @@ class StructAdapter { // CHECK:STDOUT: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc13_6.1: SomeClassAdapter = param a // CHECK:STDOUT: @F.%a: SomeClassAdapter = bind_name a, %a.loc13_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 487c07b7b7f9..8555098b2b42 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -206,7 +206,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc21: type = ptr_type DeriveFromError [template = constants.%.4] // CHECK:STDOUT: %p.loc21_37.1: DeriveFromError* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%p: DeriveFromError* = bind_name p, %p.loc21_37.1 -// CHECK:STDOUT: %return.var.loc21: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromNonType.decl: type = class_decl @DeriveFromNonType [template = constants.%DeriveFromNonType] {} // CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType [template] { @@ -214,7 +214,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc31: type = ptr_type DeriveFromNonType [template = constants.%.6] // CHECK:STDOUT: %p.loc31_38.1: DeriveFromNonType* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc31_38.1 -// CHECK:STDOUT: %return.var.loc31: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromi32.decl: type = class_decl @DeriveFromi32 [template = constants.%DeriveFromi32] {} // CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 [template] { @@ -223,14 +223,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %p.loc47_24.1: DeriveFromi32* = param p // CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc47_24.1 // CHECK:STDOUT: %.loc47_49: type = ptr_type i32 [template = constants.%.8] -// CHECK:STDOUT: %return.var.loc47: ref i32* = var +// CHECK:STDOUT: @ConvertToBadBasei32.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 [template] { // CHECK:STDOUT: %DeriveFromi32.ref.loc49: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] // CHECK:STDOUT: %.loc49: type = ptr_type DeriveFromi32 [template = constants.%.7] // CHECK:STDOUT: %p.loc49_35.1: DeriveFromi32* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc49_35.1 -// CHECK:STDOUT: %return.var.loc49: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromTuple.decl: type = class_decl @DeriveFromTuple [template = constants.%DeriveFromTuple] {} // CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple [template] { @@ -242,14 +242,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc63_56.1: (type,) = tuple_literal (%Base.ref) // CHECK:STDOUT: %.loc63_56.2: type = converted %.loc63_56.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %.loc63_57: type = ptr_type (Base,) [template = constants.%.15] -// CHECK:STDOUT: %return.var.loc63: ref (Base,)* = var +// CHECK:STDOUT: @ConvertToBadBaseTuple.%return: ref (Base,)* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple [template] { // CHECK:STDOUT: %DeriveFromTuple.ref.loc65: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] // CHECK:STDOUT: %.loc65: type = ptr_type DeriveFromTuple [template = constants.%.14] // CHECK:STDOUT: %p.loc65_37.1: DeriveFromTuple* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc65_37.1 -// CHECK:STDOUT: %return.var.loc65: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromStruct.decl: type = class_decl @DeriveFromStruct [template = constants.%DeriveFromStruct] {} // CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct [template] { @@ -259,14 +259,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @ConvertToBadBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc81_27.1 // CHECK:STDOUT: %.loc81_69: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] // CHECK:STDOUT: %.loc81_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] -// CHECK:STDOUT: %return.var.loc81: ref {.a: i32, .b: i32}* = var +// CHECK:STDOUT: @ConvertToBadBaseStruct.%return: ref {.a: i32, .b: i32}* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct [template] { // CHECK:STDOUT: %DeriveFromStruct.ref.loc84: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] // CHECK:STDOUT: %.loc84: type = ptr_type DeriveFromStruct [template = constants.%.18] // CHECK:STDOUT: %p.loc84_38.1: DeriveFromStruct* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc84_38.1 -// CHECK:STDOUT: %return.var.loc84: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %DeriveFromIncomplete.decl: type = class_decl @DeriveFromIncomplete [template = constants.%DeriveFromIncomplete] {} @@ -277,14 +277,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @ConvertToBadBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc103_31.1 // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc103_70: type = ptr_type Incomplete [template = constants.%.20] -// CHECK:STDOUT: %return.var.loc103: ref Incomplete* = var +// CHECK:STDOUT: @ConvertToBadBaseIncomplete.%return: ref Incomplete* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete [template] { // CHECK:STDOUT: %DeriveFromIncomplete.ref.loc105: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] // CHECK:STDOUT: %.loc105: type = ptr_type DeriveFromIncomplete [template = constants.%.19] // CHECK:STDOUT: %p.loc105_42.1: DeriveFromIncomplete* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc105_42.1 -// CHECK:STDOUT: %return.var.loc105: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromFinal.decl: type = class_decl @DeriveFromFinal [template = constants.%DeriveFromFinal] {} // CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal [template] { @@ -294,21 +294,21 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @ConvertToBadBaseFinal.%p: DeriveFromFinal* = bind_name p, %p.loc116_26.1 // CHECK:STDOUT: %Final.ref: type = name_ref Final, %Final.decl [template = constants.%Final] // CHECK:STDOUT: %.loc116_55: type = ptr_type Final [template = constants.%.25] -// CHECK:STDOUT: %return.var.loc116: ref Final* = var +// CHECK:STDOUT: @ConvertToBadBaseFinal.%return: ref Final* = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc120: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc120: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc120_48.1: DeriveFromFinal* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc120_48.1 -// CHECK:STDOUT: %return.var.loc120: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc124: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc124: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc124_46.1: DeriveFromFinal* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%p: DeriveFromFinal* = bind_name p, %p.loc124_46.1 -// CHECK:STDOUT: %return.var.loc124: ref i32 = var +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index b10d4a39bd6c..73cb7c564f5f 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -46,7 +46,7 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.loc15_15.1: A = param a // CHECK:STDOUT: @AccessBInA.%a: A = bind_name a, %a.loc15_15.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @AccessBInA.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index 79b29a07172f..1b082ceed85d 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -74,7 +74,7 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: @ConvertUnrelated.%p: B2* = bind_name p, %p.loc24_21.1 // CHECK:STDOUT: %A1.ref: type = name_ref A1, %A1.decl [template = constants.%A1] // CHECK:STDOUT: %.loc24_34: type = ptr_type A1 [template = constants.%.9] -// CHECK:STDOUT: %return.var.loc24: ref A1* = var +// CHECK:STDOUT: @ConvertUnrelated.%return: ref A1* = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete [template] { @@ -84,7 +84,7 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: @ConvertIncomplete.%p: Incomplete* = bind_name p, %p.loc31_22.1 // CHECK:STDOUT: %A2.ref: type = name_ref A2, %A2.decl [template = constants.%A2] // CHECK:STDOUT: %.loc31_43: type = ptr_type A2 [template = constants.%.14] -// CHECK:STDOUT: %return.var.loc31: ref A2* = var +// CHECK:STDOUT: @ConvertIncomplete.%return: ref A2* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index b50bbe46fd1c..8e9f0841c587 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -90,43 +90,44 @@ fn Let(p: Class*) { fn TakeIncomplete(c: Class); -// TODO: We should allow this, and only reject calls to the function. -// -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:23: ERROR: Function returns incomplete type `Class`. -// CHECK:STDERR: fn ReturnIncomplete() -> Class; -// CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-91]]:1: Class was forward declared here. -// CHECK:STDERR: class Class; -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fn ReturnIncomplete() -> Class; fn CallTakeIncomplete(p: Class*) { // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+10]]:3: ERROR: Forming value of incomplete type `Class`. // CHECK:STDERR: TakeIncomplete(*p); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-101]]:1: Class was forward declared here. + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-92]]:1: Class was forward declared here. // CHECK:STDERR: class Class; // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-20]]:1: Initializing parameter 1 of function declared here. + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-11]]:1: Initializing parameter 1 of function declared here. // CHECK:STDERR: fn TakeIncomplete(c: Class); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: TakeIncomplete(*p); - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+9]]:3: ERROR: Forming value of incomplete type `Class`. + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+10]]:3: ERROR: Forming value of incomplete type `Class`. // CHECK:STDERR: TakeIncomplete({}); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-113]]:1: Class was forward declared here. + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-104]]:1: Class was forward declared here. // CHECK:STDERR: class Class; // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-32]]:1: Initializing parameter 1 of function declared here. + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-23]]:1: Initializing parameter 1 of function declared here. // CHECK:STDERR: fn TakeIncomplete(c: Class); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: TakeIncomplete({}); } fn CallReturnIncomplete() { + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+9]]:3: ERROR: Function returns incomplete type `Class`. + // CHECK:STDERR: ReturnIncomplete(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-118]]:1: Class was forward declared here. + // CHECK:STDERR: class Class; + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-35]]:23: Return type declared here. + // CHECK:STDERR: fn ReturnIncomplete() -> Class; + // CHECK:STDERR: ^~~~~~~~ ReturnIncomplete(); } @@ -164,21 +165,21 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %global_var: ref = bind_name global_var, %global_var.var // CHECK:STDOUT: %ConvertFromStruct: = fn_decl @ConvertFromStruct [template] { // CHECK:STDOUT: %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %return.var.loc45: ref Class = var +// CHECK:STDOUT: @ConvertFromStruct.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc47: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc47_6.1: Class* = param p // CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc47_6.1 -// CHECK:STDOUT: %return.var.loc47: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess [template] { // CHECK:STDOUT: %Class.ref.loc58: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc58: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc58_17.1: Class* = param p // CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc58_17.1 -// CHECK:STDOUT: %return.var.loc58: ref i32 = var +// CHECK:STDOUT: @MemberAccess.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Copy: = fn_decl @Copy [template] { // CHECK:STDOUT: %Class.ref.loc76_12: type = name_ref Class, %Class.decl [template = constants.%Class] @@ -186,7 +187,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %p.loc76_9.1: Class* = param p // CHECK:STDOUT: @Copy.%p: Class* = bind_name p, %p.loc76_9.1 // CHECK:STDOUT: %Class.ref.loc76_23: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %return.var.loc76: ref Class = var +// CHECK:STDOUT: @Copy.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %Let: = fn_decl @Let [template] { // CHECK:STDOUT: %Class.ref.loc80: type = name_ref Class, %Class.decl [template = constants.%Class] @@ -200,14 +201,14 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc91_19.1 // CHECK:STDOUT: } // CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete [template] { -// CHECK:STDOUT: %Class.ref.loc102: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %return.var.loc102: ref Class = var +// CHECK:STDOUT: %Class.ref.loc93: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: @ReturnIncomplete.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete [template] { -// CHECK:STDOUT: %Class.ref.loc104: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc104: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %p.loc104_23.1: Class* = param p -// CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc104_23.1 +// CHECK:STDOUT: %Class.ref.loc95: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc95: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc95_23.1: Class* = param p +// CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc95_23.1 // CHECK:STDOUT: } // CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete [template] {} // CHECK:STDOUT: } @@ -226,7 +227,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @ConvertFromStruct() -> { +// CHECK:STDOUT: fn @ConvertFromStruct() -> Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc45: {} = struct_literal () // CHECK:STDOUT: return @@ -246,7 +247,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Copy(%p: Class*) -> { +// CHECK:STDOUT: fn @Copy(%p: Class*) -> Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc77: ref Class = deref %p.ref @@ -264,24 +265,24 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @TakeIncomplete(%c: Class); // CHECK:STDOUT: -// CHECK:STDOUT: fn @ReturnIncomplete() -> ; +// CHECK:STDOUT: fn @ReturnIncomplete() -> Class; // CHECK:STDOUT: // CHECK:STDOUT: fn @CallTakeIncomplete(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TakeIncomplete.ref.loc115: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] +// CHECK:STDOUT: %TakeIncomplete.ref.loc106: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc115_18: ref Class = deref %p.ref -// CHECK:STDOUT: %.loc115_17: init () = call %TakeIncomplete.ref.loc115() [template = ] -// CHECK:STDOUT: %TakeIncomplete.ref.loc126: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] -// CHECK:STDOUT: %.loc126_19: {} = struct_literal () -// CHECK:STDOUT: %.loc126_17: init () = call %TakeIncomplete.ref.loc126() [template = ] +// CHECK:STDOUT: %.loc106_18: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc106_17: init () = call %TakeIncomplete.ref.loc106() [template = ] +// CHECK:STDOUT: %TakeIncomplete.ref.loc118: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] +// CHECK:STDOUT: %.loc118_19: {} = struct_literal () +// CHECK:STDOUT: %.loc118_17: init () = call %TakeIncomplete.ref.loc118() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallReturnIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ReturnIncomplete.ref: = name_ref ReturnIncomplete, file.%ReturnIncomplete [template = file.%ReturnIncomplete] -// CHECK:STDOUT: %.loc130: init = call %ReturnIncomplete.ref() +// CHECK:STDOUT: %.loc131: init = call %ReturnIncomplete.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index cd077e568baf..4e6a1fd420b0 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -34,7 +34,7 @@ fn G() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 643dba006bea..c29cf3242fe5 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -11,13 +11,6 @@ class Class { // CHECK:STDERR: fn F(self: Self); - // CHECK:STDERR: fail_self.carbon:[[@LINE+7]]:10: ERROR: Function returns incomplete type `Class`. - // CHECK:STDERR: fn G() -> Self; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_self.carbon:[[@LINE-10]]:1: Class is incomplete within its definition. - // CHECK:STDERR: class Class { - // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fn G() -> Self; } @@ -75,19 +68,19 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F: = fn_decl @F.1 [template] { -// CHECK:STDOUT: %Self.ref.loc28: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc28_12.1: Class = param self -// CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc28_12.1 +// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc21_12.1: Class = param self +// CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc21_12.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc31: = fn_decl @.1 [template] { -// CHECK:STDOUT: %Self.ref.loc31: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: @.1.%return: ref Class = var +// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %Self.ref.loc24: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: @G.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %WrongSelf.decl: type = class_decl @WrongSelf [template = constants.%WrongSelf] {} // CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf [template] { // CHECK:STDOUT: %WrongSelf.ref: type = name_ref WrongSelf, %WrongSelf.decl [template = constants.%WrongSelf] -// CHECK:STDOUT: %ws.loc48_18.1: WrongSelf = param ws -// CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc48_18.1 +// CHECK:STDOUT: %ws.loc41_18.1: WrongSelf = param ws +// CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc41_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -98,7 +91,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %return.var: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -111,8 +104,8 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: class @WrongSelf { // CHECK:STDOUT: %F: = fn_decl @F.2 [template] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %self.loc45_8.1: Class = param self -// CHECK:STDOUT: %self.loc45_8.2: Class = bind_name self, %self.loc45_8.1 +// CHECK:STDOUT: %self.loc38_8.1: Class = param self +// CHECK:STDOUT: %self.loc38_8.2: Class = bind_name self, %self.loc38_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -125,26 +118,24 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G() -> ; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @.1() -> %return: Class { +// CHECK:STDOUT: fn @G() -> %return: Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.var: ref Class = var self // CHECK:STDOUT: %self: ref Class = bind_name self, %self.var // CHECK:STDOUT: %self.ref: ref Class = name_ref self, %self -// CHECK:STDOUT: %.loc41: Class = bind_value %self.ref +// CHECK:STDOUT: %.loc34: Class = bind_value %self.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@WrongSelf.%self.loc45_8.2: Class](); +// CHECK:STDOUT: fn @F.2[@WrongSelf.%self.loc38_8.2: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWrongSelf(%ws: WrongSelf) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ws.ref: WrongSelf = name_ref ws, %ws // CHECK:STDOUT: %F.ref: = name_ref F, @WrongSelf.%F [template = @WrongSelf.%F] -// CHECK:STDOUT: %.loc55_5: = bound_method %ws.ref, %F.ref -// CHECK:STDOUT: %.loc55_7: init () = call %.loc55_5() [template = ] +// CHECK:STDOUT: %.loc48_5: = bound_method %ws.ref, %F.ref +// CHECK:STDOUT: %.loc48_7: init () = call %.loc48_5() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 1bf19d053442..361ca6b9d812 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -39,7 +39,7 @@ fn G() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index c62cde096a13..472fd9ed3efe 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -37,7 +37,7 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc11_6.1: Class = param c // CHECK:STDOUT: @G.%c: Class = bind_name c, %c.loc11_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index 49695784b6d0..01659dcfd313 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -30,7 +30,7 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: @F.%p: Class* = bind_name p, %p.loc9_6.1 // CHECK:STDOUT: %Class.ref.loc9_20: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc9_25: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref Class* = var +// CHECK:STDOUT: @F.%return: ref Class* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index 94745ed3ead3..570966129ea8 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -176,9 +176,9 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Self = constants.%AdaptC // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeC() -> %return: C; +// CHECK:STDOUT: fn @MakeC() -> C; // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeAdaptC() -> %return: AdaptC; +// CHECK:STDOUT: fn @MakeAdaptC() -> AdaptC; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: @@ -276,9 +276,9 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Self = constants.%AdaptC // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeC() -> %return: C; +// CHECK:STDOUT: fn @MakeC() -> C; // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeAdaptC() -> %return: AdaptC; +// CHECK:STDOUT: fn @MakeAdaptC() -> AdaptC; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index e7e6bbb1a30d..4c6d31f90b59 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -34,7 +34,7 @@ fn F() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 670e6f2e7802..cf1c2873b2a1 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -26,8 +26,8 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: %Inner: type = class_type @Inner [template] // CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: type = unbound_element_type Outer, Inner [template] // CHECK:STDOUT: %.5: type = struct_type {.c: Inner, .d: Inner} [template] // CHECK:STDOUT: %.6: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] @@ -78,7 +78,7 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: .d = %.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeInner() -> %return: Inner; +// CHECK:STDOUT: fn @MakeInner() -> Inner; // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeOuter() -> %return: Outer { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index d7a936deb899..397f9d10db96 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -86,49 +86,49 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc16_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc16_12.1 -// CHECK:STDOUT: %return.var.loc16: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Call: = fn_decl @Call [template] { // CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc20_9.1: Class = param c // CHECK:STDOUT: @Call.%c: Class = bind_name c, %c.loc20_9.1 -// CHECK:STDOUT: %return.var.loc20: ref i32 = var +// CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallAlias: = fn_decl @CallAlias [template] { // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc26_14.1: Class = param c // CHECK:STDOUT: @CallAlias.%c: Class = bind_name c, %c.loc26_14.1 -// CHECK:STDOUT: %return.var.loc26: ref i32 = var +// CHECK:STDOUT: @CallAlias.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallOnConstBoundMethod: = fn_decl @CallOnConstBoundMethod [template] { -// CHECK:STDOUT: %return.var.loc30: ref i32 = var +// CHECK:STDOUT: @CallOnConstBoundMethod.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr [template] { -// CHECK:STDOUT: %return.var.loc34: ref i32 = var +// CHECK:STDOUT: @CallWithAddr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer [template] { // CHECK:STDOUT: %Class.ref.loc39: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc39: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %p.loc39_24.1: Class* = param p // CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc39_24.1 -// CHECK:STDOUT: %return.var.loc39: ref i32 = var +// CHECK:STDOUT: @CallFThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer [template] { // CHECK:STDOUT: %Class.ref.loc43: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc43: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %p.loc43_24.1: Class* = param p // CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 -// CHECK:STDOUT: %return.var.loc43: ref i32 = var +// CHECK:STDOUT: @CallGThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Make: = fn_decl @Make [template] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr [template] { -// CHECK:STDOUT: %return.var.loc49: ref i32 = var +// CHECK:STDOUT: @CallFOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr [template] { -// CHECK:STDOUT: %return.var.loc53: ref i32 = var +// CHECK:STDOUT: @CallGOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,7 +253,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: return %.loc44_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Make() -> %return: Class; +// CHECK:STDOUT: fn @Make() -> Class; // CHECK:STDOUT: // CHECK:STDOUT: fn @CallFOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index e3eed5847d27..7529dcb18580 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -45,7 +45,7 @@ fn G(o: Outer) { // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %oi.loc13_6.1: Inner = param oi // CHECK:STDOUT: @F.%oi: Inner = bind_name oi, %oi.loc13_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %Outer.ref.loc17: type = name_ref Outer, %Outer.decl [template = constants.%Outer] diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 47d24a2ab853..b4145e687c72 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -25,10 +25,10 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: %.1: type = ptr_type Class [template] // CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.5: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 561529898633..e472918c27e1 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -29,7 +29,7 @@ fn Class.F() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index f92df7fee878..09f3a384aa34 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -42,7 +42,7 @@ fn Run() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F: = fn_decl @F.2 [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run: = fn_decl @Run [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index 9fb5c0d23d28..e4d908a9a577 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -40,7 +40,7 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc14_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc14_12.1 -// CHECK:STDOUT: %return.var.loc14: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] @@ -48,7 +48,7 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: %self.loc18_17.1: Class* = param self // CHECK:STDOUT: @G.%self: Class* = bind_name self, %self.loc18_17.1 // CHECK:STDOUT: @G.%.loc18: Class* = addr_pattern @G.%self -// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 1bfb278c7d76..df7931048205 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -60,7 +60,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %Base.ref.loc18: type = name_ref Base, %Base.decl [template = constants.%Base] // CHECK:STDOUT: %self.loc18_21.1: Base = param self // CHECK:STDOUT: @SelfBase.%self: Base = bind_name self, %self.loc18_21.1 -// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: @SelfBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] { // CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, %Base.decl [template = constants.%Base] @@ -74,7 +74,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %.loc26: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc26_9.1: Derived* = param p // CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc26_9.1 -// CHECK:STDOUT: %return.var.loc26: ref i32 = var +// CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 9cb64441c2e4..c7bd3fe7eeac 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -6,6 +6,11 @@ class Class { fn F[self: Self]() -> i32; + fn Make() -> Self { + returned var s: Self; + s = {.p = &s}; + return var; + } var p: Self*; } @@ -32,9 +37,9 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc12_12.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc12_12.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: %self.loc17_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc17_12.1 +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -43,31 +48,52 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc8_8.1: Class = param self // CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %.loc9_8: = field_decl p, element0 [template] +// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %return.var.loc9: ref Class = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc14_14: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc14_8: = field_decl p, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .p = %.loc9_8 +// CHECK:STDOUT: .Make = %Make +// CHECK:STDOUT: .p = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %p.ref: = name_ref p, @Class.%.loc9_8 [template = @Class.%.loc9_8] -// CHECK:STDOUT: %.loc13_16.1: ref Class* = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc13_16.2: Class* = bind_value %.loc13_16.1 -// CHECK:STDOUT: %.loc13_11.1: ref Class = deref %.loc13_16.2 +// CHECK:STDOUT: %p.ref: = name_ref p, @Class.%.loc14_8 [template = @Class.%.loc14_8] +// CHECK:STDOUT: %.loc18_16.1: ref Class* = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc18_16.2: Class* = bind_value %.loc18_16.1 +// CHECK:STDOUT: %.loc18_11.1: ref Class = deref %.loc18_16.2 // CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc13_19: = bound_method %.loc13_11.1, %F.ref -// CHECK:STDOUT: %.loc13_11.2: Class = bind_value %.loc13_11.1 -// CHECK:STDOUT: %.loc13_21.1: init i32 = call %.loc13_19(%.loc13_11.2) -// CHECK:STDOUT: %.loc13_23: i32 = value_of_initializer %.loc13_21.1 -// CHECK:STDOUT: %.loc13_21.2: i32 = converted %.loc13_21.1, %.loc13_23 -// CHECK:STDOUT: return %.loc13_21.2 +// CHECK:STDOUT: %.loc18_19: = bound_method %.loc18_11.1, %F.ref +// CHECK:STDOUT: %.loc18_11.2: Class = bind_value %.loc18_11.1 +// CHECK:STDOUT: %.loc18_21.1: init i32 = call %.loc18_19(%.loc18_11.2) +// CHECK:STDOUT: %.loc18_23: i32 = value_of_initializer %.loc18_21.1 +// CHECK:STDOUT: %.loc18_21.2: i32 = converted %.loc18_21.1, %.loc18_23 +// CHECK:STDOUT: return %.loc18_21.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Make() -> @Class.%return.var.loc9: Class { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %s: ref Class = bind_name s, @Class.%return.var.loc9 +// CHECK:STDOUT: %s.ref.loc11_5: ref Class = name_ref s, %s +// CHECK:STDOUT: %s.ref.loc11_16: ref Class = name_ref s, %s +// CHECK:STDOUT: %.loc11_15: Class* = addr_of %s.ref.loc11_16 +// CHECK:STDOUT: %.loc11_17.1: {.p: Class*} = struct_literal (%.loc11_15) +// CHECK:STDOUT: %.loc11_17.2: ref Class* = class_element_access %s.ref.loc11_5, element0 +// CHECK:STDOUT: %.loc11_17.3: init Class* = initialize_from %.loc11_15 to %.loc11_17.2 +// CHECK:STDOUT: %.loc11_17.4: init Class = class_init (%.loc11_17.3), %s.ref.loc11_5 +// CHECK:STDOUT: %.loc11_17.5: init Class = converted %.loc11_17.1, %.loc11_17.4 +// CHECK:STDOUT: assign %s.ref.loc11_5, %.loc11_17.5 +// CHECK:STDOUT: return %s // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 88c53a283e0f..e0aa8315442a 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -31,7 +31,7 @@ fn Run() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %Run: = fn_decl @Run [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/basic.carbon b/toolchain/check/testdata/const/basic.carbon index 081d48eadc6e..0980deaa44c2 100644 --- a/toolchain/check/testdata/const/basic.carbon +++ b/toolchain/check/testdata/const/basic.carbon @@ -38,7 +38,7 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: %.loc7_25: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.2] // CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.3] -// CHECK:STDOUT: %return.var.loc7: ref const i32** = var +// CHECK:STDOUT: @A.%return: ref const i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { // CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.4] @@ -47,7 +47,7 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc11_6.1 // CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.5] -// CHECK:STDOUT: %return.var.loc11: ref const (i32*) = var +// CHECK:STDOUT: @B.%return: ref const (i32*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 6311c918dd55..89484288ebb7 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -36,7 +36,7 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: %.loc11_25: type = const_type const i32 [template = constants.%.1] // CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.2] // CHECK:STDOUT: %.loc11_43: type = ptr_type const i32* [template = constants.%.3] -// CHECK:STDOUT: %return.var: ref const i32** = var +// CHECK:STDOUT: @F.%return: ref const i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 2391809c7f08..02eb40d21f2e 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -40,7 +40,7 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc11_6.1 // CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %.loc11_37: type = ptr_type i32* [template = constants.%.5] -// CHECK:STDOUT: %return.var: ref i32** = var +// CHECK:STDOUT: @G.%return: ref i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 0f34fdbda3bf..4309fd1c3d2a 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -39,7 +39,7 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %.loc4: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref const i32 = var +// CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc6: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: %a_ref.var: ref const i32 = var a_ref diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index 005174a73c34..8484fa8aabd7 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -44,11 +44,11 @@ fn H() -> i32 { // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %H: = fn_decl @H [template] { -// CHECK:STDOUT: %return.var.loc15: ref i32 = var +// CHECK:STDOUT: @H.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: (i32, i32); +// CHECK:STDOUT: fn @F() -> (i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index cf0a5ac94676..c878044811b9 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -30,7 +30,7 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.1] diff --git a/toolchain/check/testdata/function/builtin/definition.carbon b/toolchain/check/testdata/function/builtin/definition.carbon index 47166f95b199..f6b839576a21 100644 --- a/toolchain/check/testdata/function/builtin/definition.carbon +++ b/toolchain/check/testdata/function/builtin/definition.carbon @@ -19,7 +19,7 @@ fn Add(a: i32, b: i32) -> i32 = "int.add"; // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index 2c2f8fa1d7ed..9261586ae136 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -55,7 +55,7 @@ fn C(n: i32, m: i32) -> i32 = "int.add"; // CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc15_6.1 // CHECK:STDOUT: %m.loc15_14.1: i32 = param m // CHECK:STDOUT: @A.%m: i32 = bind_name m, %m.loc15_14.1 -// CHECK:STDOUT: %return.var.loc15: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %B.loc17: = fn_decl @B [template] { // CHECK:STDOUT: %n.loc17_6.1: i32 = param n @@ -69,7 +69,7 @@ fn C(n: i32, m: i32) -> i32 = "int.add"; // CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc25_6.1 // CHECK:STDOUT: %m.loc25_14.1: i32 = param m // CHECK:STDOUT: @B.%m: i32 = bind_name m, %m.loc25_14.1 -// CHECK:STDOUT: %return.var.loc25: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C.loc27: = fn_decl @C [template] { // CHECK:STDOUT: %n.loc27_6.1: i32 = param n @@ -83,7 +83,7 @@ fn C(n: i32, m: i32) -> i32 = "int.add"; // CHECK:STDOUT: @C.%n: i32 = bind_name n, %n.loc34_6.1 // CHECK:STDOUT: %m.loc34_14.1: i32 = param m // CHECK:STDOUT: @C.%m: i32 = bind_name m, %m.loc34_14.1 -// CHECK:STDOUT: %return.var.loc34: ref i32 = var +// CHECK:STDOUT: @C.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/import.carbon b/toolchain/check/testdata/function/builtin/import.carbon index 863d96d6c3e8..34ee00cb1faa 100644 --- a/toolchain/check/testdata/function/builtin/import.carbon +++ b/toolchain/check/testdata/function/builtin/import.carbon @@ -29,7 +29,7 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc6_8.1 // CHECK:STDOUT: %b.loc6_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc6_16.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/alias.carbon b/toolchain/check/testdata/function/call/alias.carbon index b5d5e55d688d..0f32b5a2a588 100644 --- a/toolchain/check/testdata/function/call/alias.carbon +++ b/toolchain/check/testdata/function/call/alias.carbon @@ -27,7 +27,7 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %A.ref: = name_ref A, %A [template = %A] // CHECK:STDOUT: %B: = bind_alias B, %A [template = %A] diff --git a/toolchain/check/testdata/function/call/empty_struct.carbon b/toolchain/check/testdata/function/call/empty_struct.carbon index f8f2a4429110..fa094d5241a2 100644 --- a/toolchain/check/testdata/function/call/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/empty_struct.carbon @@ -34,7 +34,7 @@ fn Main() { // CHECK:STDOUT: @Echo.%a: {} = bind_name a, %a.loc7_9.1 // CHECK:STDOUT: %.loc7_20.1: {} = struct_literal () // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref {} = var +// CHECK:STDOUT: @Echo.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main: = fn_decl @Main [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/empty_tuple.carbon b/toolchain/check/testdata/function/call/empty_tuple.carbon index 86fcf98e66d1..7878d89b4669 100644 --- a/toolchain/check/testdata/function/call/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/empty_tuple.carbon @@ -33,7 +33,7 @@ fn Main() { // CHECK:STDOUT: @Echo.%a: () = bind_name a, %a.loc7_9.1 // CHECK:STDOUT: %.loc7_20.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref () = var +// CHECK:STDOUT: @Echo.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main: = fn_decl @Main [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index 9a06b12e8b08..7e833bdb5e0a 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -27,7 +27,7 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { -// CHECK:STDOUT: %return.var: ref f64 = var +// CHECK:STDOUT: @Foo.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run: = fn_decl @Run [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 39282a10fad3..3a599e852bca 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -28,7 +28,7 @@ fn Main() { // CHECK:STDOUT: %Echo: = fn_decl @Echo [template] { // CHECK:STDOUT: %a.loc7_9.1: i32 = param a // CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Echo.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main: = fn_decl @Main [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon new file mode 100644 index 000000000000..34344e90062d --- /dev/null +++ b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon @@ -0,0 +1,205 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE + +// --- fail_incomplete_return.carbon + +library "api" api; + +class C; +class D; + +fn ReturnCUnused() -> C; +fn ReturnCUsed() -> C; +fn ReturnDUnused() -> D; +fn ReturnDUsed() -> D; + +fn Call() { + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+10]]:3: ERROR: Function returns incomplete type `C`. + // CHECK:STDERR: ReturnCUsed(); + // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-12]]:1: Class was forward declared here. + // CHECK:STDERR: class C; + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-11]]:18: Return type declared here. + // CHECK:STDERR: fn ReturnCUsed() -> C; + // CHECK:STDERR: ^~~~ + // CHECK:STDERR: + ReturnCUsed(); + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+10]]:3: ERROR: Function returns incomplete type `D`. + // CHECK:STDERR: ReturnDUsed(); + // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-22]]:1: Class was forward declared here. + // CHECK:STDERR: class D; + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-20]]:18: Return type declared here. + // CHECK:STDERR: fn ReturnDUsed() -> D; + // CHECK:STDERR: ^~~~ + // CHECK:STDERR: + ReturnDUsed(); +} + +class D {} + +// --- fail_use_imported.carbon + +library "use_imported" api; + +import library "api"; + +fn CallFAndGIncomplete() { + // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+15]]:3: ERROR: Function returns incomplete type `C`. + // CHECK:STDERR: ReturnCUnused(); + // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-6]]:1: In import. + // CHECK:STDERR: import library "api"; + // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:4:1: Class was forward declared here. + // CHECK:STDERR: class C; + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_use_imported.carbon:[[@LINE-12]]:1: In import. + // CHECK:STDERR: import library "api"; + // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_incomplete_return.carbon:7:20: Return type declared here. + // CHECK:STDERR: fn ReturnCUnused() -> C; + // CHECK:STDERR: ^~~~ + ReturnCUnused(); + ReturnCUsed(); + ReturnDUnused(); + ReturnDUsed(); +} + +// CHECK:STDOUT: --- fail_incomplete_return.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = %Core +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl.loc5 +// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused +// CHECK:STDOUT: .ReturnCUsed = %ReturnCUsed +// CHECK:STDOUT: .ReturnDUnused = %ReturnDUnused +// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed +// CHECK:STDOUT: .Call = %Call +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %D.decl.loc5: type = class_decl @D [template = constants.%D] {} +// CHECK:STDOUT: %ReturnCUnused: = fn_decl @ReturnCUnused [template] { +// CHECK:STDOUT: %C.ref.loc7: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: @ReturnCUnused.%return: ref C = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %ReturnCUsed: = fn_decl @ReturnCUsed [template] { +// CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: @ReturnCUsed.%return: ref C = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %ReturnDUnused: = fn_decl @ReturnDUnused [template] { +// CHECK:STDOUT: %D.ref.loc9: type = name_ref D, %D.decl.loc5 [template = constants.%D] +// CHECK:STDOUT: @ReturnDUnused.%return: ref D = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %ReturnDUsed: = fn_decl @ReturnDUsed [template] { +// CHECK:STDOUT: %D.ref.loc10: type = name_ref D, %D.decl.loc5 [template = constants.%D] +// CHECK:STDOUT: @ReturnDUsed.%return: ref D = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %Call: = fn_decl @Call [template] {} +// CHECK:STDOUT: %D.decl.loc37: type = class_decl @D [template = constants.%D] {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @C; +// CHECK:STDOUT: +// CHECK:STDOUT: class @D { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%D +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnCUnused() -> C; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnCUsed() -> C; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnDUnused() -> D; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnDUsed() -> D; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Call() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%ReturnCUsed [template = file.%ReturnCUsed] +// CHECK:STDOUT: %.loc23: init = call %ReturnCUsed.ref() +// CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%ReturnDUsed [template = file.%ReturnDUsed] +// CHECK:STDOUT: %.loc34: init = call %ReturnDUsed.ref() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_use_imported.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .C = %import_ref.1 +// CHECK:STDOUT: .D = %import_ref.2 +// CHECK:STDOUT: .ReturnCUnused = %import_ref.3 +// CHECK:STDOUT: .ReturnCUsed = %import_ref.4 +// CHECK:STDOUT: .ReturnDUnused = %import_ref.5 +// CHECK:STDOUT: .ReturnDUsed = %import_ref.6 +// CHECK:STDOUT: .Call = %import_ref.7 +// CHECK:STDOUT: .Core = %Core +// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1 = import_ref ir2, inst+2, unloaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+4, unloaded +// CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+8, loc_14 [template = imports.%ReturnCUnused] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+11, loc_18 [template = imports.%ReturnCUsed] +// CHECK:STDOUT: %import_ref.5: = import_ref ir2, inst+14, loc_22 [template = imports.%ReturnDUnused] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+17, loc_26 [template = imports.%ReturnDUsed] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+18, unloaded +// CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %CallFAndGIncomplete: = fn_decl @CallFAndGIncomplete [template] {} +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+5, unloaded +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @C; +// CHECK:STDOUT: +// CHECK:STDOUT: class @D { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = file.%import_ref.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @CallFAndGIncomplete() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %C.decl: invalid = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %ReturnCUnused.ref: = name_ref ReturnCUnused, file.%import_ref.3 [template = imports.%ReturnCUnused] +// CHECK:STDOUT: %.loc22: init = call %ReturnCUnused.ref() +// CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%import_ref.4 [template = imports.%ReturnCUsed] +// CHECK:STDOUT: %.loc23: init = call %ReturnCUsed.ref() +// CHECK:STDOUT: %D.decl: invalid = class_decl @D [template = constants.%D] {} +// CHECK:STDOUT: %ReturnDUnused.ref: = name_ref ReturnDUnused, file.%import_ref.5 [template = imports.%ReturnDUnused] +// CHECK:STDOUT: %.loc24_16.1: ref D = temporary_storage +// CHECK:STDOUT: %.loc24_16.2: init D = call %ReturnDUnused.ref() to %.loc24_16.1 +// CHECK:STDOUT: %.loc24_16.3: ref D = temporary %.loc24_16.1, %.loc24_16.2 +// CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%import_ref.6 [template = imports.%ReturnDUsed] +// CHECK:STDOUT: %.loc25: init = call %ReturnDUsed.ref() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnCUnused() -> C; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnCUsed() -> C; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnDUnused() -> D; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @ReturnDUsed() -> D; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index 36d3058cf0ca..7f07ddeb22d8 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -211,7 +211,7 @@ import library "extern_api"; // CHECK:STDOUT: %B: = fn_decl @B [template] { // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C: = fn_decl @C [template] { // CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) @@ -219,7 +219,7 @@ import library "extern_api"; // CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.3] -// CHECK:STDOUT: %return.var.loc6: ref {.c: i32} = var +// CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %D: = fn_decl @D [template] {} // CHECK:STDOUT: %NS: = namespace [template] { @@ -260,7 +260,7 @@ import library "extern_api"; // CHECK:STDOUT: %B: = fn_decl @B [template] { // CHECK:STDOUT: %b.loc5_13.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_13.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C: = fn_decl @C [template] { // CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (i32) @@ -268,7 +268,7 @@ import library "extern_api"; // CHECK:STDOUT: %c.loc6_13.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_13.1 // CHECK:STDOUT: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.3] -// CHECK:STDOUT: %return.var.loc6: ref {.c: i32} = var +// CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %D: = fn_decl @D [template] {} // CHECK:STDOUT: %NS: = namespace [template] { @@ -870,7 +870,7 @@ import library "extern_api"; // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %.loc25: = fn_decl @.1 [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon index caf59a7833cc..37bacfc7f592 100644 --- a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon @@ -101,17 +101,17 @@ fn K() -> bool { return false; } // CHECK:STDOUT: } // CHECK:STDOUT: %I: = fn_decl @I [template] {} // CHECK:STDOUT: %.loc45: = fn_decl @.4 [template] { -// CHECK:STDOUT: %return.var.loc45: ref i32 = var +// CHECK:STDOUT: @.4.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %J: = fn_decl @J [template] { -// CHECK:STDOUT: %return.var.loc47: ref i32 = var +// CHECK:STDOUT: @J.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc55: = fn_decl @.5 [template] {} // CHECK:STDOUT: %K: = fn_decl @K [template] { -// CHECK:STDOUT: %return.var.loc57: ref i32 = var +// CHECK:STDOUT: @K.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc64: = fn_decl @.6 [template] { -// CHECK:STDOUT: %return.var.loc64: ref bool = var +// CHECK:STDOUT: @.6.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index eaf4fbd2e838..d43b4c6ee76c 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -112,7 +112,7 @@ fn D() {} // CHECK:STDOUT: %B: = fn_decl @B [template] { // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 -// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C: = fn_decl @C [template] { // CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) @@ -120,7 +120,7 @@ fn D() {} // CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.3] -// CHECK:STDOUT: %return.var.loc6: ref {.c: i32} = var +// CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %D: = fn_decl @D [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/type_param_scope.carbon b/toolchain/check/testdata/function/generic/type_param_scope.carbon index e3dd4308445d..a27fb95d3785 100644 --- a/toolchain/check/testdata/function/generic/type_param_scope.carbon +++ b/toolchain/check/testdata/function/generic/type_param_scope.carbon @@ -24,7 +24,7 @@ fn F(T:! type, n: T) -> T { // CHECK:STDOUT: %n.loc7_16.1: T = param n // CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc7_16.1 // CHECK:STDOUT: %T.ref.loc7_25: type = name_ref T, @F.%T [symbolic = @F.%T] -// CHECK:STDOUT: %return.var: ref T = var +// CHECK:STDOUT: @F.%return: ref T = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index 1397ada77fd7..ffbd18aa0155 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -24,7 +24,7 @@ var a: i32 = test_a(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %test_a: = fn_decl @test_a [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @test_a.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 8d8feaaec23d..d0619ee2dcf5 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -53,17 +53,17 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: %If1: = fn_decl @If1 [template] { // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc7_8.1 -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @If1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %If2: = fn_decl @If2 [template] { // CHECK:STDOUT: %b.loc18_8.1: bool = param b // CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc18_8.1 -// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: @If2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %If3: = fn_decl @If3 [template] { // CHECK:STDOUT: %b.loc29_8.1: bool = param b // CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc29_8.1 -// CHECK:STDOUT: %return.var.loc29: ref i32 = var +// CHECK:STDOUT: @If3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index 486f9c497a92..77e7fa6499ee 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -30,7 +30,7 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: %VarScope: = fn_decl @VarScope [template] { // CHECK:STDOUT: %b.loc7_13.1: bool = param b // CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc7_13.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @VarScope.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index a14c1221d9c4..31826e8a0e78 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -29,7 +29,7 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: %If: = fn_decl @If [template] { // CHECK:STDOUT: %b.loc7_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc7_7.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @If.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index ea87c08d6bf8..ae5b282bc03b 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -33,7 +33,7 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc7_15.1 // CHECK:STDOUT: %m.loc7_23.1: i32 = param m // CHECK:STDOUT: @F.%m: i32 = bind_name m, %m.loc7_23.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index 9a0dc84a50f5..cc348615a28e 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -49,24 +49,24 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc10: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc14: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Constant: = fn_decl @Constant [template] { -// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: @Constant.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %PartiallyConstant: = fn_decl @PartiallyConstant [template] { // CHECK:STDOUT: %t.loc24_22.1: type = param t // CHECK:STDOUT: @PartiallyConstant.%t: type = bind_name t, %t.loc24_22.1 -// CHECK:STDOUT: %return.var.loc24: ref i32 = var +// CHECK:STDOUT: @PartiallyConstant.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 3b36c7478755..76811e0b442e 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -27,15 +27,15 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %b.loc10_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc10_6.1 -// CHECK:STDOUT: %return.var.loc10: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index 51f7d7ed1d46..77d389c0b3fa 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -30,7 +30,7 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_15.1 // CHECK:STDOUT: %c.loc7_24.1: bool = param c // CHECK:STDOUT: @F.%c: bool = bind_name c, %c.loc7_24.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index 97c0bf7dd267..8d505402ea8c 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -155,12 +155,12 @@ class FDifferentImplicitParamType { class FDifferentReturnType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:31: ERROR: Function returns incomplete type `FDifferentReturnType`. + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: ERROR: Function redeclaration differs because return type is `FDifferentReturnType`. // CHECK:STDERR: fn F[self: bool](b: bool) -> Self; - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-5]]:1: Class is incomplete within its definition. - // CHECK:STDERR: class FDifferentReturnType { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-72]]:15: Previously declared with return type `bool`. + // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; } + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fn F[self: bool](b: bool) -> Self; } @@ -186,12 +186,12 @@ interface SelfNested { class SelfNestedBadParam { impl as SelfNested { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:56: ERROR: Function returns incomplete type `[SelfNestedBadParam; 4]`. + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: ERROR: Function redeclaration differs at parameter 1. // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-5]]:1: Class is incomplete within its definition. - // CHECK:STDERR: class SelfNestedBadParam { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: ^ + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:8: Previous declaration's corresponding parameter here. + // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4]; + // CHECK:STDERR: ^ // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; } @@ -240,22 +240,20 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.12: type = tuple_type (Self*, {.x: Self, .y: i32}) [symbolic] // CHECK:STDOUT: %.13: i32 = int_literal 4 [template] // CHECK:STDOUT: %.14: type = array_type %.13, Self [symbolic] -// CHECK:STDOUT: %.15: type = ptr_type [Self; 4] [symbolic] -// CHECK:STDOUT: %.16: type = assoc_entity_type @SelfNested, [template] -// CHECK:STDOUT: %.17: in SelfNested> = assoc_entity element0, @SelfNested.%F [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type @SelfNested, [template] +// CHECK:STDOUT: %.16: in SelfNested> = assoc_entity element0, @SelfNested.%F [template] // CHECK:STDOUT: %SelfNestedBadParam: type = class_type @SelfNestedBadParam [template] -// CHECK:STDOUT: %.18: type = ptr_type SelfNestedBadParam [template] -// CHECK:STDOUT: %.19: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.20: type = tuple_type (SelfNestedBadParam*, {.x: i32, .y: i32}) [template] -// CHECK:STDOUT: %.21: type = array_type %.13, SelfNestedBadParam [template] +// CHECK:STDOUT: %.17: type = ptr_type SelfNestedBadParam [template] +// CHECK:STDOUT: %.18: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.19: type = tuple_type (SelfNestedBadParam*, {.x: i32, .y: i32}) [template] +// CHECK:STDOUT: %.20: type = array_type %.13, SelfNestedBadParam [template] +// CHECK:STDOUT: %.21: type = struct_type {.x: SelfNestedBadParam, .y: i32} [template] +// CHECK:STDOUT: %.22: type = tuple_type (SelfNestedBadParam*, {.x: SelfNestedBadParam, .y: i32}) [template] // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.22: type = ptr_type SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.23: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template] -// CHECK:STDOUT: %.24: type = tuple_type (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) [template] -// CHECK:STDOUT: %.25: type = tuple_type () [template] -// CHECK:STDOUT: %.26: type = ptr_type {} [template] -// CHECK:STDOUT: %.27: type = ptr_type [SelfNestedBadParam; 4] [template] -// CHECK:STDOUT: %.28: type = array_type %.13, SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.23: type = ptr_type SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.24: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template] +// CHECK:STDOUT: %.25: type = tuple_type (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) [template] +// CHECK:STDOUT: %.26: type = array_type %.13, SelfNestedBadReturnType [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -353,7 +351,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.loc184_52: type = array_type %.loc184_51, Self [symbolic = constants.%.14] // CHECK:STDOUT: %return.var: ref [Self; 4] = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc184_53: in SelfNested> = assoc_entity element0, %F [template = constants.%.17] +// CHECK:STDOUT: %.loc184_53: in SelfNested> = assoc_entity element0, %F [template = constants.%.16] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -529,15 +527,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.14: SelfNestedBadParam as SelfNested { // CHECK:STDOUT: %F: = fn_decl @F.14 [template] { // CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.18] -// CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19] +// CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.17] +// CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.18] // CHECK:STDOUT: %.loc196_53.1: (type, type) = tuple_literal (%.loc196_32, %.loc196_52) -// CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.20 [template = constants.%.20] +// CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.19 [template = constants.%.19] // CHECK:STDOUT: %x.loc196_10.1: (SelfNestedBadParam*, {.x: i32, .y: i32}) = param x // CHECK:STDOUT: %x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32}) = bind_name x, %x.loc196_10.1 // CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] // CHECK:STDOUT: %.loc196_80: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc196_81: type = array_type %.loc196_80, SelfNestedBadParam [template = constants.%.21] +// CHECK:STDOUT: %.loc196_81: type = array_type %.loc196_80, SelfNestedBadParam [template = constants.%.20] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -550,16 +548,16 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.15: SelfNestedBadReturnType as SelfNested { // CHECK:STDOUT: %F: = fn_decl @F.15 [template] { // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.22] +// CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.23] // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.23] +// CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.24] // CHECK:STDOUT: %.loc208_78.1: (type, type) = tuple_literal (%.loc208_37, %.loc208_77) -// CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.24 [template = constants.%.24] +// CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.25 [template = constants.%.25] // CHECK:STDOUT: %x.loc208_10.1: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = param x // CHECK:STDOUT: %x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = bind_name x, %x.loc208_10.1 // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] // CHECK:STDOUT: %.loc208_105: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc208_106: type = array_type %.loc208_105, SelfNestedBadParam [template = constants.%.21] +// CHECK:STDOUT: %.loc208_106: type = array_type %.loc208_105, SelfNestedBadParam [template = constants.%.20] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -728,13 +726,13 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.10[@impl.11.%self.loc152_10.2: FDifferentImplicitParamType](@impl.11.%b.loc152_22.2: bool) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.11[@impl.12.%self.loc165_10.2: bool](@impl.12.%b.loc165_22.2: bool) -> ; +// CHECK:STDOUT: fn @F.11[@impl.12.%self.loc165_10.2: bool](@impl.12.%b.loc165_22.2: bool) -> FDifferentReturnType; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.12[@impl.13.%self.loc179_10.2: bool](@impl.13.%not_b.loc179_22.2: bool) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc184_8.2: (Self*, {.x: Self, .y: i32})) -> @SelfNested.%return.var: [Self; 4]; +// CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc184_8.2: (Self*, {.x: Self, .y: i32})) -> [Self; 4]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.14(@impl.14.%x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> ; +// CHECK:STDOUT: fn @F.14(@impl.14.%x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.15(@impl.15.%x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> @impl.15.%return.var: [SelfNestedBadParam; 4]; +// CHECK:STDOUT: fn @F.15(@impl.15.%x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index 2ed4970fcc64..bf382f750019 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -46,7 +46,7 @@ impl C as I { // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %F: = fn_decl @F.2 [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] diff --git a/toolchain/check/testdata/impl/lookup/instance_method.carbon b/toolchain/check/testdata/impl/lookup/instance_method.carbon index ab96e69b28ca..3f390137a68d 100644 --- a/toolchain/check/testdata/impl/lookup/instance_method.carbon +++ b/toolchain/check/testdata/impl/lookup/instance_method.carbon @@ -48,7 +48,7 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl.loc7 [template = constants.%C] // CHECK:STDOUT: %c.loc19_6.1: C = param c // CHECK:STDOUT: @F.3.%c: C = bind_name c, %c.loc19_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/self_in_signature.carbon b/toolchain/check/testdata/impl/self_in_signature.carbon index 28d626e9e332..b9b04966c278 100644 --- a/toolchain/check/testdata/impl/self_in_signature.carbon +++ b/toolchain/check/testdata/impl/self_in_signature.carbon @@ -41,9 +41,9 @@ impl D as SelfNested { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] -// CHECK:STDOUT: %.6: type = ptr_type {} [template] -// CHECK:STDOUT: %.7: = interface_witness (@impl.1.%F) [template] +// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%F) [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %.7: type = ptr_type {} [template] // CHECK:STDOUT: %.8: C = struct_value () [template] // CHECK:STDOUT: %.9: = interface_witness (@impl.2.%F) [template] // CHECK:STDOUT: %.10: D = struct_value () [template] @@ -156,7 +156,7 @@ impl D as SelfNested { // CHECK:STDOUT: %C.ref.loc16_26: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.7] +// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 21632dd49be4..c7b02b71e0e0 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -66,7 +66,7 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: [i32; 3]; +// CHECK:STDOUT: fn @F() -> [i32; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index 737e84bc4aeb..4d737865810a 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -63,7 +63,7 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: [i32; 3]; +// CHECK:STDOUT: fn @F() -> [i32; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index 1c20097d61ab..30faa78c2ac5 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -29,10 +29,10 @@ fn Run() -> i32 { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %return.var.loc7: ref (i32,) = var +// CHECK:STDOUT: @F.%return: ref (i32,) = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run: = fn_decl @Run [template] { -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon index eb4a859743c2..7643f84367d9 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon @@ -57,7 +57,7 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.add"; // CHECK:STDOUT: @.2.%a: i32 = bind_name a, %a.loc36_16.1 // CHECK:STDOUT: %b.loc36_24.1: i32 = param b // CHECK:STDOUT: @.2.%b: i32 = bind_name b, %b.loc36_24.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 3e6cadd79ce1..13d488b7f34b 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -30,7 +30,7 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index 5dd61adedbe6..fe799caa4289 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -33,7 +33,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %a.loc8_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc8_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index 88f9368d3b7e..484d88ddfec9 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -23,7 +23,7 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7 // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index dcff86bbfc79..c3787578901e 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -20,7 +20,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index 9cbac716b45f..50e5cfb9e262 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -25,7 +25,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a.loc7: i32 = bind_name a, %a.loc7_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index ec08361704d1..dd740d0bd153 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -47,7 +47,7 @@ var a: i32 = NS.A(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index cfc6588f5954..71c9a465d976 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -38,16 +38,16 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: %NS.ref.loc9: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %return.var.loc13: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %A.ref: = name_ref A, %A [template = %A] // CHECK:STDOUT: %C: = bind_alias C, %A [template = %A] // CHECK:STDOUT: %D: = fn_decl @D [template] { -// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: @D.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index a6578c366f12..aa788580154b 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -34,7 +34,7 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %NS.ref: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] // CHECK:STDOUT: %.loc18: = fn_decl @.1 [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index de358c87b49b..2527eb1e1929 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -48,7 +48,7 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: .B = %B // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index 41e49a3cffe4..ae03cfd17c8c 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -42,13 +42,13 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %And: = fn_decl @And [template] { -// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: @And.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Constant: = fn_decl @Constant [template] {} // CHECK:STDOUT: %PartialConstant: = fn_decl @PartialConstant [template] { diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 34d716ff09ba..d542b9101944 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -81,7 +81,7 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main: = fn_decl @Main [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index 0084fac9ac70..6dfbdc1e4fb4 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -34,7 +34,7 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main: = fn_decl @Main [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index f733c77995e7..7ebe68f9aac4 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -39,7 +39,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index b0afb3333740..494c010e2212 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -29,7 +29,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index 1e21d2548f07..b562fa1910cb 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -42,13 +42,13 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Or: = fn_decl @Or [template] { -// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: @Or.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Constant: = fn_decl @Constant [template] {} // CHECK:STDOUT: %PartialConstant: = fn_decl @PartialConstant [template] { diff --git a/toolchain/check/testdata/operators/builtin/unary_op.carbon b/toolchain/check/testdata/operators/builtin/unary_op.carbon index 70f62308ddc4..b522871f4f95 100644 --- a/toolchain/check/testdata/operators/builtin/unary_op.carbon +++ b/toolchain/check/testdata/operators/builtin/unary_op.carbon @@ -35,7 +35,7 @@ fn Constant() { // CHECK:STDOUT: %Not: = fn_decl @Not [template] { // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc7_8.1 -// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: @Not.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index 322d149d63fd..219ba319f6af 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Add [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @AddAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index b701a1d4a5f5..b7da6f4e3160 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitAnd [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @BitAndAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index e04cbbd27ddf..17d029c64bf8 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -76,9 +76,9 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitComplement [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = assoc_entity_type @BitComplement, [template] // CHECK:STDOUT: %.8: in BitComplement> = assoc_entity element0, file.%import_ref.6 [template] @@ -128,7 +128,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index f898480b689f..a9232badd11f 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitOr [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @BitOrAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index 9d508f5b11f0..61687b50a14e 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitXor [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @BitXorAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index 0e3e19681a1d..d80032e0d04e 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Div [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @DivAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index eb595f2c160f..4b7b5b3053f6 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -192,7 +192,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %C.ref.loc13_23: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc13_20.1: C = param b // CHECK:STDOUT: @TestEqual.%b: C = bind_name b, %b.loc13_20.1 -// CHECK:STDOUT: %return.var.loc13: ref bool = var +// CHECK:STDOUT: @TestEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: type = import_ref ir3, inst+1, loc_68 [template = constants.%.2] // CHECK:STDOUT: %import_ref.8 = import_ref ir3, inst+15, unloaded @@ -203,7 +203,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %C.ref.loc17_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc17_23.1: C = param b // CHECK:STDOUT: @TestNotEqual.%b: C = bind_name b, %b.loc17_23.1 -// CHECK:STDOUT: %return.var.loc17: ref bool = var +// CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir3, inst+1, loc_88 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir3, inst+30, unloaded @@ -310,7 +310,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %D.ref.loc8_23: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc8_20.1: D = param b // CHECK:STDOUT: @TestEqual.%b: D = bind_name b, %b.loc8_20.1 -// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: @TestEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir3, inst+1, loc_30 [template = constants.%.4] // CHECK:STDOUT: %import_ref.2 = import_ref ir3, inst+3, unloaded @@ -326,7 +326,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %D.ref.loc16_26: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc16_23.1: D = param b // CHECK:STDOUT: @TestNotEqual.%b: D = bind_name b, %b.loc16_23.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: type = import_ref ir3, inst+1, loc_50 [template = constants.%.4] // CHECK:STDOUT: %import_ref.9 = import_ref ir3, inst+30, unloaded @@ -405,7 +405,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %D.ref.loc14: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc14_21.1: D = param b // CHECK:STDOUT: @TestRhsBad.%b: D = bind_name b, %b.loc14_21.1 -// CHECK:STDOUT: %return.var.loc14: ref bool = var +// CHECK:STDOUT: @TestRhsBad.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: type = import_ref ir3, inst+1, loc_73 [template = constants.%.2] // CHECK:STDOUT: %import_ref.8 = import_ref ir3, inst+15, unloaded @@ -416,7 +416,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc25_21.1: C = param b // CHECK:STDOUT: @TestLhsBad.%b: C = bind_name b, %b.loc25_21.1 -// CHECK:STDOUT: %return.var.loc25: ref bool = var +// CHECK:STDOUT: @TestLhsBad.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir3, inst+1, loc_93 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir3, inst+30, unloaded diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 9ba54ce5a4bc..c11ad4ca2b85 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -135,13 +135,13 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.2: type = interface_type @Add [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.6: type = interface_type @AddAssign [template] -// CHECK:STDOUT: %.7: type = ptr_type C [template] -// CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %.5: type = ptr_type C [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %.7: = interface_witness (@impl.2.%Op) [template] +// CHECK:STDOUT: %.8: type = tuple_type () [template] +// CHECK:STDOUT: %.9: type = ptr_type {} [template] // CHECK:STDOUT: %.10: type = assoc_entity_type @Add, [template] // CHECK:STDOUT: %.11: in Add> = assoc_entity element0, file.%import_ref.10 [template] // CHECK:STDOUT: %.12: C = struct_value () [template] @@ -170,15 +170,15 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %Add.decl: invalid = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir3, inst+22, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir3, inst+22, loc_46 [template = constants.%.4] // CHECK:STDOUT: %import_ref.6: in AddAssign> = import_ref ir3, inst+40, loc_102 [template = constants.%.14] // CHECK:STDOUT: %import_ref.7 = import_ref ir3, inst+24, unloaded // CHECK:STDOUT: %import_ref.8: = import_ref ir3, inst+38, loc_47 [template = imports.%Op.2] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc12: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %AddAssign.decl: invalid = interface_decl @AddAssign [template = constants.%.6] {} -// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.6] +// CHECK:STDOUT: %AddAssign.decl: invalid = interface_decl @AddAssign [template = constants.%.4] {} +// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.4] // CHECK:STDOUT: } // CHECK:STDOUT: %Test: = fn_decl @Test [template] { // CHECK:STDOUT: %C.ref.loc16_12: type = name_ref C, %C.decl [template = constants.%C] @@ -197,7 +197,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %b.loc27_15.1: D = param b // CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc27_15.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir3, inst+22, loc_102 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.11: type = import_ref ir3, inst+22, loc_102 [template = constants.%.4] // CHECK:STDOUT: %import_ref.12 = import_ref ir3, inst+38, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: @@ -226,7 +226,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %C.ref.loc10_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op @@ -236,7 +236,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: impl @impl.2: C as AddAssign { // CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { // CHECK:STDOUT: %C.ref.loc13_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %.loc13_21: type = ptr_type C [template = constants.%.5] // CHECK:STDOUT: %self.loc13_14.1: C* = param self // CHECK:STDOUT: %self.loc13_14.3: C* = bind_name self, %self.loc13_14.1 // CHECK:STDOUT: %.loc13_9: C* = addr_pattern %self.loc13_14.3 @@ -244,7 +244,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %other.loc13_24.1: C = param other // CHECK:STDOUT: %other.loc13_24.2: C = bind_name other, %other.loc13_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.7] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op @@ -261,7 +261,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc10_9.2: C](@impl.1.%other.loc10_18.2: C) -> @impl.1.%return.var: C; +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc10_9.2: C](@impl.1.%other.loc10_18.2: C) -> C; // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index 9bbca6ed802b..3aad8394c49f 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @LeftShift [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @LeftShiftAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index df77e205481f..fc3d79550602 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Mod [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @ModAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index 6664cf8f839e..1208bc0056f7 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Mul [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @MulAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index f417ae373ae0..159e5c1474e4 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -76,9 +76,9 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Negate [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = assoc_entity_type @Negate, [template] // CHECK:STDOUT: %.8: in Negate> = assoc_entity element0, file.%import_ref.6 [template] @@ -128,7 +128,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index af155e1d114f..3a4083685d62 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -232,7 +232,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %C.ref.loc15_22: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc15_19.1: C = param b // CHECK:STDOUT: @TestLess.%b: C = bind_name b, %b.loc15_19.1 -// CHECK:STDOUT: %return.var.loc15: ref bool = var +// CHECK:STDOUT: @TestLess.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir3, inst+1, loc_98 [template = constants.%.2] // CHECK:STDOUT: %import_ref.12 = import_ref ir3, inst+15, unloaded @@ -243,7 +243,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %C.ref.loc19_27: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc19_24.1: C = param b // CHECK:STDOUT: @TestLessEqual.%b: C = bind_name b, %b.loc19_24.1 -// CHECK:STDOUT: %return.var.loc19: ref bool = var +// CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.13: type = import_ref ir3, inst+1, loc_118 [template = constants.%.2] // CHECK:STDOUT: %import_ref.14 = import_ref ir3, inst+30, unloaded @@ -254,7 +254,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %C.ref.loc23_25: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc23_22.1: C = param b // CHECK:STDOUT: @TestGreater.%b: C = bind_name b, %b.loc23_22.1 -// CHECK:STDOUT: %return.var.loc23: ref bool = var +// CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.15: type = import_ref ir3, inst+1, loc_138 [template = constants.%.2] // CHECK:STDOUT: %import_ref.16 = import_ref ir3, inst+44, unloaded @@ -265,7 +265,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %C.ref.loc27_30: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc27_27.1: C = param b // CHECK:STDOUT: @TestGreaterEqual.%b: C = bind_name b, %b.loc27_27.1 -// CHECK:STDOUT: %return.var.loc27: ref bool = var +// CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.17: type = import_ref ir3, inst+1, loc_158 [template = constants.%.2] // CHECK:STDOUT: %import_ref.18 = import_ref ir3, inst+58, unloaded @@ -430,7 +430,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %D.ref.loc8_22: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc8_19.1: D = param b // CHECK:STDOUT: @TestLess.%b: D = bind_name b, %b.loc8_19.1 -// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: @TestLess.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir3, inst+1, loc_30 [template = constants.%.4] // CHECK:STDOUT: %import_ref.2: in Ordered> = import_ref ir3, inst+59, loc_90 [template = constants.%.9] @@ -450,7 +450,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %D.ref.loc16_27: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc16_24.1: D = param b // CHECK:STDOUT: @TestLessEqual.%b: D = bind_name b, %b.loc16_24.1 -// CHECK:STDOUT: %return.var.loc16: ref bool = var +// CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.12: type = import_ref ir3, inst+1, loc_50 [template = constants.%.4] // CHECK:STDOUT: %import_ref.13 = import_ref ir3, inst+30, unloaded @@ -461,7 +461,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %D.ref.loc24_25: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc24_22.1: D = param b // CHECK:STDOUT: @TestGreater.%b: D = bind_name b, %b.loc24_22.1 -// CHECK:STDOUT: %return.var.loc24: ref bool = var +// CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.14: type = import_ref ir3, inst+1, loc_70 [template = constants.%.4] // CHECK:STDOUT: %import_ref.15 = import_ref ir3, inst+44, unloaded @@ -472,7 +472,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %D.ref.loc32_30: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc32_27.1: D = param b // CHECK:STDOUT: @TestGreaterEqual.%b: D = bind_name b, %b.loc32_27.1 -// CHECK:STDOUT: %return.var.loc32: ref bool = var +// CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.16: type = import_ref ir3, inst+1, loc_90 [template = constants.%.4] // CHECK:STDOUT: %import_ref.17 = import_ref ir3, inst+58, unloaded diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index be7804a1b3e5..327ad9c8b5f9 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @RightShift [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @RightShiftAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index f94a656a8f61..04bf337b46ee 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -123,9 +123,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Sub [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: C = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @SubAssign [template] // CHECK:STDOUT: %.8: type = ptr_type C [template] @@ -216,7 +216,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index 8d57e523208c..109513e07537 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -23,7 +23,7 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 01103e285927..2e8fe03e5282 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -25,7 +25,7 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index a59df3fd7410..c9ef11a57822 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -134,11 +134,11 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %H: = fn_decl @H [template] { // CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.1] -// CHECK:STDOUT: %return.var.loc9: ref {.a: i32} = var +// CHECK:STDOUT: @H.%return: ref {.a: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %AddressOfLiteral: = fn_decl @AddressOfLiteral [template] {} // CHECK:STDOUT: %AddressOfOperator: = fn_decl @AddressOfOperator [template] {} diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index ecb7f564f818..7780818d1e2e 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -38,7 +38,7 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: %.loc7_43.2: type = converted %.loc7_43.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %.loc7_44: type = ptr_type {} [template = constants.%.4] // CHECK:STDOUT: %.loc7_35: type = const_type {}* [template = constants.%.5] -// CHECK:STDOUT: %return.var: ref const ({}*) = var +// CHECK:STDOUT: @ConstMismatch.%return: ref const ({}*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index e50f2fcb3155..e0e28b176faa 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -34,7 +34,7 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: %p.loc8_6.1: const (const (const i32*)*) = param p // CHECK:STDOUT: @F.%p: const (const (const i32*)*) = bind_name p, %p.loc8_6.1 // CHECK:STDOUT: %.loc8_41: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref const i32 = var +// CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index 04cbd8faa5bb..105bf2b3b090 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -32,7 +32,7 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: %p.loc7_8.1: i32* = param p // CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc7_8.1 // CHECK:STDOUT: %.loc7_23: type = ptr_type i32 [template = constants.%.1] -// CHECK:STDOUT: %return.var.loc7: ref i32* = var +// CHECK:STDOUT: @Ptr.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr [template] { // CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.2] @@ -41,7 +41,7 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc11_13.1 // CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %return.var.loc11: ref const i32* = var +// CHECK:STDOUT: @ConstPtr.%return: ref const i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index cf33a13b2503..2e2a5689a718 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -35,7 +35,7 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %b.loc7_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 4aa29b133b1a..7a1f5aea8cdd 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -26,14 +26,14 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType [template] { -// CHECK:STDOUT: %return.var.loc9: ref type = var +// CHECK:STDOUT: @ReturnType.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: %Six: = fn_decl @Six [template] { // CHECK:STDOUT: %ReturnType.ref: = name_ref ReturnType, %ReturnType [template = %ReturnType] // CHECK:STDOUT: %.loc13_23.1: init type = call %ReturnType.ref() // CHECK:STDOUT: %.loc13_24: type = value_of_initializer %.loc13_23.1 // CHECK:STDOUT: %.loc13_23.2: type = converted %.loc13_23.1, %.loc13_24 -// CHECK:STDOUT: %return.var.loc13: ref = var +// CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index 5eb5a36b2706..52434a4f1e58 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -19,7 +19,7 @@ fn Six() -> x; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Six: = fn_decl @Six [template] { // CHECK:STDOUT: %x.ref: = name_ref x, [template = ] -// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index 2a5e7d548b19..aded7217a18a 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -19,7 +19,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index a3f1514a39eb..46aadd5524dd 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -25,7 +25,7 @@ fn F() -> () { // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref () = var +// CHECK:STDOUT: @F.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index e5f13aa47604..b49152b2d235 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -20,7 +20,7 @@ fn Procedure() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Procedure: = fn_decl @Procedure [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Procedure.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index 4334b7d3063d..af4ad9a6bb07 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -50,7 +50,7 @@ fn G() -> C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %G: = fn_decl @G [template] { diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 1b5c134c353a..53c81804307f 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -51,10 +51,10 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SameScope: = fn_decl @SameScope [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @SameScope.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes [template] { -// CHECK:STDOUT: %return.var.loc22: ref i32 = var +// CHECK:STDOUT: @DifferentScopes.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 83ae4d0c0d80..64a9fce075df 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -8,9 +8,9 @@ fn Mismatch() -> i32 { // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+6]]:19: ERROR: Type `f64` of `returned var` does not match return type of enclosing function. // CHECK:STDERR: returned var v: f64 = 0.0; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-4]]:1: Return type of function is `i32`. + // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-4]]:15: Return type of function is `i32`. // CHECK:STDERR: fn Mismatch() -> i32 { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: ^~~~~~ returned var v: f64 = 0.0; return var; } @@ -28,7 +28,7 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Mismatch.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index 8a5c76c988a2..93aef97fc7f3 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -24,7 +24,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 9d19f2e9b03a..f3afdb035d2f 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -8,9 +8,9 @@ fn Main() -> i32 { // CHECK:STDERR: fail_value_missing.carbon:[[@LINE+6]]:3: ERROR: Missing return value. // CHECK:STDERR: return; // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-4]]:1: Return type of function is `i32`. + // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-4]]:11: Return type of function is `i32`. // CHECK:STDERR: fn Main() -> i32 { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: ^~~~~~ return; } @@ -23,7 +23,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index e452589ba5ee..b3e600562808 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -28,7 +28,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %Six: = fn_decl @Six [template] { // CHECK:STDOUT: %x.ref: ref type = name_ref x, %x // CHECK:STDOUT: %.loc11: type = bind_value %x.ref -// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index a4968c910e66..7c9a0bf58e9e 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -46,7 +46,7 @@ fn G() -> i32 { // CHECK:STDOUT: @F.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index ff4dc07ba434..c7f639ce0268 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -39,12 +39,12 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @UnrelatedScopes.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter [template] { // CHECK:STDOUT: %b.loc17_22.1: bool = param b // CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc17_22.1 -// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: @EnclosingButAfter.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index 3c001b78075d..4ee3cd6d7672 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -24,7 +24,7 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { // CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] -// CHECK:STDOUT: %return.var: ref {.a: i32} = var +// CHECK:STDOUT: @Main.%return: ref {.a: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index d0fecdc5563f..37410bd42559 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -21,7 +21,7 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main: = fn_decl @Main [template] { -// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index aeee38eaa974..31c69fcf023d 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -69,7 +69,7 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: @F.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc23_35: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc23_36: {.a: i32} = struct_literal (%.loc23_35) diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index 3cbd20fe498e..e66eef21fe1f 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -14,8 +14,8 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {.x: i32, .y: i32, .z: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 3 [template] // CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} [template] // CHECK:STDOUT: %.6: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] @@ -34,15 +34,15 @@ fn F() -> i32 { // CHECK:STDOUT: @G.%return: ref {.x: i32, .y: i32, .z: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G() -> %return: {.x: i32, .y: i32, .z: i32}; +// CHECK:STDOUT: fn @G() -> {.x: i32, .y: i32, .z: i32}; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage // CHECK:STDOUT: %.loc10_25.2: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index cea2a063f1e3..1d31164d95c1 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -15,8 +15,8 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32, i32) [template] // CHECK:STDOUT: %.5: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] // CHECK:STDOUT: %.6: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] // CHECK:STDOUT: } @@ -36,7 +36,7 @@ fn G() { // CHECK:STDOUT: %G: = fn_decl @G [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); +// CHECK:STDOUT: fn @F() -> (i32, i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: @@ -44,7 +44,7 @@ fn G() { // CHECK:STDOUT: %.loc10_29.2: type = converted %.loc10_29.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (i32, i32, i32) // CHECK:STDOUT: %.loc10_50.2: type = converted %.loc10_50.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] +// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.3] // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F [template = file.%F] diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 0dd2979b49bb..5e54198089a3 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -31,10 +31,10 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32 [template] { -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: @MakeI32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64 [template] { -// CHECK:STDOUT: %return.var.loc8: ref f64 = var +// CHECK:STDOUT: @MakeF64.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index 4bc46e272680..28999465a466 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -19,9 +19,9 @@ fn H() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.4: type = tuple_type ((type, type, type), (type, type, type)) [template] -// CHECK:STDOUT: %.5: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] +// CHECK:STDOUT: %.3: type = tuple_type ((type, type, type), (type, type, type)) [template] +// CHECK:STDOUT: %.4: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] +// CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] // CHECK:STDOUT: %.6: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] // CHECK:STDOUT: %.7: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] // CHECK:STDOUT: %.8: type = tuple_type (type, (type, type, type), type) [template] @@ -49,7 +49,7 @@ fn H() { // CHECK:STDOUT: %H: = fn_decl @H [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); +// CHECK:STDOUT: fn @F() -> (i32, i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: @@ -58,7 +58,7 @@ fn H() { // CHECK:STDOUT: %.loc10_43.1: ((type, type, type), (type, type, type)) = tuple_literal (%.loc10_25.1, %.loc10_42.1) // CHECK:STDOUT: %.loc10_25.2: type = converted %.loc10_25.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_42.2: type = converted %.loc10_42.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_43.2: type = converted %.loc10_43.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_43.2: type = converted %.loc10_43.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %v.var: ref ((i32, i32, i32), (i32, i32, i32)) = var v // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_48: = name_ref F, file.%F [template = file.%F] diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index 56ff1bba64db..ff82b84a99d1 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -43,28 +43,28 @@ fn While() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = fn_decl @A [template] { -// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: @A.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: @B.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %C: = fn_decl @C [template] { -// CHECK:STDOUT: %return.var.loc9: ref bool = var +// CHECK:STDOUT: @C.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %D: = fn_decl @D [template] { -// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: @D.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %E: = fn_decl @E [template] { -// CHECK:STDOUT: %return.var.loc11: ref bool = var +// CHECK:STDOUT: @E.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %return.var.loc12: ref bool = var +// CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %return.var.loc13: ref bool = var +// CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %H: = fn_decl @H [template] { -// CHECK:STDOUT: %return.var.loc14: ref bool = var +// CHECK:STDOUT: @H.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %While: = fn_decl @While [template] {} // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 6dfc29e927f5..33f6dc30a5b0 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -36,7 +36,7 @@ fn While() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Cond: = fn_decl @Cond [template] { -// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] {} // CHECK:STDOUT: %G: = fn_decl @G [template] {} diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 6ccb939da7b6..d84980528de1 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -35,7 +35,7 @@ fn While() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Cond: = fn_decl @Cond [template] { -// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %F: = fn_decl @F [template] {} // CHECK:STDOUT: %G: = fn_decl @G [template] {} diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index c0f2fc9744bb..a3ac04fe2bc9 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -155,6 +155,7 @@ CARBON_DIAGNOSTIC_KIND(UsedImportLoc) CARBON_DIAGNOSTIC_KIND(AddrSelfIsNonRef) CARBON_DIAGNOSTIC_KIND(CallArgCountMismatch) CARBON_DIAGNOSTIC_KIND(CallToNonCallable) +CARBON_DIAGNOSTIC_KIND(IncompleteReturnTypeHere) CARBON_DIAGNOSTIC_KIND(InCallToFunction) CARBON_DIAGNOSTIC_KIND(InCallToFunctionParam) CARBON_DIAGNOSTIC_KIND(InCallToFunctionSelf) diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index 18f1fd569ffe..5ce4c31b7746 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -101,7 +101,12 @@ auto FileContext::BuildFunctionDecl(SemIR::FunctionId function_id) return nullptr; } - const bool has_return_slot = function.return_slot_id.is_valid(); + // Don't lower unused functions. + if (function.return_slot == SemIR::Function::ReturnSlot::NotComputed) { + return nullptr; + } + + const bool has_return_slot = function.has_return_slot(); auto implicit_param_refs = sem_ir().inst_blocks().Get(function.implicit_param_refs_id); auto param_refs = sem_ir().inst_blocks().Get(function.param_refs_id); @@ -124,7 +129,7 @@ auto FileContext::BuildFunctionDecl(SemIR::FunctionId function_id) param_inst_ids.reserve(max_llvm_params); if (has_return_slot) { param_types.push_back(GetType(function.return_type_id)->getPointerTo()); - param_inst_ids.push_back(function.return_slot_id); + param_inst_ids.push_back(function.return_storage_id); } for (auto param_ref_id : llvm::concat(implicit_param_refs, param_refs)) { @@ -176,7 +181,7 @@ auto FileContext::BuildFunctionDecl(SemIR::FunctionId function_id) for (auto [inst_id, arg] : llvm::zip_equal(param_inst_ids, llvm_function->args())) { auto name_id = SemIR::NameId::Invalid; - if (inst_id == function.return_slot_id) { + if (inst_id == function.return_storage_id) { name_id = SemIR::NameId::ReturnSlot; arg.addAttr(llvm::Attribute::getWithStructRetType( llvm_context(), GetType(function.return_type_id))); @@ -202,7 +207,7 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id) llvm::Function* llvm_function = GetFunction(function_id); FunctionContext function_lowering(*this, llvm_function, vlog_stream_); - const bool has_return_slot = function.return_slot_id.is_valid(); + const bool has_return_slot = function.has_return_slot(); // Add parameters to locals. // TODO: This duplicates the mapping between sem_ir instructions and LLVM @@ -213,7 +218,7 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id) auto param_refs = sem_ir().inst_blocks().Get(function.param_refs_id); int param_index = 0; if (has_return_slot) { - function_lowering.SetLocal(function.return_slot_id, + function_lowering.SetLocal(function.return_storage_id, llvm_function->getArg(param_index)); ++param_index; } diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 8e476d661d63..9bd3d7dc6c5a 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -79,11 +79,11 @@ class InstNamer { *this, fn_loc, sem_ir.names().GetIRBaseName(fn.name_id).str()); CollectNamesInBlock(fn_scope, fn.implicit_param_refs_id); CollectNamesInBlock(fn_scope, fn.param_refs_id); - if (fn.return_slot_id.is_valid()) { - insts[fn.return_slot_id.index] = { - fn_scope, - GetScopeInfo(fn_scope).insts.AllocateName( - *this, sem_ir.insts().GetLocId(fn.return_slot_id), "return")}; + if (fn.return_storage_id.is_valid()) { + insts[fn.return_storage_id.index] = { + fn_scope, GetScopeInfo(fn_scope).insts.AllocateName( + *this, sem_ir.insts().GetLocId(fn.return_storage_id), + "return")}; } if (!fn.body_block_ids.empty()) { AddBlockLabel(fn_scope, fn.body_block_ids.front(), "entry", fn_loc); @@ -792,8 +792,8 @@ class Formatter { if (fn.return_type_id.is_valid()) { out_ << " -> "; - if (fn.return_slot_id.is_valid()) { - FormatInstName(fn.return_slot_id); + if (!fn.body_block_ids.empty() && fn.has_return_slot()) { + FormatInstName(fn.return_storage_id); out_ << ": "; } FormatType(fn.return_type_id); diff --git a/toolchain/sem_ir/function.h b/toolchain/sem_ir/function.h index 75f5781a1ca9..52688d5f32ac 100644 --- a/toolchain/sem_ir/function.h +++ b/toolchain/sem_ir/function.h @@ -13,14 +13,43 @@ namespace Carbon::SemIR { // A function. struct Function : public Printable { + // A value that describes whether the function uses a return slot. + enum class ReturnSlot : int8_t { + // Not yet known: the function has not been called or defined. + NotComputed, + // The function is known to not use a return slot. + Absent, + // The function has a return slot, and a call to the function is expected to + // have an additional final argument corresponding to the return slot. + Present, + // Computing whether the function should have a return slot failed, for + // example because the return type was incomplete. + Error + }; + auto Print(llvm::raw_ostream& out) const -> void { out << "{name: " << name_id << ", enclosing_scope: " << enclosing_scope_id << ", param_refs: " << param_refs_id; if (return_type_id.is_valid()) { out << ", return_type: " << return_type_id; } - if (return_slot_id.is_valid()) { - out << ", return_slot: " << return_slot_id; + if (return_storage_id.is_valid()) { + out << ", return_storage: " << return_storage_id; + out << ", return_slot: "; + switch (return_slot) { + case ReturnSlot::NotComputed: + out << "unknown"; + break; + case ReturnSlot::Absent: + out << "absent"; + break; + case ReturnSlot::Present: + out << "present"; + break; + case ReturnSlot::Error: + out << "error"; + break; + } } if (!body_block_ids.empty()) { out << llvm::formatv( @@ -36,6 +65,15 @@ struct Function : public Printable { static auto GetParamFromParamRefId(const File& sem_ir, InstId param_ref_id) -> std::pair; + // Returns whether the function has a return slot. Can only be called for a + // function that has either been called or defined, otherwise this is not + // known. + auto has_return_slot() const -> bool { + CARBON_CHECK(return_slot != ReturnSlot::NotComputed); + // On error, we assume no return slot is used. + return return_slot == ReturnSlot::Present; + } + // The following members always have values, and do not change throughout the // lifetime of the function. @@ -52,14 +90,18 @@ struct Function : public Printable { // The return type. This will be invalid if the return type wasn't specified. TypeId return_type_id; // The storage for the return value, which is a reference expression whose - // type is the return type of the function. Will be invalid if the function - // doesn't have a return slot. If this is valid, a call to the function is - // expected to have an additional final argument corresponding to the return - // slot. - InstId return_slot_id; + // type is the return type of the function. This may or may not be used by the + // function, depending on whether the return type needs a return slot. + InstId return_storage_id; // Whether the declaration is extern. bool is_extern; + // The following member is set on the first call to the function, or at the + // point where the function is defined. + + // Whether the function uses a return slot. + ReturnSlot return_slot; + // The following members are set at the end of a builtin function definition. // If this is a builtin function, the corresponding builtin kind.