Explorar el Código

Start including the prelude for testing. (#3861)

- Adds an empty prelude.carbon file
- Imports that file in any non-Core package file
  - Adds --disable-prelude-import to avoid that
- Adds --exclude-dump-file-prefix to be able to hide files from dumping
- Used to hide core files (we can't do this by package name due to lex
dumps, for example)
- Restructures some tests to not rely on `i32`, particularly `alias`
tests (which rely on a name ref) and tests with no prelude.

I'm adding the framework for switching i32 to calling Int32 in the
prelude, but I'm running into a separate error actually switching over.
So that *mostly* works, but isn't quite ready for prime time. However,
maybe the current state of this PR is still useful to review since it
does a lot of the infrastructure work and adds the %Core everywhere?
Jon Ross-Perkins hace 2 años
padre
commit
895e90e791
Se han modificado 100 ficheros con 984 adiciones y 456 borrados
  1. 9 0
      core/BUILD
  2. 13 0
      core/prelude.carbon
  3. 23 9
      toolchain/check/check.cpp
  4. 1 1
      toolchain/check/check.h
  5. 54 2
      toolchain/check/context.cpp
  6. 5 1
      toolchain/check/context.h
  7. 19 0
      toolchain/check/handle_literal.cpp
  8. 3 1
      toolchain/check/node_stack.h
  9. 5 53
      toolchain/check/operator.cpp
  10. 38 11
      toolchain/check/testdata/alias/alias_of_alias.carbon
  11. 2 0
      toolchain/check/testdata/alias/builtins.carbon
  12. 25 7
      toolchain/check/testdata/alias/fail_aliased_name_in_diag.carbon
  13. 2 0
      toolchain/check/testdata/alias/fail_bool_value.carbon
  14. 2 0
      toolchain/check/testdata/alias/fail_local_in_namespace.carbon
  15. 34 15
      toolchain/check/testdata/alias/fail_modifiers.carbon
  16. 29 14
      toolchain/check/testdata/alias/fail_name_conflict.carbon
  17. 2 0
      toolchain/check/testdata/alias/fail_not_constant.carbon
  18. 19 3
      toolchain/check/testdata/alias/fail_todo_private.carbon
  19. 6 2
      toolchain/check/testdata/alias/import.carbon
  20. 108 51
      toolchain/check/testdata/alias/import_order.carbon
  21. 48 15
      toolchain/check/testdata/alias/in_namespace.carbon
  22. 2 0
      toolchain/check/testdata/alias/local.carbon
  23. 2 0
      toolchain/check/testdata/array/array_in_place.carbon
  24. 2 0
      toolchain/check/testdata/array/array_vs_tuple.carbon
  25. 2 0
      toolchain/check/testdata/array/assign_return_value.carbon
  26. 2 0
      toolchain/check/testdata/array/assign_var.carbon
  27. 2 0
      toolchain/check/testdata/array/base.carbon
  28. 2 0
      toolchain/check/testdata/array/canonicalize_index.carbon
  29. 2 0
      toolchain/check/testdata/array/fail_bound_negative.carbon
  30. 2 0
      toolchain/check/testdata/array/fail_bound_overflow.carbon
  31. 2 0
      toolchain/check/testdata/array/fail_incomplete_element.carbon
  32. 2 0
      toolchain/check/testdata/array/fail_invalid_type.carbon
  33. 2 0
      toolchain/check/testdata/array/fail_out_of_bound.carbon
  34. 2 0
      toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon
  35. 2 0
      toolchain/check/testdata/array/fail_type_mismatch.carbon
  36. 2 0
      toolchain/check/testdata/array/function_param.carbon
  37. 2 0
      toolchain/check/testdata/array/index_not_literal.carbon
  38. 2 0
      toolchain/check/testdata/array/nine_elements.carbon
  39. 4 1
      toolchain/check/testdata/as/as_type.carbon
  40. 2 0
      toolchain/check/testdata/as/basic.carbon
  41. 4 1
      toolchain/check/testdata/as/fail_no_conversion.carbon
  42. 4 1
      toolchain/check/testdata/as/fail_not_type.carbon
  43. 2 0
      toolchain/check/testdata/as/identity.carbon
  44. 2 0
      toolchain/check/testdata/as/tuple.carbon
  45. 1 1
      toolchain/check/testdata/basics/builtin_insts.carbon
  46. 2 0
      toolchain/check/testdata/basics/builtin_types.carbon
  47. 4 1
      toolchain/check/testdata/basics/empty.carbon
  48. 4 1
      toolchain/check/testdata/basics/empty_decl.carbon
  49. 2 0
      toolchain/check/testdata/basics/fail_bad_run.carbon
  50. 2 0
      toolchain/check/testdata/basics/fail_bad_run_2.carbon
  51. 2 0
      toolchain/check/testdata/basics/fail_name_lookup.carbon
  52. 2 0
      toolchain/check/testdata/basics/fail_non_type_as_type.carbon
  53. 4 1
      toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
  54. 2 0
      toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
  55. 4 0
      toolchain/check/testdata/basics/multifile.carbon
  56. 1 1
      toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon
  57. 1 1
      toolchain/check/testdata/basics/multifile_raw_ir.carbon
  58. 2 0
      toolchain/check/testdata/basics/numeric_literals.carbon
  59. 2 0
      toolchain/check/testdata/basics/parens.carbon
  60. 133 107
      toolchain/check/testdata/basics/raw_and_textual_ir.carbon
  61. 35 19
      toolchain/check/testdata/basics/raw_identifier.carbon
  62. 104 83
      toolchain/check/testdata/basics/raw_ir.carbon
  63. 2 0
      toolchain/check/testdata/basics/run.carbon
  64. 2 0
      toolchain/check/testdata/basics/run_i32.carbon
  65. 32 27
      toolchain/check/testdata/basics/textual_ir.carbon
  66. 1 1
      toolchain/check/testdata/basics/verbose.carbon
  67. 5 1
      toolchain/check/testdata/builtins/bool/make_type.carbon
  68. 8 2
      toolchain/check/testdata/builtins/float/make_type.carbon
  69. 6 0
      toolchain/check/testdata/builtins/int/add.carbon
  70. 2 0
      toolchain/check/testdata/builtins/int/and.carbon
  71. 2 0
      toolchain/check/testdata/builtins/int/complement.carbon
  72. 6 0
      toolchain/check/testdata/builtins/int/div.carbon
  73. 4 0
      toolchain/check/testdata/builtins/int/eq.carbon
  74. 2 0
      toolchain/check/testdata/builtins/int/greater.carbon
  75. 2 0
      toolchain/check/testdata/builtins/int/greater_eq.carbon
  76. 4 0
      toolchain/check/testdata/builtins/int/left_shift.carbon
  77. 2 0
      toolchain/check/testdata/builtins/int/less.carbon
  78. 2 0
      toolchain/check/testdata/builtins/int/less_eq.carbon
  79. 5 1
      toolchain/check/testdata/builtins/int/make_type_32.carbon
  80. 6 0
      toolchain/check/testdata/builtins/int/mod.carbon
  81. 4 0
      toolchain/check/testdata/builtins/int/mul.carbon
  82. 6 0
      toolchain/check/testdata/builtins/int/negate.carbon
  83. 2 0
      toolchain/check/testdata/builtins/int/neq.carbon
  84. 2 0
      toolchain/check/testdata/builtins/int/or.carbon
  85. 6 0
      toolchain/check/testdata/builtins/int/right_shift.carbon
  86. 4 0
      toolchain/check/testdata/builtins/int/sub.carbon
  87. 2 0
      toolchain/check/testdata/builtins/int/xor.carbon
  88. 3 1
      toolchain/check/testdata/class/base.carbon
  89. 3 1
      toolchain/check/testdata/class/base_field.carbon
  90. 3 1
      toolchain/check/testdata/class/base_function_unqualified.carbon
  91. 3 1
      toolchain/check/testdata/class/base_method.carbon
  92. 3 1
      toolchain/check/testdata/class/base_method_qualified.carbon
  93. 5 3
      toolchain/check/testdata/class/base_method_shadow.carbon
  94. 2 0
      toolchain/check/testdata/class/basic.carbon
  95. 2 0
      toolchain/check/testdata/class/complete_in_member_fn.carbon
  96. 3 1
      toolchain/check/testdata/class/compound_field.carbon
  97. 23 9
      toolchain/check/testdata/class/cross_package_import.carbon
  98. 4 2
      toolchain/check/testdata/class/derived_to_base.carbon
  99. 3 1
      toolchain/check/testdata/class/fail_abstract.carbon
  100. 2 0
      toolchain/check/testdata/class/fail_addr_not_self.carbon

+ 9 - 0
core/BUILD

@@ -0,0 +1,9 @@
+# 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
+
+filegroup(
+    name = "core",
+    data = glob(["**/*.carbon"]),
+    visibility = ["//visibility:public"],
+)

+ 13 - 0
core/prelude.carbon

@@ -0,0 +1,13 @@
+// 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
+
+package Core library "prelude" api;
+
+// TODO: Uncomment once name deduplication works.
+// TODO: These are here for name lookup. Add a way to export import and move them out.
+// fn Int32() -> type = "int.make_type_32";
+// fn Float(size: i32) -> type = "float.make_type";
+// fn Bool() -> type = "bool.make_type";

+ 23 - 9
toolchain/check/check.cpp

@@ -1028,7 +1028,7 @@ static auto BuildApiMapAndDiagnosePackaging(
 }
 
 auto CheckParseTrees(const SemIR::File& builtin_ir,
-                     llvm::MutableArrayRef<Unit> units,
+                     llvm::MutableArrayRef<Unit> units, bool prelude_import,
                      llvm::raw_ostream* vlog_stream) -> void {
   // Prepare diagnostic emitters in case we run into issues during package
   // checking.
@@ -1047,17 +1047,31 @@ auto CheckParseTrees(const SemIR::File& builtin_ir,
   llvm::SmallVector<UnitInfo*> ready_to_check;
   ready_to_check.reserve(units.size());
   for (auto& unit_info : unit_infos) {
-    if (const auto& packaging =
-            unit_info.unit->parse_tree->packaging_directive()) {
-      if (packaging->api_or_impl == Parse::Tree::ApiOrImpl::Impl) {
-        // An `impl` has an implicit import of its `api`.
-        auto implicit_names = packaging->names;
-        implicit_names.package_id = IdentifierId::Invalid;
-        TrackImport(api_map, nullptr, unit_info, implicit_names);
-      }
+    const auto& packaging = unit_info.unit->parse_tree->packaging_directive();
+    if (packaging && packaging->api_or_impl == Parse::Tree::ApiOrImpl::Impl) {
+      // An `impl` has an implicit import of its `api`.
+      auto implicit_names = packaging->names;
+      implicit_names.package_id = IdentifierId::Invalid;
+      TrackImport(api_map, nullptr, unit_info, implicit_names);
     }
 
     llvm::DenseMap<ImportKey, Parse::NodeId> explicit_import_map;
+
+    // Add the prelude import. It's added to explicit_import_map so that it can
+    // conflict with an explicit import of the prelude.
+    // TODO: Add --no-prelude-import for `/no_prelude/` subdirs.
+    IdentifierId core_ident_id =
+        unit_info.unit->value_stores->identifiers().Add("Core");
+    if (prelude_import &&
+        !(packaging && packaging->names.package_id == core_ident_id)) {
+      auto prelude_id =
+          unit_info.unit->value_stores->string_literal_values().Add("prelude");
+      TrackImport(api_map, &explicit_import_map, unit_info,
+                  {.node_id = Parse::InvalidNodeId(),
+                   .package_id = core_ident_id,
+                   .library_id = prelude_id});
+    }
+
     for (const auto& import : unit_info.unit->parse_tree->imports()) {
       TrackImport(api_map, &explicit_import_map, unit_info, import);
     }

+ 1 - 1
toolchain/check/check.h

@@ -33,7 +33,7 @@ struct Unit {
 // Checks a group of parse trees. This will use imports to decide the order of
 // checking.
 auto CheckParseTrees(const SemIR::File& builtin_ir,
-                     llvm::MutableArrayRef<Unit> units,
+                     llvm::MutableArrayRef<Unit> units, bool prelude_import,
                      llvm::raw_ostream* vlog_stream) -> void;
 
 }  // namespace Carbon::Check

+ 54 - 2
toolchain/check/context.cpp

@@ -180,11 +180,11 @@ auto Context::DiagnoseDuplicateName(SemIRLoc dup_def, SemIRLoc prev_def)
       .Emit();
 }
 
-auto Context::DiagnoseNameNotFound(SemIR::LocId loc_id, SemIR::NameId name_id)
+auto Context::DiagnoseNameNotFound(SemIRLoc loc, SemIR::NameId name_id)
     -> void {
   CARBON_DIAGNOSTIC(NameNotFound, Error, "Name `{0}` not found.",
                     SemIR::NameId);
-  emitter_->Emit(loc_id, NameNotFound, name_id);
+  emitter_->Emit(loc, NameNotFound, name_id);
 }
 
 auto Context::NoteIncompleteClass(SemIR::ClassId class_id,
@@ -416,6 +416,58 @@ auto Context::LookupQualifiedName(Parse::NodeId node_id, SemIR::NameId name_id,
   return result_id;
 }
 
+// Returns the scope of the Core package, or Invalid if it's not found.
+//
+// TODO: Consider tracking the Core package in SemIR so we don't need to use
+// name lookup to find it.
+static auto GetCorePackage(Context& context, SemIRLoc loc)
+    -> SemIR::NameScopeId {
+  auto core_ident_id = context.identifiers().Add("Core");
+  auto packaging = context.parse_tree().packaging_directive();
+  if (packaging && packaging->names.package_id == core_ident_id) {
+    return SemIR::NameScopeId::Package;
+  }
+  auto core_name_id = SemIR::NameId::ForIdentifier(core_ident_id);
+
+  // Look up `package.Core`.
+  auto core_inst_id = context.LookupNameInExactScope(
+      loc, core_name_id, context.name_scopes().Get(SemIR::NameScopeId::Package),
+      /*mark_imports_used=*/true);
+  if (!core_inst_id.is_valid()) {
+    context.DiagnoseNameNotFound(loc, core_name_id);
+    return SemIR::NameScopeId::Invalid;
+  }
+
+  // We expect it to be a namespace.
+  if (auto namespace_inst =
+          context.insts().TryGetAs<SemIR::Namespace>(core_inst_id)) {
+    return namespace_inst->name_scope_id;
+  }
+  // TODO: This should really diagnose the name issue.
+  context.DiagnoseNameNotFound(loc, core_name_id);
+  return SemIR::NameScopeId::Invalid;
+}
+
+auto Context::LookupNameInCore(SemIRLoc loc, llvm::StringRef name)
+    -> SemIR::InstId {
+  auto core_package_id = GetCorePackage(*this, loc);
+  if (!core_package_id.is_valid()) {
+    return SemIR::InstId::BuiltinError;
+  }
+
+  auto name_id = SemIR::NameId::ForIdentifier(identifiers().Add(name));
+  auto inst_id =
+      LookupNameInExactScope(loc, name_id, name_scopes().Get(core_package_id),
+                             /*mark_imports_used=*/true);
+  if (!inst_id.is_valid()) {
+    DiagnoseNameNotFound(loc, name_id);
+    return SemIR::InstId::BuiltinError;
+  }
+
+  // Look through import_refs and aliases.
+  return constant_values().Get(inst_id).inst_id();
+}
+
 template <typename BranchNode, typename... Args>
 static auto AddDominatedBlockAndBranchImpl(Context& context,
                                            Parse::NodeId node_id, Args... args)

+ 5 - 1
toolchain/check/context.h

@@ -123,11 +123,15 @@ class Context {
                            SemIR::NameScopeId scope_id, bool required = true)
       -> SemIR::InstId;
 
+  // Returns the instruction corresponding to a name in the core package, or
+  // BuiltinError if not found.
+  auto LookupNameInCore(SemIRLoc loc, llvm::StringRef name) -> SemIR::InstId;
+
   // Prints a diagnostic for a duplicate name.
   auto DiagnoseDuplicateName(SemIRLoc dup_def, SemIRLoc prev_def) -> void;
 
   // Prints a diagnostic for a missing name.
-  auto DiagnoseNameNotFound(SemIR::LocId loc_id, SemIR::NameId name_id) -> void;
+  auto DiagnoseNameNotFound(SemIRLoc loc, SemIR::NameId name_id) -> void;
 
   // Adds a note to a diagnostic explaining that a class is incomplete.
   auto NoteIncompleteClass(SemIR::ClassId class_id, DiagnosticBuilder& builder)

+ 19 - 0
toolchain/check/handle_literal.cpp

@@ -2,6 +2,7 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+#include "toolchain/check/call.h"
 #include "toolchain/check/context.h"
 
 namespace Carbon::Check {
@@ -69,6 +70,10 @@ auto HandleStringLiteral(Context& context, Parse::StringLiteralId node_id)
 
 auto HandleBoolTypeLiteral(Context& context, Parse::BoolTypeLiteralId node_id)
     -> bool {
+  // TODO: Migrate once functions can be in prelude.carbon.
+  // auto fn_inst_id = context.LookupNameInCore(node_id, "Bool");
+  // auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {});
+  // context.node_stack().Push(node_id, type_inst_id);
   context.node_stack().Push(node_id, SemIR::InstId::BuiltinBoolType);
   return true;
 }
@@ -80,6 +85,10 @@ auto HandleIntTypeLiteral(Context& context, Parse::IntTypeLiteralId node_id)
   if (text != "i32") {
     return context.TODO(node_id, "Currently only i32 is allowed");
   }
+  // TODO: Migrate once functions can be in prelude.carbon.
+  // auto fn_inst_id = context.LookupNameInCore(node_id, "Int32");
+  // auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {});
+  // context.node_stack().Push(node_id, type_inst_id);
   context.node_stack().Push(node_id, SemIR::InstId::BuiltinIntType);
   return true;
 }
@@ -97,6 +106,16 @@ auto HandleFloatTypeLiteral(Context& context, Parse::FloatTypeLiteralId node_id)
   if (text != "f64") {
     return context.TODO(node_id, "Currently only f64 is allowed");
   }
+  // TODO: Migrate once functions can be in prelude.carbon.
+  // auto fn_inst_id = context.LookupNameInCore(node_id, "Float");
+  // auto width_inst_id = context.AddInstInNoBlock(
+  //     {node_id,
+  //      SemIR::IntLiteral{
+  //          context.GetBuiltinType(SemIR::BuiltinKind::IntType),
+  //          context.ints().Add(llvm::APInt(/*numBits=*/32, /*val=*/64))}});
+  // auto type_inst_id =
+  //     PerformCall(context, node_id, fn_inst_id, {width_inst_id});
+  // context.node_stack().Push(node_id, type_inst_id);
   context.node_stack().Push(node_id, SemIR::InstId::BuiltinFloatType);
   return true;
 }

+ 3 - 1
toolchain/check/node_stack.h

@@ -502,7 +502,9 @@ class NodeStack {
   auto RequireIdKind(Parse::NodeKind parse_kind, Id::Kind id_kind) const
       -> void {
     CARBON_CHECK(NodeKindToIdKind(parse_kind) == id_kind)
-        << "Unexpected Id::Kind mapping for " << parse_kind;
+        << "Unexpected Id::Kind mapping for " << parse_kind << ": expected "
+        << static_cast<int>(id_kind) << ", found "
+        << static_cast<int>(NodeKindToIdKind(parse_kind));
   }
 
   // Require an entry to have the given Parse::NodeKind.

+ 5 - 53
toolchain/check/operator.cpp

@@ -12,65 +12,15 @@
 
 namespace Carbon::Check {
 
-// Returns the scope of the Core package, or Invalid if it's not found.
-//
-// TODO: Consider tracking the Core package in SemIR so we don't need to use
-// name lookup to find it.
-static auto GetCorePackage(Context& context, Parse::AnyExprId node_id)
-    -> SemIR::NameScopeId {
-  // TODO: If the current package is the `Core` package, return
-  // `SemIR::InstId::Package`.
-
-  auto ident_id = context.identifiers().Lookup("Core");
-  if (!ident_id.is_valid()) {
-    return SemIR::NameScopeId::Invalid;
-  }
-  auto name_id = SemIR::NameId::ForIdentifier(ident_id);
-
-  // Look up `package.Core`.
-  auto package_id = context.LookupQualifiedName(
-      node_id, name_id, SemIR::NameScopeId::Package, /*required=*/false);
-  if (!package_id.is_valid()) {
-    return SemIR::NameScopeId::Invalid;
-  }
-
-  // Look through import_refs and aliases.
-  package_id = context.constant_values().Get(package_id).inst_id();
-
-  // We expect it to be a package, and fail if not.
-  if (auto package_inst =
-          context.insts().TryGetAs<SemIR::Namespace>(package_id)) {
-    auto& name_scope = context.name_scopes().Get(package_inst->name_scope_id);
-    // Check that this is really the `Core` package and not an alias.
-    if (name_scope.is_closed_import && name_scope.name_id == name_id &&
-        name_scope.enclosing_scope_id == SemIR::NameScopeId::Package) {
-      return package_inst->name_scope_id;
-    }
-  }
-  return SemIR::NameScopeId::Invalid;
-}
-
 // Returns the name scope of the operator interface for the specified operator
 // from the Core package.
 static auto GetOperatorInterface(Context& context, Parse::AnyExprId node_id,
                                  Operator op) -> SemIR::NameScopeId {
-  auto carbon_package_id = GetCorePackage(context, node_id);
-  if (!carbon_package_id.is_valid()) {
-    return SemIR::NameScopeId::Invalid;
-  }
-
-  // Lookup `Core.InterfaceName`.
-  auto interface_ident_id = context.identifiers().Add(op.interface_name);
-  auto interface_id = context.LookupQualifiedName(
-      node_id, SemIR::NameId::ForIdentifier(interface_ident_id),
-      carbon_package_id, /*required=*/false);
-  if (!interface_id.is_valid()) {
+  auto interface_id = context.LookupNameInCore(node_id, op.interface_name);
+  if (interface_id == SemIR::InstId::BuiltinError) {
     return SemIR::NameScopeId::Invalid;
   }
 
-  // Look through import_refs and aliases.
-  interface_id = context.constant_values().Get(interface_id).inst_id();
-
   // We expect it to be an interface.
   if (auto interface_inst =
           context.insts().TryGetAs<SemIR::InterfaceType>(interface_id)) {
@@ -110,7 +60,9 @@ auto BuildUnaryOperator(Context& context, Parse::AnyExprId node_id, Operator op,
                         SemIR::InstId operand_id) -> SemIR::InstId {
   auto op_fn = GetOperatorOpFunction(context, node_id, op);
   if (!op_fn.is_valid()) {
-    context.TODO(node_id, "missing or invalid operator interface");
+    context.TODO(node_id,
+                 "missing or invalid operator interface, also avoid duplicate "
+                 "diagnostic if prelude is unavailable");
     return SemIR::InstId::BuiltinError;
   }
 

+ 38 - 11
toolchain/check/testdata/alias/alias_of_alias.carbon

@@ -4,30 +4,57 @@
 //
 // AUTOUPDATE
 
-alias a = bool;
+class C { var v: i32; }
+alias a = C;
 alias b = a;
 alias c = b;
-let d: c = false;
+let d: c = {.v = 0};
 
 // CHECK:STDOUT: --- alias_of_alias.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: bool = bool_literal false [template]
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = unbound_element_type C, i32 [template]
+// CHECK:STDOUT:   %.2: type = struct_type {.v: i32} [template]
+// CHECK:STDOUT:   %.3: type = ptr_type {.v: i32} [template]
+// CHECK:STDOUT:   %.4: i32 = int_literal 0 [template]
+// CHECK:STDOUT:   %.5: C = struct_value (%.4) [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %a: type = bind_alias a, bool [template = bool]
-// CHECK:STDOUT:   %a.ref: type = name_ref a, %a [template = bool]
-// CHECK:STDOUT:   %b: type = bind_alias b, %a [template = bool]
-// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = bool]
-// CHECK:STDOUT:   %c: type = bind_alias c, %b [template = bool]
-// CHECK:STDOUT:   %c.ref: type = name_ref c, %c [template = bool]
-// CHECK:STDOUT:   %.loc10: bool = bool_literal false [template = constants.%.1]
-// CHECK:STDOUT:   %d: bool = bind_name d, %.loc10
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %C.ref: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a: type = bind_alias a, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a.ref: type = name_ref a, %a [template = constants.%C]
+// CHECK:STDOUT:   %b: type = bind_alias b, %a [template = constants.%C]
+// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = constants.%C]
+// CHECK:STDOUT:   %c: type = bind_alias c, %b [template = constants.%C]
+// CHECK:STDOUT:   %c.ref: type = name_ref c, %c [template = constants.%C]
+// CHECK:STDOUT:   %.loc11_18: i32 = int_literal 0 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc11_19.1: {.v: i32} = struct_literal (%.loc11_18)
+// CHECK:STDOUT:   %.loc11_19.2: ref C = temporary_storage
+// CHECK:STDOUT:   %.loc11_19.3: ref i32 = class_element_access %.loc11_19.2, element0
+// CHECK:STDOUT:   %.loc11_19.4: init i32 = initialize_from %.loc11_18 to %.loc11_19.3 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc11_19.5: init C = class_init (%.loc11_19.4), %.loc11_19.2 [template = constants.%.5]
+// CHECK:STDOUT:   %.loc11_19.6: ref C = temporary %.loc11_19.2, %.loc11_19.5
+// CHECK:STDOUT:   %.loc11_19.7: ref C = converted %.loc11_19.1, %.loc11_19.6
+// CHECK:STDOUT:   %.loc11_19.8: C = bind_value %.loc11_19.7
+// CHECK:STDOUT:   %d: C = bind_name d, %.loc11_19.8
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT:   %.loc7: <unbound element of class C> = field_decl v, element0 [template]
+// CHECK:STDOUT:
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
+// CHECK:STDOUT:   .v = %.loc7
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/alias/builtins.carbon

@@ -19,9 +19,11 @@ let b_test: b = false;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %a: type = bind_alias a, i32 [template = i32]
 // CHECK:STDOUT:   %a.ref: type = name_ref a, %a [template = i32]
 // CHECK:STDOUT:   %.loc8: i32 = int_literal 0 [template = constants.%.1]

+ 25 - 7
toolchain/check/testdata/alias/fail_aliased_name_in_diag.carbon

@@ -4,8 +4,9 @@
 //
 // AUTOUPDATE
 
-alias b = bool;
-// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `i32` to `bool`.
+class C { var v: i32; }
+alias b = C;
+// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `i32` to `C`.
 // CHECK:STDERR: let c: b = 2;
 // CHECK:STDERR: ^~~~~~~~~~~~~
 let c: b = 2;
@@ -13,16 +14,33 @@ let c: b = 2;
 // CHECK:STDOUT: --- fail_aliased_name_in_diag.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: i32 = int_literal 2 [template]
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = unbound_element_type C, i32 [template]
+// CHECK:STDOUT:   %.2: type = struct_type {.v: i32} [template]
+// CHECK:STDOUT:   %.3: type = ptr_type {.v: i32} [template]
+// CHECK:STDOUT:   %.4: i32 = int_literal 2 [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %b: type = bind_alias b, bool [template = bool]
-// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = bool]
-// CHECK:STDOUT:   %.loc11: i32 = int_literal 2 [template = constants.%.1]
-// CHECK:STDOUT:   %c: bool = bind_name c, <error>
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %C.ref: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %b: type = bind_alias b, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = constants.%C]
+// CHECK:STDOUT:   %.loc12: i32 = int_literal 2 [template = constants.%.4]
+// CHECK:STDOUT:   %c: C = bind_name c, <error>
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT:   %.loc7: <unbound element of class C> = field_decl v, element0 [template]
+// CHECK:STDOUT:
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
+// CHECK:STDOUT:   .v = %.loc7
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/alias/fail_bool_value.carbon

@@ -18,8 +18,10 @@ let a_test: bool = a;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc10: bool = bool_literal false [template = constants.%.1]
 // CHECK:STDOUT:   %a: <error> = bind_alias a, <error> [template = <error>]
 // CHECK:STDOUT:   %a.ref: <error> = name_ref a, %a [template = <error>]

+ 2 - 0
toolchain/check/testdata/alias/fail_local_in_namespace.carbon

@@ -30,9 +30,11 @@ fn F() -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .NS = %NS
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %NS: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
 // CHECK:STDOUT:     %return.var: ref bool = var <return slot>

+ 34 - 15
toolchain/check/testdata/alias/fail_modifiers.carbon

@@ -4,54 +4,73 @@
 //
 // AUTOUPDATE
 
+class Class {}
+
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:1: ERROR: `abstract` not allowed on `alias` declaration.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR: ^~~~~~~~
 // CHECK:STDERR:
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:10: ERROR: `base` not allowed on declaration with `abstract`.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR:          ^~~~
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:1: `abstract` previously appeared here.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR: ^~~~~~~~
 // CHECK:STDERR:
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:15: ERROR: `default` not allowed on declaration with `abstract`.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR:               ^~~~~~~
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: `abstract` previously appeared here.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR: ^~~~~~~~
 // CHECK:STDERR:
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:23: ERROR: `final` not allowed on declaration with `abstract`.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR:                       ^~~~~
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: `abstract` previously appeared here.
-// CHECK:STDERR: abstract base default final alias A = i32;
+// CHECK:STDERR: abstract base default final alias A = Class;
 // CHECK:STDERR: ^~~~~~~~
 // CHECK:STDERR:
-abstract base default final alias A = i32;
+abstract base default final alias A = Class;
 
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: ERROR: `impl` not allowed on `alias` declaration.
-// CHECK:STDERR: impl alias B = i32;
+// CHECK:STDERR: impl alias B = Class;
 // CHECK:STDERR: ^~~~
 // CHECK:STDERR:
-impl alias B = i32;
+impl alias B = Class;
 
 // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `extern` not allowed on `alias` declaration.
-// CHECK:STDERR: extern alias C = i32;
+// CHECK:STDERR: extern alias C = Class;
 // CHECK:STDERR: ^~~~~~
-extern alias C = i32;
+extern alias C = Class;
 
 // CHECK:STDOUT: --- fail_modifiers.carbon
 // CHECK:STDOUT:
+// CHECK:STDOUT: constants {
+// CHECK:STDOUT:   %Class: type = class_type @Class [template]
+// CHECK:STDOUT:   %.1: type = struct_type {} [template]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .Class = %Class.decl
 // CHECK:STDOUT:     .A = %A
 // CHECK:STDOUT:     .B = %B
 // CHECK:STDOUT:     .C = %C
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %A: type = bind_alias A, i32 [template = i32]
-// CHECK:STDOUT:   %B: type = bind_alias B, i32 [template = i32]
-// CHECK:STDOUT:   %C: type = bind_alias C, i32 [template = i32]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %Class.decl: type = class_decl @Class [template = constants.%Class] {}
+// CHECK:STDOUT:   %Class.ref.loc34: type = name_ref Class, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT:   %A: type = bind_alias A, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT:   %Class.ref.loc40: type = name_ref Class, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT:   %B: type = bind_alias B, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT:   %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT:   %C: type = bind_alias C, %Class.decl [template = constants.%Class]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @Class {
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%Class
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 29 - 14
toolchain/check/testdata/alias/fail_name_conflict.carbon

@@ -4,51 +4,66 @@
 //
 // AUTOUPDATE
 
-alias a = i32;
+class C {}
+
+alias a = C;
 // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: ERROR: Duplicate name being declared in the same scope.
 // CHECK:STDERR: var a: i32 = 1;
 // CHECK:STDERR:     ^
 // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: Name is previously declared here.
-// CHECK:STDERR: alias a = i32;
+// CHECK:STDERR: alias a = C;
 // CHECK:STDERR:       ^
 // CHECK:STDERR:
 var a: i32 = 1;
 
 var b: i32 = 2;
 // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+6]]:7: ERROR: Duplicate name being declared in the same scope.
-// CHECK:STDERR: alias b = i32;
+// CHECK:STDERR: alias b = C;
 // CHECK:STDERR:       ^
 // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: Name is previously declared here.
 // CHECK:STDERR: var b: i32 = 2;
 // CHECK:STDERR:     ^
-alias b = i32;
+alias b = C;
 
 // CHECK:STDOUT: --- fail_name_conflict.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: i32 = int_literal 1 [template]
-// CHECK:STDOUT:   %.2: i32 = int_literal 2 [template]
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = struct_type {} [template]
+// CHECK:STDOUT:   %.2: i32 = int_literal 1 [template]
+// CHECK:STDOUT:   %.3: i32 = int_literal 2 [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
-// CHECK:STDOUT:     .a = %a.loc7
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
+// CHECK:STDOUT:     .a = %a.loc9
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %a.loc7: type = bind_alias a, i32 [template = i32]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %C.ref.loc9: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a.loc9: type = bind_alias a, %C.decl [template = constants.%C]
 // CHECK:STDOUT:   %a.var: ref i32 = var a
-// CHECK:STDOUT:   %a.loc15: ref i32 = bind_name a, %a.var
+// CHECK:STDOUT:   %a.loc17: ref i32 = bind_name a, %a.var
 // CHECK:STDOUT:   %b.var: ref i32 = var b
 // CHECK:STDOUT:   %b: ref i32 = bind_name b, %b.var
-// CHECK:STDOUT:   %.loc24: type = bind_alias <invalid>, i32 [template = i32]
+// CHECK:STDOUT:   %C.ref.loc26: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %.loc26: type = bind_alias <invalid>, %C.decl [template = constants.%C]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @__global_init() {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %.loc15: i32 = int_literal 1 [template = constants.%.1]
-// CHECK:STDOUT:   assign file.%a.var, %.loc15
-// CHECK:STDOUT:   %.loc17: i32 = int_literal 2 [template = constants.%.2]
-// CHECK:STDOUT:   assign file.%b.var, %.loc17
+// CHECK:STDOUT:   %.loc17: i32 = int_literal 1 [template = constants.%.2]
+// CHECK:STDOUT:   assign file.%a.var, %.loc17
+// CHECK:STDOUT:   %.loc19: i32 = int_literal 2 [template = constants.%.3]
+// CHECK:STDOUT:   assign file.%b.var, %.loc19
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/alias/fail_not_constant.carbon

@@ -22,8 +22,10 @@ fn F() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 19 - 3
toolchain/check/testdata/alias/fail_todo_private.carbon

@@ -4,17 +4,33 @@
 //
 // AUTOUPDATE
 
+class C {}
 // CHECK:STDERR: fail_todo_private.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `access modifier`.
-// CHECK:STDERR: private alias A = i32;
+// CHECK:STDERR: private alias A = C;
 // CHECK:STDERR: ^~~~~~~
-private alias A = i32;
+private alias A = C;
 
 // CHECK:STDOUT: --- fail_todo_private.carbon
 // CHECK:STDOUT:
+// CHECK:STDOUT: constants {
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = struct_type {} [template]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .A = %A
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %A: type = bind_alias A, i32 [template = i32]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %C.ref: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %A: type = bind_alias A, %C.decl [template = constants.%C]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 6 - 2
toolchain/check/testdata/alias/import.carbon

@@ -28,9 +28,11 @@ var c: i32 = b;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %a.var: ref i32 = var a
 // CHECK:STDOUT:   %a: ref i32 = bind_name a, %a.var
 // CHECK:STDOUT:   %a.ref: ref i32 = name_ref a, %a
@@ -50,10 +52,12 @@ var c: i32 = b;
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .a = %import_ref.1
 // CHECK:STDOUT:     .b = %import_ref.2
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref.1 = import_ref ir2, inst+2, unloaded
-// CHECK:STDOUT:   %import_ref.2: ref i32 = import_ref ir2, inst+7, loc_14
+// CHECK:STDOUT:   %import_ref.1 = import_ref ir2, inst+3, unloaded
+// CHECK:STDOUT:   %import_ref.2: ref i32 = import_ref ir2, inst+8, loc_14
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %c.var: ref i32 = var c
 // CHECK:STDOUT:   %c: ref i32 = bind_name c, %c.var
 // CHECK:STDOUT: }

+ 108 - 51
toolchain/check/testdata/alias/import_order.carbon

@@ -8,7 +8,8 @@
 
 library "a" api;
 
-alias a = i32;
+class C { var v: i32; }
+alias a = C;
 alias b = a;
 alias c = b;
 alias d = c;
@@ -20,84 +21,140 @@ library "b" api;
 import library "a";
 
 // Access imports in reverse order of export.
-var d_val: d = 1;
-var c_val: c = d_val;
-var b_val: b = c_val;
-var a_val: a = b_val;
-var i32_val: i32 = a_val;
+var d_val: d = {.v = 0};
+var c_val: c = {.v = d_val.v};
+var b_val: b = {.v = c_val.v};
+var a_val: a = {.v = b_val.v};
 
 // CHECK:STDOUT: --- a.carbon
 // CHECK:STDOUT:
+// CHECK:STDOUT: constants {
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = unbound_element_type C, i32 [template]
+// CHECK:STDOUT:   %.2: type = struct_type {.v: i32} [template]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:     .d = %d
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %a: type = bind_alias a, i32 [template = i32]
-// CHECK:STDOUT:   %a.ref: type = name_ref a, %a [template = i32]
-// CHECK:STDOUT:   %b: type = bind_alias b, %a [template = i32]
-// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = i32]
-// CHECK:STDOUT:   %c: type = bind_alias c, %b [template = i32]
-// CHECK:STDOUT:   %c.ref: type = name_ref c, %c [template = i32]
-// CHECK:STDOUT:   %d: type = bind_alias d, %c [template = i32]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %C.ref: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a: type = bind_alias a, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a.ref: type = name_ref a, %a [template = constants.%C]
+// CHECK:STDOUT:   %b: type = bind_alias b, %a [template = constants.%C]
+// CHECK:STDOUT:   %b.ref: type = name_ref b, %b [template = constants.%C]
+// CHECK:STDOUT:   %c: type = bind_alias c, %b [template = constants.%C]
+// CHECK:STDOUT:   %c.ref: type = name_ref c, %c [template = constants.%C]
+// CHECK:STDOUT:   %d: type = bind_alias d, %c [template = constants.%C]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT:   %.loc4: <unbound element of class C> = field_decl v, element0 [template]
+// CHECK:STDOUT:
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
+// CHECK:STDOUT:   .v = %.loc4
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: --- b.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: i32 = int_literal 1 [template]
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = struct_type {.v: i32} [template]
+// CHECK:STDOUT:   %.2: type = ptr_type {.v: i32} [template]
+// CHECK:STDOUT:   %.3: i32 = int_literal 0 [template]
+// CHECK:STDOUT:   %.4: C = struct_value (%.3) [template]
+// CHECK:STDOUT:   %.5: type = unbound_element_type C, i32 [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
-// CHECK:STDOUT:     .a = %import_ref.1
-// CHECK:STDOUT:     .b = %import_ref.2
-// CHECK:STDOUT:     .c = %import_ref.3
-// CHECK:STDOUT:     .d = %import_ref.4
+// CHECK:STDOUT:     .C = %import_ref.1
+// CHECK:STDOUT:     .a = %import_ref.2
+// CHECK:STDOUT:     .b = %import_ref.3
+// CHECK:STDOUT:     .c = %import_ref.4
+// CHECK:STDOUT:     .d = %import_ref.5
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .d_val = %d_val
 // CHECK:STDOUT:     .c_val = %c_val
 // CHECK:STDOUT:     .b_val = %b_val
 // CHECK:STDOUT:     .a_val = %a_val
-// CHECK:STDOUT:     .i32_val = %i32_val
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref.1: type = import_ref ir2, inst+1, loc_32 [template = i32]
-// CHECK:STDOUT:   %import_ref.2: type = import_ref ir2, inst+3, loc_25 [template = i32]
-// CHECK:STDOUT:   %import_ref.3: type = import_ref ir2, inst+5, loc_18 [template = i32]
-// CHECK:STDOUT:   %import_ref.4: type = import_ref ir2, inst+7, loc_11 [template = i32]
-// CHECK:STDOUT:   %d.ref: type = name_ref d, %import_ref.4 [template = i32]
-// CHECK:STDOUT:   %d_val.var: ref i32 = var d_val
-// CHECK:STDOUT:   %d_val: ref i32 = bind_name d_val, %d_val.var
-// CHECK:STDOUT:   %c.ref: type = name_ref c, %import_ref.3 [template = i32]
-// CHECK:STDOUT:   %c_val.var: ref i32 = var c_val
-// CHECK:STDOUT:   %c_val: ref i32 = bind_name c_val, %c_val.var
-// CHECK:STDOUT:   %b.ref: type = name_ref b, %import_ref.2 [template = i32]
-// CHECK:STDOUT:   %b_val.var: ref i32 = var b_val
-// CHECK:STDOUT:   %b_val: ref i32 = bind_name b_val, %b_val.var
-// CHECK:STDOUT:   %a.ref: type = name_ref a, %import_ref.1 [template = i32]
-// CHECK:STDOUT:   %a_val.var: ref i32 = var a_val
-// CHECK:STDOUT:   %a_val: ref i32 = bind_name a_val, %a_val.var
-// CHECK:STDOUT:   %i32_val.var: ref i32 = var i32_val
-// CHECK:STDOUT:   %i32_val: ref i32 = bind_name i32_val, %i32_val.var
+// CHECK:STDOUT:   %import_ref.1 = import_ref ir2, inst+2, unloaded
+// CHECK:STDOUT:   %import_ref.2: type = import_ref ir2, inst+10, loc_51 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref.3: type = import_ref ir2, inst+12, loc_37 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref.4: type = import_ref ir2, inst+14, loc_23 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref.5: type = import_ref ir2, inst+16, loc_11 [template = constants.%C]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: invalid = class_decl @C [template = constants.%C] {}
+// CHECK:STDOUT:   %import_ref.6: <unbound element of class C> = import_ref ir2, inst+5, loc_31 [template = imports.%.1]
+// CHECK:STDOUT:   %import_ref.7 = import_ref ir2, inst+3, unloaded
+// CHECK:STDOUT:   %d.ref: type = name_ref d, %import_ref.5 [template = constants.%C]
+// CHECK:STDOUT:   %d_val.var: ref C = var d_val
+// CHECK:STDOUT:   %d_val: ref C = bind_name d_val, %d_val.var
+// CHECK:STDOUT:   %c.ref: type = name_ref c, %import_ref.4 [template = constants.%C]
+// CHECK:STDOUT:   %c_val.var: ref C = var c_val
+// CHECK:STDOUT:   %c_val: ref C = bind_name c_val, %c_val.var
+// CHECK:STDOUT:   %b.ref: type = name_ref b, %import_ref.3 [template = constants.%C]
+// CHECK:STDOUT:   %b_val.var: ref C = var b_val
+// CHECK:STDOUT:   %b_val: ref C = bind_name b_val, %b_val.var
+// CHECK:STDOUT:   %a.ref: type = name_ref a, %import_ref.2 [template = constants.%C]
+// CHECK:STDOUT:   %a_val.var: ref C = var a_val
+// CHECK:STDOUT:   %a_val: ref C = bind_name a_val, %a_val.var
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .v = file.%import_ref.6
+// CHECK:STDOUT:   .Self = file.%import_ref.7
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @__global_init() {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %.loc7: i32 = int_literal 1 [template = constants.%.1]
-// CHECK:STDOUT:   assign file.%d_val.var, %.loc7
-// CHECK:STDOUT:   %d_val.ref: ref i32 = name_ref d_val, file.%d_val
-// CHECK:STDOUT:   %.loc8: i32 = bind_value %d_val.ref
-// CHECK:STDOUT:   assign file.%c_val.var, %.loc8
-// CHECK:STDOUT:   %c_val.ref: ref i32 = name_ref c_val, file.%c_val
-// CHECK:STDOUT:   %.loc9: i32 = bind_value %c_val.ref
-// CHECK:STDOUT:   assign file.%b_val.var, %.loc9
-// CHECK:STDOUT:   %b_val.ref: ref i32 = name_ref b_val, file.%b_val
-// CHECK:STDOUT:   %.loc10: i32 = bind_value %b_val.ref
-// CHECK:STDOUT:   assign file.%a_val.var, %.loc10
-// CHECK:STDOUT:   %a_val.ref: ref i32 = name_ref a_val, file.%a_val
-// CHECK:STDOUT:   %.loc11: i32 = bind_value %a_val.ref
-// CHECK:STDOUT:   assign file.%i32_val.var, %.loc11
+// CHECK:STDOUT:   %.loc7_22: i32 = int_literal 0 [template = constants.%.3]
+// CHECK:STDOUT:   %.loc7_23.1: {.v: i32} = struct_literal (%.loc7_22)
+// CHECK:STDOUT:   %.loc7_23.2: ref i32 = class_element_access file.%d_val.var, element0
+// CHECK:STDOUT:   %.loc7_23.3: init i32 = initialize_from %.loc7_22 to %.loc7_23.2 [template = constants.%.3]
+// CHECK:STDOUT:   %.loc7_23.4: init C = class_init (%.loc7_23.3), file.%d_val.var [template = constants.%.4]
+// CHECK:STDOUT:   %.loc7_23.5: init C = converted %.loc7_23.1, %.loc7_23.4 [template = constants.%.4]
+// CHECK:STDOUT:   assign file.%d_val.var, %.loc7_23.5
+// CHECK:STDOUT:   %d_val.ref: ref C = name_ref d_val, file.%d_val
+// CHECK:STDOUT:   %v.ref.loc8: <unbound element of class C> = name_ref v, file.%import_ref.6 [template = imports.%.1]
+// CHECK:STDOUT:   %.loc8_27.1: ref i32 = class_element_access %d_val.ref, element0
+// CHECK:STDOUT:   %.loc8_29.1: {.v: i32} = struct_literal (%.loc8_27.1)
+// CHECK:STDOUT:   %.loc8_27.2: i32 = bind_value %.loc8_27.1
+// CHECK:STDOUT:   %.loc8_29.2: ref i32 = class_element_access file.%c_val.var, element0
+// CHECK:STDOUT:   %.loc8_29.3: init i32 = initialize_from %.loc8_27.2 to %.loc8_29.2
+// CHECK:STDOUT:   %.loc8_29.4: init C = class_init (%.loc8_29.3), file.%c_val.var
+// CHECK:STDOUT:   %.loc8_29.5: init C = converted %.loc8_29.1, %.loc8_29.4
+// CHECK:STDOUT:   assign file.%c_val.var, %.loc8_29.5
+// CHECK:STDOUT:   %c_val.ref: ref C = name_ref c_val, file.%c_val
+// CHECK:STDOUT:   %v.ref.loc9: <unbound element of class C> = name_ref v, file.%import_ref.6 [template = imports.%.1]
+// CHECK:STDOUT:   %.loc9_27.1: ref i32 = class_element_access %c_val.ref, element0
+// CHECK:STDOUT:   %.loc9_29.1: {.v: i32} = struct_literal (%.loc9_27.1)
+// CHECK:STDOUT:   %.loc9_27.2: i32 = bind_value %.loc9_27.1
+// CHECK:STDOUT:   %.loc9_29.2: ref i32 = class_element_access file.%b_val.var, element0
+// CHECK:STDOUT:   %.loc9_29.3: init i32 = initialize_from %.loc9_27.2 to %.loc9_29.2
+// CHECK:STDOUT:   %.loc9_29.4: init C = class_init (%.loc9_29.3), file.%b_val.var
+// CHECK:STDOUT:   %.loc9_29.5: init C = converted %.loc9_29.1, %.loc9_29.4
+// CHECK:STDOUT:   assign file.%b_val.var, %.loc9_29.5
+// CHECK:STDOUT:   %b_val.ref: ref C = name_ref b_val, file.%b_val
+// CHECK:STDOUT:   %v.ref.loc10: <unbound element of class C> = name_ref v, file.%import_ref.6 [template = imports.%.1]
+// CHECK:STDOUT:   %.loc10_27.1: ref i32 = class_element_access %b_val.ref, element0
+// CHECK:STDOUT:   %.loc10_29.1: {.v: i32} = struct_literal (%.loc10_27.1)
+// CHECK:STDOUT:   %.loc10_27.2: i32 = bind_value %.loc10_27.1
+// CHECK:STDOUT:   %.loc10_29.2: ref i32 = class_element_access file.%a_val.var, element0
+// CHECK:STDOUT:   %.loc10_29.3: init i32 = initialize_from %.loc10_27.2 to %.loc10_29.2
+// CHECK:STDOUT:   %.loc10_29.4: init C = class_init (%.loc10_29.3), file.%a_val.var
+// CHECK:STDOUT:   %.loc10_29.5: init C = converted %.loc10_29.1, %.loc10_29.4
+// CHECK:STDOUT:   assign file.%a_val.var, %.loc10_29.5
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 48 - 15
toolchain/check/testdata/alias/in_namespace.carbon

@@ -4,44 +4,77 @@
 //
 // AUTOUPDATE
 
+class C { var v: i32; }
+
 namespace NS;
-alias NS.a = bool;
+alias NS.a = C;
 
-let b: NS.a = false;
+let b: NS.a = {.v = 0};
 
 fn F() -> NS.a {
-  return false;
+  return {.v = 0};
 }
 
 // CHECK:STDOUT: --- in_namespace.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: bool = bool_literal false [template]
+// CHECK:STDOUT:   %C: type = class_type @C [template]
+// CHECK:STDOUT:   %.1: type = unbound_element_type C, i32 [template]
+// CHECK:STDOUT:   %.2: type = struct_type {.v: i32} [template]
+// CHECK:STDOUT:   %.3: type = ptr_type {.v: i32} [template]
+// CHECK:STDOUT:   %.4: i32 = int_literal 0 [template]
+// CHECK:STDOUT:   %.5: C = struct_value (%.4) [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .NS = %NS
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
 // CHECK:STDOUT:   %NS: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %a: type = bind_alias a, bool [template = bool]
-// CHECK:STDOUT:   %NS.ref.loc10: <namespace> = name_ref NS, %NS [template = %NS]
-// CHECK:STDOUT:   %a.ref.loc10: type = name_ref a, %a [template = bool]
-// CHECK:STDOUT:   %.loc10: bool = bool_literal false [template = constants.%.1]
-// CHECK:STDOUT:   %b: bool = bind_name b, %.loc10
+// CHECK:STDOUT:   %C.ref: type = name_ref C, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %a: type = bind_alias a, %C.decl [template = constants.%C]
+// CHECK:STDOUT:   %NS.ref.loc12: <namespace> = name_ref NS, %NS [template = %NS]
+// CHECK:STDOUT:   %a.ref.loc12: type = name_ref a, %a [template = constants.%C]
+// CHECK:STDOUT:   %.loc12_21: i32 = int_literal 0 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_22.1: {.v: i32} = struct_literal (%.loc12_21)
+// CHECK:STDOUT:   %.loc12_22.2: ref C = temporary_storage
+// CHECK:STDOUT:   %.loc12_22.3: ref i32 = class_element_access %.loc12_22.2, element0
+// CHECK:STDOUT:   %.loc12_22.4: init i32 = initialize_from %.loc12_21 to %.loc12_22.3 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_22.5: init C = class_init (%.loc12_22.4), %.loc12_22.2 [template = constants.%.5]
+// CHECK:STDOUT:   %.loc12_22.6: ref C = temporary %.loc12_22.2, %.loc12_22.5
+// CHECK:STDOUT:   %.loc12_22.7: ref C = converted %.loc12_22.1, %.loc12_22.6
+// CHECK:STDOUT:   %.loc12_22.8: C = bind_value %.loc12_22.7
+// CHECK:STDOUT:   %b: C = bind_name b, %.loc12_22.8
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
-// CHECK:STDOUT:     %NS.ref.loc12: <namespace> = name_ref NS, %NS [template = %NS]
-// CHECK:STDOUT:     %a.ref.loc12: type = name_ref a, %a [template = bool]
-// CHECK:STDOUT:     %return.var: ref bool = var <return slot>
+// CHECK:STDOUT:     %NS.ref.loc14: <namespace> = name_ref NS, %NS [template = %NS]
+// CHECK:STDOUT:     %a.ref.loc14: type = name_ref a, %a [template = constants.%C]
+// CHECK:STDOUT:     @F.%return: ref C = var <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @F() -> bool {
+// CHECK:STDOUT: class @C {
+// CHECK:STDOUT:   %.loc7: <unbound element of class C> = field_decl v, element0 [template]
+// CHECK:STDOUT:
+// CHECK:STDOUT: !members:
+// CHECK:STDOUT:   .Self = constants.%C
+// CHECK:STDOUT:   .v = %.loc7
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
+// CHECK:STDOUT: fn @F() -> %return: C {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %.loc13: bool = bool_literal false [template = constants.%.1]
-// CHECK:STDOUT:   return %.loc13
+// CHECK:STDOUT:   %.loc15_16: i32 = int_literal 0 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc15_17.1: {.v: i32} = struct_literal (%.loc15_16)
+// CHECK:STDOUT:   %.loc15_17.2: ref i32 = class_element_access %return, element0
+// CHECK:STDOUT:   %.loc15_17.3: init i32 = initialize_from %.loc15_16 to %.loc15_17.2 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc15_17.4: init C = class_init (%.loc15_17.3), %return [template = constants.%.5]
+// CHECK:STDOUT:   %.loc15_17.5: init C = converted %.loc15_17.1, %.loc15_17.4 [template = constants.%.5]
+// CHECK:STDOUT:   return %.loc15_17.5
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/alias/local.carbon

@@ -18,8 +18,10 @@ fn F() -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
 // CHECK:STDOUT:     %return.var: ref i32 = var <return slot>
 // CHECK:STDOUT:   }

+ 2 - 0
toolchain/check/testdata/array/array_in_place.carbon

@@ -26,9 +26,11 @@ fn G() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .G = %G
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
 // CHECK:STDOUT:     %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32)
 // CHECK:STDOUT:     %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2]

+ 2 - 0
toolchain/check/testdata/array/array_vs_tuple.carbon

@@ -28,8 +28,10 @@ fn G() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .G = %G
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %G: <function> = fn_decl @G [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/array/assign_return_value.carbon

@@ -24,9 +24,11 @@ fn Run() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = 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]

+ 2 - 0
toolchain/check/testdata/array/assign_var.carbon

@@ -24,9 +24,11 @@ var b: [i32; 3] = a;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_22.1: (type, type, type) = tuple_literal (i32, i32, i32)
 // CHECK:STDOUT:   %.loc7_22.2: type = converted %.loc7_22.1, constants.%.2 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref (i32, i32, i32) = var a

+ 2 - 0
toolchain/check/testdata/array/base.carbon

@@ -37,10 +37,12 @@ var c: [(); 5] = ((), (), (), (), (),);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_14: i32 = int_literal 1 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 1] = var a

+ 2 - 0
toolchain/check/testdata/array/canonicalize_index.carbon

@@ -24,9 +24,11 @@ let b: [i32; 3]* = &a;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Add = %Add
 // CHECK:STDOUT:     .a = %a.loc9
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Add: <function> = fn_decl @Add [template] {
 // CHECK:STDOUT:     %a.loc7_8.1: i32 = param a
 // CHECK:STDOUT:     @Add.%a: i32 = bind_name a, %a.loc7_8.1

+ 2 - 0
toolchain/check/testdata/array/fail_bound_negative.carbon

@@ -20,9 +20,11 @@ var a: [i32; Negate(1)];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Negate: <function> = 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

+ 2 - 0
toolchain/check/testdata/array/fail_bound_overflow.carbon

@@ -30,9 +30,11 @@ var b: [1; 39999999999999999993];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc14: type = array_type <error>, i32 [template = <error>]
 // CHECK:STDOUT:   %a.var: ref <error> = var a
 // CHECK:STDOUT:   %a: ref <error> = bind_name a, %a.var

+ 2 - 0
toolchain/check/testdata/array/fail_incomplete_element.carbon

@@ -28,10 +28,12 @@ var p: Incomplete* = &a[0];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Incomplete = %Incomplete.decl
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .p = %p
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {}
 // CHECK:STDOUT:   %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
 // CHECK:STDOUT:   %.loc15_21: i32 = int_literal 1 [template = constants.%.1]

+ 2 - 0
toolchain/check/testdata/array/fail_invalid_type.carbon

@@ -17,8 +17,10 @@ var a: [1; 1];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc10_9: i32 = int_literal 1 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc10_12: i32 = int_literal 1 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc10_13: type = array_type %.loc10_12, <error> [template = <error>]

+ 2 - 0
toolchain/check/testdata/array/fail_out_of_bound.carbon

@@ -22,8 +22,10 @@ var a: [i32; 1] = (1, 2, 3);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc10_14: i32 = int_literal 1 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 1] = var a

+ 2 - 0
toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon

@@ -27,9 +27,11 @@ var b: i32 = a[{.index = 3}.index];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 3] = var a

+ 2 - 0
toolchain/check/testdata/array/fail_type_mismatch.carbon

@@ -52,6 +52,7 @@ var d: [i32; 3] = t2;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .t1 = %t1
 // CHECK:STDOUT:     .b = %b
@@ -59,6 +60,7 @@ var d: [i32; 3] = t2;
 // CHECK:STDOUT:     .t2 = %t2
 // CHECK:STDOUT:     .d = %d
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc11_14: i32 = int_literal 3 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 3] = var a

+ 2 - 0
toolchain/check/testdata/array/function_param.carbon

@@ -27,9 +27,11 @@ fn G() -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .G = %G
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
 // CHECK:STDOUT:     %.loc7_17: i32 = int_literal 3 [template = constants.%.1]
 // CHECK:STDOUT:     %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2]

+ 2 - 0
toolchain/check/testdata/array/index_not_literal.carbon

@@ -24,9 +24,11 @@ var b: i32 = a[{.index = 2}.index];
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 3] = var a

+ 2 - 0
toolchain/check/testdata/array/nine_elements.carbon

@@ -27,8 +27,10 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_14: i32 = int_literal 9 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
 // CHECK:STDOUT:   %a.var: ref [i32; 9] = var a

+ 4 - 1
toolchain/check/testdata/as/as_type.carbon

@@ -14,7 +14,10 @@ let t: type = (i32, i32) as type;
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc7_24.1: (type, type) = tuple_literal (i32, i32)
 // CHECK:STDOUT:   %.loc7_24.2: type = converted %.loc7_24.1, constants.%.2 [template = constants.%.2]
 // CHECK:STDOUT:   %t: type = bind_name t, %.loc7_24.2

+ 2 - 0
toolchain/check/testdata/as/basic.carbon

@@ -16,8 +16,10 @@ fn Main() -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Main = %Main
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Main: <function> = fn_decl @Main [template] {
 // CHECK:STDOUT:     %return.var: ref i32 = var <return slot>
 // CHECK:STDOUT:   }

+ 4 - 1
toolchain/check/testdata/as/fail_no_conversion.carbon

@@ -19,7 +19,10 @@ let n: (i32, i32) = 1 as (i32, i32);
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc10_17.1: (type, type) = tuple_literal (i32, i32)
 // CHECK:STDOUT:   %.loc10_17.2: type = converted %.loc10_17.1, constants.%.2 [template = constants.%.2]
 // CHECK:STDOUT:   %.loc10_21: i32 = int_literal 1 [template = constants.%.4]

+ 4 - 1
toolchain/check/testdata/as/fail_not_type.carbon

@@ -17,7 +17,10 @@ let n: i32 = 1 as 2;
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %.loc10_14: i32 = int_literal 1 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc10_19: i32 = int_literal 2 [template = constants.%.2]
 // CHECK:STDOUT:   %n: i32 = bind_name n, <error>

+ 2 - 0
toolchain/check/testdata/as/identity.carbon

@@ -36,12 +36,14 @@ fn Initializing() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .X = %X.decl
 // CHECK:STDOUT:     .Value = %Value
 // CHECK:STDOUT:     .Reference = %Reference
 // CHECK:STDOUT:     .Make = %Make
 // CHECK:STDOUT:     .Initializing = %Initializing
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %X.decl: type = class_decl @X [template = constants.%X] {}
 // CHECK:STDOUT:   %Value: <function> = fn_decl @Value [template] {
 // CHECK:STDOUT:     %X.ref.loc13: type = name_ref X, %X.decl [template = constants.%X]

+ 2 - 0
toolchain/check/testdata/as/tuple.carbon

@@ -35,11 +35,13 @@ fn Var() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .X = %X.decl
 // CHECK:STDOUT:     .Make = %Make
 // CHECK:STDOUT:     .Let = %Let
 // CHECK:STDOUT:     .Var = %Var
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %X.decl: type = class_decl @X [template = constants.%X] {}
 // CHECK:STDOUT:   %Make: <function> = fn_decl @Make [template] {
 // CHECK:STDOUT:     %X.ref: type = name_ref X, %X.decl [template = constants.%X]

+ 1 - 1
toolchain/check/testdata/basics/builtin_insts.carbon

@@ -2,7 +2,7 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-raw-sem-ir --builtin-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-raw-sem-ir --builtin-sem-ir %s
 //
 // AUTOUPDATE
 

+ 2 - 0
toolchain/check/testdata/basics/builtin_types.carbon

@@ -20,10 +20,12 @@ var test_type: type = i32;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .test_i32 = %test_i32
 // CHECK:STDOUT:     .test_f64 = %test_f64
 // CHECK:STDOUT:     .test_type = %test_type
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %test_i32.var: ref i32 = var test_i32
 // CHECK:STDOUT:   %test_i32: ref i32 = bind_name test_i32, %test_i32.var
 // CHECK:STDOUT:   %test_f64.var: ref f64 = var test_f64

+ 4 - 1
toolchain/check/testdata/basics/empty.carbon

@@ -7,6 +7,9 @@
 // CHECK:STDOUT: --- empty.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 4 - 1
toolchain/check/testdata/basics/empty_decl.carbon

@@ -9,6 +9,9 @@
 // CHECK:STDOUT: --- empty_decl.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/basics/fail_bad_run.carbon

@@ -22,8 +22,10 @@ fn Run() -> String {}
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Run: <function> = fn_decl @Run [template] {
 // CHECK:STDOUT:     @Run.%return: ref String = var <return slot>
 // CHECK:STDOUT:   }

+ 2 - 0
toolchain/check/testdata/basics/fail_bad_run_2.carbon

@@ -13,8 +13,10 @@ fn Run(n: i32) {}
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Run: <function> = fn_decl @Run [template] {
 // CHECK:STDOUT:     %n.loc10_8.1: i32 = param n
 // CHECK:STDOUT:     @Run.%n: i32 = bind_name n, %n.loc10_8.1

+ 2 - 0
toolchain/check/testdata/basics/fail_name_lookup.carbon

@@ -15,8 +15,10 @@ fn Main() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Main = %Main
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Main: <function> = fn_decl @Main [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/basics/fail_non_type_as_type.carbon

@@ -17,8 +17,10 @@ var x: type = 42;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .x = %x
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %x.var: ref type = var x
 // CHECK:STDOUT:   %x: ref type = bind_name x, %x.var
 // CHECK:STDOUT: }

+ 4 - 1
toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon

@@ -24,7 +24,10 @@ let c: i32 = 0x8000_0000;
 // CHECK:STDOUT: --- fail_numeric_literal_overflow.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
-// CHECK:STDOUT:   package: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
+// CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %a: i32 = bind_name a, <error>
 // CHECK:STDOUT:   %b: i32 = bind_name b, <error>
 // CHECK:STDOUT:   %c: i32 = bind_name c, <error>

+ 2 - 0
toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon

@@ -14,9 +14,11 @@ var y: i32 = x.b;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .x = %x
 // CHECK:STDOUT:     .y = %y
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %x.var: ref i32 = var x
 // CHECK:STDOUT:   %x: ref i32 = bind_name x, %x.var
 // CHECK:STDOUT:   %y.var: ref i32 = var y

+ 4 - 0
toolchain/check/testdata/basics/multifile.carbon

@@ -18,8 +18,10 @@ fn B() {}
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .A = %A
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %A: <function> = fn_decl @A [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -32,8 +34,10 @@ fn B() {}
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .B = %B
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %B: <function> = fn_decl @B [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 1 - 1
toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon

@@ -2,7 +2,7 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-sem-ir --dump-raw-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-sem-ir --dump-raw-sem-ir %s
 //
 // Check that we can combine textual IR and raw IR dumping in one compile.
 //

+ 1 - 1
toolchain/check/testdata/basics/multifile_raw_ir.carbon

@@ -2,7 +2,7 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-raw-sem-ir %s
+// ARGS: compile --no-prelude-import  --phase=check --dump-raw-sem-ir %s
 //
 // Check that raw IR dumping works as expected.
 //

+ 2 - 0
toolchain/check/testdata/basics/numeric_literals.carbon

@@ -59,8 +59,10 @@ fn F() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/basics/parens.carbon

@@ -16,9 +16,11 @@ var b: i32 = ((2));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .a = %a
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %a.var: ref i32 = var a
 // CHECK:STDOUT:   %a: ref i32 = bind_name a, %a.var
 // CHECK:STDOUT:   %b.var: ref i32 = var b

+ 133 - 107
toolchain/check/testdata/basics/raw_and_textual_ir.carbon

@@ -2,14 +2,14 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-sem-ir --dump-raw-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-sem-ir --dump-raw-sem-ir %s
 //
 // Check that we can combine textual IR and raw IR dumping in one compile.
 //
 // AUTOUPDATE
 
-fn Foo(n: i32) -> (i32, i32, f64) {
-  return (n, 2, 3.4);
+fn Foo(n: ()) -> ((), ()) {
+  return (n, ());
 }
 
 // CHECK:STDOUT: ---
@@ -17,124 +17,145 @@ fn Foo(n: i32) -> (i32, i32, f64) {
 // 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<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+9}}
+// CHECK:STDOUT:     name_scope0:     {inst: inst+0, enclosing_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+15}}
 // CHECK:STDOUT:   bind_names:
 // CHECK:STDOUT:     bindName0:       {name: name1, enclosing_scope: name_scope<invalid>}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function0:       {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type4, return_slot: inst+7, body: [block6]}
+// CHECK:STDOUT:     function0:       {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_slot: inst+13, 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 instIntType, value_rep: {kind: copy, type: type1}}
-// CHECK:STDOUT:     type2:           {constant: template inst+3, value_rep: {kind: unknown, type: type<invalid>}}
-// CHECK:STDOUT:     type3:           {constant: template instFloatType, value_rep: {kind: copy, type: type3}}
-// CHECK:STDOUT:     type4:           {constant: template inst+5, value_rep: {kind: pointer, type: type5}}
-// CHECK:STDOUT:     type5:           {constant: template inst+8, value_rep: {kind: copy, type: type5}}
-// CHECK:STDOUT:     type6:           {constant: template instFunctionType, value_rep: {kind: copy, type: type6}}
+// 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:   type_blocks:
-// CHECK:STDOUT:     typeBlock0:
-// CHECK:STDOUT:       0:               typeTypeType
-// CHECK:STDOUT:       1:               typeTypeType
-// CHECK:STDOUT:       2:               typeTypeType
-// CHECK:STDOUT:     typeBlock1:
+// CHECK:STDOUT:     typeBlock0:      {}
+// CHECK:STDOUT:     typeBlock1:      {}
+// CHECK:STDOUT:     typeBlock2:      {}
+// CHECK:STDOUT:     typeBlock3:      {}
+// CHECK:STDOUT:     typeBlock4:
 // CHECK:STDOUT:       0:               type1
 // CHECK:STDOUT:       1:               type1
-// CHECK:STDOUT:       2:               type3
-// CHECK:STDOUT:     typeBlock2:
+// CHECK:STDOUT:     typeBlock5:      {}
+// CHECK:STDOUT:     typeBlock6:      {}
+// CHECK:STDOUT:     typeBlock7:
+// CHECK:STDOUT:       0:               type1
+// CHECK:STDOUT:       1:               type1
+// CHECK:STDOUT:     typeBlock8:      {}
+// CHECK:STDOUT:     typeBlock9:      {}
+// CHECK:STDOUT:     typeBlock10:
 // CHECK:STDOUT:       0:               type1
 // CHECK:STDOUT:       1:               type1
-// CHECK:STDOUT:       2:               type3
 // CHECK:STDOUT:   insts:
 // CHECK:STDOUT:     inst+0:          {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
-// CHECK:STDOUT:     inst+1:          {kind: Param, arg0: name1, type: type1}
-// CHECK:STDOUT:     inst+2:          {kind: BindName, arg0: bindName0, arg1: inst+1, type: type1}
-// CHECK:STDOUT:     inst+3:          {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
-// CHECK:STDOUT:     inst+4:          {kind: TupleLiteral, arg0: block4, type: type2}
-// CHECK:STDOUT:     inst+5:          {kind: TupleType, arg0: typeBlock1, type: typeTypeType}
-// CHECK:STDOUT:     inst+6:          {kind: Converted, arg0: inst+4, arg1: inst+5, type: typeTypeType}
-// CHECK:STDOUT:     inst+7:          {kind: VarStorage, arg0: nameReturnSlot, type: type4}
-// CHECK:STDOUT:     inst+8:          {kind: PointerType, arg0: type4, type: typeTypeType}
-// CHECK:STDOUT:     inst+9:          {kind: FunctionDecl, arg0: function0, arg1: block5, type: type6}
-// CHECK:STDOUT:     inst+10:         {kind: NameRef, arg0: name1, arg1: inst+2, type: type1}
-// CHECK:STDOUT:     inst+11:         {kind: IntLiteral, arg0: int5, type: type1}
-// CHECK:STDOUT:     inst+12:         {kind: IntLiteral, arg0: int5, type: type1}
-// CHECK:STDOUT:     inst+13:         {kind: RealLiteral, arg0: real0, type: type3}
-// CHECK:STDOUT:     inst+14:         {kind: RealLiteral, arg0: real0, type: type3}
-// CHECK:STDOUT:     inst+15:         {kind: TupleLiteral, arg0: block7, type: type4}
-// CHECK:STDOUT:     inst+16:         {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1}
-// CHECK:STDOUT:     inst+17:         {kind: InitializeFrom, arg0: inst+10, arg1: inst+16, type: type1}
-// CHECK:STDOUT:     inst+18:         {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1}
-// CHECK:STDOUT:     inst+19:         {kind: InitializeFrom, arg0: inst+11, arg1: inst+18, type: type1}
-// CHECK:STDOUT:     inst+20:         {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3}
-// CHECK:STDOUT:     inst+21:         {kind: InitializeFrom, arg0: inst+13, arg1: inst+20, type: type3}
-// CHECK:STDOUT:     inst+22:         {kind: TupleInit, arg0: block8, arg1: inst+7, type: type4}
-// CHECK:STDOUT:     inst+23:         {kind: Converted, arg0: inst+15, arg1: inst+22, type: type4}
-// CHECK:STDOUT:     inst+24:         {kind: ReturnExpr, arg0: inst+23}
+// CHECK:STDOUT:     inst+1:          {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
+// CHECK:STDOUT:     inst+2:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+3:          {kind: Converted, arg0: inst+2, arg1: inst+1, type: typeTypeType}
+// CHECK:STDOUT:     inst+4:          {kind: Param, arg0: name1, type: type1}
+// CHECK:STDOUT:     inst+5:          {kind: BindName, arg0: bindName0, arg1: inst+4, type: type1}
+// CHECK:STDOUT:     inst+6:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+7:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+8:          {kind: TupleType, arg0: typeBlock4, type: typeTypeType}
+// CHECK:STDOUT:     inst+9:          {kind: TupleLiteral, arg0: block4, type: type2}
+// CHECK:STDOUT:     inst+10:         {kind: Converted, arg0: inst+6, arg1: inst+1, type: typeTypeType}
+// 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+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}
+// CHECK:STDOUT:     inst+19:         {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1}
+// CHECK:STDOUT:     inst+20:         {kind: TupleInit, arg0: block8, arg1: inst+19, type: type1}
+// CHECK:STDOUT:     inst+21:         {kind: TupleValue, arg0: block9, type: type1}
+// CHECK:STDOUT:     inst+22:         {kind: Converted, arg0: inst+16, arg1: inst+20, type: type1}
+// CHECK:STDOUT:     inst+23:         {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1}
+// CHECK:STDOUT:     inst+24:         {kind: TupleInit, arg0: empty, arg1: inst+23, type: type1}
+// CHECK:STDOUT:     inst+25:         {kind: Converted, arg0: inst+17, arg1: inst+24, type: type1}
+// CHECK:STDOUT:     inst+26:         {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2}
+// CHECK:STDOUT:     inst+27:         {kind: TupleValue, arg0: block12, type: type2}
+// CHECK:STDOUT:     inst+28:         {kind: Converted, arg0: inst+18, arg1: inst+26, type: type2}
+// CHECK:STDOUT:     inst+29:         {kind: ReturnExpr, arg0: inst+28}
 // CHECK:STDOUT:   constant_values:
 // CHECK:STDOUT:     inst+0:          template inst+0
-// CHECK:STDOUT:     inst+3:          template inst+3
-// CHECK:STDOUT:     inst+5:          template inst+5
-// CHECK:STDOUT:     inst+6:          template inst+5
+// CHECK:STDOUT:     inst+1:          template inst+1
+// CHECK:STDOUT:     inst+3:          template inst+1
 // CHECK:STDOUT:     inst+8:          template inst+8
-// CHECK:STDOUT:     inst+9:          template inst+9
-// CHECK:STDOUT:     inst+11:         template inst+12
-// CHECK:STDOUT:     inst+12:         template inst+12
-// CHECK:STDOUT:     inst+13:         template inst+14
+// CHECK:STDOUT:     inst+10:         template inst+1
+// CHECK:STDOUT:     inst+11:         template inst+1
+// CHECK:STDOUT:     inst+12:         template inst+8
 // CHECK:STDOUT:     inst+14:         template inst+14
-// CHECK:STDOUT:     inst+19:         template inst+12
-// CHECK:STDOUT:     inst+21:         template inst+14
+// CHECK:STDOUT:     inst+15:         template inst+15
+// CHECK:STDOUT:     inst+20:         template inst+21
+// CHECK:STDOUT:     inst+21:         template inst+21
+// CHECK:STDOUT:     inst+22:         template inst+21
+// CHECK:STDOUT:     inst+24:         template inst+21
+// CHECK:STDOUT:     inst+25:         template inst+21
+// CHECK:STDOUT:     inst+26:         template inst+27
+// CHECK:STDOUT:     inst+27:         template inst+27
+// CHECK:STDOUT:     inst+28:         template inst+27
 // CHECK:STDOUT:   inst_blocks:
 // CHECK:STDOUT:     empty:           {}
 // CHECK:STDOUT:     exports:
-// CHECK:STDOUT:       0:               inst+9
+// CHECK:STDOUT:       0:               inst+15
 // CHECK:STDOUT:     global_init:     {}
 // CHECK:STDOUT:     block3:
-// CHECK:STDOUT:       0:               inst+2
+// CHECK:STDOUT:       0:               inst+5
 // CHECK:STDOUT:     block4:
-// CHECK:STDOUT:       0:               instIntType
-// CHECK:STDOUT:       1:               instIntType
-// CHECK:STDOUT:       2:               instFloatType
+// CHECK:STDOUT:       0:               inst+6
+// CHECK:STDOUT:       1:               inst+7
 // CHECK:STDOUT:     block5:
-// CHECK:STDOUT:       0:               inst+1
-// CHECK:STDOUT:       1:               inst+2
+// CHECK:STDOUT:       0:               inst+2
+// CHECK:STDOUT:       1:               inst+3
 // CHECK:STDOUT:       2:               inst+4
-// CHECK:STDOUT:       3:               inst+6
-// CHECK:STDOUT:       4:               inst+7
+// CHECK:STDOUT:       3:               inst+5
+// CHECK:STDOUT:       4:               inst+6
+// CHECK:STDOUT:       5:               inst+7
+// CHECK:STDOUT:       6:               inst+9
+// CHECK:STDOUT:       7:               inst+10
+// CHECK:STDOUT:       8:               inst+11
+// CHECK:STDOUT:       9:               inst+12
+// CHECK:STDOUT:       10:              inst+13
 // CHECK:STDOUT:     block6:
-// CHECK:STDOUT:       0:               inst+10
-// CHECK:STDOUT:       1:               inst+11
-// CHECK:STDOUT:       2:               inst+13
-// CHECK:STDOUT:       3:               inst+15
-// CHECK:STDOUT:       4:               inst+16
-// CHECK:STDOUT:       5:               inst+17
-// CHECK:STDOUT:       6:               inst+18
-// CHECK:STDOUT:       7:               inst+19
-// CHECK:STDOUT:       8:               inst+20
-// CHECK:STDOUT:       9:               inst+21
-// CHECK:STDOUT:       10:              inst+22
-// CHECK:STDOUT:       11:              inst+23
-// CHECK:STDOUT:       12:              inst+24
+// CHECK:STDOUT:       0:               inst+16
+// CHECK:STDOUT:       1:               inst+17
+// CHECK:STDOUT:       2:               inst+18
+// CHECK:STDOUT:       3:               inst+19
+// CHECK:STDOUT:       4:               inst+20
+// CHECK:STDOUT:       5:               inst+22
+// CHECK:STDOUT:       6:               inst+23
+// CHECK:STDOUT:       7:               inst+24
+// CHECK:STDOUT:       8:               inst+25
+// CHECK:STDOUT:       9:               inst+26
+// CHECK:STDOUT:       10:              inst+28
+// CHECK:STDOUT:       11:              inst+29
 // CHECK:STDOUT:     block7:
-// CHECK:STDOUT:       0:               inst+10
-// CHECK:STDOUT:       1:               inst+11
-// CHECK:STDOUT:       2:               inst+13
-// CHECK:STDOUT:     block8:
-// CHECK:STDOUT:       0:               inst+17
-// CHECK:STDOUT:       1:               inst+19
-// CHECK:STDOUT:       2:               inst+21
-// CHECK:STDOUT:     block9:
+// CHECK:STDOUT:       0:               inst+16
+// CHECK:STDOUT:       1:               inst+17
+// CHECK:STDOUT:     block8:          {}
+// CHECK:STDOUT:     block9:          {}
+// CHECK:STDOUT:     block10:
+// CHECK:STDOUT:       0:               inst+22
+// CHECK:STDOUT:       1:               inst+25
+// CHECK:STDOUT:     block11:         {}
+// CHECK:STDOUT:     block12:
+// CHECK:STDOUT:       0:               inst+21
+// CHECK:STDOUT:       1:               inst+21
+// CHECK:STDOUT:     block13:
 // CHECK:STDOUT:       0:               inst+0
-// CHECK:STDOUT:       1:               inst+9
+// CHECK:STDOUT:       1:               inst+15
 // CHECK:STDOUT: ...
 // CHECK:STDOUT:
 // CHECK:STDOUT: --- raw_and_textual_ir.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: type = tuple_type (type, type, type) [template]
-// CHECK:STDOUT:   %.2: type = tuple_type (i32, i32, f64) [template]
-// CHECK:STDOUT:   %.3: type = ptr_type (i32, i32, f64) [template]
-// CHECK:STDOUT:   %.4: i32 = int_literal 2 [template]
-// CHECK:STDOUT:   %.5: f64 = real_literal 34e-1 [template]
+// CHECK:STDOUT:   %.1: type = tuple_type () [template]
+// CHECK:STDOUT:   %.2: type = tuple_type ((), ()) [template]
+// CHECK:STDOUT:   %.3: type = ptr_type ((), ()) [template]
+// CHECK:STDOUT:   %.4: () = tuple_value () [template]
+// CHECK:STDOUT:   %.5: ((), ()) = tuple_value (%.4, %.4) [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
@@ -142,28 +163,33 @@ fn Foo(n: i32) -> (i32, i32, f64) {
 // CHECK:STDOUT:     .Foo = %Foo
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Foo: <function> = fn_decl @Foo [template] {
-// CHECK:STDOUT:     %n.loc11_8.1: i32 = param n
-// CHECK:STDOUT:     @Foo.%n: i32 = bind_name n, %n.loc11_8.1
-// CHECK:STDOUT:     %.loc11_33.1: (type, type, type) = tuple_literal (i32, i32, f64)
-// CHECK:STDOUT:     %.loc11_33.2: type = converted %.loc11_33.1, constants.%.2 [template = constants.%.2]
-// CHECK:STDOUT:     @Foo.%return: ref (i32, i32, f64) = var <return slot>
+// CHECK:STDOUT:     %.loc11_12.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %n.loc11_8.1: () = param n
+// CHECK:STDOUT:     @Foo.%n: () = bind_name n, %n.loc11_8.1
+// CHECK:STDOUT:     %.loc11_20.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_24.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_25.1: ((), ()) = tuple_literal (%.loc11_20.1, %.loc11_24.1)
+// CHECK:STDOUT:     %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %.loc11_24.2: type = converted %.loc11_24.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %.loc11_25.2: type = converted %.loc11_25.1, constants.%.2 [template = constants.%.2]
+// CHECK:STDOUT:     @Foo.%return: ref ((), ()) = var <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) {
+// CHECK:STDOUT: fn @Foo(%n: ()) -> %return: ((), ()) {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %n.ref: i32 = name_ref n, %n
-// CHECK:STDOUT:   %.loc12_14: i32 = int_literal 2 [template = constants.%.4]
-// CHECK:STDOUT:   %.loc12_17: f64 = real_literal 34e-1 [template = constants.%.5]
-// CHECK:STDOUT:   %.loc12_20.1: (i32, i32, f64) = tuple_literal (%n.ref, %.loc12_14, %.loc12_17)
-// CHECK:STDOUT:   %.loc12_20.2: ref i32 = tuple_access %return, element0
-// CHECK:STDOUT:   %.loc12_20.3: init i32 = initialize_from %n.ref to %.loc12_20.2
-// CHECK:STDOUT:   %.loc12_20.4: ref i32 = tuple_access %return, element1
-// CHECK:STDOUT:   %.loc12_20.5: init i32 = initialize_from %.loc12_14 to %.loc12_20.4 [template = constants.%.4]
-// CHECK:STDOUT:   %.loc12_20.6: ref f64 = tuple_access %return, element2
-// CHECK:STDOUT:   %.loc12_20.7: init f64 = initialize_from %.loc12_17 to %.loc12_20.6 [template = constants.%.5]
-// CHECK:STDOUT:   %.loc12_20.8: init (i32, i32, f64) = tuple_init (%.loc12_20.3, %.loc12_20.5, %.loc12_20.7) to %return
-// CHECK:STDOUT:   %.loc12_20.9: init (i32, i32, f64) = converted %.loc12_20.1, %.loc12_20.8
-// CHECK:STDOUT:   return %.loc12_20.9
+// CHECK:STDOUT:   %n.ref: () = name_ref n, %n
+// CHECK:STDOUT:   %.loc12_15.1: () = tuple_literal ()
+// CHECK:STDOUT:   %.loc12_16.1: ((), ()) = tuple_literal (%n.ref, %.loc12_15.1)
+// CHECK:STDOUT:   %.loc12_16.2: ref () = tuple_access %return, element0
+// CHECK:STDOUT:   %.loc12_11.1: init () = tuple_init () to %.loc12_16.2 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_11.2: init () = converted %n.ref, %.loc12_11.1 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_16.3: ref () = tuple_access %return, element1
+// CHECK:STDOUT:   %.loc12_15.2: init () = tuple_init () to %.loc12_16.3 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_15.3: init () = converted %.loc12_15.1, %.loc12_15.2 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_16.4: init ((), ()) = tuple_init (%.loc12_11.2, %.loc12_15.3) to %return [template = constants.%.5]
+// CHECK:STDOUT:   %.loc12_16.5: init ((), ()) = converted %.loc12_16.1, %.loc12_16.4 [template = constants.%.5]
+// CHECK:STDOUT:   return %.loc12_16.5
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 35 - 19
toolchain/check/testdata/basics/raw_identifier.carbon

@@ -2,26 +2,30 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-sem-ir %s
 //
 // Check that the command-line flag to dump textual IR works.
 //
 // AUTOUPDATE
 
-fn A(n: i32) -> i32 {
+fn A(n: ()) -> () {
   return r#n;
 }
 
-fn B(r#n: i32) -> i32 {
+fn B(r#n: ()) -> () {
   return n;
 }
 
-fn C(r#if: i32) -> i32 {
+fn C(r#if: ()) -> () {
   return r#if;
 }
 
 // CHECK:STDOUT: --- raw_identifier.carbon
 // CHECK:STDOUT:
+// CHECK:STDOUT: constants {
+// CHECK:STDOUT:   %.1: type = tuple_type () [template]
+// CHECK:STDOUT: }
+// CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .A = %A
@@ -29,37 +33,49 @@ fn C(r#if: i32) -> i32 {
 // CHECK:STDOUT:     .C = %C
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %A: <function> = fn_decl @A [template] {
-// CHECK:STDOUT:     %n.loc11_6.1: i32 = param n
-// CHECK:STDOUT:     @A.%n: i32 = bind_name n, %n.loc11_6.1
-// CHECK:STDOUT:     %return.var.loc11: ref i32 = var <return slot>
+// CHECK:STDOUT:     %.loc11_10.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_10.2: type = converted %.loc11_10.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %n.loc11_6.1: () = param n
+// 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 <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %B: <function> = fn_decl @B [template] {
-// CHECK:STDOUT:     %n.loc15_6.1: i32 = param n
-// CHECK:STDOUT:     @B.%n: i32 = bind_name n, %n.loc15_6.1
-// CHECK:STDOUT:     %return.var.loc15: ref i32 = var <return slot>
+// CHECK:STDOUT:     %.loc15_12.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %n.loc15_6.1: () = param n
+// 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 <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %C: <function> = fn_decl @C [template] {
-// CHECK:STDOUT:     %if.loc19_6.1: i32 = param r#if
-// CHECK:STDOUT:     @C.%if: i32 = bind_name r#if, %if.loc19_6.1
-// CHECK:STDOUT:     %return.var.loc19: ref i32 = var <return slot>
+// CHECK:STDOUT:     %.loc19_13.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc19_13.2: type = converted %.loc19_13.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %if.loc19_6.1: () = param 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 <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @A(%n: i32) -> i32 {
+// CHECK:STDOUT: fn @A(%n: ()) -> () {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %n.ref: i32 = name_ref n, %n
+// CHECK:STDOUT:   %n.ref: () = name_ref n, %n
 // CHECK:STDOUT:   return %n.ref
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @B(%n: i32) -> i32 {
+// CHECK:STDOUT: fn @B(%n: ()) -> () {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %n.ref: i32 = name_ref n, %n
+// CHECK:STDOUT:   %n.ref: () = name_ref n, %n
 // CHECK:STDOUT:   return %n.ref
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @C(%if: i32) -> i32 {
+// CHECK:STDOUT: fn @C(%if: ()) -> () {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %if.ref: i32 = name_ref r#if, %if
+// CHECK:STDOUT:   %if.ref: () = name_ref r#if, %if
 // CHECK:STDOUT:   return %if.ref
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 104 - 83
toolchain/check/testdata/basics/raw_ir.carbon

@@ -2,14 +2,14 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-raw-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-raw-sem-ir %s
 //
 // Check that raw IR dumping works as expected.
 //
 // AUTOUPDATE
 
-fn Foo(n: i32) -> (i32, i32, f64) {
-  return (n, 2, 3.4);
+fn Foo(n: ()) -> ((), ()) {
+  return (n, ());
 }
 
 // CHECK:STDOUT: ---
@@ -17,112 +17,133 @@ fn Foo(n: i32) -> (i32, i32, f64) {
 // 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<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+9}}
+// CHECK:STDOUT:     name_scope0:     {inst: inst+0, enclosing_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+15}}
 // CHECK:STDOUT:   bind_names:
 // CHECK:STDOUT:     bindName0:       {name: name1, enclosing_scope: name_scope<invalid>}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function0:       {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type4, return_slot: inst+7, body: [block6]}
+// CHECK:STDOUT:     function0:       {name: name0, enclosing_scope: name_scope0, param_refs: block3, return_type: type2, return_slot: inst+13, 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 instIntType, value_rep: {kind: copy, type: type1}}
-// CHECK:STDOUT:     type2:           {constant: template inst+3, value_rep: {kind: unknown, type: type<invalid>}}
-// CHECK:STDOUT:     type3:           {constant: template instFloatType, value_rep: {kind: copy, type: type3}}
-// CHECK:STDOUT:     type4:           {constant: template inst+5, value_rep: {kind: pointer, type: type5}}
-// CHECK:STDOUT:     type5:           {constant: template inst+8, value_rep: {kind: copy, type: type5}}
-// CHECK:STDOUT:     type6:           {constant: template instFunctionType, value_rep: {kind: copy, type: type6}}
+// 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:   type_blocks:
-// CHECK:STDOUT:     typeBlock0:
-// CHECK:STDOUT:       0:               typeTypeType
-// CHECK:STDOUT:       1:               typeTypeType
-// CHECK:STDOUT:       2:               typeTypeType
-// CHECK:STDOUT:     typeBlock1:
+// CHECK:STDOUT:     typeBlock0:      {}
+// CHECK:STDOUT:     typeBlock1:      {}
+// CHECK:STDOUT:     typeBlock2:      {}
+// CHECK:STDOUT:     typeBlock3:      {}
+// CHECK:STDOUT:     typeBlock4:
 // CHECK:STDOUT:       0:               type1
 // CHECK:STDOUT:       1:               type1
-// CHECK:STDOUT:       2:               type3
-// CHECK:STDOUT:     typeBlock2:
+// CHECK:STDOUT:     typeBlock5:      {}
+// CHECK:STDOUT:     typeBlock6:      {}
+// CHECK:STDOUT:     typeBlock7:
+// CHECK:STDOUT:       0:               type1
+// CHECK:STDOUT:       1:               type1
+// CHECK:STDOUT:     typeBlock8:      {}
+// CHECK:STDOUT:     typeBlock9:      {}
+// CHECK:STDOUT:     typeBlock10:
 // CHECK:STDOUT:       0:               type1
 // CHECK:STDOUT:       1:               type1
-// CHECK:STDOUT:       2:               type3
 // CHECK:STDOUT:   insts:
 // CHECK:STDOUT:     inst+0:          {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
-// CHECK:STDOUT:     inst+1:          {kind: Param, arg0: name1, type: type1}
-// CHECK:STDOUT:     inst+2:          {kind: BindName, arg0: bindName0, arg1: inst+1, type: type1}
-// CHECK:STDOUT:     inst+3:          {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
-// CHECK:STDOUT:     inst+4:          {kind: TupleLiteral, arg0: block4, type: type2}
-// CHECK:STDOUT:     inst+5:          {kind: TupleType, arg0: typeBlock1, type: typeTypeType}
-// CHECK:STDOUT:     inst+6:          {kind: Converted, arg0: inst+4, arg1: inst+5, type: typeTypeType}
-// CHECK:STDOUT:     inst+7:          {kind: VarStorage, arg0: nameReturnSlot, type: type4}
-// CHECK:STDOUT:     inst+8:          {kind: PointerType, arg0: type4, type: typeTypeType}
-// CHECK:STDOUT:     inst+9:          {kind: FunctionDecl, arg0: function0, arg1: block5, type: type6}
-// CHECK:STDOUT:     inst+10:         {kind: NameRef, arg0: name1, arg1: inst+2, type: type1}
-// CHECK:STDOUT:     inst+11:         {kind: IntLiteral, arg0: int5, type: type1}
-// CHECK:STDOUT:     inst+12:         {kind: IntLiteral, arg0: int5, type: type1}
-// CHECK:STDOUT:     inst+13:         {kind: RealLiteral, arg0: real0, type: type3}
-// CHECK:STDOUT:     inst+14:         {kind: RealLiteral, arg0: real0, type: type3}
-// CHECK:STDOUT:     inst+15:         {kind: TupleLiteral, arg0: block7, type: type4}
-// CHECK:STDOUT:     inst+16:         {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1}
-// CHECK:STDOUT:     inst+17:         {kind: InitializeFrom, arg0: inst+10, arg1: inst+16, type: type1}
-// CHECK:STDOUT:     inst+18:         {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1}
-// CHECK:STDOUT:     inst+19:         {kind: InitializeFrom, arg0: inst+11, arg1: inst+18, type: type1}
-// CHECK:STDOUT:     inst+20:         {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3}
-// CHECK:STDOUT:     inst+21:         {kind: InitializeFrom, arg0: inst+13, arg1: inst+20, type: type3}
-// CHECK:STDOUT:     inst+22:         {kind: TupleInit, arg0: block8, arg1: inst+7, type: type4}
-// CHECK:STDOUT:     inst+23:         {kind: Converted, arg0: inst+15, arg1: inst+22, type: type4}
-// CHECK:STDOUT:     inst+24:         {kind: ReturnExpr, arg0: inst+23}
+// CHECK:STDOUT:     inst+1:          {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
+// CHECK:STDOUT:     inst+2:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+3:          {kind: Converted, arg0: inst+2, arg1: inst+1, type: typeTypeType}
+// CHECK:STDOUT:     inst+4:          {kind: Param, arg0: name1, type: type1}
+// CHECK:STDOUT:     inst+5:          {kind: BindName, arg0: bindName0, arg1: inst+4, type: type1}
+// CHECK:STDOUT:     inst+6:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+7:          {kind: TupleLiteral, arg0: empty, type: type1}
+// CHECK:STDOUT:     inst+8:          {kind: TupleType, arg0: typeBlock4, type: typeTypeType}
+// CHECK:STDOUT:     inst+9:          {kind: TupleLiteral, arg0: block4, type: type2}
+// CHECK:STDOUT:     inst+10:         {kind: Converted, arg0: inst+6, arg1: inst+1, type: typeTypeType}
+// 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+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}
+// CHECK:STDOUT:     inst+19:         {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1}
+// CHECK:STDOUT:     inst+20:         {kind: TupleInit, arg0: block8, arg1: inst+19, type: type1}
+// CHECK:STDOUT:     inst+21:         {kind: TupleValue, arg0: block9, type: type1}
+// CHECK:STDOUT:     inst+22:         {kind: Converted, arg0: inst+16, arg1: inst+20, type: type1}
+// CHECK:STDOUT:     inst+23:         {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1}
+// CHECK:STDOUT:     inst+24:         {kind: TupleInit, arg0: empty, arg1: inst+23, type: type1}
+// CHECK:STDOUT:     inst+25:         {kind: Converted, arg0: inst+17, arg1: inst+24, type: type1}
+// CHECK:STDOUT:     inst+26:         {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2}
+// CHECK:STDOUT:     inst+27:         {kind: TupleValue, arg0: block12, type: type2}
+// CHECK:STDOUT:     inst+28:         {kind: Converted, arg0: inst+18, arg1: inst+26, type: type2}
+// CHECK:STDOUT:     inst+29:         {kind: ReturnExpr, arg0: inst+28}
 // CHECK:STDOUT:   constant_values:
 // CHECK:STDOUT:     inst+0:          template inst+0
-// CHECK:STDOUT:     inst+3:          template inst+3
-// CHECK:STDOUT:     inst+5:          template inst+5
-// CHECK:STDOUT:     inst+6:          template inst+5
+// CHECK:STDOUT:     inst+1:          template inst+1
+// CHECK:STDOUT:     inst+3:          template inst+1
 // CHECK:STDOUT:     inst+8:          template inst+8
-// CHECK:STDOUT:     inst+9:          template inst+9
-// CHECK:STDOUT:     inst+11:         template inst+12
-// CHECK:STDOUT:     inst+12:         template inst+12
-// CHECK:STDOUT:     inst+13:         template inst+14
+// CHECK:STDOUT:     inst+10:         template inst+1
+// CHECK:STDOUT:     inst+11:         template inst+1
+// CHECK:STDOUT:     inst+12:         template inst+8
 // CHECK:STDOUT:     inst+14:         template inst+14
-// CHECK:STDOUT:     inst+19:         template inst+12
-// CHECK:STDOUT:     inst+21:         template inst+14
+// CHECK:STDOUT:     inst+15:         template inst+15
+// CHECK:STDOUT:     inst+20:         template inst+21
+// CHECK:STDOUT:     inst+21:         template inst+21
+// CHECK:STDOUT:     inst+22:         template inst+21
+// CHECK:STDOUT:     inst+24:         template inst+21
+// CHECK:STDOUT:     inst+25:         template inst+21
+// CHECK:STDOUT:     inst+26:         template inst+27
+// CHECK:STDOUT:     inst+27:         template inst+27
+// CHECK:STDOUT:     inst+28:         template inst+27
 // CHECK:STDOUT:   inst_blocks:
 // CHECK:STDOUT:     empty:           {}
 // CHECK:STDOUT:     exports:
-// CHECK:STDOUT:       0:               inst+9
+// CHECK:STDOUT:       0:               inst+15
 // CHECK:STDOUT:     global_init:     {}
 // CHECK:STDOUT:     block3:
-// CHECK:STDOUT:       0:               inst+2
+// CHECK:STDOUT:       0:               inst+5
 // CHECK:STDOUT:     block4:
-// CHECK:STDOUT:       0:               instIntType
-// CHECK:STDOUT:       1:               instIntType
-// CHECK:STDOUT:       2:               instFloatType
+// CHECK:STDOUT:       0:               inst+6
+// CHECK:STDOUT:       1:               inst+7
 // CHECK:STDOUT:     block5:
-// CHECK:STDOUT:       0:               inst+1
-// CHECK:STDOUT:       1:               inst+2
+// CHECK:STDOUT:       0:               inst+2
+// CHECK:STDOUT:       1:               inst+3
 // CHECK:STDOUT:       2:               inst+4
-// CHECK:STDOUT:       3:               inst+6
-// CHECK:STDOUT:       4:               inst+7
+// CHECK:STDOUT:       3:               inst+5
+// CHECK:STDOUT:       4:               inst+6
+// CHECK:STDOUT:       5:               inst+7
+// CHECK:STDOUT:       6:               inst+9
+// CHECK:STDOUT:       7:               inst+10
+// CHECK:STDOUT:       8:               inst+11
+// CHECK:STDOUT:       9:               inst+12
+// CHECK:STDOUT:       10:              inst+13
 // CHECK:STDOUT:     block6:
-// CHECK:STDOUT:       0:               inst+10
-// CHECK:STDOUT:       1:               inst+11
-// CHECK:STDOUT:       2:               inst+13
-// CHECK:STDOUT:       3:               inst+15
-// CHECK:STDOUT:       4:               inst+16
-// CHECK:STDOUT:       5:               inst+17
-// CHECK:STDOUT:       6:               inst+18
-// CHECK:STDOUT:       7:               inst+19
-// CHECK:STDOUT:       8:               inst+20
-// CHECK:STDOUT:       9:               inst+21
-// CHECK:STDOUT:       10:              inst+22
-// CHECK:STDOUT:       11:              inst+23
-// CHECK:STDOUT:       12:              inst+24
+// CHECK:STDOUT:       0:               inst+16
+// CHECK:STDOUT:       1:               inst+17
+// CHECK:STDOUT:       2:               inst+18
+// CHECK:STDOUT:       3:               inst+19
+// CHECK:STDOUT:       4:               inst+20
+// CHECK:STDOUT:       5:               inst+22
+// CHECK:STDOUT:       6:               inst+23
+// CHECK:STDOUT:       7:               inst+24
+// CHECK:STDOUT:       8:               inst+25
+// CHECK:STDOUT:       9:               inst+26
+// CHECK:STDOUT:       10:              inst+28
+// CHECK:STDOUT:       11:              inst+29
 // CHECK:STDOUT:     block7:
-// CHECK:STDOUT:       0:               inst+10
-// CHECK:STDOUT:       1:               inst+11
-// CHECK:STDOUT:       2:               inst+13
-// CHECK:STDOUT:     block8:
-// CHECK:STDOUT:       0:               inst+17
-// CHECK:STDOUT:       1:               inst+19
-// CHECK:STDOUT:       2:               inst+21
-// CHECK:STDOUT:     block9:
+// CHECK:STDOUT:       0:               inst+16
+// CHECK:STDOUT:       1:               inst+17
+// CHECK:STDOUT:     block8:          {}
+// CHECK:STDOUT:     block9:          {}
+// CHECK:STDOUT:     block10:
+// CHECK:STDOUT:       0:               inst+22
+// CHECK:STDOUT:       1:               inst+25
+// CHECK:STDOUT:     block11:         {}
+// CHECK:STDOUT:     block12:
+// CHECK:STDOUT:       0:               inst+21
+// CHECK:STDOUT:       1:               inst+21
+// CHECK:STDOUT:     block13:
 // CHECK:STDOUT:       0:               inst+0
-// CHECK:STDOUT:       1:               inst+9
+// CHECK:STDOUT:       1:               inst+15
 // CHECK:STDOUT: ...

+ 2 - 0
toolchain/check/testdata/basics/run.carbon

@@ -10,8 +10,10 @@ fn Run() {}
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Run: <function> = fn_decl @Run [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 2 - 0
toolchain/check/testdata/basics/run_i32.carbon

@@ -14,8 +14,10 @@ fn Run() -> i32 { return 0; }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Run: <function> = fn_decl @Run [template] {
 // CHECK:STDOUT:     %return.var: ref i32 = var <return slot>
 // CHECK:STDOUT:   }

+ 32 - 27
toolchain/check/testdata/basics/textual_ir.carbon

@@ -2,24 +2,24 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: compile --phase=check --dump-sem-ir %s
+// ARGS: compile --no-prelude-import --phase=check --dump-sem-ir %s
 //
 // Check that the command-line flag to dump textual IR works.
 //
 // AUTOUPDATE
 
-fn Foo(n: i32) -> (i32, i32, f64) {
-  return (n, 2, 3.4);
+fn Foo(n: ()) -> ((), ()) {
+  return (n, ());
 }
 
 // CHECK:STDOUT: --- textual_ir.carbon
 // CHECK:STDOUT:
 // CHECK:STDOUT: constants {
-// CHECK:STDOUT:   %.1: type = tuple_type (type, type, type) [template]
-// CHECK:STDOUT:   %.2: type = tuple_type (i32, i32, f64) [template]
-// CHECK:STDOUT:   %.3: type = ptr_type (i32, i32, f64) [template]
-// CHECK:STDOUT:   %.4: i32 = int_literal 2 [template]
-// CHECK:STDOUT:   %.5: f64 = real_literal 34e-1 [template]
+// CHECK:STDOUT:   %.1: type = tuple_type () [template]
+// CHECK:STDOUT:   %.2: type = tuple_type ((), ()) [template]
+// CHECK:STDOUT:   %.3: type = ptr_type ((), ()) [template]
+// CHECK:STDOUT:   %.4: () = tuple_value () [template]
+// CHECK:STDOUT:   %.5: ((), ()) = tuple_value (%.4, %.4) [template]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
@@ -27,28 +27,33 @@ fn Foo(n: i32) -> (i32, i32, f64) {
 // CHECK:STDOUT:     .Foo = %Foo
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Foo: <function> = fn_decl @Foo [template] {
-// CHECK:STDOUT:     %n.loc11_8.1: i32 = param n
-// CHECK:STDOUT:     @Foo.%n: i32 = bind_name n, %n.loc11_8.1
-// CHECK:STDOUT:     %.loc11_33.1: (type, type, type) = tuple_literal (i32, i32, f64)
-// CHECK:STDOUT:     %.loc11_33.2: type = converted %.loc11_33.1, constants.%.2 [template = constants.%.2]
-// CHECK:STDOUT:     @Foo.%return: ref (i32, i32, f64) = var <return slot>
+// CHECK:STDOUT:     %.loc11_12.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %n.loc11_8.1: () = param n
+// CHECK:STDOUT:     @Foo.%n: () = bind_name n, %n.loc11_8.1
+// CHECK:STDOUT:     %.loc11_20.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_24.1: () = tuple_literal ()
+// CHECK:STDOUT:     %.loc11_25.1: ((), ()) = tuple_literal (%.loc11_20.1, %.loc11_24.1)
+// CHECK:STDOUT:     %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %.loc11_24.2: type = converted %.loc11_24.1, constants.%.1 [template = constants.%.1]
+// CHECK:STDOUT:     %.loc11_25.2: type = converted %.loc11_25.1, constants.%.2 [template = constants.%.2]
+// CHECK:STDOUT:     @Foo.%return: ref ((), ()) = var <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) {
+// CHECK:STDOUT: fn @Foo(%n: ()) -> %return: ((), ()) {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %n.ref: i32 = name_ref n, %n
-// CHECK:STDOUT:   %.loc12_14: i32 = int_literal 2 [template = constants.%.4]
-// CHECK:STDOUT:   %.loc12_17: f64 = real_literal 34e-1 [template = constants.%.5]
-// CHECK:STDOUT:   %.loc12_20.1: (i32, i32, f64) = tuple_literal (%n.ref, %.loc12_14, %.loc12_17)
-// CHECK:STDOUT:   %.loc12_20.2: ref i32 = tuple_access %return, element0
-// CHECK:STDOUT:   %.loc12_20.3: init i32 = initialize_from %n.ref to %.loc12_20.2
-// CHECK:STDOUT:   %.loc12_20.4: ref i32 = tuple_access %return, element1
-// CHECK:STDOUT:   %.loc12_20.5: init i32 = initialize_from %.loc12_14 to %.loc12_20.4 [template = constants.%.4]
-// CHECK:STDOUT:   %.loc12_20.6: ref f64 = tuple_access %return, element2
-// CHECK:STDOUT:   %.loc12_20.7: init f64 = initialize_from %.loc12_17 to %.loc12_20.6 [template = constants.%.5]
-// CHECK:STDOUT:   %.loc12_20.8: init (i32, i32, f64) = tuple_init (%.loc12_20.3, %.loc12_20.5, %.loc12_20.7) to %return
-// CHECK:STDOUT:   %.loc12_20.9: init (i32, i32, f64) = converted %.loc12_20.1, %.loc12_20.8
-// CHECK:STDOUT:   return %.loc12_20.9
+// CHECK:STDOUT:   %n.ref: () = name_ref n, %n
+// CHECK:STDOUT:   %.loc12_15.1: () = tuple_literal ()
+// CHECK:STDOUT:   %.loc12_16.1: ((), ()) = tuple_literal (%n.ref, %.loc12_15.1)
+// CHECK:STDOUT:   %.loc12_16.2: ref () = tuple_access %return, element0
+// CHECK:STDOUT:   %.loc12_11.1: init () = tuple_init () to %.loc12_16.2 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_11.2: init () = converted %n.ref, %.loc12_11.1 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_16.3: ref () = tuple_access %return, element1
+// CHECK:STDOUT:   %.loc12_15.2: init () = tuple_init () to %.loc12_16.3 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_15.3: init () = converted %.loc12_15.1, %.loc12_15.2 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc12_16.4: init ((), ()) = tuple_init (%.loc12_11.2, %.loc12_15.3) to %return [template = constants.%.5]
+// CHECK:STDOUT:   %.loc12_16.5: init ((), ()) = converted %.loc12_16.1, %.loc12_16.4 [template = constants.%.5]
+// CHECK:STDOUT:   return %.loc12_16.5
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 1 - 1
toolchain/check/testdata/basics/verbose.carbon

@@ -2,7 +2,7 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ARGS: -v compile --phase=check %s
+// ARGS: -v compile --no-prelude-import --phase=check %s
 //
 // Only checks a couple statements in order to minimize manual update churn.
 // NOAUTOUPDATE

+ 5 - 1
toolchain/check/testdata/builtins/bool/make_type.carbon

@@ -22,8 +22,10 @@ var b: Bool() = false;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Bool = %Bool
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Bool: <function> = fn_decl @Bool [template] {
 // CHECK:STDOUT:     %return.var: ref type = var <return slot>
 // CHECK:STDOUT:   }
@@ -40,9 +42,11 @@ var b: Bool() = false;
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .Bool = %import_ref
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .b = %b
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+2, loc_11 [template = imports.%Bool]
+// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+3, loc_11 [template = imports.%Bool]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Bool.ref: <function> = name_ref Bool, %import_ref [template = imports.%Bool]
 // CHECK:STDOUT:   %.loc6_12.1: init type = call %Bool.ref() [template = bool]
 // CHECK:STDOUT:   %.loc6_13: type = value_of_initializer %.loc6_12.1 [template = bool]

+ 8 - 2
toolchain/check/testdata/builtins/float/make_type.carbon

@@ -44,8 +44,10 @@ var dyn: Float(dyn_size);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Float = %Float
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Float: <function> = 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
@@ -65,10 +67,12 @@ var dyn: Float(dyn_size);
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .Float = %import_ref
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .f = %f
 // CHECK:STDOUT:     .GetFloat = %GetFloat
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+4, loc_11 [template = imports.%Float]
+// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+5, loc_11 [template = imports.%Float]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Float.ref: <function> = name_ref Float, %import_ref [template = imports.%Float]
 // CHECK:STDOUT:   %.loc6_14: i32 = int_literal 64 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc6_13.1: init type = call %Float.ref(%.loc6_14) [template = f64]
@@ -112,11 +116,13 @@ var dyn: Float(dyn_size);
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .Float = %import_ref
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .invalid_float = %invalid_float
 // CHECK:STDOUT:     .dyn_size = %dyn_size
 // CHECK:STDOUT:     .dyn = %dyn
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+4, loc_11 [template = imports.%Float]
+// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+5, loc_11 [template = imports.%Float]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Float.ref.loc10: <function> = name_ref Float, %import_ref [template = imports.%Float]
 // CHECK:STDOUT:   %.loc10_26: i32 = int_literal 32 [template = constants.%.1]
 // CHECK:STDOUT:   %.loc10_25.1: init type = call %Float.ref.loc10(%.loc10_26) [template = <error>]

+ 6 - 0
toolchain/check/testdata/builtins/int/add.carbon

@@ -97,10 +97,12 @@ let b: i32 = Add(0x7FFFFFFF, 1);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Add = %Add
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Add: <function> = fn_decl @Add [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Add.%a: i32 = bind_name a, %a.loc2_8.1
@@ -153,6 +155,7 @@ let b: i32 = Add(0x7FFFFFFF, 1);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .TooFew = %TooFew
 // CHECK:STDOUT:     .TooMany = %TooMany
 // CHECK:STDOUT:     .BadReturnType = %BadReturnType
@@ -165,6 +168,7 @@ let b: i32 = Add(0x7FFFFFFF, 1);
 // CHECK:STDOUT:     .RuntimeCallTooMany = %RuntimeCallTooMany
 // CHECK:STDOUT:     .RuntimeCallBadReturnType = %RuntimeCallBadReturnType
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %TooFew: <function> = 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
@@ -294,8 +298,10 @@ let b: i32 = Add(0x7FFFFFFF, 1);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Add = %Add
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Add: <function> = fn_decl @Add [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Add.%a: i32 = bind_name a, %a.loc4_8.1

+ 2 - 0
toolchain/check/testdata/builtins/int/and.carbon

@@ -27,10 +27,12 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .And = %And
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %And: <function> = fn_decl @And [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @And.%a: i32 = bind_name a, %a.loc2_8.1

+ 2 - 0
toolchain/check/testdata/builtins/int/complement.carbon

@@ -29,11 +29,13 @@ fn RuntimeCall(a: i32) -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Complement = %Complement
 // CHECK:STDOUT:     .And = %And
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Complement: <function> = 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

+ 6 - 0
toolchain/check/testdata/builtins/int/div.carbon

@@ -65,10 +65,12 @@ let b: i32 = Div(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Div = %Div
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Div: <function> = fn_decl @Div [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Div.%a: i32 = bind_name a, %a.loc2_8.1
@@ -123,10 +125,12 @@ let b: i32 = Div(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Div = %Div
 // CHECK:STDOUT:     .Sub = %Sub
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Div: <function> = fn_decl @Div [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Div.%a: i32 = bind_name a, %a.loc4_8.1
@@ -214,8 +218,10 @@ let b: i32 = Div(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Div = %Div
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Div: <function> = fn_decl @Div [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Div.%a: i32 = bind_name a, %a.loc4_8.1

+ 4 - 0
toolchain/check/testdata/builtins/int/eq.carbon

@@ -45,12 +45,14 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Eq = %Eq
 // CHECK:STDOUT:     .True = %True.decl
 // CHECK:STDOUT:     .False = %False.decl
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Eq: <function> = fn_decl @Eq [template] {
 // CHECK:STDOUT:     %a.loc2_7.1: i32 = param a
 // CHECK:STDOUT:     @Eq.%a: i32 = bind_name a, %a.loc2_7.1
@@ -147,8 +149,10 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .WrongResult = %WrongResult
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %WrongResult: <function> = fn_decl @WrongResult [template] {
 // CHECK:STDOUT:     %a.loc7_16.1: i32 = param a
 // CHECK:STDOUT:     @WrongResult.%a: i32 = bind_name a, %a.loc7_16.1

+ 2 - 0
toolchain/check/testdata/builtins/int/greater.carbon

@@ -42,6 +42,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Greater = %Greater
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .True = %True.decl
@@ -49,6 +50,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Greater: <function> = fn_decl @Greater [template] {
 // CHECK:STDOUT:     %a.loc2_12.1: i32 = param a
 // CHECK:STDOUT:     @Greater.%a: i32 = bind_name a, %a.loc2_12.1

+ 2 - 0
toolchain/check/testdata/builtins/int/greater_eq.carbon

@@ -42,6 +42,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .GreaterEq = %GreaterEq
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .True = %True.decl
@@ -49,6 +50,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %GreaterEq: <function> = fn_decl @GreaterEq [template] {
 // CHECK:STDOUT:     %a.loc2_14.1: i32 = param a
 // CHECK:STDOUT:     @GreaterEq.%a: i32 = bind_name a, %a.loc2_14.1

+ 4 - 0
toolchain/check/testdata/builtins/int/left_shift.carbon

@@ -71,10 +71,12 @@ let negative: i32 = LeftShift(1, Negate(1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .LeftShift = %LeftShift
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %LeftShift: <function> = fn_decl @LeftShift [template] {
 // CHECK:STDOUT:     %a.loc2_14.1: i32 = param a
 // CHECK:STDOUT:     @LeftShift.%a: i32 = bind_name a, %a.loc2_14.1
@@ -132,9 +134,11 @@ let negative: i32 = LeftShift(1, Negate(1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .LeftShift = %LeftShift
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %LeftShift: <function> = fn_decl @LeftShift [template] {
 // CHECK:STDOUT:     %a.loc4_14.1: i32 = param a
 // CHECK:STDOUT:     @LeftShift.%a: i32 = bind_name a, %a.loc4_14.1

+ 2 - 0
toolchain/check/testdata/builtins/int/less.carbon

@@ -42,6 +42,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Less = %Less
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .True = %True.decl
@@ -49,6 +50,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Less: <function> = fn_decl @Less [template] {
 // CHECK:STDOUT:     %a.loc2_9.1: i32 = param a
 // CHECK:STDOUT:     @Less.%a: i32 = bind_name a, %a.loc2_9.1

+ 2 - 0
toolchain/check/testdata/builtins/int/less_eq.carbon

@@ -42,6 +42,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .LessEq = %LessEq
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .True = %True.decl
@@ -49,6 +50,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %LessEq: <function> = fn_decl @LessEq [template] {
 // CHECK:STDOUT:     %a.loc2_11.1: i32 = param a
 // CHECK:STDOUT:     @LessEq.%a: i32 = bind_name a, %a.loc2_11.1

+ 5 - 1
toolchain/check/testdata/builtins/int/make_type_32.carbon

@@ -22,8 +22,10 @@ var i: Int() = 0;
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Int = %Int
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Int: <function> = fn_decl @Int [template] {
 // CHECK:STDOUT:     %return.var: ref type = var <return slot>
 // CHECK:STDOUT:   }
@@ -40,9 +42,11 @@ var i: Int() = 0;
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .Int = %import_ref
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .i = %i
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+2, loc_11 [template = imports.%Int]
+// CHECK:STDOUT:   %import_ref: <function> = import_ref ir2, inst+3, loc_11 [template = imports.%Int]
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Int.ref: <function> = name_ref Int, %import_ref [template = imports.%Int]
 // CHECK:STDOUT:   %.loc6_11.1: init type = call %Int.ref() [template = i32]
 // CHECK:STDOUT:   %.loc6_12: type = value_of_initializer %.loc6_11.1 [template = i32]

+ 6 - 0
toolchain/check/testdata/builtins/int/mod.carbon

@@ -68,10 +68,12 @@ let b: i32 = Mod(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Mod = %Mod
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Mod: <function> = fn_decl @Mod [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Mod.%a: i32 = bind_name a, %a.loc2_8.1
@@ -127,10 +129,12 @@ let b: i32 = Mod(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Mod = %Mod
 // CHECK:STDOUT:     .Sub = %Sub
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Mod: <function> = fn_decl @Mod [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Mod.%a: i32 = bind_name a, %a.loc4_8.1
@@ -218,8 +222,10 @@ let b: i32 = Mod(0, 0);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Mod = %Mod
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Mod: <function> = fn_decl @Mod [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Mod.%a: i32 = bind_name a, %a.loc4_8.1

+ 4 - 0
toolchain/check/testdata/builtins/int/mul.carbon

@@ -39,10 +39,12 @@ let b: i32 = Mul(0x8000, 0x10000);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Mul = %Mul
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Mul: <function> = fn_decl @Mul [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Mul.%a: i32 = bind_name a, %a.loc2_8.1
@@ -97,8 +99,10 @@ let b: i32 = Mul(0x8000, 0x10000);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Mul = %Mul
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Mul: <function> = fn_decl @Mul [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Mul.%a: i32 = bind_name a, %a.loc4_8.1

+ 6 - 0
toolchain/check/testdata/builtins/int/negate.carbon

@@ -125,10 +125,12 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Negate: <function> = 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
@@ -186,6 +188,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .TooFew = %TooFew
 // CHECK:STDOUT:     .TooMany = %TooMany
 // CHECK:STDOUT:     .BadReturnType = %BadReturnType
@@ -198,6 +201,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
 // CHECK:STDOUT:     .RuntimeCallTooMany = %RuntimeCallTooMany
 // CHECK:STDOUT:     .RuntimeCallBadReturnType = %RuntimeCallBadReturnType
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %TooFew: <function> = fn_decl @TooFew [template] {
 // CHECK:STDOUT:     %return.var.loc8: ref i32 = var <return slot>
 // CHECK:STDOUT:   }
@@ -315,9 +319,11 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .Sub = %Sub
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Negate: <function> = 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

+ 2 - 0
toolchain/check/testdata/builtins/int/neq.carbon

@@ -36,12 +36,14 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Neq = %Neq
 // CHECK:STDOUT:     .True = %True.decl
 // CHECK:STDOUT:     .False = %False.decl
 // CHECK:STDOUT:     .F = %F
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Neq: <function> = fn_decl @Neq [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Neq.%a: i32 = bind_name a, %a.loc2_8.1

+ 2 - 0
toolchain/check/testdata/builtins/int/or.carbon

@@ -27,10 +27,12 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Or = %Or
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Or: <function> = fn_decl @Or [template] {
 // CHECK:STDOUT:     %a.loc2_7.1: i32 = param a
 // CHECK:STDOUT:     @Or.%a: i32 = bind_name a, %a.loc2_7.1

+ 6 - 0
toolchain/check/testdata/builtins/int/right_shift.carbon

@@ -72,10 +72,12 @@ let negative: i32 = RightShift(1, Negate(1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .RightShift = %RightShift
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %RightShift: <function> = fn_decl @RightShift [template] {
 // CHECK:STDOUT:     %a.loc2_15.1: i32 = param a
 // CHECK:STDOUT:     @RightShift.%a: i32 = bind_name a, %a.loc2_15.1
@@ -136,11 +138,13 @@ let negative: i32 = RightShift(1, Negate(1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .RightShift = %RightShift
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:     .arr1 = %arr1
 // CHECK:STDOUT:     .arr2 = %arr2
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %RightShift: <function> = fn_decl @RightShift [template] {
 // CHECK:STDOUT:     %a.loc6_15.1: i32 = param a
 // CHECK:STDOUT:     @RightShift.%a: i32 = bind_name a, %a.loc6_15.1
@@ -214,9 +218,11 @@ let negative: i32 = RightShift(1, Negate(1));
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .RightShift = %RightShift
 // CHECK:STDOUT:     .Negate = %Negate
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %RightShift: <function> = fn_decl @RightShift [template] {
 // CHECK:STDOUT:     %a.loc4_15.1: i32 = param a
 // CHECK:STDOUT:     @RightShift.%a: i32 = bind_name a, %a.loc4_15.1

+ 4 - 0
toolchain/check/testdata/builtins/int/sub.carbon

@@ -40,10 +40,12 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Sub = %Sub
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Sub: <function> = fn_decl @Sub [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Sub.%a: i32 = bind_name a, %a.loc2_8.1
@@ -99,8 +101,10 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Sub = %Sub
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Sub: <function> = fn_decl @Sub [template] {
 // CHECK:STDOUT:     %a.loc4_8.1: i32 = param a
 // CHECK:STDOUT:     @Sub.%a: i32 = bind_name a, %a.loc4_8.1

+ 2 - 0
toolchain/check/testdata/builtins/int/xor.carbon

@@ -27,10 +27,12 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Xor = %Xor
 // CHECK:STDOUT:     .arr = %arr
 // CHECK:STDOUT:     .RuntimeCall = %RuntimeCall
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Xor: <function> = fn_decl @Xor [template] {
 // CHECK:STDOUT:     %a.loc2_8.1: i32 = param a
 // CHECK:STDOUT:     @Xor.%a: i32 = bind_name a, %a.loc2_8.1

+ 3 - 1
toolchain/check/testdata/class/base.carbon

@@ -48,11 +48,13 @@ fn Access(d: Derived) -> (i32, i32) {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:     .Make = %Make
 // CHECK:STDOUT:     .Access = %Access
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %Make: <function> = fn_decl @Make [template] {
@@ -86,7 +88,7 @@ fn Access(d: Derived) -> (i32, i32) {
 // CHECK:STDOUT:   .Self = constants.%Derived
 // CHECK:STDOUT:   .base = %.loc12
 // CHECK:STDOUT:   .d = %.loc14
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @Make() -> %return: Derived {

+ 3 - 1
toolchain/check/testdata/class/base_field.carbon

@@ -41,10 +41,12 @@ fn Access(p: Derived*) -> i32* {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:     .Access = %Access
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %Access: <function> = fn_decl @Access [template] {
@@ -80,7 +82,7 @@ fn Access(p: Derived*) -> i32* {
 // CHECK:STDOUT:   .base = %.loc14
 // CHECK:STDOUT:   .d = %.loc16
 // CHECK:STDOUT:   .e = %.loc17
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @Access(%p: Derived*) -> i32* {

+ 3 - 1
toolchain/check/testdata/class/base_function_unqualified.carbon

@@ -33,9 +33,11 @@ fn Derived.H() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %H: <function> = fn_decl @H [template] {}
@@ -60,7 +62,7 @@ fn Derived.H() {
 // CHECK:STDOUT:   .base = %.loc12
 // CHECK:STDOUT:   .G = %G
 // CHECK:STDOUT:   .H = %H
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @F();

+ 3 - 1
toolchain/check/testdata/class/base_method.carbon

@@ -42,10 +42,12 @@ fn Call(p: Derived*) {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:     .Call = %Call
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %F: <function> = fn_decl @F [template] {
 // CHECK:STDOUT:     %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base]
@@ -86,7 +88,7 @@ fn Call(p: Derived*) {
 // CHECK:STDOUT: !members:
 // CHECK:STDOUT:   .Self = constants.%Derived
 // CHECK:STDOUT:   .base = %.loc18
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @F[addr %self: Base*]() {

+ 3 - 1
toolchain/check/testdata/class/base_method_qualified.carbon

@@ -51,6 +51,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Derived = %Derived.decl.loc7
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Call = %Call
@@ -58,6 +59,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 {
 // CHECK:STDOUT:     .PassDerivedToBase = %PassDerivedToBase
 // CHECK:STDOUT:     .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Derived.decl.loc7: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %Derived.decl.loc14: type = class_decl @Derived [template = constants.%Derived] {}
@@ -108,7 +110,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 {
 // CHECK:STDOUT:   .base = %.loc15
 // CHECK:STDOUT:   .F = %F
 // CHECK:STDOUT:   .G = %G
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @Base {

+ 5 - 3
toolchain/check/testdata/class/base_method_shadow.carbon

@@ -56,12 +56,14 @@ fn Call(a: A*, b: B*, c: C*, d: D*) {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .A = %A.decl
 // CHECK:STDOUT:     .B = %B.decl
 // CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:     .D = %D.decl
 // CHECK:STDOUT:     .Call = %Call
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %A.decl: type = class_decl @A [template = constants.%A] {}
 // CHECK:STDOUT:   %B.decl: type = class_decl @B [template = constants.%B] {}
 // CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
@@ -115,7 +117,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) {
 // CHECK:STDOUT:   .Self = constants.%B
 // CHECK:STDOUT:   .base = %.loc12
 // CHECK:STDOUT:   .F = %F
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @C {
@@ -133,7 +135,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) {
 // CHECK:STDOUT:   .Self = constants.%C
 // CHECK:STDOUT:   .base = %.loc17
 // CHECK:STDOUT:   .F = %F
-// CHECK:STDOUT:   extend name_scope2
+// CHECK:STDOUT:   extend name_scope3
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @D {
@@ -143,7 +145,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) {
 // CHECK:STDOUT: !members:
 // CHECK:STDOUT:   .Self = constants.%D
 // CHECK:STDOUT:   .base = %.loc22
-// CHECK:STDOUT:   extend name_scope2
+// CHECK:STDOUT:   extend name_scope3
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @F.1[addr @A.%self.loc8_13.3: A*]();

+ 2 - 0
toolchain/check/testdata/class/basic.carbon

@@ -33,9 +33,11 @@ fn Run() -> i32 {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Class = %Class.decl
 // CHECK:STDOUT:     .Run = %Run
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Class.decl: type = class_decl @Class [template = constants.%Class] {}
 // CHECK:STDOUT:   %G: <function> = fn_decl @G [template] {
 // CHECK:STDOUT:     %n.loc17_12.1: i32 = param n

+ 2 - 0
toolchain/check/testdata/class/complete_in_member_fn.carbon

@@ -21,8 +21,10 @@ class C {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 3 - 1
toolchain/check/testdata/class/compound_field.carbon

@@ -53,6 +53,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Base = %Base.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:     .AccessDerived = %AccessDerived
@@ -60,6 +61,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* {
 // CHECK:STDOUT:     .AccessDerivedIndirect = %AccessDerivedIndirect
 // CHECK:STDOUT:     .AccessBaseIndirect = %AccessBaseIndirect
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Base.decl: type = class_decl @Base [template = constants.%Base] {}
 // CHECK:STDOUT:   %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %AccessDerived: <function> = fn_decl @AccessDerived [template] {
@@ -115,7 +117,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* {
 // CHECK:STDOUT:   .base = %.loc14
 // CHECK:STDOUT:   .d = %.loc16
 // CHECK:STDOUT:   .e = %.loc17
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @AccessDerived(%d: Derived) -> i32 {

+ 23 - 9
toolchain/check/testdata/class/cross_package_import.carbon

@@ -109,8 +109,10 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -127,8 +129,10 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .C = %C.decl
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -138,8 +142,10 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .C = %C
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %C: <function> = fn_decl @C [template] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
@@ -160,14 +166,16 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Other = %Other
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other.ref: <namespace> = name_ref Other, %Other [template = %Other]
-// CHECK:STDOUT:   %import_ref.1: type = import_ref ir2, inst+1, loc_14 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref.1: type = import_ref ir3, inst+2, loc_14 [template = constants.%C]
 // CHECK:STDOUT:   %C.decl: invalid = class_decl @C [template = constants.%C] {}
-// CHECK:STDOUT:   %import_ref.2 = import_ref ir2, inst+2, unloaded
+// CHECK:STDOUT:   %import_ref.2 = import_ref ir3, inst+3, unloaded
 // CHECK:STDOUT:   %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C]
 // CHECK:STDOUT:   %c.var: ref C = var c
 // CHECK:STDOUT:   %c: ref C = bind_name c, %c.var
@@ -196,12 +204,14 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Other = %Other
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other.ref: <namespace> = name_ref Other, %Other [template = %Other]
-// CHECK:STDOUT:   %import_ref: type = import_ref ir2, inst+1, loc_14 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref: type = import_ref ir3, inst+2, loc_14 [template = constants.%C]
 // CHECK:STDOUT:   %C.decl: invalid = class_decl @C [template = constants.%C] {}
 // CHECK:STDOUT:   %C.ref: type = name_ref C, %import_ref [template = constants.%C]
 // CHECK:STDOUT:   %c.var: ref <error> = var c
@@ -230,15 +240,17 @@ var c: Other.C = {};
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Other = %Other
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other.ref: <namespace> = name_ref Other, %Other [template = %Other]
-// CHECK:STDOUT:   %import_ref.1: type = import_ref ir2, inst+1, loc_19 [template = constants.%C.1]
+// CHECK:STDOUT:   %import_ref.1: type = import_ref ir3, inst+2, loc_19 [template = constants.%C.1]
 // CHECK:STDOUT:   %C.decl.1: invalid = class_decl @C.1 [template = constants.%C.1] {}
-// CHECK:STDOUT:   %import_ref.2 = import_ref ir2, inst+2, unloaded
-// CHECK:STDOUT:   %import_ref.3: type = import_ref ir3, inst+1, loaded [template = constants.%C.2]
+// CHECK:STDOUT:   %import_ref.2 = import_ref ir3, inst+3, unloaded
+// CHECK:STDOUT:   %import_ref.3: type = import_ref ir4, inst+2, loaded [template = constants.%C.2]
 // CHECK:STDOUT:   %C.decl.2: invalid = class_decl @C.2 [template = constants.%C.2] {}
 // CHECK:STDOUT:   %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C.1]
 // CHECK:STDOUT:   %c.var: ref C = var c
@@ -274,14 +286,16 @@ var c: Other.C = {};
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
 // CHECK:STDOUT:     .Other = %Other
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .c = %c
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   %Other: <namespace> = namespace [template] {}
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Other.ref: <namespace> = name_ref Other, %Other [template = %Other]
-// CHECK:STDOUT:   %import_ref.1: type = import_ref ir2, inst+1, loc_19 [template = constants.%C]
+// CHECK:STDOUT:   %import_ref.1: type = import_ref ir2, inst+2, loc_19 [template = constants.%C]
 // CHECK:STDOUT:   %C.decl: invalid = class_decl @C.2 [template = constants.%C] {}
-// CHECK:STDOUT:   %import_ref.2 = import_ref ir2, inst+2, unloaded
-// CHECK:STDOUT:   %import_ref.3: <function> = import_ref ir3, inst+1, loaded [template = imports.%C]
+// CHECK:STDOUT:   %import_ref.2 = import_ref ir2, inst+3, unloaded
+// CHECK:STDOUT:   %import_ref.3: <function> = import_ref ir3, inst+2, loaded [template = imports.%C]
 // CHECK:STDOUT:   %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C]
 // CHECK:STDOUT:   %c.var: ref C = var c
 // CHECK:STDOUT:   %c: ref C = bind_name c, %c.var

+ 4 - 2
toolchain/check/testdata/class/derived_to_base.carbon

@@ -70,6 +70,7 @@ fn ConvertInit() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .A = %A.decl
 // CHECK:STDOUT:     .B = %B.decl
 // CHECK:STDOUT:     .C = %C.decl
@@ -80,6 +81,7 @@ fn ConvertInit() {
 // CHECK:STDOUT:     .ConvertRef = %ConvertRef
 // CHECK:STDOUT:     .ConvertInit = %ConvertInit
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %A.decl: type = class_decl @A [template = constants.%A] {}
 // CHECK:STDOUT:   %B.decl: type = class_decl @B [template = constants.%B] {}
 // CHECK:STDOUT:   %C.decl: type = class_decl @C [template = constants.%C] {}
@@ -144,7 +146,7 @@ fn ConvertInit() {
 // CHECK:STDOUT:   .Self = constants.%B
 // CHECK:STDOUT:   .base = %.loc12
 // CHECK:STDOUT:   .b = %.loc13
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @C {
@@ -156,7 +158,7 @@ fn ConvertInit() {
 // CHECK:STDOUT:   .Self = constants.%C
 // CHECK:STDOUT:   .base = %.loc17
 // CHECK:STDOUT:   .c = %.loc18
-// CHECK:STDOUT:   extend name_scope2
+// CHECK:STDOUT:   extend name_scope3
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @ConvertCToB(%p: C*) -> B* {

+ 3 - 1
toolchain/check/testdata/class/fail_abstract.carbon

@@ -50,11 +50,13 @@ fn Access(d: Derived) -> (i32, i32) {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Abstract = %Abstract.decl
 // CHECK:STDOUT:     .Derived = %Derived.decl
 // CHECK:STDOUT:     .Make = %Make
 // CHECK:STDOUT:     .Access = %Access
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {}
 // CHECK:STDOUT:   %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
 // CHECK:STDOUT:   %Make: <function> = fn_decl @Make [template] {
@@ -88,7 +90,7 @@ fn Access(d: Derived) -> (i32, i32) {
 // CHECK:STDOUT:   .Self = constants.%Derived
 // CHECK:STDOUT:   .base = %.loc12
 // CHECK:STDOUT:   .d = %.loc14
-// CHECK:STDOUT:   extend name_scope1
+// CHECK:STDOUT:   extend name_scope2
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @Make() -> %return: Derived {

+ 2 - 0
toolchain/check/testdata/class/fail_addr_not_self.carbon

@@ -27,8 +27,10 @@ class Class {
 // CHECK:STDOUT:
 // CHECK:STDOUT: file {
 // CHECK:STDOUT:   package: <namespace> = namespace [template] {
+// CHECK:STDOUT:     .Core = %Core
 // CHECK:STDOUT:     .Class = %Class.decl
 // CHECK:STDOUT:   }
+// CHECK:STDOUT:   %Core: <namespace> = namespace [template] {}
 // CHECK:STDOUT:   %Class.decl: type = class_decl @Class [template = constants.%Class] {}
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio