From 9b959440200e5c552ddb4c612798c7fb2873d504 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Wed, 29 Oct 2025 15:07:33 -0700 Subject: [PATCH] Mask unexpected inst ids (#6295) Just more anti-churn work. --- .../if_expr/fail_not_in_function.carbon | 4 ++-- .../check/testdata/interface/require.carbon | 18 +++++++++--------- .../testdata/let/compile_time_bindings.carbon | 4 ++-- .../testdata/let/fail_missing_value.carbon | 2 +- .../builtin/fail_and_or_not_in_function.carbon | 16 ++++++++-------- toolchain/testing/file_test.cpp | 3 ++- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 3222a4e0b6b1..a4f053673aed 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -130,7 +130,7 @@ fn F() { // CHECK:STDOUT: %true: bool = bool_literal true [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(.inst68000014.loc4_14: type) { +// CHECK:STDOUT: generic class @C(.inst{{[0-9A-F]+}}.loc4_14: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -145,7 +145,7 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst68000019.loc4_24 [concrete = constants.%C.generic] +// CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst{{[0-9A-F]+}}.loc4_24 [concrete = constants.%C.generic] // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] // CHECK:STDOUT: if %true br !if.expr.then else br !if.expr.else // CHECK:STDOUT: complete_type_witness = invalid diff --git a/toolchain/check/testdata/interface/require.carbon b/toolchain/check/testdata/interface/require.carbon index 7afc4cd66f83..51b89bf74b7c 100644 --- a/toolchain/check/testdata/interface/require.carbon +++ b/toolchain/check/testdata/interface/require.carbon @@ -185,7 +185,7 @@ fn F(T:! Z) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst6000001D +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: @@ -196,7 +196,7 @@ fn F(T:! Z) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst5000001D +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: @@ -207,7 +207,7 @@ fn F(T:! Z) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst68000023 +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: @@ -218,7 +218,7 @@ fn F(T:! Z) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst5800001A +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: @@ -228,12 +228,12 @@ fn F(T:! Z) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Z(.inst78000017.loc6_13: type) { +// CHECK:STDOUT: generic interface @Z(.inst{{[0-9A-F]+}}.loc6_13: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst78000021 +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -248,12 +248,12 @@ fn F(T:! Z) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Z(.inst44000017.loc6_13: type) { +// CHECK:STDOUT: generic interface @Z(.inst{{[0-9A-F]+}}.loc6_13: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst44000021 +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -269,7 +269,7 @@ fn F(T:! Z) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = .inst6400001D +// CHECK:STDOUT: .Self = .inst{{[0-9A-F]+}} // CHECK:STDOUT: witness = invalid // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/compile_time_bindings.carbon b/toolchain/check/testdata/let/compile_time_bindings.carbon index 04bedadbd2e1..abca165e5fa3 100644 --- a/toolchain/check/testdata/let/compile_time_bindings.carbon +++ b/toolchain/check/testdata/let/compile_time_bindings.carbon @@ -632,12 +632,12 @@ impl i32 as Empty { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .F = %C.F.decl -// CHECK:STDOUT: .x = .inst48000023.loc14_7 +// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc14_7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C.F() -> %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst48000023.loc14_7 +// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst{{[0-9A-F]+}}.loc14_7 // CHECK:STDOUT: %.loc5_25: init %empty_tuple.type = tuple_init () to %return [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_26: init %empty_tuple.type = converted %x.ref, %.loc5_25 [concrete = constants.%empty_tuple] // CHECK:STDOUT: return %.loc5_26 to %return diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index b8097902951d..0404e9ce28c6 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -50,7 +50,7 @@ fn F() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .n = .inst6000002C.loc19_5 +// CHECK:STDOUT: .n = .inst{{[0-9A-F]+}}.loc19_5 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index 0c9bbd21c135..d8c103f257f3 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -96,7 +96,7 @@ fn F() { // CHECK:STDOUT: %f64: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Copy.impl_witness.de9: = impl_witness .inst60000155 [concrete] +// CHECK:STDOUT: %Copy.impl_witness.de9: = impl_witness .inst{{[0-9A-F]+}} [concrete] // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value type, (%Copy.impl_witness.de9) [concrete] // CHECK:STDOUT: %.98f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] // CHECK:STDOUT: %type.as.Copy.impl.Op.type: type = fn_type @type.as.Copy.impl.Op [concrete] @@ -105,7 +105,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b.param: bool) -> type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %b.ref: bool = name_ref b, .inst6000001B.loc5_6 +// CHECK:STDOUT: %b.ref: bool = name_ref b, .inst{{[0-9A-F]+}}.loc5_6 // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -123,7 +123,7 @@ fn F() { // CHECK:STDOUT: %impl.elem0: %.98f = impl_witness_access constants.%Copy.impl_witness.de9, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc6, %impl.elem0 // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%.loc6) -// CHECK:STDOUT: return %type.as.Copy.impl.Op.call to .inst60000024.loc5_15 +// CHECK:STDOUT: return %type.as.Copy.impl.Op.call to .inst{{[0-9A-F]+}}.loc5_15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_and_val.carbon @@ -140,7 +140,7 @@ fn F() { // CHECK:STDOUT: %f64: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Copy.impl_witness.de9: = impl_witness .inst70000155 [concrete] +// CHECK:STDOUT: %Copy.impl_witness.de9: = impl_witness .inst{{[0-9A-F]+}} [concrete] // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value type, (%Copy.impl_witness.de9) [concrete] // CHECK:STDOUT: %.98f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] // CHECK:STDOUT: %type.as.Copy.impl.Op.type: type = fn_type @type.as.Copy.impl.Op [concrete] @@ -149,7 +149,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b.param: bool) -> type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %b.ref: bool = name_ref b, .inst7000001B.loc5_6 +// CHECK:STDOUT: %b.ref: bool = name_ref b, .inst{{[0-9A-F]+}}.loc5_6 // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -167,7 +167,7 @@ fn F() { // CHECK:STDOUT: %impl.elem0: %.98f = impl_witness_access constants.%Copy.impl_witness.de9, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc6, %impl.elem0 // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%.loc6) -// CHECK:STDOUT: return %type.as.Copy.impl.Op.call to .inst70000024.loc5_15 +// CHECK:STDOUT: return %type.as.Copy.impl.Op.call to .inst{{[0-9A-F]+}}.loc5_15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_or_val.carbon @@ -189,7 +189,7 @@ fn F() { // CHECK:STDOUT: %false: bool = bool_literal false [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(.inst6800001E.loc4_14: bool) { +// CHECK:STDOUT: generic class @C(.inst{{[0-9A-F]+}}.loc4_14: bool) { // CHECK:STDOUT: %B: bool = symbolic_binding B, 0 [symbolic = %B (constants.%B.931)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -204,7 +204,7 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst68000024.loc4_24 [concrete = constants.%C.generic] +// CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst{{[0-9A-F]+}}.loc4_24 [concrete = constants.%C.generic] // CHECK:STDOUT: %true.loc12_20: bool = bool_literal true [concrete = constants.%true] // CHECK:STDOUT: %.loc12: bool = not %true.loc12_20 [concrete = constants.%false] // CHECK:STDOUT: %true.loc12_25: bool = bool_literal true [concrete = constants.%true] diff --git a/toolchain/testing/file_test.cpp b/toolchain/testing/file_test.cpp index d38007775b2f..6f646ba6cff9 100644 --- a/toolchain/testing/file_test.cpp +++ b/toolchain/testing/file_test.cpp @@ -322,7 +322,8 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const // Reduce instruction numbering sensitivity; this is brittle for // instruction edits including adding/removing singleton instructions. - static RE2 inst_re(R"((import_ref [^,]*, inst)[0-9A-F]+)"); + static RE2 inst_re( + R"(((?:import_ref [^,]*, |\.)inst)[0-9A-F]+)"); RE2::Replace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})"); // Reduce location sensitivity in imports referring to `Core`; this is