Move instruction names for struct and tuple values from lower to InstNamer. (#3918)

Change the names for emitted globals for constants with storage to
include both the name of the constant and the name of the use.

This causes the instructions to also be named in SemIR and in LLVM IR
constants.
This commit is contained in:
Richard Smith
2024-04-26 23:47:08 +00:00
committed by GitHub
parent 79c0b65288
commit 008d41d7f3
148 changed files with 1297 additions and 1271 deletions
@@ -18,10 +18,10 @@ fn Main() {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.3: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.4: (i32,) = tuple_value (%.3) [template]
// CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 6 [template]
// CHECK:STDOUT: %.7: type = tuple_type () [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template]
// CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.5: i32 = int_literal 6 [template]
// CHECK:STDOUT: %.6: type = tuple_type () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -53,14 +53,14 @@ fn Main() {
// CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var
// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.3]
// CHECK:STDOUT: %.loc10_22.1: (i32,) = tuple_literal (%.loc10_20)
// CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var [template = constants.%.4]
// CHECK:STDOUT: %.loc10_23: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 [template = constants.%.4]
// CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var [template = constants.%tuple]
// CHECK:STDOUT: %.loc10_23: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 [template = constants.%tuple]
// CHECK:STDOUT: assign %x.var, %.loc10_23
// CHECK:STDOUT: %Foo.ref: <function> = name_ref Foo, file.%Foo [template = file.%Foo]
// CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x
// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9
// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.6]
// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1
// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13)
// CHECK:STDOUT: return
@@ -16,7 +16,7 @@ fn Main() {
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %.2: () = tuple_value () [template]
// CHECK:STDOUT: %tuple: () = tuple_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -37,9 +37,9 @@ fn Main() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A() -> () {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_24.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc7_24.2: () = tuple_value () [template = constants.%.2]
// CHECK:STDOUT: %.loc7_25: () = converted %.loc7_24.1, %.loc7_24.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_24: () = tuple_literal ()
// CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple]
// CHECK:STDOUT: %.loc7_25: () = converted %.loc7_24, %tuple [template = constants.%tuple]
// CHECK:STDOUT: return %.loc7_25
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -17,7 +17,7 @@ fn Main() {
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %.3: {} = struct_value () [template]
// CHECK:STDOUT: %struct: {} = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -46,9 +46,9 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Echo.ref: <function> = name_ref Echo, file.%Echo [template = file.%Echo]
// CHECK:STDOUT: %.loc12_9.1: {} = struct_literal ()
// CHECK:STDOUT: %.loc12_9.2: {} = struct_value () [template = constants.%.3]
// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.3]
// CHECK:STDOUT: %.loc12_9: {} = struct_literal ()
// CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct]
// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9, %struct [template = constants.%struct]
// CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc12_7)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -16,7 +16,7 @@ fn Main() {
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %.2: () = tuple_value () [template]
// CHECK:STDOUT: %tuple: () = tuple_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -45,9 +45,9 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Echo.ref: <function> = name_ref Echo, file.%Echo [template = file.%Echo]
// CHECK:STDOUT: %.loc12_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: () = tuple_value () [template = constants.%.2]
// CHECK:STDOUT: %.loc12_7: () = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc12_9: () = tuple_literal ()
// CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple]
// CHECK:STDOUT: %.loc12_7: () = converted %.loc12_9, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %Echo.call: init () = call %Echo.ref(%.loc12_7)
// CHECK:STDOUT: return
// CHECK:STDOUT: }