Преглед изворни кода

Rewrite pending specifics to use the work stack (#6415)

I was trying to figure out the right way to get specifics to be added to
the work.

Technically, we could keep the pending_specific list; this is taking a
different approach of inserting inside the work stack, which will do
extra work moving entries, although typically that should be expected to
be small. One challenge of `pending_specifics` is that if we would need
to shift them to work after both `Done` (for immediate processing) and
`Retry` (for processing after the current instruction is later revisited
and done). That feels kind of awkward as additional tracking to do.
Also, the common case is probably that there's either 0 or 1 specifics
being added, so an additional vector may be significant overhead. That's
why I leaned more in this direction of just inserting them in the vector
of work.
Jon Ross-Perkins пре 5 месеци
родитељ
комит
167b45ca35

+ 119 - 133
toolchain/check/import_ref.cpp

@@ -147,18 +147,6 @@ namespace {
 // Therefore code that accepts an ImportContext is unable to enqueue new work.
 class ImportContext {
  public:
-  // A generic that we have partially imported.
-  struct PendingGeneric {
-    SemIR::GenericId import_id;
-    SemIR::GenericId local_id;
-  };
-
-  // A specific that we have partially imported.
-  struct PendingSpecific {
-    SemIR::SpecificId import_id;
-    SemIR::SpecificId local_id;
-  };
-
   // `context` must not be null.
   explicit ImportContext(Context* context, SemIR::ImportIRId import_ir_id)
       : context_(context),
@@ -315,27 +303,10 @@ class ImportContext {
   }
   auto local_types() -> SemIR::TypeStore& { return local_ir().types(); }
 
-  // Add a specific that has been partially imported but needs to be finished.
-  auto AddPendingSpecific(PendingSpecific pending) -> void {
-    pending_specifics_.push_back(pending);
-  }
-
- protected:
-  auto pending_specifics() -> llvm::SmallVector<PendingSpecific>& {
-    return pending_specifics_;
-  }
-
  private:
   Context* context_;
   SemIR::ImportIRId import_ir_id_;
   const SemIR::File& import_ir_;
-
-  // TODO: The following members don't belong here. This pending work mechanism
-  // can probably be removed entirely if we stop importing generic eval blocks
-  // and instead evaluate them directly in the imported IR.
-
-  // Specifics that we have partially imported but not yet finished importing.
-  llvm::SmallVector<PendingSpecific> pending_specifics_;
 };
 
 // Resolves an instruction from an imported IR into a constant referring to the
@@ -420,31 +391,29 @@ class ImportRefResolver : public ImportContext {
   // Iteratively resolves an imported instruction's inner references until a
   // constant ID referencing the current IR is produced. See the class comment
   // for more details.
-  auto ResolveOneInst(SemIR::InstId inst_id) -> SemIR::ConstantId;
-
-  // Performs resolution for one instruction and then performs all work we
-  // deferred.
-  auto Resolve(SemIR::InstId inst_id) -> SemIR::ConstantId {
-    auto const_id = ResolveOneInst(inst_id);
-    PerformPendingWork();
-    return const_id;
-  }
+  auto Resolve(SemIR::InstId inst_id) -> SemIR::ConstantId;
 
   // Wraps constant evaluation with logic to handle constants.
-  auto ResolveConstant(SemIR::ConstantId import_const_id) -> SemIR::ConstantId {
-    return Resolve(GetInstWithConstantValue(import_ir(), import_const_id));
-  }
+  auto ResolveConstant(SemIR::ConstantId import_const_id) -> SemIR::ConstantId;
 
   // Wraps constant evaluation with logic to handle types.
   auto ResolveType(SemIR::TypeId import_type_id) -> SemIR::TypeId;
 
   // Returns true if new unresolved constants were found as part of this
   // `Resolve` step.
-  auto HasNewWork() -> bool {
-    CARBON_CHECK(initial_work_ <= work_stack_.size(),
-                 "Work shouldn't decrease");
-    return initial_work_ < work_stack_.size();
-  }
+  auto HasNewWork() -> bool;
+
+  // Pushes a specific onto the work stack. This will only process when the
+  // current instruction is done, and does not count towards `HasNewWork`. We
+  // add specifics this way because some instructions (e.g. `FacetTypeInfo`) can
+  // add multiple specifics.
+  //
+  // The insert may do extra work moving already-added work on the work stack,
+  // but that is expected to be okay because the common cases are 0 or 1
+  // specifics being added. If this ends up showing up in profiles, potentially
+  // due to vector growth, it may be worth revisiting.
+  auto PushSpecific(SemIR::SpecificId import_id, SemIR::SpecificId local_id)
+      -> void;
 
   // Returns the ConstantId for an InstId. Adds unresolved constants to
   // work_stack_.
@@ -466,6 +435,12 @@ class ImportRefResolver : public ImportContext {
     SemIR::GenericId local_id;
   };
 
+  // A specific to import.
+  struct SpecificWork {
+    SemIR::SpecificId import_id;
+    SemIR::SpecificId local_id;
+  };
+
   // The constant found by FindResolvedConstId.
   struct ResolvedConstId {
     // The constant for the instruction. `None` if not yet resolved.
@@ -488,9 +463,8 @@ class ImportRefResolver : public ImportContext {
                           llvm::ArrayRef<SemIR::ImportIRInst> indirect_insts,
                           SemIR::ConstantId const_id) -> void;
 
-  auto PerformPendingWork() -> void;
-
-  llvm::SmallVector<std::variant<InstWork, GenericWork>> work_stack_;
+  llvm::SmallVector<std::variant<InstWork, GenericWork, SpecificWork>>
+      work_stack_;
   // The size of work_stack_ at the start of resolving the current instruction.
   size_t initial_work_ = 0;
 };
@@ -959,14 +933,24 @@ static auto GetLocalSpecificData(ImportRefResolver& resolver,
   };
 }
 
+// True for an already-imported specific.
+static auto IsSpecificImported(const SemIR::Specific& import_specific,
+                               const SemIR::Specific& local_specific) -> bool {
+  return local_specific.decl_block_id.has_value() &&
+         (local_specific.definition_block_id.has_value() ||
+          !import_specific.definition_block_id.has_value());
+}
+
 // Gets a local specific whose data was already imported by
-// GetLocalSpecificData. Does not add any new work.
+// GetLocalSpecificData. This can add work through `PushSpecific`, but callers
+// shouldn't need to consider that because specifics are processed after the
+// current instruction.
 //
 // `local_generic_id` is provided when this is used for a generic's `self`
 // specific, where `GetLocalGenericId` won't work because `generic_const_id` can
 // be `TypeType`.
 static auto GetOrAddLocalSpecific(
-    ImportContext& context, SemIR::SpecificId import_specific_id,
+    ImportRefResolver& resolver, SemIR::SpecificId import_specific_id,
     const SpecificData& data,
     SemIR::GenericId local_generic_id = SemIR::GenericId::None)
     -> SemIR::SpecificId {
@@ -976,24 +960,21 @@ static auto GetOrAddLocalSpecific(
 
   // Form a corresponding local specific ID.
   const auto& import_specific =
-      context.import_specifics().Get(import_specific_id);
+      resolver.import_specifics().Get(import_specific_id);
   if (!local_generic_id.has_value()) {
-    local_generic_id = GetLocalGenericId(context, data.generic_const_id);
+    local_generic_id = GetLocalGenericId(resolver, data.generic_const_id);
   }
-  auto args_id =
-      GetLocalCanonicalInstBlockId(context, import_specific.args_id, data.args);
+  auto args_id = GetLocalCanonicalInstBlockId(resolver, import_specific.args_id,
+                                              data.args);
 
   // Get the specific.
   auto local_specific_id =
-      context.local_specifics().GetOrAdd(local_generic_id, args_id);
+      resolver.local_specifics().GetOrAdd(local_generic_id, args_id);
 
-  // Fill in the remaining information in FinishPendingSpecific, if necessary.
-  auto& local_specific = context.local_specifics().Get(local_specific_id);
-  if (!local_specific.decl_block_id.has_value() ||
-      (import_specific.definition_block_id.has_value() &&
-       !local_specific.definition_block_id.has_value())) {
-    context.AddPendingSpecific(
-        {.import_id = import_specific_id, .local_id = local_specific_id});
+  if (!IsSpecificImported(import_specific,
+                          resolver.local_specifics().Get(local_specific_id))) {
+    // Enqueue the specific to fill in remaining fields.
+    resolver.PushSpecific(import_specific_id, local_specific_id);
   }
   return local_specific_id;
 }
@@ -1034,6 +1015,40 @@ static auto TryFinishGeneric(ImportRefResolver& resolver,
   return true;
 }
 
+// Given a specific that's gone through the initial setup with `SpecificData`,
+// finish the import.
+static auto TryFinishSpecific(ImportRefResolver& resolver,
+                              SemIR::SpecificId import_specific_id,
+                              SemIR::SpecificId local_specific_id) -> bool {
+  const auto& import_specific =
+      resolver.import_specifics().Get(import_specific_id);
+  auto& local_specific = resolver.local_specifics().Get(local_specific_id);
+
+  if (IsSpecificImported(import_specific, local_specific)) {
+    return true;
+  }
+
+  llvm::SmallVector<SemIR::InstId> decl_block;
+  if (!local_specific.decl_block_id.has_value()) {
+    decl_block =
+        GetLocalInstBlockContents(resolver, import_specific.decl_block_id);
+  }
+  auto definition_block =
+      GetLocalInstBlockContents(resolver, import_specific.definition_block_id);
+
+  if (resolver.HasNewWork()) {
+    return false;
+  }
+
+  if (!local_specific.decl_block_id.has_value()) {
+    local_specific.decl_block_id = GetLocalCanonicalInstBlockId(
+        resolver, import_specific.decl_block_id, decl_block);
+  }
+  local_specific.definition_block_id = GetLocalCanonicalInstBlockId(
+      resolver, import_specific.definition_block_id, definition_block);
+  return true;
+}
+
 namespace {
 struct SpecificInterfaceData {
   SemIR::ConstantId interface_const_id;
@@ -1057,7 +1072,8 @@ static auto GetLocalSpecificInterfaceData(
 }
 
 static auto GetLocalSpecificInterface(
-    ImportContext& context, SemIR::SpecificInterface import_specific_interface,
+    ImportRefResolver& resolver,
+    SemIR::SpecificInterface import_specific_interface,
     SpecificInterfaceData interface_data) -> SemIR::SpecificInterface {
   if (!interface_data.interface_const_id.has_value()) {
     return SemIR::SpecificInterface::None;
@@ -1067,19 +1083,19 @@ static auto GetLocalSpecificInterface(
   // build a interface type referencing this specialization of the generic
   // interface.
   auto interface_const_inst =
-      context.local_insts().Get(context.local_constant_values().GetInstId(
+      resolver.local_insts().Get(resolver.local_constant_values().GetInstId(
           interface_data.interface_const_id));
   if (auto facet_type = interface_const_inst.TryAs<SemIR::FacetType>()) {
     const SemIR::FacetTypeInfo& new_facet_type_info =
-        context.local_facet_types().Get(facet_type->facet_type_id);
+        resolver.local_facet_types().Get(facet_type->facet_type_id);
     return std::get<SemIR::SpecificInterface>(
         *new_facet_type_info.TryAsSingleExtend());
   } else {
     auto generic_interface_type =
-        context.local_types().GetAs<SemIR::GenericInterfaceType>(
+        resolver.local_types().GetAs<SemIR::GenericInterfaceType>(
             interface_const_inst.type_id());
     auto specific_id =
-        GetOrAddLocalSpecific(context, import_specific_interface.specific_id,
+        GetOrAddLocalSpecific(resolver, import_specific_interface.specific_id,
                               interface_data.specific_data);
     return {generic_interface_type.interface_id, specific_id};
   }
@@ -1109,7 +1125,7 @@ static auto GetLocalSpecificNamedConstraintData(
 }
 
 static auto GetLocalSpecificNamedConstraint(
-    ImportContext& context,
+    ImportRefResolver& resolver,
     SemIR::SpecificNamedConstraint import_specific_constraint,
     SpecificNamedConstraintData constraint_data)
     -> SemIR::SpecificNamedConstraint {
@@ -1121,19 +1137,19 @@ static auto GetLocalSpecificNamedConstraint(
   // constraint, build a named constraint type referencing this specialization
   // of the generic named constraint.
   auto constraint_const_inst =
-      context.local_insts().Get(context.local_constant_values().GetInstId(
+      resolver.local_insts().Get(resolver.local_constant_values().GetInstId(
           constraint_data.constraint_const_id));
   if (auto facet_type = constraint_const_inst.TryAs<SemIR::FacetType>()) {
     const SemIR::FacetTypeInfo& new_facet_type_info =
-        context.local_facet_types().Get(facet_type->facet_type_id);
+        resolver.local_facet_types().Get(facet_type->facet_type_id);
     return std::get<SemIR::SpecificNamedConstraint>(
         *new_facet_type_info.TryAsSingleExtend());
   } else {
     auto generic_constraint_type =
-        context.local_types().GetAs<SemIR::GenericNamedConstraintType>(
+        resolver.local_types().GetAs<SemIR::GenericNamedConstraintType>(
             constraint_const_inst.type_id());
     auto specific_id =
-        GetOrAddLocalSpecific(context, import_specific_constraint.specific_id,
+        GetOrAddLocalSpecific(resolver, import_specific_constraint.specific_id,
                               constraint_data.specific_data);
     return {generic_constraint_type.named_constraint_id, specific_id};
   }
@@ -3887,8 +3903,7 @@ static auto TryResolveInst(ImportRefResolver& resolver, SemIR::InstId inst_id,
   return result;
 }
 
-auto ImportRefResolver::ResolveOneInst(SemIR::InstId inst_id)
-    -> SemIR::ConstantId {
+auto ImportRefResolver::Resolve(SemIR::InstId inst_id) -> SemIR::ConstantId {
   work_stack_.push_back(InstWork{.inst_id = inst_id});
   while (!work_stack_.empty()) {
     auto work_variant = work_stack_.back();
@@ -3941,6 +3956,16 @@ auto ImportRefResolver::ResolveOneInst(SemIR::InstId inst_id)
         }
         break;
       }
+      case CARBON_KIND(SpecificWork specific_work): {
+        // Specifics may require 2 steps to finish, similar to step 2 and step 3
+        // of instructions.
+        initial_work_ = work_stack_.size();
+        if (TryFinishSpecific(*this, specific_work.import_id,
+                              specific_work.local_id)) {
+          work_stack_.pop_back();
+        }
+        break;
+      }
     }
   }
   auto constant_id =
@@ -3949,6 +3974,11 @@ auto ImportRefResolver::ResolveOneInst(SemIR::InstId inst_id)
   return constant_id;
 }
 
+auto ImportRefResolver::ResolveConstant(SemIR::ConstantId import_const_id)
+    -> SemIR::ConstantId {
+  return Resolve(GetInstWithConstantValue(import_ir(), import_const_id));
+}
+
 auto ImportRefResolver::ResolveType(SemIR::TypeId import_type_id)
     -> SemIR::TypeId {
   if (!import_type_id.has_value()) {
@@ -3969,6 +3999,20 @@ auto ImportRefResolver::ResolveType(SemIR::TypeId import_type_id)
   }
 }
 
+auto ImportRefResolver::HasNewWork() -> bool {
+  CARBON_CHECK(initial_work_ <= work_stack_.size(), "Work shouldn't decrease");
+  return initial_work_ < work_stack_.size();
+}
+
+auto ImportRefResolver::PushSpecific(SemIR::SpecificId import_id,
+                                     SemIR::SpecificId local_id) -> void {
+  // Insert before the current instruction.
+  work_stack_.insert(
+      work_stack_.begin() + initial_work_ - 1,
+      SpecificWork{.import_id = import_id, .local_id = local_id});
+  ++initial_work_;
+}
+
 auto ImportRefResolver::GetLocalConstantValueOrPush(SemIR::InstId inst_id)
     -> SemIR::ConstantId {
   if (!inst_id.has_value()) {
@@ -4049,64 +4093,6 @@ auto ImportRefResolver::SetResolvedConstId(
   SetIndirectConstantValues(local_context(), indirect_insts, const_id);
 }
 
-// Resolves and returns the local contents for an imported instruction block
-// of constant instructions.
-static auto ResolveLocalInstBlockContents(ImportRefResolver& resolver,
-                                          SemIR::InstBlockId import_block_id)
-    -> llvm::SmallVector<SemIR::InstId> {
-  auto import_block = resolver.import_inst_blocks().Get(import_block_id);
-
-  llvm::SmallVector<SemIR::InstId> inst_ids;
-  inst_ids.reserve(import_block.size());
-  for (auto import_inst_id : import_block) {
-    inst_ids.push_back(resolver.local_constant_values().GetInstId(
-        resolver.ResolveOneInst(import_inst_id)));
-  }
-  return inst_ids;
-}
-
-// Resolves and returns a local inst block of constant instructions
-// corresponding to an imported inst block.
-static auto ResolveLocalInstBlock(ImportRefResolver& resolver,
-                                  SemIR::InstBlockId import_block_id)
-    -> SemIR::InstBlockId {
-  if (!import_block_id.has_value()) {
-    return SemIR::InstBlockId::None;
-  }
-
-  auto inst_ids = ResolveLocalInstBlockContents(resolver, import_block_id);
-  return resolver.local_inst_blocks().Add(inst_ids);
-}
-
-// Fills in the remaining information in a partially-imported specific.
-static auto FinishPendingSpecific(ImportRefResolver& resolver,
-                                  ImportContext::PendingSpecific pending)
-    -> void {
-  const auto& import_specific =
-      resolver.import_specifics().Get(pending.import_id);
-  auto& local_specific = resolver.local_specifics().Get(pending.local_id);
-
-  if (!local_specific.decl_block_id.has_value()) {
-    local_specific.decl_block_id =
-        ResolveLocalInstBlock(resolver, import_specific.decl_block_id);
-  }
-
-  if (!local_specific.definition_block_id.has_value() &&
-      import_specific.definition_block_id.has_value()) {
-    local_specific.definition_block_id =
-        ResolveLocalInstBlock(resolver, import_specific.definition_block_id);
-  }
-}
-
-// Perform any work that we deferred until the end of the main Resolve loop.
-auto ImportRefResolver::PerformPendingWork() -> void {
-  // Note that the individual Finish steps can add new pending work, so keep
-  // going until we have no more work to do.
-  while (!pending_specifics().empty()) {
-    FinishPendingSpecific(*this, pending_specifics().pop_back_val());
-  }
-}
-
 // Returns a list of ImportIRInsts equivalent to the ImportRef currently being
 // loaded (including the one pointed at directly by the ImportRef), and the
 // final instruction's type ID.

+ 1 - 1
toolchain/check/testdata/array/init_dependent_bound.carbon

@@ -174,10 +174,10 @@ fn H() { G(3); }
 // CHECK:STDOUT:   %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %tuple: %tuple.type = tuple_value (%int_1, %int_2, %int_3.1ba) [concrete]
 // CHECK:STDOUT:   %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %From: Core.IntLiteral = symbolic_binding From, 0 [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.type.2c2: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.cdf: %Int.as.ImplicitAs.impl.Convert.type.2c2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %int_3.822: %i32 = int_value 3 [concrete]
 // CHECK:STDOUT:   %ImplicitAs.impl_witness.972: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.783, @Int.as.ImplicitAs.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.type.592: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%int_32) [concrete]

Разлика између датотеке није приказан због своје велике величине
+ 475 - 475
toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon


+ 4 - 4
toolchain/check/testdata/class/generic/adapt.carbon

@@ -292,6 +292,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
 // CHECK:STDOUT:   %Int.generic: %Int.type = struct_value () [concrete]
 // CHECK:STDOUT:   %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
 // CHECK:STDOUT:   %i32: type = class_type @Int, @Int(%int_32) [concrete]
+// CHECK:STDOUT:   %i32.builtin: type = int_type signed, %int_32 [concrete]
+// CHECK:STDOUT:   %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
 // CHECK:STDOUT:   %C.type: type = generic_class_type @C [concrete]
 // CHECK:STDOUT:   %C.generic: %C.type = struct_value () [concrete]
 // CHECK:STDOUT:   %T.d9f: type = symbolic_binding T, 0 [symbolic]
@@ -303,8 +305,6 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
 // CHECK:STDOUT:   %C.239: type = class_type @C, @C(%i32) [concrete]
 // CHECK:STDOUT:   %struct_type.x.767: type = struct_type {.x: %i32} [concrete]
 // CHECK:STDOUT:   %complete_type.c07: <witness> = complete_type_witness %struct_type.x.767 [concrete]
-// CHECK:STDOUT:   %i32.builtin: type = int_type signed, %int_32 [concrete]
-// CHECK:STDOUT:   %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
 // CHECK:STDOUT:   %C.elem.ed6: type = unbound_element_type %C.239, %i32 [concrete]
 // CHECK:STDOUT:   %pattern_type.27e: type = pattern_type %Adapter [concrete]
 // CHECK:STDOUT:   %pattern_type.501: type = pattern_type %i32 [concrete]
@@ -683,6 +683,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
 // CHECK:STDOUT:   %Int.type: type = generic_class_type @Int [concrete]
 // CHECK:STDOUT:   %Int.generic: %Int.type = struct_value () [concrete]
 // CHECK:STDOUT:   %i32: type = class_type @Int, @Int(%int_32) [concrete]
+// CHECK:STDOUT:   %i32.builtin: type = int_type signed, %int_32 [concrete]
+// CHECK:STDOUT:   %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic]
 // CHECK:STDOUT:   %struct_type.x.200: type = struct_type {.x: %T} [symbolic]
 // CHECK:STDOUT:   %complete_type.9d1: <witness> = complete_type_witness %struct_type.x.200 [symbolic]
@@ -692,8 +694,6 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
 // CHECK:STDOUT:   %C.239: type = class_type @C, @C(%i32) [concrete]
 // CHECK:STDOUT:   %struct_type.x.767: type = struct_type {.x: %i32} [concrete]
 // CHECK:STDOUT:   %complete_type.c07: <witness> = complete_type_witness %struct_type.x.767 [concrete]
-// CHECK:STDOUT:   %i32.builtin: type = int_type signed, %int_32 [concrete]
-// CHECK:STDOUT:   %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
 // CHECK:STDOUT:   %C.elem.ed6: type = unbound_element_type %C.239, %i32 [concrete]
 // CHECK:STDOUT:   %pattern_type.27e: type = pattern_type %Adapter [concrete]
 // CHECK:STDOUT:   %pattern_type.501: type = pattern_type %i32 [concrete]

+ 8 - 8
toolchain/check/testdata/class/generic/base_is_generic.carbon

@@ -286,11 +286,11 @@ fn H() {
 // CHECK:STDOUT:   %Base.elem.e9c: type = unbound_element_type %Base.8f3, %T.d9f [symbolic]
 // CHECK:STDOUT:   %require_complete.4b7: <witness> = require_complete_type %T.d9f [symbolic]
 // CHECK:STDOUT:   %Base.7a8: type = class_type @Base, @Base(%Param) [concrete]
-// CHECK:STDOUT:   %struct_type.base.8bc: type = struct_type {.base: %Base.7a8} [concrete]
-// CHECK:STDOUT:   %complete_type.b07: <witness> = complete_type_witness %struct_type.base.8bc [concrete]
-// CHECK:STDOUT:   %Base.elem.d1f: type = unbound_element_type %Base.7a8, %Param [concrete]
 // CHECK:STDOUT:   %struct_type.x.975: type = struct_type {.x: %Param} [concrete]
 // CHECK:STDOUT:   %complete_type.db3: <witness> = complete_type_witness %struct_type.x.975 [concrete]
+// CHECK:STDOUT:   %Base.elem.d1f: type = unbound_element_type %Base.7a8, %Param [concrete]
+// CHECK:STDOUT:   %struct_type.base.8bc: type = struct_type {.base: %Base.7a8} [concrete]
+// CHECK:STDOUT:   %complete_type.b07: <witness> = complete_type_witness %struct_type.base.8bc [concrete]
 // CHECK:STDOUT:   %pattern_type.fb9: type = pattern_type %Derived [concrete]
 // CHECK:STDOUT:   %pattern_type.501: type = pattern_type %i32 [concrete]
 // CHECK:STDOUT:   %ImportedDoubleFieldAccess.type: type = fn_type @ImportedDoubleFieldAccess [concrete]
@@ -801,13 +801,13 @@ fn H() {
 // CHECK:STDOUT:   %X.G.specific_fn.f7a: <specific function> = specific_function %X.G.045884.1, @X.G(%U) [symbolic]
 // CHECK:STDOUT:   %require_complete.4b7: <witness> = require_complete_type %U [symbolic]
 // CHECK:STDOUT:   %X.fa229d.2: type = class_type @X, @X(%T) [symbolic]
+// CHECK:STDOUT:   %X.G.type.89b800.2: type = fn_type @X.G, @X(%T) [symbolic]
+// CHECK:STDOUT:   %X.G.045884.2: %X.G.type.89b800.2 = struct_value () [symbolic]
 // CHECK:STDOUT:   %C.3f0: type = class_type @C, @C(%T) [symbolic]
 // CHECK:STDOUT:   %C.elem.b96: type = unbound_element_type %C.3f0, %X.fa229d.2 [symbolic]
 // CHECK:STDOUT:   %struct_type.base.b13: type = struct_type {.base: %X.fa229d.2} [symbolic]
 // CHECK:STDOUT:   %complete_type.b1f: <witness> = complete_type_witness %struct_type.base.b13 [symbolic]
 // CHECK:STDOUT:   %require_complete.6fb: <witness> = require_complete_type %X.fa229d.2 [symbolic]
-// CHECK:STDOUT:   %X.G.type.89b800.2: type = fn_type @X.G, @X(%T) [symbolic]
-// CHECK:STDOUT:   %X.G.045884.2: %X.G.type.89b800.2 = struct_value () [symbolic]
 // CHECK:STDOUT:   %C.98a: type = class_type @C, @C(%i32) [concrete]
 // CHECK:STDOUT:   %X.448: type = class_type @X, @X(%i32) [concrete]
 // CHECK:STDOUT:   %X.G.type.862: type = fn_type @X.G, @X(%i32) [concrete]
@@ -828,10 +828,10 @@ fn H() {
 // CHECK:STDOUT:     import Core//prelude/...
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
+// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//extend_generic_symbolic_base, loc4_14, loaded [symbolic = @X.%U (constants.%U)]
 // CHECK:STDOUT:   %Main.import_ref.8f2: <witness> = import_ref Main//extend_generic_symbolic_base, loc6_1, loaded [concrete = constants.%complete_type.357]
 // CHECK:STDOUT:   %Main.import_ref.e14 = import_ref Main//extend_generic_symbolic_base, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.e33: @X.%X.G.type (%X.G.type.89b800.1) = import_ref Main//extend_generic_symbolic_base, loc5_15, loaded [symbolic = @X.%X.G (constants.%X.G.045884.1)]
-// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//extend_generic_symbolic_base, loc4_14, loaded [symbolic = @X.%U (constants.%U)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//extend_generic_symbolic_base, loc4_14, loaded [symbolic = @X.%U (constants.%U)]
 // CHECK:STDOUT:   %Main.import_ref.5d2: <witness> = import_ref Main//extend_generic_symbolic_base, loc10_1, loaded [symbolic = @C.%complete_type (constants.%complete_type.b1f)]
 // CHECK:STDOUT:   %Main.import_ref.034 = import_ref Main//extend_generic_symbolic_base, inst{{[0-9A-F]+}} [no loc], unloaded
@@ -875,7 +875,7 @@ fn H() {
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @X(imports.%Main.import_ref.efcd44.1: type) [from "extend_generic_symbolic_base.carbon"] {
+// CHECK:STDOUT: generic class @X(imports.%Main.import_ref.efcd44.2: type) [from "extend_generic_symbolic_base.carbon"] {
 // CHECK:STDOUT:   %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -914,7 +914,7 @@ fn H() {
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @X.G(imports.%Main.import_ref.efcd44.2: type) [from "extend_generic_symbolic_base.carbon"] {
+// CHECK:STDOUT: generic fn @X.G(imports.%Main.import_ref.efcd44.1: type) [from "extend_generic_symbolic_base.carbon"] {
 // CHECK:STDOUT:   %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
 // CHECK:STDOUT:   %pattern_type: type = pattern_type %U [symbolic = %pattern_type (constants.%pattern_type.e68)]
 // CHECK:STDOUT:

+ 2 - 2
toolchain/check/testdata/class/generic/field.carbon

@@ -65,13 +65,13 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
 // CHECK:STDOUT:   %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic]
 // CHECK:STDOUT:   %T.417: %Copy.type = symbolic_binding T, 0 [symbolic]
 // CHECK:STDOUT:   %T.binding.as_type: type = symbolic_binding_type T, 0, %T.417 [symbolic]
-// CHECK:STDOUT:   %pattern_type.322: type = pattern_type %Copy.type [concrete]
 // CHECK:STDOUT:   %Copy.lookup_impl_witness.c42a3d.1: <witness> = lookup_impl_witness %T.417, @Copy [symbolic]
 // CHECK:STDOUT:   %.a79665.1: type = fn_type_with_self_type %Copy.Op.type, %T.417 [symbolic]
 // CHECK:STDOUT:   %impl.elem0.fac0be.1: %.a79665.1 = impl_witness_access %Copy.lookup_impl_witness.c42a3d.1, element0 [symbolic]
 // CHECK:STDOUT:   %specific_impl_fn.103937.1: <specific function> = specific_impl_function %impl.elem0.fac0be.1, @Copy.Op(%T.417) [symbolic]
-// CHECK:STDOUT:   %require_complete.d742dc.1: <witness> = require_complete_type %T.binding.as_type [symbolic]
 // CHECK:STDOUT:   %pattern_type.f14b96.2: type = pattern_type %T.binding.as_type [symbolic]
+// CHECK:STDOUT:   %require_complete.d742dc.1: <witness> = require_complete_type %T.binding.as_type [symbolic]
+// CHECK:STDOUT:   %pattern_type.322: type = pattern_type %Copy.type [concrete]
 // CHECK:STDOUT:   %Copy.impl_witness.fb7: <witness> = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete]

+ 9 - 9
toolchain/check/testdata/class/generic/import.carbon

@@ -322,11 +322,11 @@ class Class(U:! type) {
 // CHECK:STDOUT:   %Main.import_ref.39e: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.60d) = import_ref Main//foo, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.846)]
 // CHECK:STDOUT:   %ImplicitAs.impl_witness_table.99d = impl_witness_table (%Main.import_ref.39e), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//foo, loc4_13, loaded [symbolic = @Class.%T.1 (constants.%T)]
+// CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.eb1: <witness> = import_ref Main//foo, loc9_1, loaded [concrete = constants.%complete_type.a68]
 // CHECK:STDOUT:   %Main.import_ref.bcf = import_ref Main//foo, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.1b0 = import_ref Main//foo, loc7_8, unloaded
 // CHECK:STDOUT:   %Main.import_ref.758 = import_ref Main//foo, loc8_17, unloaded
-// CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.3: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
 // CHECK:STDOUT:   %Core.ImplicitAs: %ImplicitAs.type.595 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
@@ -384,7 +384,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.3: type) [from "foo.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -403,7 +403,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.3: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
 // CHECK:STDOUT: !definition:
 // CHECK:STDOUT:
 // CHECK:STDOUT:   fn;
@@ -513,11 +513,11 @@ class Class(U:! type) {
 // CHECK:STDOUT:     import Core//prelude/...
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
+// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T.d9f)]
 // CHECK:STDOUT:   %Main.import_ref.eb1: <witness> = import_ref Main//foo, loc9_1, loaded [concrete = constants.%complete_type.54b]
 // CHECK:STDOUT:   %Main.import_ref.bcf = import_ref Main//foo, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.c3a: @CompleteClass.%CompleteClass.elem (%CompleteClass.elem.36b) = import_ref Main//foo, loc7_8, loaded [concrete = %.a07]
 // CHECK:STDOUT:   %Main.import_ref.191: @CompleteClass.%CompleteClass.F.type (%CompleteClass.F.type.0fa) = import_ref Main//foo, loc8_17, loaded [symbolic = @CompleteClass.%CompleteClass.F (constants.%CompleteClass.F.6e9)]
-// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T.d9f)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T.d9f)]
 // CHECK:STDOUT:   %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
 // CHECK:STDOUT:   %.a07: @CompleteClass.%CompleteClass.elem (%CompleteClass.elem.36b) = field_decl n, element0 [concrete]
@@ -557,7 +557,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.1: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T.d9f)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -606,7 +606,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   return %CompleteClass.F.call to %return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.1: type) [from "foo.carbon"] {
 // CHECK:STDOUT: !definition:
 // CHECK:STDOUT:
 // CHECK:STDOUT:   fn;
@@ -726,11 +726,11 @@ class Class(U:! type) {
 // CHECK:STDOUT:     import Core//prelude
 // CHECK:STDOUT:     import Core//prelude/...
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.eb1: <witness> = import_ref Main//foo, loc9_1, loaded [concrete = constants.%complete_type.a68]
 // CHECK:STDOUT:   %Main.import_ref.bcf = import_ref Main//foo, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.1b0 = import_ref Main//foo, loc7_8, unloaded
 // CHECK:STDOUT:   %Main.import_ref.758 = import_ref Main//foo, loc8_17, unloaded
-// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)]
 // CHECK:STDOUT:   %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
 // CHECK:STDOUT:   %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
@@ -750,7 +750,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   %Use.decl: %Use.type = fn_decl @Use [concrete = constants.%Use] {} {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.1: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic class @CompleteClass(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -796,7 +796,7 @@ class Class(U:! type) {
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.2: type) [from "foo.carbon"] {
+// CHECK:STDOUT: generic fn @CompleteClass.F(imports.%Main.import_ref.efcd44.1: type) [from "foo.carbon"] {
 // CHECK:STDOUT: !definition:
 // CHECK:STDOUT:
 // CHECK:STDOUT:   fn;

+ 5 - 5
toolchain/check/testdata/class/virtual_modifiers.carbon

@@ -4824,9 +4824,9 @@ class T2(G2:! type) {
 // CHECK:STDOUT:   %Base.8f3: type = class_type @Base, @Base(%T) [symbolic]
 // CHECK:STDOUT:   %Base.F.type.3ca: type = fn_type @Base.F, @Base(%T) [symbolic]
 // CHECK:STDOUT:   %Base.F.77f: %Base.F.type.3ca = struct_value () [symbolic]
-// CHECK:STDOUT:   %pattern_type.7f5: type = pattern_type %Base.8f3 [symbolic]
-// CHECK:STDOUT:   %require_complete: <witness> = require_complete_type %Base.8f3 [symbolic]
 // CHECK:STDOUT:   %Base.F.specific_fn.2ee: <specific function> = specific_function %Base.F.77f, @Base.F(%T) [symbolic]
+// CHECK:STDOUT:   %require_complete: <witness> = require_complete_type %Base.8f3 [symbolic]
+// CHECK:STDOUT:   %pattern_type.7f5: type = pattern_type %Base.8f3 [symbolic]
 // CHECK:STDOUT:   %Base.ea5: type = class_type @Base, @Base(%T1) [concrete]
 // CHECK:STDOUT:   %Base.F.type.d82: type = fn_type @Base.F, @Base(%T1) [concrete]
 // CHECK:STDOUT:   %Base.F.d25: %Base.F.type.d82 = struct_value () [concrete]
@@ -4846,11 +4846,11 @@ class T2(G2:! type) {
 // CHECK:STDOUT:     import Core//prelude
 // CHECK:STDOUT:     import Core//prelude/...
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//generic_lib, loc4_17, loaded [symbolic = @Base.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.4aa: ref %ptr.454 = import_ref Main//generic_lib, loc6_1, loaded [concrete = constants.%Base.vtable_decl]
 // CHECK:STDOUT:   %Main.import_ref.05e: <witness> = import_ref Main//generic_lib, loc6_1, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.a14 = import_ref Main//generic_lib, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.184 = import_ref Main//generic_lib, loc5_30, unloaded
-// CHECK:STDOUT:   %Main.import_ref.efcd44.1: type = import_ref Main//generic_lib, loc4_17, loaded [symbolic = @Base.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//generic_lib, loc4_17, loaded [symbolic = @Base.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.66b: <specific function> = import_ref Main//generic_lib, loc6_1, loaded [symbolic = constants.%Base.F.specific_fn.2ee]
 // CHECK:STDOUT: }
@@ -4880,7 +4880,7 @@ class T2(G2:! type) {
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @T1;
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @Base(imports.%Main.import_ref.efcd44.1: type) [from "generic_lib.carbon"] {
+// CHECK:STDOUT: generic class @Base(imports.%Main.import_ref.efcd44.2: type) [from "generic_lib.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -4902,7 +4902,7 @@ class T2(G2:! type) {
 // CHECK:STDOUT:   imports.%Main.import_ref.66b
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic virtual fn @Base.F(imports.%Main.import_ref.efcd44.2: type) [from "generic_lib.carbon"] {
+// CHECK:STDOUT: generic virtual fn @Base.F(imports.%Main.import_ref.efcd44.1: type) [from "generic_lib.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
 // CHECK:STDOUT:   %Base: type = class_type @Base, @Base(%T) [symbolic = %Base (constants.%Base.8f3)]
 // CHECK:STDOUT:   %pattern_type: type = pattern_type %Base [symbolic = %pattern_type (constants.%pattern_type.7f5)]

+ 3 - 3
toolchain/check/testdata/for/actual.carbon

@@ -894,12 +894,12 @@ fn Read() {
 // CHECK:STDOUT:     import Core//prelude/...
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral]
+// CHECK:STDOUT:   %Main.import_ref.40af26.1: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)]
 // CHECK:STDOUT:   %Main.import_ref.80d: <witness> = import_ref Main//lib, loc24_1, loaded [symbolic = @IntRange.%complete_type (constants.%complete_type.655)]
 // CHECK:STDOUT:   %Main.import_ref.b1b = import_ref Main//lib, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.765 = import_ref Main//lib, loc5_57, unloaded
 // CHECK:STDOUT:   %Main.import_ref.e5d = import_ref Main//lib, loc22_20, unloaded
 // CHECK:STDOUT:   %Main.import_ref.997 = import_ref Main//lib, loc23_18, unloaded
-// CHECK:STDOUT:   %Main.import_ref.40af26.1: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)]
 // CHECK:STDOUT:   %Main.import_ref.40af26.2: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)]
 // CHECK:STDOUT:   %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
 // CHECK:STDOUT:   %Core.import_ref.7d5: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.8cf)]
@@ -919,7 +919,7 @@ fn Read() {
 // CHECK:STDOUT:   %Read.decl: %Read.type = fn_decl @Read [concrete = constants.%Read] {} {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic class @IntRange(imports.%Main.import_ref.40af26.1: Core.IntLiteral) [from "lib.carbon"] {
+// CHECK:STDOUT: generic class @IntRange(imports.%Main.import_ref.40af26.2: Core.IntLiteral) [from "lib.carbon"] {
 // CHECK:STDOUT:   %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
@@ -988,7 +988,7 @@ fn Read() {
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @IntRange.Make(imports.%Main.import_ref.40af26.2: Core.IntLiteral) [from "lib.carbon"] {
+// CHECK:STDOUT: generic fn @IntRange.Make(imports.%Main.import_ref.40af26.1: Core.IntLiteral) [from "lib.carbon"] {
 // CHECK:STDOUT:   %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
 // CHECK:STDOUT:   %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.f4f02c.1)]
 // CHECK:STDOUT:   %pattern_type.1: type = pattern_type %Int [symbolic = %pattern_type.1 (constants.%pattern_type.e3e33e.1)]

+ 1 - 1
toolchain/check/testdata/function/builtin/call.carbon

@@ -40,10 +40,10 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
 // CHECK:STDOUT:   %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %From: Core.IntLiteral = symbolic_binding From, 0 [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.type.2c2: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.cdf: %Int.as.ImplicitAs.impl.Convert.type.2c2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]

+ 4 - 4
toolchain/check/testdata/function/builtin/call_from_operator.carbon

@@ -729,11 +729,11 @@ var arr: array(i32, (1 as i32) + (2 as i32)) = (3, 4, (3 as i32) + (4 as i32));
 // CHECK:STDOUT:   %assoc0.5cf: %ImplicitAs.assoc_type.959 = assoc_entity element0, imports.%Core.import_ref.b91295.1 [concrete]
 // CHECK:STDOUT:   %assoc0.7b6: %ImplicitAs.assoc_type.8b5 = assoc_entity element0, imports.%Core.import_ref.d11 [symbolic]
 // CHECK:STDOUT:   %ImplicitAs.type.873: type = facet_type <@ImplicitAs, @ImplicitAs(%i32.builtin)> [concrete]
-// CHECK:STDOUT:   %Self.418: %ImplicitAs.type.873 = symbolic_binding Self, 1 [symbolic]
-// CHECK:STDOUT:   %ImplicitAs.Convert.type.059: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32.builtin) [concrete]
-// CHECK:STDOUT:   %ImplicitAs.Convert.4d7: %ImplicitAs.Convert.type.059 = struct_value () [concrete]
 // CHECK:STDOUT:   %ImplicitAs.assoc_type.398: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%i32.builtin) [concrete]
 // CHECK:STDOUT:   %assoc0.5eb: %ImplicitAs.assoc_type.398 = assoc_entity element0, imports.%Core.import_ref.b91295.2 [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.type.059: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32.builtin) [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.4d7: %ImplicitAs.Convert.type.059 = struct_value () [concrete]
+// CHECK:STDOUT:   %Self.418: %ImplicitAs.type.873 = symbolic_binding Self, 1 [symbolic]
 // CHECK:STDOUT:   %ImplicitAs.impl_witness.fb8: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.16d [concrete]
 // CHECK:STDOUT:   %ImplicitAs.facet.7e7: %ImplicitAs.type.7a9 = facet_value %i32.builtin, (%ImplicitAs.impl_witness.fb8) [concrete]
 // CHECK:STDOUT:   %.f56: type = fn_type_with_self_type %ImplicitAs.Convert.type.71e, %ImplicitAs.facet.7e7 [concrete]
@@ -809,9 +809,9 @@ var arr: array(i32, (1 as i32) + (2 as i32)) = (3, 4, (3 as i32) + (4 as i32));
 // CHECK:STDOUT:   %Core.import_ref.4ff: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2d9) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.4f1)]
 // CHECK:STDOUT:   %Core.import_ref.d11 = import_ref Core//default, loc{{\d+_\d+}}, unloaded
 // CHECK:STDOUT:   %Core.import_ref.8a9: <witness> = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = constants.%ImplicitAs.impl_witness.c15]
+// CHECK:STDOUT:   %Core.import_ref.b91295.2: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
 // CHECK:STDOUT:   %Core.import_ref.8721d7.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = Core.IntLiteral]
 // CHECK:STDOUT:   %Core.import_ref.64f: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = constants.%ImplicitAs.type.873]
-// CHECK:STDOUT:   %Core.import_ref.b91295.2: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.4c8) = import_ref Core//default, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert.e9f)]
 // CHECK:STDOUT:   %Core.import_ref.614: <witness> = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = constants.%ImplicitAs.impl_witness.fb8]
 // CHECK:STDOUT:   %Core.import_ref.c8c7cd.2: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = constants.%i32.builtin]
 // CHECK:STDOUT:   %Core.import_ref.d7b: type = import_ref Core//default, loc{{\d+_\d+}}, loaded [concrete = constants.%ImplicitAs.type.7a9]

+ 1 - 1
toolchain/check/testdata/function/builtin/method.carbon

@@ -70,9 +70,9 @@ var arr: array(i32, (1 as i32).(I.F)(2));
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
 // CHECK:STDOUT:   %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.type.2c2: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.cdf: %Int.as.ImplicitAs.impl.Convert.type.2c2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
 // CHECK:STDOUT:   %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]

+ 3 - 3
toolchain/check/testdata/impl/import_builtin_call.carbon

@@ -473,9 +473,9 @@ var n: Int(64) = MakeFromClass(FromLiteral(64) as OtherInt);
 // CHECK:STDOUT:   %Main.import_ref.06e: <witness> = import_ref Main//generic_impl, loc15_48, loaded [symbolic = @MyInt.as.Add.impl.%Add.impl_witness (constants.%Add.impl_witness.ec1)]
 // CHECK:STDOUT:   %Main.import_ref.59c: @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op.type (%MyInt.as.Add.impl.Op.type.1ab) = import_ref Main//generic_impl, loc16_42, loaded [symbolic = @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op (constants.%MyInt.as.Add.impl.Op.959)]
 // CHECK:STDOUT:   %Add.impl_witness_table = impl_witness_table (%Main.import_ref.59c), @MyInt.as.Add.impl [concrete]
+// CHECK:STDOUT:   %Main.import_ref.40af26.3: Core.IntLiteral = import_ref Main//generic_impl, loc15_14, loaded [symbolic = @MyInt.as.Add.impl.%N (constants.%N)]
 // CHECK:STDOUT:   %Main.import_ref.fbc: type = import_ref Main//generic_impl, loc15_39, loaded [symbolic = @MyInt.as.Add.impl.%MyInt (constants.%MyInt.19f)]
 // CHECK:STDOUT:   %Main.import_ref.bf0: type = import_ref Main//generic_impl, loc15_44, loaded [concrete = constants.%Add.type]
-// CHECK:STDOUT:   %Main.import_ref.40af26.3: Core.IntLiteral = import_ref Main//generic_impl, loc15_14, loaded [symbolic = @MyInt.as.Add.impl.%N (constants.%N)]
 // CHECK:STDOUT:   %Main.import_ref.40af26.4: Core.IntLiteral = import_ref Main//generic_impl, loc15_14, loaded [symbolic = @MyInt.as.Add.impl.%N (constants.%N)]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -519,7 +519,7 @@ var n: Int(64) = MakeFromClass(FromLiteral(64) as OtherInt);
 // CHECK:STDOUT: !requires:
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic impl @MyInt.as.Add.impl(imports.%Main.import_ref.40af26.3: Core.IntLiteral) [from "generic_impl.carbon"] {
+// CHECK:STDOUT: generic impl @MyInt.as.Add.impl(imports.%Main.import_ref.40af26.4: Core.IntLiteral) [from "generic_impl.carbon"] {
 // CHECK:STDOUT:   %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
 // CHECK:STDOUT:   %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt.19f)]
 // CHECK:STDOUT:   %Add.impl_witness: <witness> = impl_witness imports.%Add.impl_witness_table, @MyInt.as.Add.impl(%N) [symbolic = %Add.impl_witness (constants.%Add.impl_witness.ec1)]
@@ -584,7 +584,7 @@ var n: Int(64) = MakeFromClass(FromLiteral(64) as OtherInt);
 // CHECK:STDOUT:   fn;
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @MyInt.as.Add.impl.Op(imports.%Main.import_ref.40af26.4: Core.IntLiteral) [from "generic_impl.carbon"] {
+// CHECK:STDOUT: generic fn @MyInt.as.Add.impl.Op(imports.%Main.import_ref.40af26.3: Core.IntLiteral) [from "generic_impl.carbon"] {
 // CHECK:STDOUT:   %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
 // CHECK:STDOUT:   %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt.19f)]
 // CHECK:STDOUT:   %pattern_type: type = pattern_type %MyInt [symbolic = %pattern_type (constants.%pattern_type.37a)]

+ 1 - 1
toolchain/check/testdata/impl/import_generic.carbon

@@ -934,9 +934,9 @@ impl forall [T:! type] D as N(T*) {}
 // CHECK:STDOUT:   %require_complete.c94: <witness> = require_complete_type %I.type.070 [symbolic]
 // CHECK:STDOUT:   %ptr: type = ptr_type %T [symbolic]
 // CHECK:STDOUT:   %I.type.229: type = facet_type <@I, @I(%ptr)> [symbolic]
+// CHECK:STDOUT:   %Self.6d0: %I.type.229 = symbolic_binding Self, 1 [symbolic]
 // CHECK:STDOUT:   %I.impl_witness.a0f: <witness> = impl_witness imports.%I.impl_witness_table.af9, @C.as.I.impl.1fddff.1(%T) [symbolic]
 // CHECK:STDOUT:   %require_complete.555: <witness> = require_complete_type %I.type.229 [symbolic]
-// CHECK:STDOUT:   %Self.6d0: %I.type.229 = symbolic_binding Self, 1 [symbolic]
 // CHECK:STDOUT:   %type: type = facet_type <type> [concrete]
 // CHECK:STDOUT:   %.Self: %type = symbolic_binding .Self [symbolic_self]
 // CHECK:STDOUT:   %N.type.673: type = generic_named_constaint_type @N [concrete]

+ 12 - 12
toolchain/check/testdata/impl/import_thunk.carbon

@@ -391,17 +391,17 @@ fn G() {
 // CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.type.158: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%DestroyT) [symbolic]
 // CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.732: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.158 = struct_value () [symbolic]
 // CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.type.9d8: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.4a7) [symbolic]
+// CHECK:STDOUT:   %require_complete.10b: <witness> = require_complete_type %C.32c8ec.2 [symbolic]
 // CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.32b: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.9d8 = struct_value () [symbolic]
-// CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.a82: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.32b, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.4a7) [symbolic]
 // CHECK:STDOUT:   %Destroy.impl_witness.3e8: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.4a7) [symbolic]
+// CHECK:STDOUT:   %C.as.I.impl.F.type.bc035d.2: type = fn_type @C.as.I.impl.F.2, @C.as.I.impl(%Y) [symbolic]
+// CHECK:STDOUT:   %C.as.I.impl.F.e11987.2: %C.as.I.impl.F.type.bc035d.2 = struct_value () [symbolic]
+// CHECK:STDOUT:   %pattern_type.ba6: type = pattern_type %C.32c8ec.2 [symbolic]
+// CHECK:STDOUT:   %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.a82: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.32b, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.4a7) [symbolic]
 // CHECK:STDOUT:   %Destroy.facet.f71: %Destroy.type = facet_value %C.32c8ec.2, (%Destroy.impl_witness.3e8) [symbolic]
 // CHECK:STDOUT:   %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
 // CHECK:STDOUT:   %.7e5: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.f71 [symbolic]
 // CHECK:STDOUT:   %C.val.31e: %C.32c8ec.2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %require_complete.10b: <witness> = require_complete_type %C.32c8ec.2 [symbolic]
-// CHECK:STDOUT:   %C.as.I.impl.F.type.bc035d.2: type = fn_type @C.as.I.impl.F.2, @C.as.I.impl(%Y) [symbolic]
-// CHECK:STDOUT:   %C.as.I.impl.F.e11987.2: %C.as.I.impl.F.type.bc035d.2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %pattern_type.ba6: type = pattern_type %C.32c8ec.2 [symbolic]
 // CHECK:STDOUT:   %C.as.I.impl.F.specific_fn.5ba: <specific function> = specific_function %C.as.I.impl.F.e11987.2, @C.as.I.impl.F.2(%Y) [symbolic]
 // CHECK:STDOUT:   %I.impl_witness.2f0: <witness> = impl_witness imports.%I.impl_witness_table, @C.as.I.impl(%empty_tuple) [concrete]
 // CHECK:STDOUT:   %C.as.I.impl.F.type.b60f7c.1: type = fn_type @C.as.I.impl.F.2, @C.as.I.impl(%empty_tuple) [concrete]
@@ -443,13 +443,13 @@ fn G() {
 // CHECK:STDOUT:   %Main.import_ref.c03: <witness> = import_ref Main//b, loc7_32, loaded [symbolic = @C.as.I.impl.%I.impl_witness (constants.%I.impl_witness.9b0)]
 // CHECK:STDOUT:   %Main.import_ref.fad: @C.as.I.impl.%C.as.I.impl.F.type.2 (%C.as.I.impl.F.type.bc035d.1) = import_ref Main//b, loc8_17, loaded [symbolic = @C.as.I.impl.%C.as.I.impl.F.2 (constants.%C.as.I.impl.F.e11987.1)]
 // CHECK:STDOUT:   %I.impl_witness_table = impl_witness_table (%Main.import_ref.fad), @C.as.I.impl [concrete]
-// CHECK:STDOUT:   %Main.import_ref.801: type = import_ref Main//b, loc7_25, loaded [symbolic = @C.as.I.impl.%C (constants.%C.32c8ec.2)]
-// CHECK:STDOUT:   %Main.import_ref.f50: type = import_ref Main//b, loc7_30, loaded [concrete = constants.%I.type]
-// CHECK:STDOUT:   %Main.import_ref.7a8327.2: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @C.as.I.impl.%Y (constants.%Y)]
 // CHECK:STDOUT:   %Main.F.564: @C.as.I.impl.%C.as.I.impl.F.type.1 (%C.as.I.impl.F.type.bc035d.2) = import_ref Main//b, F, loaded [symbolic = @C.as.I.impl.%C.as.I.impl.F.1 (constants.%C.as.I.impl.F.e11987.2)]
-// CHECK:STDOUT:   %Main.import_ref.7a8327.3: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @C.as.I.impl.%Y (constants.%Y)]
+// CHECK:STDOUT:   %Main.import_ref.7a8327.2: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @C.as.I.impl.%Y (constants.%Y)]
 // CHECK:STDOUT:   %Main.import_ref.eac: @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op.type (%DestroyT.binding.as_type.as.Destroy.impl.Op.type.158) = import_ref Main//b, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.732)]
 // CHECK:STDOUT:   %Destroy.impl_witness_table = impl_witness_table (%Main.import_ref.eac), @DestroyT.binding.as_type.as.Destroy.impl [concrete]
+// CHECK:STDOUT:   %Main.import_ref.7a8327.3: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @C.as.I.impl.%Y (constants.%Y)]
+// CHECK:STDOUT:   %Main.import_ref.801: type = import_ref Main//b, loc7_25, loaded [symbolic = @C.as.I.impl.%C (constants.%C.32c8ec.2)]
+// CHECK:STDOUT:   %Main.import_ref.f50: type = import_ref Main//b, loc7_30, loaded [concrete = constants.%I.type]
 // CHECK:STDOUT:   %Main.import_ref.7a8327.4: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @C.as.I.impl.%Y (constants.%Y)]
 // CHECK:STDOUT:   %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
 // CHECK:STDOUT: }
@@ -475,7 +475,7 @@ fn G() {
 // CHECK:STDOUT: !requires:
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic impl @C.as.I.impl(imports.%Main.import_ref.7a8327.2: %empty_tuple.type) [from "b.carbon"] {
+// CHECK:STDOUT: generic impl @C.as.I.impl(imports.%Main.import_ref.7a8327.4: %empty_tuple.type) [from "b.carbon"] {
 // CHECK:STDOUT:   %Y: %empty_tuple.type = symbolic_binding Y, 0 [symbolic = %Y (constants.%Y)]
 // CHECK:STDOUT:   %C: type = class_type @C, @C(%Y) [symbolic = %C (constants.%C.32c8ec.2)]
 // CHECK:STDOUT:   %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table, @C.as.I.impl(%Y) [symbolic = %I.impl_witness (constants.%I.impl_witness.9b0)]
@@ -543,7 +543,7 @@ fn G() {
 // CHECK:STDOUT:   fn;
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @C.as.I.impl.F.1(imports.%Main.import_ref.7a8327.3: %empty_tuple.type) [from "b.carbon"] {
+// CHECK:STDOUT: generic fn @C.as.I.impl.F.1(imports.%Main.import_ref.7a8327.2: %empty_tuple.type) [from "b.carbon"] {
 // CHECK:STDOUT: !definition:
 // CHECK:STDOUT:   %Y: %empty_tuple.type = symbolic_binding Y, 0 [symbolic = %Y (constants.%Y)]
 // CHECK:STDOUT:   %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F.2, @C.as.I.impl(%Y) [symbolic = %C.as.I.impl.F.type (constants.%C.as.I.impl.F.type.bc035d.2)]
@@ -563,7 +563,7 @@ fn G() {
 // CHECK:STDOUT:   fn [thunk imports.%Main.F.564];
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @C.as.I.impl.F.2(imports.%Main.import_ref.7a8327.4: %empty_tuple.type) [from "b.carbon"] {
+// CHECK:STDOUT: generic fn @C.as.I.impl.F.2(imports.%Main.import_ref.7a8327.3: %empty_tuple.type) [from "b.carbon"] {
 // CHECK:STDOUT:   %Y: %empty_tuple.type = symbolic_binding Y, 0 [symbolic = %Y (constants.%Y)]
 // CHECK:STDOUT:   %C: type = class_type @C, @C(%Y) [symbolic = %C (constants.%C.32c8ec.2)]
 // CHECK:STDOUT:   %pattern_type: type = pattern_type %C [symbolic = %pattern_type (constants.%pattern_type.ba6)]

+ 3 - 3
toolchain/check/testdata/impl/import_use_generic.carbon

@@ -230,9 +230,9 @@ fn H() -> C({}).(I.F)() {}
 // CHECK:STDOUT:   %Main.import_ref.bc1: <witness> = import_ref Main//import_generic, loc10_34, loaded [symbolic = @C.as.I.impl.%I.impl_witness (constants.%I.impl_witness.2ba)]
 // CHECK:STDOUT:   %Main.import_ref.2bf: @C.as.I.impl.%C.as.I.impl.F.type (%C.as.I.impl.F.type.dd2) = import_ref Main//import_generic, loc11_10, loaded [symbolic = @C.as.I.impl.%C.as.I.impl.F (constants.%C.as.I.impl.F.470)]
 // CHECK:STDOUT:   %I.impl_witness_table = impl_witness_table (%Main.import_ref.2bf), @C.as.I.impl [concrete]
+// CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @C.as.I.impl.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.4d2: type = import_ref Main//import_generic, loc10_27, loaded [symbolic = @C.as.I.impl.%C (constants.%C.3f0)]
 // CHECK:STDOUT:   %Main.import_ref.301: type = import_ref Main//import_generic, loc10_32, loaded [concrete = constants.%I.type]
-// CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @C.as.I.impl.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.efcd44.3: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @C.as.I.impl.%T (constants.%T)]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -298,7 +298,7 @@ fn H() -> C({}).(I.F)() {}
 // CHECK:STDOUT: !requires:
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic impl @C.as.I.impl(imports.%Main.import_ref.efcd44.2: type) [from "import_generic.carbon"] {
+// CHECK:STDOUT: generic impl @C.as.I.impl(imports.%Main.import_ref.efcd44.3: type) [from "import_generic.carbon"] {
 // CHECK:STDOUT:   %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
 // CHECK:STDOUT:   %C: type = class_type @C, @C(%T) [symbolic = %C (constants.%C.3f0)]
 // CHECK:STDOUT:   %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table, @C.as.I.impl(%T) [symbolic = %I.impl_witness (constants.%I.impl_witness.2ba)]
@@ -334,7 +334,7 @@ fn H() -> C({}).(I.F)() {}
 // CHECK:STDOUT: !entry:
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @C.as.I.impl.F(imports.%Main.import_ref.efcd44.3: type) [from "import_generic.carbon"] {
+// CHECK:STDOUT: generic fn @C.as.I.impl.F(imports.%Main.import_ref.efcd44.2: type) [from "import_generic.carbon"] {
 // CHECK:STDOUT: !definition:
 // CHECK:STDOUT:
 // CHECK:STDOUT:   fn;

+ 26 - 26
toolchain/check/testdata/impl/interface_args.carbon

@@ -445,12 +445,12 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.e34 [symbolic]
 // CHECK:STDOUT:   %pattern_type.29e: type = pattern_type %Self.binding.as_type [symbolic]
 // CHECK:STDOUT:   %Action.type.74f: type = facet_type <@Action, @Action(%B)> [concrete]
-// CHECK:STDOUT:   %A: type = class_type @A [concrete]
-// CHECK:STDOUT:   %Self.1b9: %Action.type.74f = symbolic_binding Self, 1 [symbolic]
-// CHECK:STDOUT:   %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
-// CHECK:STDOUT:   %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
 // CHECK:STDOUT:   %Action.assoc_type.4ee: type = assoc_entity_type @Action, @Action(%B) [concrete]
 // CHECK:STDOUT:   %assoc0.785: %Action.assoc_type.4ee = assoc_entity element0, imports.%Main.import_ref.38d [concrete]
+// CHECK:STDOUT:   %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
+// CHECK:STDOUT:   %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
+// CHECK:STDOUT:   %Self.1b9: %Action.type.74f = symbolic_binding Self, 1 [symbolic]
+// CHECK:STDOUT:   %A: type = class_type @A [concrete]
 // CHECK:STDOUT:   %pattern_type.c10: type = pattern_type %A [concrete]
 // CHECK:STDOUT:   %G.type: type = fn_type @G [concrete]
 // CHECK:STDOUT:   %G: %G.type = struct_value () [concrete]
@@ -482,12 +482,12 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.e3c: @Action.%Action.type (%Action.type.f0c) = import_ref Main//action, loc4_28, loaded [symbolic = @Action.%Self (constants.%Self.e34)]
 // CHECK:STDOUT:   %Main.import_ref.c2f: <witness> = import_ref Main//action, loc12_21, loaded [concrete = constants.%Action.impl_witness]
+// CHECK:STDOUT:   %Main.import_ref.38d: @Action.%Action.Op.type (%Action.Op.type.0af) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%Action.Op (constants.%Action.Op.afb)]
 // CHECK:STDOUT:   %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.da3 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
 // CHECK:STDOUT:   %Main.import_ref.99f: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.74f]
 // CHECK:STDOUT:   %Main.import_ref.8c4 = import_ref Main//action, loc13_23, unloaded
-// CHECK:STDOUT:   %Main.import_ref.38d: @Action.%Action.Op.type (%Action.Op.type.0af) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%Action.Op (constants.%Action.Op.afb)]
 // CHECK:STDOUT:   %Main.import_ref.35cfc8.2 = import_ref Main//action, loc5_22, unloaded
 // CHECK:STDOUT:   %Main.import_ref.469: %A.as.Action.impl.Op.type = import_ref Main//action, loc13_23, loaded [concrete = constants.%A.as.Action.impl.Op]
 // CHECK:STDOUT:   %Action.impl_witness_table = impl_witness_table (%Main.import_ref.469), @A.as.Action.impl [concrete]
@@ -625,12 +625,12 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.e34 [symbolic]
 // CHECK:STDOUT:   %pattern_type.29e: type = pattern_type %Self.binding.as_type [symbolic]
 // CHECK:STDOUT:   %Action.type.74f: type = facet_type <@Action, @Action(%B)> [concrete]
-// CHECK:STDOUT:   %A: type = class_type @A [concrete]
-// CHECK:STDOUT:   %Self.1b9: %Action.type.74f = symbolic_binding Self, 1 [symbolic]
-// CHECK:STDOUT:   %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
-// CHECK:STDOUT:   %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
 // CHECK:STDOUT:   %Action.assoc_type.4ee: type = assoc_entity_type @Action, @Action(%B) [concrete]
 // CHECK:STDOUT:   %assoc0.cdf: %Action.assoc_type.4ee = assoc_entity element0, imports.%Main.import_ref.35cfc8.1 [concrete]
+// CHECK:STDOUT:   %Action.Op.type.54d: type = fn_type @Action.Op, @Action(%B) [concrete]
+// CHECK:STDOUT:   %Action.Op.dba: %Action.Op.type.54d = struct_value () [concrete]
+// CHECK:STDOUT:   %Self.1b9: %Action.type.74f = symbolic_binding Self, 1 [symbolic]
+// CHECK:STDOUT:   %A: type = class_type @A [concrete]
 // CHECK:STDOUT:   %pattern_type.c10: type = pattern_type %A [concrete]
 // CHECK:STDOUT:   %G.type: type = fn_type @G [concrete]
 // CHECK:STDOUT:   %G: %G.type = struct_value () [concrete]
@@ -664,12 +664,12 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Main.import_ref.efcd44.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.e3c: @Action.%Action.type (%Action.type.f0c) = import_ref Main//action, loc4_28, loaded [symbolic = @Action.%Self (constants.%Self.e34)]
 // CHECK:STDOUT:   %Main.import_ref.7bf = import_ref Main//action, loc12_21, unloaded
+// CHECK:STDOUT:   %Main.import_ref.35cfc8.1 = import_ref Main//action, loc5_22, unloaded
 // CHECK:STDOUT:   %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.da3 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
 // CHECK:STDOUT:   %Main.import_ref.99f: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.74f]
 // CHECK:STDOUT:   %Main.import_ref.8c4 = import_ref Main//action, loc13_23, unloaded
-// CHECK:STDOUT:   %Main.import_ref.35cfc8.1 = import_ref Main//action, loc5_22, unloaded
 // CHECK:STDOUT:   %Main.import_ref.8f24d3.3: <witness> = import_ref Main//action, loc10_10, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.2c4 = import_ref Main//action, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.35cfc8.2 = import_ref Main//action, loc5_22, unloaded
@@ -1073,15 +1073,15 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Factory.Make.type.b89: type = fn_type @Factory.Make, @Factory(%T) [symbolic]
 // CHECK:STDOUT:   %Factory.Make.af4: %Factory.Make.type.b89 = struct_value () [symbolic]
 // CHECK:STDOUT:   %Factory.type.3cb: type = facet_type <@Factory, @Factory(%B)> [concrete]
-// CHECK:STDOUT:   %A: type = class_type @A [concrete]
-// CHECK:STDOUT:   %Self.197: %Factory.type.3cb = symbolic_binding Self, 1 [symbolic]
-// CHECK:STDOUT:   %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
-// CHECK:STDOUT:   %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
 // CHECK:STDOUT:   %Factory.assoc_type.579: type = assoc_entity_type @Factory, @Factory(%B) [concrete]
-// CHECK:STDOUT:   %assoc0.29a: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.b49 [concrete]
+// CHECK:STDOUT:   %assoc1.952: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.a6b [concrete]
 // CHECK:STDOUT:   %Factory.Method.type.117: type = fn_type @Factory.Method, @Factory(%B) [concrete]
 // CHECK:STDOUT:   %Factory.Method.ea9: %Factory.Method.type.117 = struct_value () [concrete]
-// CHECK:STDOUT:   %assoc1.952: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.a6b [concrete]
+// CHECK:STDOUT:   %assoc0.29a: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.b49 [concrete]
+// CHECK:STDOUT:   %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
+// CHECK:STDOUT:   %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
+// CHECK:STDOUT:   %Self.197: %Factory.type.3cb = symbolic_binding Self, 1 [symbolic]
+// CHECK:STDOUT:   %A: type = class_type @A [concrete]
 // CHECK:STDOUT:   %pattern_type.049: type = pattern_type %B [concrete]
 // CHECK:STDOUT:   %MakeB.type: type = fn_type @MakeB [concrete]
 // CHECK:STDOUT:   %MakeB: %MakeB.type = struct_value () [concrete]
@@ -1123,14 +1123,14 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Main.import_ref.efcd44.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.85fa76.2: @Factory.%Factory.type (%Factory.type.fc2) = import_ref Main//factory, loc4_29, loaded [symbolic = @Factory.%Self (constants.%Self.96a)]
 // CHECK:STDOUT:   %Main.import_ref.a6e: <witness> = import_ref Main//factory, loc14_22, loaded [concrete = constants.%Factory.impl_witness]
+// CHECK:STDOUT:   %Main.import_ref.a6b: @Factory.%Factory.Method.type (%Factory.Method.type.159) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%Factory.Method (constants.%Factory.Method.8f7)]
+// CHECK:STDOUT:   %Main.import_ref.b49: @Factory.%Factory.Make.type (%Factory.Make.type.b89) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%Factory.Make (constants.%Factory.Make.af4)]
 // CHECK:STDOUT:   %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.da3 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
 // CHECK:STDOUT:   %Main.import_ref.e91: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.3cb]
 // CHECK:STDOUT:   %Main.import_ref.22f = import_ref Main//factory, loc15_17, unloaded
 // CHECK:STDOUT:   %Main.import_ref.5a9 = import_ref Main//factory, loc16_31, unloaded
-// CHECK:STDOUT:   %Main.import_ref.b49: @Factory.%Factory.Make.type (%Factory.Make.type.b89) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%Factory.Make (constants.%Factory.Make.af4)]
-// CHECK:STDOUT:   %Main.import_ref.a6b: @Factory.%Factory.Method.type (%Factory.Method.type.159) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%Factory.Method (constants.%Factory.Method.8f7)]
 // CHECK:STDOUT:   %Main.import_ref.b0ae2d.2 = import_ref Main//factory, loc6_17, unloaded
 // CHECK:STDOUT:   %Main.import_ref.4c9: %A.as.Factory.impl.Make.type = import_ref Main//factory, loc15_17, loaded [concrete = constants.%A.as.Factory.impl.Make]
 // CHECK:STDOUT:   %Main.import_ref.721: %A.as.Factory.impl.Method.type = import_ref Main//factory, loc16_31, loaded [concrete = constants.%A.as.Factory.impl.Method]
@@ -1327,15 +1327,15 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Factory.Make.type.b89: type = fn_type @Factory.Make, @Factory(%T) [symbolic]
 // CHECK:STDOUT:   %Factory.Make.af4: %Factory.Make.type.b89 = struct_value () [symbolic]
 // CHECK:STDOUT:   %Factory.type.3cb: type = facet_type <@Factory, @Factory(%B)> [concrete]
-// CHECK:STDOUT:   %A: type = class_type @A [concrete]
-// CHECK:STDOUT:   %Self.197: %Factory.type.3cb = symbolic_binding Self, 1 [symbolic]
-// CHECK:STDOUT:   %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
-// CHECK:STDOUT:   %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
 // CHECK:STDOUT:   %Factory.assoc_type.579: type = assoc_entity_type @Factory, @Factory(%B) [concrete]
-// CHECK:STDOUT:   %assoc0.17c: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.b0ae2d.1 [concrete]
+// CHECK:STDOUT:   %assoc1.387: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.b6f0d8.1 [concrete]
 // CHECK:STDOUT:   %Factory.Method.type.117: type = fn_type @Factory.Method, @Factory(%B) [concrete]
 // CHECK:STDOUT:   %Factory.Method.ea9: %Factory.Method.type.117 = struct_value () [concrete]
-// CHECK:STDOUT:   %assoc1.387: %Factory.assoc_type.579 = assoc_entity element1, imports.%Main.import_ref.b6f0d8.1 [concrete]
+// CHECK:STDOUT:   %assoc0.17c: %Factory.assoc_type.579 = assoc_entity element0, imports.%Main.import_ref.b0ae2d.1 [concrete]
+// CHECK:STDOUT:   %Factory.Make.type.c59: type = fn_type @Factory.Make, @Factory(%B) [concrete]
+// CHECK:STDOUT:   %Factory.Make.efe: %Factory.Make.type.c59 = struct_value () [concrete]
+// CHECK:STDOUT:   %Self.197: %Factory.type.3cb = symbolic_binding Self, 1 [symbolic]
+// CHECK:STDOUT:   %A: type = class_type @A [concrete]
 // CHECK:STDOUT:   %C: type = class_type @C [concrete]
 // CHECK:STDOUT:   %pattern_type.c48: type = pattern_type %C [concrete]
 // CHECK:STDOUT:   %MakeC.type: type = fn_type @MakeC [concrete]
@@ -1380,14 +1380,14 @@ fn InstanceC(a: A) -> C {
 // CHECK:STDOUT:   %Main.import_ref.efcd44.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
 // CHECK:STDOUT:   %Main.import_ref.85fa76.2: @Factory.%Factory.type (%Factory.type.fc2) = import_ref Main//factory, loc4_29, loaded [symbolic = @Factory.%Self (constants.%Self.96a)]
 // CHECK:STDOUT:   %Main.import_ref.42c = import_ref Main//factory, loc14_22, unloaded
+// CHECK:STDOUT:   %Main.import_ref.b6f0d8.1 = import_ref Main//factory, loc8_31, unloaded
+// CHECK:STDOUT:   %Main.import_ref.b0ae2d.1 = import_ref Main//factory, loc6_17, unloaded
 // CHECK:STDOUT:   %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
 // CHECK:STDOUT:   %Main.import_ref.da3 = import_ref Main//factory, inst{{[0-9A-F]+}} [no loc], unloaded
 // CHECK:STDOUT:   %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
 // CHECK:STDOUT:   %Main.import_ref.e91: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.3cb]
 // CHECK:STDOUT:   %Main.import_ref.22f = import_ref Main//factory, loc15_17, unloaded
 // CHECK:STDOUT:   %Main.import_ref.5a9 = import_ref Main//factory, loc16_31, unloaded
-// CHECK:STDOUT:   %Main.import_ref.b0ae2d.1 = import_ref Main//factory, loc6_17, unloaded
-// CHECK:STDOUT:   %Main.import_ref.b6f0d8.1 = import_ref Main//factory, loc8_31, unloaded
 // CHECK:STDOUT:   %Main.import_ref.b0ae2d.2 = import_ref Main//factory, loc6_17, unloaded
 // CHECK:STDOUT:   %Main.import_ref.b6f0d8.2 = import_ref Main//factory, loc8_31, unloaded
 // CHECK:STDOUT: }

+ 1 - 1
toolchain/check/testdata/interop/cpp/function/decayed_param.carbon

@@ -109,9 +109,9 @@ fn F() {
 // CHECK:STDOUT:   %MaybeUnformed.cff: type = class_type @MaybeUnformed, @MaybeUnformed(%ptr.4f0) [symbolic]
 // CHECK:STDOUT:   %ptr.as.OptionalStorage.impl.Some.type.911: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic]
 // CHECK:STDOUT:   %ptr.as.OptionalStorage.impl.Some.2a0: %ptr.as.OptionalStorage.impl.Some.type.911 = struct_value () [symbolic]
-// CHECK:STDOUT:   %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
 // CHECK:STDOUT:   %ptr.as.OptionalStorage.impl.None.type.8ed: type = fn_type @ptr.as.OptionalStorage.impl.None, @ptr.as.OptionalStorage.impl(%T.d9f) [symbolic]
 // CHECK:STDOUT:   %ptr.as.OptionalStorage.impl.None.41a: %ptr.as.OptionalStorage.impl.None.type.8ed = struct_value () [symbolic]
+// CHECK:STDOUT:   %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
 // CHECK:STDOUT:   %OptionalStorage.impl_witness.d16: <witness> = impl_witness imports.%OptionalStorage.impl_witness_table.f03, @ptr.as.OptionalStorage.impl(%i32) [concrete]
 // CHECK:STDOUT:   %OptionalStorage.facet.083: %OptionalStorage.type = facet_value %ptr.235, (%OptionalStorage.impl_witness.d16) [concrete]
 // CHECK:STDOUT:   %Optional.97d: type = class_type @Optional, @Optional(%OptionalStorage.facet.083) [concrete]

+ 1 - 1
toolchain/check/testdata/tuple/element_access.carbon

@@ -270,10 +270,10 @@ var b: i32 = a.({.index = 2}.index);
 // CHECK:STDOUT:   %tuple.elem1: ref %i32 = tuple_access file.%a.var, element1 [concrete]
 // CHECK:STDOUT:   %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
 // CHECK:STDOUT:   %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
+// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %From: Core.IntLiteral = symbolic_binding From, 0 [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.type.2c2: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
 // CHECK:STDOUT:   %Int.as.ImplicitAs.impl.Convert.cdf: %Int.as.ImplicitAs.impl.Convert.type.2c2 = struct_value () [symbolic]
-// CHECK:STDOUT:   %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
 // CHECK:STDOUT:   %pattern_type.7ce: type = pattern_type %i32 [concrete]
 // CHECK:STDOUT:   %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
 // CHECK:STDOUT:   %struct_type.index.b1b: type = struct_type {.index: Core.IntLiteral} [concrete]

Неке датотеке нису приказане због велике количине промена