Просмотр исходного кода

Dump all non-indexed ids as hex (#6228)

The indexed ids are kept in decimal since they won't get tagging because
their ordered-ness is significant to their usage, as I understand it.

Addressing
https://github.com/carbon-language/carbon-lang/pull/6215#discussion_r2430180953
feedback
David Blaikie 6 месяцев назад
Родитель
Сommit
f64b08863a

+ 20 - 23
scripts/lldbinit.py

@@ -75,30 +75,27 @@ Example usage:
 
     context = args[0]
 
-    DECIMAL = 10
-    HEX = 16
-
     # The set of "Make" functions in dump.cpp, and whether the ids are printed
     # in decimal or hex.
     id_types = {
-        "class": ("SemIR::MakeClassId", HEX),
-        "constant": ("SemIR::MakeConstantId", DECIMAL),
-        "symbolic_constant": ("SemIR::MakeSymbolicConstantId", DECIMAL),
-        "entity_name": ("SemIR::MakeEntityNameId", DECIMAL),
-        "facet_type": ("SemIR::MakeFacetTypeId", DECIMAL),
-        "function": ("SemIR::MakeFunctionId", HEX),
-        "generic": ("SemIR::MakeGenericId", DECIMAL),
-        "impl": ("SemIR::MakeImplId", HEX),
-        "inst_block": ("SemIR::MakeInstBlockId", DECIMAL),
-        "inst": ("SemIR::MakeInstId", HEX),
-        "interface": ("SemIR::MakeInterfaceId", DECIMAL),
-        "name": ("SemIR::MakeNameId", DECIMAL),
-        "name_scope": ("SemIR::MakeNameScopeId", DECIMAL),
-        "identified_facet_type": ("SemIR::MakeIdentifiedFacetTypeId", DECIMAL),
-        "specific": ("SemIR::MakeSpecificId", DECIMAL),
-        "specific_interface": ("SemIR::MakeSpecificInterfaceId", HEX),
-        "struct_type_fields": ("SemIR::MakeStructTypeFieldsId", DECIMAL),
-        "type": ("SemIR::MakeTypeId", DECIMAL),
+        "class": "SemIR::MakeClassId",
+        "constant": "SemIR::MakeConstantId",
+        "symbolic_constant": "SemIR::MakeSymbolicConstantId",
+        "entity_name": "SemIR::MakeEntityNameId",
+        "facet_type": "SemIR::MakeFacetTypeId",
+        "function": "SemIR::MakeFunctionId",
+        "generic": "SemIR::MakeGenericId",
+        "impl": "SemIR::MakeImplId",
+        "inst_block": "SemIR::MakeInstBlockId",
+        "inst": "SemIR::MakeInstId",
+        "interface": "SemIR::MakeInterfaceId",
+        "name": "SemIR::MakeNameId",
+        "name_scope": "SemIR::MakeNameScopeId",
+        "identified_facet_type": "SemIR::MakeIdentifiedFacetTypeId",
+        "specific": "SemIR::MakeSpecificId",
+        "specific_interface": "SemIR::MakeSpecificInterfaceId",
+        "struct_type_fields": "SemIR::MakeStructTypeFieldsId",
+        "type": "SemIR::MakeTypeId",
     }
 
     def print_dump(context: str, expr: str) -> None:
@@ -123,8 +120,8 @@ Example usage:
             if len(args) != 2:
                 print_usage()
                 return
-            (make_id_fn, base) = id_types[m[1]]
-            id = int(m[2], base)
+            make_id_fn = id_types[m[1]]
+            id = int(m[2], 16)
             print_dump(context, f"{make_id_fn}({id})")
             found_id_type = True
 

+ 11 - 10
toolchain/base/index_base.h

@@ -57,16 +57,6 @@ struct IdBase : public AnyIdBase, public Printable<IdT> {
   static const IdT& None;
 
   auto Print(llvm::raw_ostream& out) const -> void {
-    out << IdT::Label;
-    if (has_value()) {
-      out << index;
-    } else {
-      out << "<none>";
-    }
-  }
-
-  // TODO: Make Print() do the hex thing for all IDs and remove this function.
-  auto PrintHex(llvm::raw_ostream& out) const -> void {
     out << IdT::Label;
     if (has_value()) {
       out << llvm::format_hex_no_prefix(index, 8, /*Upper=*/true);
@@ -98,6 +88,17 @@ struct IndexBase : public IdBase<IdT> {
       -> std::strong_ordering {
     return lhs.index <=> rhs.index;
   }
+
+  // Print indexed ids in decimal, since they won't have tagging (because, as
+  // the class comment explains, these ids are not entirely opaque).
+  auto Print(llvm::raw_ostream& out) const -> void {
+    out << IdT::Label;
+    if (this->has_value()) {
+      out << this->index;
+    } else {
+      out << "<none>";
+    }
+  }
 };
 
 // A random-access iterator for arrays using IndexBase-derived types.

+ 7 - 6
toolchain/base/shared_value_stores_test.cpp

@@ -52,12 +52,13 @@ TEST(SharedValueStores, PrintVals) {
   RawStringOstream out;
   value_stores.Print(out);
 
-  EXPECT_THAT(Yaml::Value::FromText(out.TakeStr()),
-              MatchSharedValues(
-                  ElementsAre(Pair("ap_int0", Yaml::Scalar("999999999999"))),
-                  ElementsAre(Pair("real0", Yaml::Scalar("8*10^8"))), IsEmpty(),
-                  ElementsAre(Pair("identifier0", Yaml::Scalar("a"))),
-                  ElementsAre(Pair("string0", Yaml::Scalar("foo'\"baz")))));
+  EXPECT_THAT(
+      Yaml::Value::FromText(out.TakeStr()),
+      MatchSharedValues(
+          ElementsAre(Pair("ap_int00000000", Yaml::Scalar("999999999999"))),
+          ElementsAre(Pair("real00000000", Yaml::Scalar("8*10^8"))), IsEmpty(),
+          ElementsAre(Pair("identifier00000000", Yaml::Scalar("a"))),
+          ElementsAre(Pair("string00000000", Yaml::Scalar("foo'\"baz")))));
 }
 
 }  // namespace

+ 4 - 4
toolchain/check/testdata/basics/raw_sem_ir/builtins.carbon

@@ -20,7 +20,7 @@
 // CHECK:STDOUT:   import_ir_insts: {}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
 // CHECK:STDOUT:   entity_names:    {}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:       {}
@@ -28,7 +28,7 @@
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -51,7 +51,7 @@
 // CHECK:STDOUT:     'inst(SpecificFunctionType)': {kind: SpecificFunctionType, type: type(TypeType)}
 // CHECK:STDOUT:     'inst(VtableType)': {kind: VtableType, type: type(TypeType)}
 // CHECK:STDOUT:     'inst(WitnessType)': {kind: WitnessType, type: type(TypeType)}
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:   constant_values:
 // CHECK:STDOUT:     values:
 // CHECK:STDOUT:       'inst(TypeType)':  concrete_constant(inst(TypeType))
@@ -75,6 +75,6 @@
 // CHECK:STDOUT:     exports:         {}
 // CHECK:STDOUT:     imports:         {}
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:
+// CHECK:STDOUT:     inst_block00000004:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT: ...

+ 86 - 86
toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon

@@ -39,45 +39,45 @@ fn G(x: Cpp.X) {
 // CHECK:STDOUT:     'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
 // CHECK:STDOUT:     'import_ir(Cpp)':  {decl_id: inst<none>, is_export: false}
 // CHECK:STDOUT:   import_ir_insts:
-// CHECK:STDOUT:     import_ir_inst0: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc0}
-// CHECK:STDOUT:     import_ir_inst1: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc1}
-// CHECK:STDOUT:     import_ir_inst2: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc2}
+// CHECK:STDOUT:     import_ir_inst00000000: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc00000000}
+// CHECK:STDOUT:     import_ir_inst00000001: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc00000001}
+// CHECK:STDOUT:     import_ir_inst00000002: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc00000002}
 // CHECK:STDOUT:   clang_decls:
-// CHECK:STDOUT:     clang_decl_id0:  {key: "<translation unit>", inst_id: inst60000010}
-// CHECK:STDOUT:     clang_decl_id1:  {key: "struct X {}", inst_id: inst60000012}
-// CHECK:STDOUT:     clang_decl_id2:  {key: "X * _Nonnull p", inst_id: inst60000021}
-// CHECK:STDOUT:     clang_decl_id3:  {key: {decl: "void f(X x = {})", num_params: 0}, inst_id: inst6000002C}
-// CHECK:STDOUT:     clang_decl_id4:  {key: {decl: "extern void f__carbon_thunk()", num_params: 0}, inst_id: inst6000002F}
-// CHECK:STDOUT:     clang_decl_id5:  {key: {decl: "void f(X x = {})", num_params: 1}, inst_id: inst6000003A}
-// CHECK:STDOUT:     clang_decl_id6:  {key: {decl: "extern void f__carbon_thunk(X * _Nonnull x)", num_params: 1}, inst_id: inst60000042}
-// CHECK:STDOUT:     clang_decl_id7:  {key: "X * _Nonnull global", inst_id: inst6000004B}
+// CHECK:STDOUT:     clang_decl_id00000000: {key: "<translation unit>", inst_id: inst60000010}
+// CHECK:STDOUT:     clang_decl_id00000001: {key: "struct X {}", inst_id: inst60000012}
+// CHECK:STDOUT:     clang_decl_id00000002: {key: "X * _Nonnull p", inst_id: inst60000021}
+// CHECK:STDOUT:     clang_decl_id00000003: {key: {decl: "void f(X x = {})", num_params: 0}, inst_id: inst6000002C}
+// CHECK:STDOUT:     clang_decl_id00000004: {key: {decl: "extern void f__carbon_thunk()", num_params: 0}, inst_id: inst6000002F}
+// CHECK:STDOUT:     clang_decl_id00000005: {key: {decl: "void f(X x = {})", num_params: 1}, inst_id: inst6000003A}
+// CHECK:STDOUT:     clang_decl_id00000006: {key: {decl: "extern void f__carbon_thunk(X * _Nonnull x)", num_params: 1}, inst_id: inst60000042}
+// CHECK:STDOUT:     clang_decl_id00000007: {key: "X * _Nonnull global", inst_id: inst6000004B}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: inst60000010, name1: inst6000001B}}
-// CHECK:STDOUT:     name_scope1:     {inst: inst60000010, parent_scope: name_scope0, has_error: false, extended_scopes: [], names: {name3: inst60000012, name4: inst60000029, name5: inst6000004B}}
-// CHECK:STDOUT:     name_scope2:     {inst: inst60000012, parent_scope: name_scope1, has_error: false, extended_scopes: [], names: {}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000000: inst60000010, name00000001: inst6000001B}}
+// CHECK:STDOUT:     name_scope00000001: {inst: inst60000010, parent_scope: name_scope00000000, has_error: false, extended_scopes: [], names: {name00000003: inst60000012, name00000004: inst60000029, name00000005: inst6000004B}}
+// CHECK:STDOUT:     name_scope00000002: {inst: inst60000012, parent_scope: name_scope00000001, has_error: false, extended_scopes: [], names: {}}
 // CHECK:STDOUT:   entity_names:
-// CHECK:STDOUT:     entity_name0:    {name: name2, parent_scope: name_scope<none>, index: -1, is_template: 0}
-// CHECK:STDOUT:     entity_name1:    {name: name2, parent_scope: name_scope<none>, index: -1, is_template: 0}
-// CHECK:STDOUT:     entity_name2:    {name: name2, parent_scope: name_scope<none>, index: -1, is_template: 0}
-// CHECK:STDOUT:     entity_name3:    {name: name5, parent_scope: name_scope1, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000000: {name: name00000002, parent_scope: name_scope<none>, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000001: {name: name00000002, parent_scope: name_scope<none>, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000002: {name: name00000002, parent_scope: name_scope<none>, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000003: {name: name00000005, parent_scope: name_scope00000001, index: -1, is_template: 0}
 // CHECK:STDOUT:   cpp_global_vars:
-// CHECK:STDOUT:     cpp_global_var0: {key: {entity_name_id: entity_name3}, clang_decl_id: clang_decl_id7}
+// CHECK:STDOUT:     cpp_global_var00000000: {key: {entity_name_id: entity_name00000003}, clang_decl_id: clang_decl_id00000007}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function60000000: {name: name1, parent_scope: name_scope0, call_params_id: inst_block6, body: [inst_block9]}
-// CHECK:STDOUT:     function60000001: {name: name4, parent_scope: name_scope1, call_params_id: inst_block_empty}
-// CHECK:STDOUT:     function60000002: {name: name7, parent_scope: name_scope1, call_params_id: inst_block_empty}
-// CHECK:STDOUT:     function60000003: {name: name4, parent_scope: name_scope1, call_params_id: inst_block13}
-// CHECK:STDOUT:     function60000004: {name: name7, parent_scope: name_scope1, call_params_id: inst_block18}
+// CHECK:STDOUT:     function60000000: {name: name00000001, parent_scope: name_scope00000000, call_params_id: inst_block00000006, body: [inst_block00000009]}
+// CHECK:STDOUT:     function60000001: {name: name00000004, parent_scope: name_scope00000001, call_params_id: inst_block_empty}
+// CHECK:STDOUT:     function60000002: {name: name00000007, parent_scope: name_scope00000001, call_params_id: inst_block_empty}
+// CHECK:STDOUT:     function60000003: {name: name00000004, parent_scope: name_scope00000001, call_params_id: inst_block0000000D}
+// CHECK:STDOUT:     function60000004: {name: name00000007, parent_scope: name_scope00000001, call_params_id: inst_block00000012}
 // CHECK:STDOUT:   classes:
-// CHECK:STDOUT:     class60000000:   {name: name3, parent_scope: name_scope1, self_type_id: type(inst60000013), inheritance_kind: Base, is_dynamic: 0, scope_id: name_scope2, body_block_id: inst_block10, adapt_id: inst<none>, base_id: inst<none>, complete_type_witness_id: inst60000024, vtable_decl_id: inst<none>}}
+// CHECK:STDOUT:     class60000000:   {name: name00000003, parent_scope: name_scope00000001, self_type_id: type(inst60000013), inheritance_kind: Base, is_dynamic: 0, scope_id: name_scope00000002, body_block_id: inst_block0000000A, adapt_id: inst<none>, base_id: inst<none>, complete_type_witness_id: inst60000024, vtable_decl_id: inst<none>}}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
-// CHECK:STDOUT:     struct_type_fields1:
-// CHECK:STDOUT:       0:               {name_id: name6, type_inst_id: inst6000001F}
-// CHECK:STDOUT:     struct_type_fields2:
-// CHECK:STDOUT:       0:               {name_id: name6, type_inst_id: inst6000001F}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
+// CHECK:STDOUT:     struct_type_fields00000001:
+// CHECK:STDOUT:       0:               {name_id: name00000006, type_inst_id: inst6000001F}
+// CHECK:STDOUT:     struct_type_fields00000002:
+// CHECK:STDOUT:       0:               {name_id: name00000006, type_inst_id: inst6000001F}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -124,36 +124,36 @@ fn G(x: Cpp.X) {
 // CHECK:STDOUT:     'inst(SpecificFunctionType)': {kind: SpecificFunctionType, type: type(TypeType)}
 // CHECK:STDOUT:     'inst(VtableType)': {kind: VtableType, type: type(TypeType)}
 // CHECK:STDOUT:     'inst(WitnessType)': {kind: WitnessType, type: type(TypeType)}
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst6000000F:    {kind: ImportCppDecl}
-// CHECK:STDOUT:     inst60000010:    {kind: Namespace, arg0: name_scope1, arg1: inst6000000F, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst60000011:    {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000010:    {kind: Namespace, arg0: name_scope00000001, arg1: inst6000000F, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000011:    {kind: NameRef, arg0: name00000000, arg1: inst60000010, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst60000012:    {kind: ClassDecl, arg0: class60000000, arg1: inst_block<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000013:    {kind: ClassType, arg0: class60000000, arg1: specific<none>, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000014:    {kind: NameRef, arg0: name3, arg1: inst60000012, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000015:    {kind: BindName, arg0: entity_name0, arg1: inst60000019, type: type(inst60000013)}
+// CHECK:STDOUT:     inst60000014:    {kind: NameRef, arg0: name00000003, arg1: inst60000012, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000015:    {kind: BindName, arg0: entity_name00000000, arg1: inst60000019, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000016:    {kind: PatternType, arg0: inst60000013, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000017:    {kind: BindingPattern, arg0: entity_name0, type: type(inst60000016)}
+// CHECK:STDOUT:     inst60000017:    {kind: BindingPattern, arg0: entity_name00000000, type: type(inst60000016)}
 // CHECK:STDOUT:     inst60000018:    {kind: ValueParamPattern, arg0: inst60000017, arg1: call_param0, type: type(inst60000016)}
-// CHECK:STDOUT:     inst60000019:    {kind: ValueParam, arg0: call_param0, arg1: name2, type: type(inst60000013)}
-// CHECK:STDOUT:     inst6000001A:    {kind: SpliceBlock, arg0: inst_block4, arg1: inst60000014, type: type(TypeType)}
-// CHECK:STDOUT:     inst6000001B:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block8, type: type(inst6000001C)}
+// CHECK:STDOUT:     inst60000019:    {kind: ValueParam, arg0: call_param0, arg1: name00000002, type: type(inst60000013)}
+// CHECK:STDOUT:     inst6000001A:    {kind: SpliceBlock, arg0: inst_block00000004, arg1: inst60000014, type: type(TypeType)}
+// CHECK:STDOUT:     inst6000001B:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block00000008, type: type(inst6000001C)}
 // CHECK:STDOUT:     inst6000001C:    {kind: FunctionType, arg0: function60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000001D:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000001E:    {kind: StructValue, arg0: inst_block_empty, type: type(inst6000001C)}
 // CHECK:STDOUT:     inst6000001F:    {kind: PointerType, arg0: inst60000013, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000020:    {kind: UnboundElementType, arg0: inst60000013, arg1: inst6000001F, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000021:    {kind: FieldDecl, arg0: name6, arg1: element0, type: type(inst60000020)}
-// CHECK:STDOUT:     inst60000022:    {kind: CustomLayoutType, arg0: struct_type_fields1, arg1: custom_layout1, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000023:    {kind: CustomLayoutType, arg0: struct_type_fields2, arg1: custom_layout1, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000021:    {kind: FieldDecl, arg0: name00000006, arg1: element0, type: type(inst60000020)}
+// CHECK:STDOUT:     inst60000022:    {kind: CustomLayoutType, arg0: struct_type_fields00000001, arg1: custom_layout00000001, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000023:    {kind: CustomLayoutType, arg0: struct_type_fields00000002, arg1: custom_layout00000001, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000024:    {kind: CompleteTypeWitness, arg0: inst60000022, type: type(inst(WitnessType))}
 // CHECK:STDOUT:     inst60000025:    {kind: CompleteTypeWitness, arg0: inst60000023, type: type(inst(WitnessType))}
 // CHECK:STDOUT:     inst60000026:    {kind: PointerType, arg0: inst60000023, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000027:    {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000027:    {kind: NameRef, arg0: name00000000, arg1: inst60000010, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst60000028:    {kind: CppOverloadSetType, arg0: cpp_overload_set60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000029:    {kind: CppOverloadSetValue, arg0: cpp_overload_set60000000, type: type(inst60000028)}
 // CHECK:STDOUT:     inst6000002A:    {kind: CppOverloadSetValue, arg0: cpp_overload_set60000000, type: type(inst60000028)}
-// CHECK:STDOUT:     inst6000002B:    {kind: NameRef, arg0: name4, arg1: inst60000029, type: type(inst60000028)}
+// CHECK:STDOUT:     inst6000002B:    {kind: NameRef, arg0: name00000004, arg1: inst60000029, type: type(inst60000028)}
 // CHECK:STDOUT:     inst6000002C:    {kind: FunctionDecl, arg0: function60000001, arg1: inst_block_empty, type: type(inst6000002D)}
 // CHECK:STDOUT:     inst6000002D:    {kind: FunctionType, arg0: function60000001, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000002E:    {kind: StructValue, arg0: inst_block_empty, type: type(inst6000002D)}
@@ -161,41 +161,41 @@ fn G(x: Cpp.X) {
 // CHECK:STDOUT:     inst60000030:    {kind: FunctionType, arg0: function60000002, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000031:    {kind: StructValue, arg0: inst_block_empty, type: type(inst60000030)}
 // CHECK:STDOUT:     inst60000032:    {kind: Call, arg0: inst6000002F, arg1: inst_block_empty, type: type(inst6000001D)}
-// CHECK:STDOUT:     inst60000033:    {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst60000034:    {kind: NameRef, arg0: name4, arg1: inst60000029, type: type(inst60000028)}
-// CHECK:STDOUT:     inst60000035:    {kind: NameRef, arg0: name2, arg1: inst60000015, type: type(inst60000013)}
-// CHECK:STDOUT:     inst60000036:    {kind: BindName, arg0: entity_name1, arg1: inst60000039, type: type(inst60000013)}
-// CHECK:STDOUT:     inst60000037:    {kind: BindingPattern, arg0: entity_name1, type: type(inst60000016)}
+// CHECK:STDOUT:     inst60000033:    {kind: NameRef, arg0: name00000000, arg1: inst60000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000034:    {kind: NameRef, arg0: name00000004, arg1: inst60000029, type: type(inst60000028)}
+// CHECK:STDOUT:     inst60000035:    {kind: NameRef, arg0: name00000002, arg1: inst60000015, type: type(inst60000013)}
+// CHECK:STDOUT:     inst60000036:    {kind: BindName, arg0: entity_name00000001, arg1: inst60000039, type: type(inst60000013)}
+// CHECK:STDOUT:     inst60000037:    {kind: BindingPattern, arg0: entity_name00000001, type: type(inst60000016)}
 // CHECK:STDOUT:     inst60000038:    {kind: ValueParamPattern, arg0: inst60000037, arg1: call_param0, type: type(inst60000016)}
-// CHECK:STDOUT:     inst60000039:    {kind: ValueParam, arg0: call_param0, arg1: name2, type: type(inst60000013)}
-// CHECK:STDOUT:     inst6000003A:    {kind: FunctionDecl, arg0: function60000003, arg1: inst_block15, type: type(inst6000003B)}
+// CHECK:STDOUT:     inst60000039:    {kind: ValueParam, arg0: call_param0, arg1: name00000002, type: type(inst60000013)}
+// CHECK:STDOUT:     inst6000003A:    {kind: FunctionDecl, arg0: function60000003, arg1: inst_block0000000F, type: type(inst6000003B)}
 // CHECK:STDOUT:     inst6000003B:    {kind: FunctionType, arg0: function60000003, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000003C:    {kind: StructValue, arg0: inst_block_empty, type: type(inst6000003B)}
-// CHECK:STDOUT:     inst6000003D:    {kind: BindName, arg0: entity_name2, arg1: inst60000041, type: type(inst6000001F)}
+// CHECK:STDOUT:     inst6000003D:    {kind: BindName, arg0: entity_name00000002, arg1: inst60000041, type: type(inst6000001F)}
 // CHECK:STDOUT:     inst6000003E:    {kind: PatternType, arg0: inst6000001F, type: type(TypeType)}
-// CHECK:STDOUT:     inst6000003F:    {kind: BindingPattern, arg0: entity_name2, type: type(inst6000003E)}
+// CHECK:STDOUT:     inst6000003F:    {kind: BindingPattern, arg0: entity_name00000002, type: type(inst6000003E)}
 // CHECK:STDOUT:     inst60000040:    {kind: ValueParamPattern, arg0: inst6000003F, arg1: call_param0, type: type(inst6000003E)}
-// CHECK:STDOUT:     inst60000041:    {kind: ValueParam, arg0: call_param0, arg1: name2, type: type(inst6000001F)}
-// CHECK:STDOUT:     inst60000042:    {kind: FunctionDecl, arg0: function60000004, arg1: inst_block20, type: type(inst60000043)}
+// CHECK:STDOUT:     inst60000041:    {kind: ValueParam, arg0: call_param0, arg1: name00000002, type: type(inst6000001F)}
+// CHECK:STDOUT:     inst60000042:    {kind: FunctionDecl, arg0: function60000004, arg1: inst_block00000014, type: type(inst60000043)}
 // CHECK:STDOUT:     inst60000043:    {kind: FunctionType, arg0: function60000004, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000044:    {kind: StructValue, arg0: inst_block_empty, type: type(inst60000043)}
 // CHECK:STDOUT:     inst60000045:    {kind: ValueAsRef, arg0: inst60000035, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000046:    {kind: AddrOf, arg0: inst60000045, type: type(inst6000001F)}
-// CHECK:STDOUT:     inst60000047:    {kind: Call, arg0: inst60000042, arg1: inst_block22, type: type(inst6000001D)}
-// CHECK:STDOUT:     inst60000048:    {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst60000049:    {kind: NameRef, arg0: name4, arg1: inst60000029, type: type(inst60000028)}
-// CHECK:STDOUT:     inst6000004A:    {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000047:    {kind: Call, arg0: inst60000042, arg1: inst_block00000016, type: type(inst6000001D)}
+// CHECK:STDOUT:     inst60000048:    {kind: NameRef, arg0: name00000000, arg1: inst60000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst60000049:    {kind: NameRef, arg0: name00000004, arg1: inst60000029, type: type(inst60000028)}
+// CHECK:STDOUT:     inst6000004A:    {kind: NameRef, arg0: name00000000, arg1: inst60000010, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst6000004B:    {kind: VarStorage, arg0: inst6000004D, type: type(inst6000001F)}
-// CHECK:STDOUT:     inst6000004C:    {kind: BindingPattern, arg0: entity_name3, type: type(inst6000003E)}
+// CHECK:STDOUT:     inst6000004C:    {kind: BindingPattern, arg0: entity_name00000003, type: type(inst6000003E)}
 // CHECK:STDOUT:     inst6000004D:    {kind: VarPattern, arg0: inst6000004C, type: type(inst6000003E)}
-// CHECK:STDOUT:     inst6000004E:    {kind: NameBindingDecl, arg0: inst_block23}
-// CHECK:STDOUT:     inst6000004F:    {kind: NameRef, arg0: name5, arg1: inst6000004B, type: type(inst6000001F)}
+// CHECK:STDOUT:     inst6000004E:    {kind: NameBindingDecl, arg0: inst_block00000017}
+// CHECK:STDOUT:     inst6000004F:    {kind: NameRef, arg0: name00000005, arg1: inst6000004B, type: type(inst6000001F)}
 // CHECK:STDOUT:     inst60000050:    {kind: BindValue, arg0: inst6000004F, type: type(inst6000001F)}
 // CHECK:STDOUT:     inst60000051:    {kind: Deref, arg0: inst60000050, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000052:    {kind: BindValue, arg0: inst60000051, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000053:    {kind: ValueAsRef, arg0: inst60000052, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000054:    {kind: AddrOf, arg0: inst60000053, type: type(inst6000001F)}
-// CHECK:STDOUT:     inst60000055:    {kind: Call, arg0: inst60000042, arg1: inst_block25, type: type(inst6000001D)}
+// CHECK:STDOUT:     inst60000055:    {kind: Call, arg0: inst60000042, arg1: inst_block00000019, type: type(inst6000001D)}
 // CHECK:STDOUT:     inst60000056:    {kind: Return}
 // CHECK:STDOUT:   constant_values:
 // CHECK:STDOUT:     values:
@@ -282,21 +282,21 @@ fn G(x: Cpp.X) {
 // CHECK:STDOUT:       7:               inst6000004E
 // CHECK:STDOUT:       8:               inst6000004B
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:
+// CHECK:STDOUT:     inst_block00000004:
 // CHECK:STDOUT:       0:               inst60000011
 // CHECK:STDOUT:       1:               inst60000014
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst60000018
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst60000019
-// CHECK:STDOUT:     inst_block7:
+// CHECK:STDOUT:     inst_block00000007:
 // CHECK:STDOUT:       0:               inst60000017
 // CHECK:STDOUT:       1:               inst60000018
-// CHECK:STDOUT:     inst_block8:
+// CHECK:STDOUT:     inst_block00000008:
 // CHECK:STDOUT:       0:               inst60000019
 // CHECK:STDOUT:       1:               inst6000001A
 // CHECK:STDOUT:       2:               inst60000015
-// CHECK:STDOUT:     inst_block9:
+// CHECK:STDOUT:     inst_block00000009:
 // CHECK:STDOUT:       0:               inst60000027
 // CHECK:STDOUT:       1:               inst6000002B
 // CHECK:STDOUT:       2:               inst60000032
@@ -317,44 +317,44 @@ fn G(x: Cpp.X) {
 // CHECK:STDOUT:       17:              inst60000054
 // CHECK:STDOUT:       18:              inst60000055
 // CHECK:STDOUT:       19:              inst60000056
-// CHECK:STDOUT:     inst_block10:
+// CHECK:STDOUT:     inst_block0000000A:
 // CHECK:STDOUT:       0:               inst60000021
 // CHECK:STDOUT:       1:               inst60000022
 // CHECK:STDOUT:       2:               inst60000024
-// CHECK:STDOUT:     inst_block11:    {}
-// CHECK:STDOUT:     inst_block12:
+// CHECK:STDOUT:     inst_block0000000B: {}
+// CHECK:STDOUT:     inst_block0000000C:
 // CHECK:STDOUT:       0:               inst60000038
-// CHECK:STDOUT:     inst_block13:
+// CHECK:STDOUT:     inst_block0000000D:
 // CHECK:STDOUT:       0:               inst60000039
-// CHECK:STDOUT:     inst_block14:
+// CHECK:STDOUT:     inst_block0000000E:
 // CHECK:STDOUT:       0:               inst60000037
 // CHECK:STDOUT:       1:               inst60000038
-// CHECK:STDOUT:     inst_block15:
+// CHECK:STDOUT:     inst_block0000000F:
 // CHECK:STDOUT:       0:               inst60000039
 // CHECK:STDOUT:       1:               inst60000036
-// CHECK:STDOUT:     inst_block16:    {}
-// CHECK:STDOUT:     inst_block17:
+// CHECK:STDOUT:     inst_block00000010: {}
+// CHECK:STDOUT:     inst_block00000011:
 // CHECK:STDOUT:       0:               inst60000040
-// CHECK:STDOUT:     inst_block18:
+// CHECK:STDOUT:     inst_block00000012:
 // CHECK:STDOUT:       0:               inst60000041
-// CHECK:STDOUT:     inst_block19:
+// CHECK:STDOUT:     inst_block00000013:
 // CHECK:STDOUT:       0:               inst6000003F
 // CHECK:STDOUT:       1:               inst60000040
-// CHECK:STDOUT:     inst_block20:
+// CHECK:STDOUT:     inst_block00000014:
 // CHECK:STDOUT:       0:               inst60000041
 // CHECK:STDOUT:       1:               inst6000003D
-// CHECK:STDOUT:     inst_block21:
+// CHECK:STDOUT:     inst_block00000015:
 // CHECK:STDOUT:       0:               inst60000035
-// CHECK:STDOUT:     inst_block22:
+// CHECK:STDOUT:     inst_block00000016:
 // CHECK:STDOUT:       0:               inst60000046
-// CHECK:STDOUT:     inst_block23:
+// CHECK:STDOUT:     inst_block00000017:
 // CHECK:STDOUT:       0:               inst6000004C
 // CHECK:STDOUT:       1:               inst6000004D
-// CHECK:STDOUT:     inst_block24:
+// CHECK:STDOUT:     inst_block00000018:
 // CHECK:STDOUT:       0:               inst60000052
-// CHECK:STDOUT:     inst_block25:
+// CHECK:STDOUT:     inst_block00000019:
 // CHECK:STDOUT:       0:               inst60000054
-// CHECK:STDOUT:     inst_block26:
+// CHECK:STDOUT:     inst_block0000001A:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst6000000F
 // CHECK:STDOUT:       2:               inst6000001B

+ 25 - 25
toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon

@@ -36,16 +36,16 @@ fn B() {
 // CHECK:STDOUT:   import_ir_insts: {}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: inst6000000F}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000000: inst6000000F}}
 // CHECK:STDOUT:   entity_names:    {}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function60000000: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
+// CHECK:STDOUT:     function60000000: {name: name00000000, parent_scope: name_scope00000000, call_params_id: inst_block_empty, body: [inst_block00000005]}
 // CHECK:STDOUT:   classes:         {}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -58,7 +58,7 @@ fn B() {
 // CHECK:STDOUT:     'type(inst60000011)':
 // CHECK:STDOUT:       value_repr:      {kind: none, type: type(inst60000011)}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst6000000F:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block_empty, type: type(inst60000010)}
 // CHECK:STDOUT:     inst60000010:    {kind: FunctionType, arg0: function60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000011:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
@@ -78,10 +78,10 @@ fn B() {
 // CHECK:STDOUT:       0:               inst6000000F
 // CHECK:STDOUT:     imports:         {}
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:     {}
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000004: {}
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst60000013
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst6000000F
 // CHECK:STDOUT: ...
@@ -91,25 +91,25 @@ fn B() {
 // CHECK:STDOUT:   import_irs:
 // CHECK:STDOUT:     'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
 // CHECK:STDOUT:     'import_ir(Cpp)':  {decl_id: inst<none>, is_export: false}
-// CHECK:STDOUT:     import_ir2:      {decl_id: inst5000000F, is_export: false}
+// CHECK:STDOUT:     import_ir00000002: {decl_id: inst5000000F, is_export: false}
 // CHECK:STDOUT:   import_ir_insts:
-// CHECK:STDOUT:     import_ir_inst0: {ir_id: import_ir2, inst_id: inst6000000F}
-// CHECK:STDOUT:     import_ir_inst1: {ir_id: import_ir2, inst_id: inst6000000F}
+// CHECK:STDOUT:     import_ir_inst00000000: {ir_id: import_ir00000002, inst_id: inst6000000F}
+// CHECK:STDOUT:     import_ir_inst00000001: {ir_id: import_ir00000002, inst_id: inst6000000F}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name1: inst50000010, name0: inst50000011}}
-// CHECK:STDOUT:     name_scope1:     {inst: inst50000010, parent_scope: name_scope0, has_error: false, extended_scopes: [], names: {name1: inst50000016}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000001: inst50000010, name00000000: inst50000011}}
+// CHECK:STDOUT:     name_scope00000001: {inst: inst50000010, parent_scope: name_scope00000000, has_error: false, extended_scopes: [], names: {name00000001: inst50000016}}
 // CHECK:STDOUT:   entity_names:
-// CHECK:STDOUT:     entity_name0:    {name: name1, parent_scope: name_scope1, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000000: {name: name00000001, parent_scope: name_scope00000001, index: -1, is_template: 0}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function50000000: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
-// CHECK:STDOUT:     function50000001: {name: name1, parent_scope: name_scope1}
+// CHECK:STDOUT:     function50000000: {name: name00000000, parent_scope: name_scope00000000, call_params_id: inst_block_empty, body: [inst_block00000005]}
+// CHECK:STDOUT:     function50000001: {name: name00000001, parent_scope: name_scope00000001}
 // CHECK:STDOUT:   classes:         {}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -122,19 +122,19 @@ fn B() {
 // CHECK:STDOUT:     'type(inst50000013)':
 // CHECK:STDOUT:       value_repr:      {kind: none, type: type(inst50000013)}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst5000000F:    {kind: ImportDecl, arg0: name1}
-// CHECK:STDOUT:     inst50000010:    {kind: Namespace, arg0: name_scope1, arg1: inst5000000F, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst5000000F:    {kind: ImportDecl, arg0: name00000001}
+// CHECK:STDOUT:     inst50000010:    {kind: Namespace, arg0: name_scope00000001, arg1: inst5000000F, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst50000011:    {kind: FunctionDecl, arg0: function50000000, arg1: inst_block_empty, type: type(inst50000012)}
 // CHECK:STDOUT:     inst50000012:    {kind: FunctionType, arg0: function50000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000013:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000014:    {kind: StructValue, arg0: inst_block_empty, type: type(inst50000012)}
-// CHECK:STDOUT:     inst50000015:    {kind: NameRef, arg0: name1, arg1: inst50000010, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst50000016:    {kind: ImportRefLoaded, arg0: import_ir_inst0, arg1: entity_name0, type: type(inst50000018)}
+// CHECK:STDOUT:     inst50000015:    {kind: NameRef, arg0: name00000001, arg1: inst50000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst50000016:    {kind: ImportRefLoaded, arg0: import_ir_inst00000000, arg1: entity_name00000000, type: type(inst50000018)}
 // CHECK:STDOUT:     inst50000017:    {kind: FunctionDecl, arg0: function50000001, arg1: inst_block_empty, type: type(inst50000018)}
 // CHECK:STDOUT:     inst50000018:    {kind: FunctionType, arg0: function50000001, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000019:    {kind: StructValue, arg0: inst_block_empty, type: type(inst50000018)}
-// CHECK:STDOUT:     inst5000001A:    {kind: NameRef, arg0: name1, arg1: inst50000016, type: type(inst50000018)}
+// CHECK:STDOUT:     inst5000001A:    {kind: NameRef, arg0: name00000001, arg1: inst50000016, type: type(inst50000018)}
 // CHECK:STDOUT:     inst5000001B:    {kind: Call, arg0: inst5000001A, arg1: inst_block_empty, type: type(inst50000013)}
 // CHECK:STDOUT:     inst5000001C:    {kind: Return}
 // CHECK:STDOUT:   constant_values:
@@ -161,13 +161,13 @@ fn B() {
 // CHECK:STDOUT:       1:               inst50000016
 // CHECK:STDOUT:       2:               inst50000017
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:     {}
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000004: {}
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst50000015
 // CHECK:STDOUT:       1:               inst5000001A
 // CHECK:STDOUT:       2:               inst5000001B
 // CHECK:STDOUT:       3:               inst5000001C
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst5000000F
 // CHECK:STDOUT:       2:               inst50000011

+ 25 - 25
toolchain/check/testdata/basics/raw_sem_ir/multifile_with_textual_ir.carbon

@@ -36,16 +36,16 @@ fn B() {
 // CHECK:STDOUT:   import_ir_insts: {}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: inst6000000F}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000000: inst6000000F}}
 // CHECK:STDOUT:   entity_names:    {}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function60000000: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
+// CHECK:STDOUT:     function60000000: {name: name00000000, parent_scope: name_scope00000000, call_params_id: inst_block_empty, body: [inst_block00000005]}
 // CHECK:STDOUT:   classes:         {}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -58,7 +58,7 @@ fn B() {
 // CHECK:STDOUT:     'type(inst60000011)':
 // CHECK:STDOUT:       value_repr:      {kind: none, type: type(inst60000011)}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst6000000F:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block_empty, type: type(inst60000010)}
 // CHECK:STDOUT:     inst60000010:    {kind: FunctionType, arg0: function60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000011:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
@@ -78,10 +78,10 @@ fn B() {
 // CHECK:STDOUT:       0:               inst6000000F
 // CHECK:STDOUT:     imports:         {}
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:     {}
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000004: {}
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst60000013
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst6000000F
 // CHECK:STDOUT: ...
@@ -110,25 +110,25 @@ fn B() {
 // CHECK:STDOUT:   import_irs:
 // CHECK:STDOUT:     'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
 // CHECK:STDOUT:     'import_ir(Cpp)':  {decl_id: inst<none>, is_export: false}
-// CHECK:STDOUT:     import_ir2:      {decl_id: inst5000000F, is_export: false}
+// CHECK:STDOUT:     import_ir00000002: {decl_id: inst5000000F, is_export: false}
 // CHECK:STDOUT:   import_ir_insts:
-// CHECK:STDOUT:     import_ir_inst0: {ir_id: import_ir2, inst_id: inst6000000F}
-// CHECK:STDOUT:     import_ir_inst1: {ir_id: import_ir2, inst_id: inst6000000F}
+// CHECK:STDOUT:     import_ir_inst00000000: {ir_id: import_ir00000002, inst_id: inst6000000F}
+// CHECK:STDOUT:     import_ir_inst00000001: {ir_id: import_ir00000002, inst_id: inst6000000F}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name1: inst50000010, name0: inst50000011}}
-// CHECK:STDOUT:     name_scope1:     {inst: inst50000010, parent_scope: name_scope0, has_error: false, extended_scopes: [], names: {name1: inst50000016}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000001: inst50000010, name00000000: inst50000011}}
+// CHECK:STDOUT:     name_scope00000001: {inst: inst50000010, parent_scope: name_scope00000000, has_error: false, extended_scopes: [], names: {name00000001: inst50000016}}
 // CHECK:STDOUT:   entity_names:
-// CHECK:STDOUT:     entity_name0:    {name: name1, parent_scope: name_scope1, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000000: {name: name00000001, parent_scope: name_scope00000001, index: -1, is_template: 0}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function50000000: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
-// CHECK:STDOUT:     function50000001: {name: name1, parent_scope: name_scope1}
+// CHECK:STDOUT:     function50000000: {name: name00000000, parent_scope: name_scope00000000, call_params_id: inst_block_empty, body: [inst_block00000005]}
+// CHECK:STDOUT:     function50000001: {name: name00000001, parent_scope: name_scope00000001}
 // CHECK:STDOUT:   classes:         {}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -141,19 +141,19 @@ fn B() {
 // CHECK:STDOUT:     'type(inst50000013)':
 // CHECK:STDOUT:       value_repr:      {kind: none, type: type(inst50000013)}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst5000000F:    {kind: ImportDecl, arg0: name1}
-// CHECK:STDOUT:     inst50000010:    {kind: Namespace, arg0: name_scope1, arg1: inst5000000F, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst5000000F:    {kind: ImportDecl, arg0: name00000001}
+// CHECK:STDOUT:     inst50000010:    {kind: Namespace, arg0: name_scope00000001, arg1: inst5000000F, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst50000011:    {kind: FunctionDecl, arg0: function50000000, arg1: inst_block_empty, type: type(inst50000012)}
 // CHECK:STDOUT:     inst50000012:    {kind: FunctionType, arg0: function50000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000013:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000014:    {kind: StructValue, arg0: inst_block_empty, type: type(inst50000012)}
-// CHECK:STDOUT:     inst50000015:    {kind: NameRef, arg0: name1, arg1: inst50000010, type: type(inst(NamespaceType))}
-// CHECK:STDOUT:     inst50000016:    {kind: ImportRefLoaded, arg0: import_ir_inst0, arg1: entity_name0, type: type(inst50000018)}
+// CHECK:STDOUT:     inst50000015:    {kind: NameRef, arg0: name00000001, arg1: inst50000010, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst50000016:    {kind: ImportRefLoaded, arg0: import_ir_inst00000000, arg1: entity_name00000000, type: type(inst50000018)}
 // CHECK:STDOUT:     inst50000017:    {kind: FunctionDecl, arg0: function50000001, arg1: inst_block_empty, type: type(inst50000018)}
 // CHECK:STDOUT:     inst50000018:    {kind: FunctionType, arg0: function50000001, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst50000019:    {kind: StructValue, arg0: inst_block_empty, type: type(inst50000018)}
-// CHECK:STDOUT:     inst5000001A:    {kind: NameRef, arg0: name1, arg1: inst50000016, type: type(inst50000018)}
+// CHECK:STDOUT:     inst5000001A:    {kind: NameRef, arg0: name00000001, arg1: inst50000016, type: type(inst50000018)}
 // CHECK:STDOUT:     inst5000001B:    {kind: Call, arg0: inst5000001A, arg1: inst_block_empty, type: type(inst50000013)}
 // CHECK:STDOUT:     inst5000001C:    {kind: Return}
 // CHECK:STDOUT:   constant_values:
@@ -180,13 +180,13 @@ fn B() {
 // CHECK:STDOUT:       1:               inst50000016
 // CHECK:STDOUT:       2:               inst50000017
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:     {}
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000004: {}
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst50000015
 // CHECK:STDOUT:       1:               inst5000001A
 // CHECK:STDOUT:       2:               inst5000001B
 // CHECK:STDOUT:       3:               inst5000001C
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst5000000F
 // CHECK:STDOUT:       2:               inst50000011

Разница между файлами не показана из-за своего большого размера
+ 566 - 566
toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon


+ 31 - 31
toolchain/check/testdata/basics/raw_sem_ir/one_file_with_textual_ir.carbon

@@ -26,17 +26,17 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:   import_ir_insts: {}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: inst60000025}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name00000000: inst60000025}}
 // CHECK:STDOUT:   entity_names:
-// CHECK:STDOUT:     entity_name0:    {name: name1, parent_scope: name_scope<none>, index: -1, is_template: 0}
+// CHECK:STDOUT:     entity_name00000000: {name: name00000001, parent_scope: name_scope<none>, index: -1, is_template: 0}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:
-// CHECK:STDOUT:     function60000000: {name: name0, parent_scope: name_scope0, call_params_id: inst_block9, return_slot_pattern: inst60000020, body: [inst_block12]}
+// CHECK:STDOUT:     function60000000: {name: name00000000, parent_scope: name_scope00000000, call_params_id: inst_block00000009, return_slot_pattern: inst60000020, body: [inst_block0000000C]}
 // CHECK:STDOUT:   classes:         {}
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -53,18 +53,18 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:     'type(inst60000026)':
 // CHECK:STDOUT:       value_repr:      {kind: none, type: type(inst6000000F)}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:     inst6000000F:    {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000010:    {kind: TupleLiteral, arg0: inst_block_empty, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000011:    {kind: Converted, arg0: inst60000010, arg1: inst6000000F, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000012:    {kind: BindName, arg0: entity_name0, arg1: inst60000021, type: type(inst6000000F)}
+// CHECK:STDOUT:     inst60000012:    {kind: BindName, arg0: entity_name00000000, arg1: inst60000021, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000013:    {kind: PatternType, arg0: inst6000000F, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000014:    {kind: BindingPattern, arg0: entity_name0, type: type(inst60000013)}
+// CHECK:STDOUT:     inst60000014:    {kind: BindingPattern, arg0: entity_name00000000, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000015:    {kind: ValueParamPattern, arg0: inst60000014, arg1: call_param0, type: type(inst60000013)}
 // CHECK:STDOUT:     inst60000016:    {kind: TupleLiteral, arg0: inst_block_empty, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000017:    {kind: TupleLiteral, arg0: inst_block_empty, type: type(inst6000000F)}
-// CHECK:STDOUT:     inst60000018:    {kind: TupleType, arg0: inst_block7, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000019:    {kind: TupleLiteral, arg0: inst_block6, type: type(inst60000018)}
+// CHECK:STDOUT:     inst60000018:    {kind: TupleType, arg0: inst_block00000007, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000019:    {kind: TupleLiteral, arg0: inst_block00000006, type: type(inst60000018)}
 // CHECK:STDOUT:     inst6000001A:    {kind: PointerType, arg0: inst60000018, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000001B:    {kind: Converted, arg0: inst60000016, arg1: inst6000000F, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000001C:    {kind: Converted, arg0: inst60000017, arg1: inst6000000F, type: type(TypeType)}
@@ -72,25 +72,25 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:     inst6000001E:    {kind: PatternType, arg0: inst60000018, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000001F:    {kind: ReturnSlotPattern, arg0: inst6000001D, type: type(inst6000001E)}
 // CHECK:STDOUT:     inst60000020:    {kind: OutParamPattern, arg0: inst6000001F, arg1: call_param1, type: type(inst6000001E)}
-// CHECK:STDOUT:     inst60000021:    {kind: ValueParam, arg0: call_param0, arg1: name1, type: type(inst6000000F)}
-// CHECK:STDOUT:     inst60000022:    {kind: SpliceBlock, arg0: inst_block4, arg1: inst60000011, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000021:    {kind: ValueParam, arg0: call_param0, arg1: name00000001, type: type(inst6000000F)}
+// CHECK:STDOUT:     inst60000022:    {kind: SpliceBlock, arg0: inst_block00000004, arg1: inst60000011, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000023:    {kind: OutParam, arg0: call_param1, arg1: name(ReturnSlot), type: type(inst60000018)}
 // CHECK:STDOUT:     inst60000024:    {kind: ReturnSlot, arg0: inst60000018, arg1: inst60000023, type: type(inst60000018)}
-// CHECK:STDOUT:     inst60000025:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block11, type: type(inst60000026)}
+// CHECK:STDOUT:     inst60000025:    {kind: FunctionDecl, arg0: function60000000, arg1: inst_block0000000B, type: type(inst60000026)}
 // CHECK:STDOUT:     inst60000026:    {kind: FunctionType, arg0: function60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000027:    {kind: StructValue, arg0: inst_block_empty, type: type(inst60000026)}
-// CHECK:STDOUT:     inst60000028:    {kind: NameRef, arg0: name1, arg1: inst60000012, type: type(inst6000000F)}
+// CHECK:STDOUT:     inst60000028:    {kind: NameRef, arg0: name00000001, arg1: inst60000012, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000029:    {kind: TupleLiteral, arg0: inst_block_empty, type: type(inst6000000F)}
-// CHECK:STDOUT:     inst6000002A:    {kind: TupleLiteral, arg0: inst_block13, type: type(inst60000018)}
+// CHECK:STDOUT:     inst6000002A:    {kind: TupleLiteral, arg0: inst_block0000000D, type: type(inst60000018)}
 // CHECK:STDOUT:     inst6000002B:    {kind: TupleAccess, arg0: inst60000024, arg1: element0, type: type(inst6000000F)}
-// CHECK:STDOUT:     inst6000002C:    {kind: TupleInit, arg0: inst_block14, arg1: inst6000002B, type: type(inst6000000F)}
+// CHECK:STDOUT:     inst6000002C:    {kind: TupleInit, arg0: inst_block0000000E, arg1: inst6000002B, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst6000002D:    {kind: TupleValue, arg0: inst_block_empty, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst6000002E:    {kind: Converted, arg0: inst60000028, arg1: inst6000002C, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst6000002F:    {kind: TupleAccess, arg0: inst60000024, arg1: element1, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000030:    {kind: TupleInit, arg0: inst_block_empty, arg1: inst6000002F, type: type(inst6000000F)}
 // CHECK:STDOUT:     inst60000031:    {kind: Converted, arg0: inst60000029, arg1: inst60000030, type: type(inst6000000F)}
-// CHECK:STDOUT:     inst60000032:    {kind: TupleInit, arg0: inst_block15, arg1: inst60000024, type: type(inst60000018)}
-// CHECK:STDOUT:     inst60000033:    {kind: TupleValue, arg0: inst_block16, type: type(inst60000018)}
+// CHECK:STDOUT:     inst60000032:    {kind: TupleInit, arg0: inst_block0000000F, arg1: inst60000024, type: type(inst60000018)}
+// CHECK:STDOUT:     inst60000033:    {kind: TupleValue, arg0: inst_block00000010, type: type(inst60000018)}
 // CHECK:STDOUT:     inst60000034:    {kind: Converted, arg0: inst6000002A, arg1: inst60000032, type: type(inst60000018)}
 // CHECK:STDOUT:     inst60000035:    {kind: ReturnExpr, arg0: inst60000034, arg1: inst60000024}
 // CHECK:STDOUT:   constant_values:
@@ -128,29 +128,29 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:       0:               inst60000025
 // CHECK:STDOUT:     imports:         {}
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:
+// CHECK:STDOUT:     inst_block00000004:
 // CHECK:STDOUT:       0:               inst60000010
 // CHECK:STDOUT:       1:               inst60000011
-// CHECK:STDOUT:     inst_block5:
+// CHECK:STDOUT:     inst_block00000005:
 // CHECK:STDOUT:       0:               inst60000015
-// CHECK:STDOUT:     inst_block6:
+// CHECK:STDOUT:     inst_block00000006:
 // CHECK:STDOUT:       0:               inst60000016
 // CHECK:STDOUT:       1:               inst60000017
-// CHECK:STDOUT:     inst_block7:
+// CHECK:STDOUT:     inst_block00000007:
 // CHECK:STDOUT:       0:               inst6000000F
 // CHECK:STDOUT:       1:               inst6000000F
-// CHECK:STDOUT:     inst_block8:
+// CHECK:STDOUT:     inst_block00000008:
 // CHECK:STDOUT:       0:               inst6000001B
 // CHECK:STDOUT:       1:               inst6000001C
-// CHECK:STDOUT:     inst_block9:
+// CHECK:STDOUT:     inst_block00000009:
 // CHECK:STDOUT:       0:               inst60000021
 // CHECK:STDOUT:       1:               inst60000023
-// CHECK:STDOUT:     inst_block10:
+// CHECK:STDOUT:     inst_block0000000A:
 // CHECK:STDOUT:       0:               inst60000014
 // CHECK:STDOUT:       1:               inst60000015
 // CHECK:STDOUT:       2:               inst6000001F
 // CHECK:STDOUT:       3:               inst60000020
-// CHECK:STDOUT:     inst_block11:
+// CHECK:STDOUT:     inst_block0000000B:
 // CHECK:STDOUT:       0:               inst60000016
 // CHECK:STDOUT:       1:               inst60000017
 // CHECK:STDOUT:       2:               inst60000019
@@ -162,7 +162,7 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:       8:               inst60000012
 // CHECK:STDOUT:       9:               inst60000023
 // CHECK:STDOUT:       10:              inst60000024
-// CHECK:STDOUT:     inst_block12:
+// CHECK:STDOUT:     inst_block0000000C:
 // CHECK:STDOUT:       0:               inst60000028
 // CHECK:STDOUT:       1:               inst60000029
 // CHECK:STDOUT:       2:               inst6000002A
@@ -175,17 +175,17 @@ fn Foo(n: ()) -> ((), ()) {
 // CHECK:STDOUT:       9:               inst60000032
 // CHECK:STDOUT:       10:              inst60000034
 // CHECK:STDOUT:       11:              inst60000035
-// CHECK:STDOUT:     inst_block13:
+// CHECK:STDOUT:     inst_block0000000D:
 // CHECK:STDOUT:       0:               inst60000028
 // CHECK:STDOUT:       1:               inst60000029
-// CHECK:STDOUT:     inst_block14:    {}
-// CHECK:STDOUT:     inst_block15:
+// CHECK:STDOUT:     inst_block0000000E: {}
+// CHECK:STDOUT:     inst_block0000000F:
 // CHECK:STDOUT:       0:               inst6000002E
 // CHECK:STDOUT:       1:               inst60000031
-// CHECK:STDOUT:     inst_block16:
+// CHECK:STDOUT:     inst_block00000010:
 // CHECK:STDOUT:       0:               inst6000002D
 // CHECK:STDOUT:       1:               inst6000002D
-// CHECK:STDOUT:     inst_block17:
+// CHECK:STDOUT:     inst_block00000011:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT:       1:               inst60000025
 // CHECK:STDOUT: ...

+ 12 - 12
toolchain/driver/testdata/dump_shared_values.carbon

@@ -24,19 +24,19 @@ var str2: str = "ab'\"c";
 // CHECK:STDOUT: shared_values:
 // CHECK:STDOUT:   ints:            {}
 // CHECK:STDOUT:   reals:
-// CHECK:STDOUT:     real0:           10*10^-1
-// CHECK:STDOUT:     real1:           8*10^7
-// CHECK:STDOUT:     real2:           8*10^8
+// CHECK:STDOUT:     real00000000:    10*10^-1
+// CHECK:STDOUT:     real00000001:    8*10^7
+// CHECK:STDOUT:     real00000002:    8*10^8
 // CHECK:STDOUT:   floats:          {}
 // CHECK:STDOUT:   identifiers:
-// CHECK:STDOUT:     identifier0:     int1
-// CHECK:STDOUT:     identifier1:     int2
-// CHECK:STDOUT:     identifier2:     real1
-// CHECK:STDOUT:     identifier3:     real2
-// CHECK:STDOUT:     identifier4:     real3
-// CHECK:STDOUT:     identifier5:     str1
-// CHECK:STDOUT:     identifier6:     str2
+// CHECK:STDOUT:     identifier00000000: int1
+// CHECK:STDOUT:     identifier00000001: int2
+// CHECK:STDOUT:     identifier00000002: real1
+// CHECK:STDOUT:     identifier00000003: real2
+// CHECK:STDOUT:     identifier00000004: real3
+// CHECK:STDOUT:     identifier00000005: str1
+// CHECK:STDOUT:     identifier00000006: str2
 // CHECK:STDOUT:   strings:
-// CHECK:STDOUT:     string0:         abc
-// CHECK:STDOUT:     string1:         ab'"c
+// CHECK:STDOUT:     string00000000:  abc
+// CHECK:STDOUT:     string00000001:  ab'"c
 // CHECK:STDOUT: ...

+ 4 - 4
toolchain/driver/testdata/stdin.carbon

@@ -32,7 +32,7 @@
 // CHECK:STDOUT:   import_ir_insts: {}
 // CHECK:STDOUT:   clang_decls:     {}
 // CHECK:STDOUT:   name_scopes:
-// CHECK:STDOUT:     name_scope0:     {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
+// CHECK:STDOUT:     name_scope00000000: {inst: inst0000000E, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
 // CHECK:STDOUT:   entity_names:    {}
 // CHECK:STDOUT:   cpp_global_vars: {}
 // CHECK:STDOUT:   functions:       {}
@@ -40,7 +40,7 @@
 // CHECK:STDOUT:   generics:        {}
 // CHECK:STDOUT:   specifics:       {}
 // CHECK:STDOUT:   struct_type_fields:
-// CHECK:STDOUT:     struct_type_fields0: {}
+// CHECK:STDOUT:     struct_type_fields00000000: {}
 // CHECK:STDOUT:   types:
 // CHECK:STDOUT:     'type(TypeType)':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(TypeType)}
@@ -49,7 +49,7 @@
 // CHECK:STDOUT:     'type(inst(NamespaceType))':
 // CHECK:STDOUT:       value_repr:      {kind: copy, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:   insts:
-// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
+// CHECK:STDOUT:     inst0000000E:    {kind: Namespace, arg0: name_scope00000000, arg1: inst<none>, type: type(inst(NamespaceType))}
 // CHECK:STDOUT:   constant_values:
 // CHECK:STDOUT:     values:
 // CHECK:STDOUT:       inst0000000E:    concrete_constant(inst0000000E)
@@ -59,7 +59,7 @@
 // CHECK:STDOUT:     exports:         {}
 // CHECK:STDOUT:     imports:         {}
 // CHECK:STDOUT:     global_init:     {}
-// CHECK:STDOUT:     inst_block4:
+// CHECK:STDOUT:     inst_block00000004:
 // CHECK:STDOUT:       0:               inst0000000E
 // CHECK:STDOUT: ...
 // CHECK:STDOUT: --- -

+ 1 - 29
toolchain/sem_ir/ids.cpp

@@ -16,7 +16,7 @@ auto InstId::Print(llvm::raw_ostream& out) const -> void {
   if (IsSingletonInstId(*this)) {
     out << Label << "(" << SingletonInstKinds[index] << ")";
   } else {
-    IdBase::PrintHex(out);
+    IdBase::Print(out);
   }
 }
 
@@ -42,14 +42,6 @@ auto ConstantId::Print(llvm::raw_ostream& out, bool disambiguate) const
   }
 }
 
-auto CppOverloadSetId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
-auto FunctionId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
 auto CheckIRId::Print(llvm::raw_ostream& out) const -> void {
   if (*this == Cpp) {
     out << Label << "(Cpp)";
@@ -58,26 +50,6 @@ auto CheckIRId::Print(llvm::raw_ostream& out) const -> void {
   }
 }
 
-auto ClassId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
-auto VtableId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
-auto AssociatedConstantId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
-auto ImplId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
-auto SpecificInterfaceId::Print(llvm::raw_ostream& out) const -> void {
-  IdBase::PrintHex(out);
-}
-
 auto GenericInstIndex::Print(llvm::raw_ostream& out) const -> void {
   out << "generic_inst";
   if (has_value()) {

+ 0 - 14
toolchain/sem_ir/ids.h

@@ -283,8 +283,6 @@ struct CppOverloadSetId : public IdBase<CppOverloadSetId> {
   static constexpr llvm::StringLiteral Label = "cpp_overload_set";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of a function.
@@ -292,8 +290,6 @@ struct FunctionId : public IdBase<FunctionId> {
   static constexpr llvm::StringLiteral Label = "function";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of an IR within the set of all IRs being evaluated in the current
@@ -315,8 +311,6 @@ struct ClassId : public IdBase<ClassId> {
   static constexpr llvm::StringLiteral Label = "class";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of a `Vtable`.
@@ -324,8 +318,6 @@ struct VtableId : public IdBase<VtableId> {
   static constexpr llvm::StringLiteral Label = "vtable";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of an `Interface`.
@@ -340,8 +332,6 @@ struct AssociatedConstantId : public IdBase<AssociatedConstantId> {
   static constexpr llvm::StringLiteral Label = "assoc_const";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of a `FacetTypeInfo`.
@@ -365,8 +355,6 @@ struct ImplId : public IdBase<ImplId> {
   static constexpr llvm::StringLiteral Label = "impl";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The ID of a `Generic`.
@@ -393,8 +381,6 @@ struct SpecificInterfaceId : public IdBase<SpecificInterfaceId> {
   static constexpr llvm::StringLiteral Label = "specific_interface";
 
   using IdBase::IdBase;
-
-  auto Print(llvm::raw_ostream& out) const -> void;
 };
 
 // The index of an instruction that depends on generic parameters within a

+ 13 - 11
toolchain/sem_ir/yaml_test.cpp

@@ -91,17 +91,19 @@ TEST(SemIRTest, Yaml) {
                Pair("values",
                     Yaml::Mapping(AllOf(Each(Pair(inst_id, constant_id))))),
                Pair("symbolic_constants", Yaml::Mapping(SizeIs(0)))))),
-      Pair("inst_blocks",
-           Yaml::Mapping(ElementsAre(
-               Pair("inst_block_empty", Yaml::Mapping(IsEmpty())),
-               Pair("exports", Yaml::Mapping(Each(Pair(_, inst_id)))),
-               Pair("imports", Yaml::Mapping(IsEmpty())),
-               Pair("global_init", Yaml::Mapping(IsEmpty())),
-               Pair("inst_block4", Yaml::Mapping(Each(Pair(_, inst_id)))),
-               Pair("inst_block5", Yaml::Mapping(Each(Pair(_, inst_id)))),
-               Pair("inst_block6", Yaml::Mapping(Each(Pair(_, inst_id)))),
-               Pair("inst_block7", Yaml::Mapping(Each(Pair(_, inst_id)))),
-               Pair("inst_block8", Yaml::Mapping(Each(Pair(_, inst_id)))))))));
+      Pair(
+          "inst_blocks",
+          Yaml::Mapping(ElementsAre(
+              Pair("inst_block_empty", Yaml::Mapping(IsEmpty())),
+              Pair("exports", Yaml::Mapping(Each(Pair(_, inst_id)))),
+              Pair("imports", Yaml::Mapping(IsEmpty())),
+              Pair("global_init", Yaml::Mapping(IsEmpty())),
+              Pair("inst_block00000004", Yaml::Mapping(Each(Pair(_, inst_id)))),
+              Pair("inst_block00000005", Yaml::Mapping(Each(Pair(_, inst_id)))),
+              Pair("inst_block00000006", Yaml::Mapping(Each(Pair(_, inst_id)))),
+              Pair("inst_block00000007", Yaml::Mapping(Each(Pair(_, inst_id)))),
+              Pair("inst_block00000008",
+                   Yaml::Mapping(Each(Pair(_, inst_id)))))))));
 
   auto root = Yaml::Sequence(ElementsAre(Yaml::Mapping(
       ElementsAre(Pair("filename", "test.carbon"), Pair("sem_ir", file)))));

Некоторые файлы не были показаны из-за большого количества измененных файлов