Name empty tuples distinctly in SemIR. (#4503)

Building on #4502, give empty tuple values a distinct name, and also
explicitly name tuple types (previously values but not types were
named).
This commit is contained in:
Jon Ross-Perkins
2024-11-08 17:14:52 +00:00
committed by GitHub
parent bbeb66b5fe
commit 10e256a241
585 changed files with 14742 additions and 14732 deletions
+19 -19
View File
@@ -17,18 +17,18 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
// CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %F.type: type = fn_type @F [template]
// CHECK:STDOUT: %F: %F.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type %.3 [template]
// CHECK:STDOUT: %.5: i32 = int_value 0 [template]
// CHECK:STDOUT: %.6: type = tuple_type (i32) [template]
// CHECK:STDOUT: %array: %.3 = tuple_value (%.5) [template]
// CHECK:STDOUT: %.1: i32 = int_value 1 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// CHECK:STDOUT: %.3: type = ptr_type %.2 [template]
// CHECK:STDOUT: %.4: i32 = int_value 0 [template]
// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template]
// CHECK:STDOUT: %array: %.2 = tuple_value (%.4) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -88,32 +88,32 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: fn @F(%b.param_patt: bool, %n.param_patt: i32, %m.param_patt: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc12_16: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc12_16: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32]
// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12, %.loc12_11.1 [template = i32]
// CHECK:STDOUT: %.loc12_17: type = array_type %.loc12_16, i32 [template = constants.%.3]
// CHECK:STDOUT: %x.var: ref %.3 = var x
// CHECK:STDOUT: %x: ref %.3 = bind_name x, %x.var
// CHECK:STDOUT: %.loc12_22: i32 = int_value 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_24.1: %.6 = tuple_literal (%.loc12_22)
// CHECK:STDOUT: %.loc12_24.2: i32 = int_value 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_17: type = array_type %.loc12_16, i32 [template = constants.%.2]
// CHECK:STDOUT: %x.var: ref %.2 = var x
// CHECK:STDOUT: %x: ref %.2 = bind_name x, %x.var
// CHECK:STDOUT: %.loc12_22: i32 = int_value 0 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_24.1: %tuple.type = tuple_literal (%.loc12_22)
// CHECK:STDOUT: %.loc12_24.2: i32 = int_value 0 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_24.3: ref i32 = array_index %x.var, %.loc12_24.2
// CHECK:STDOUT: %.loc12_24.4: init i32 = initialize_from %.loc12_22 to %.loc12_24.3 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_24.5: init %.3 = array_init (%.loc12_24.4) to %x.var [template = constants.%array]
// CHECK:STDOUT: %.loc12_25: init %.3 = converted %.loc12_24.1, %.loc12_24.5 [template = constants.%array]
// CHECK:STDOUT: %.loc12_24.4: init i32 = initialize_from %.loc12_22 to %.loc12_24.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_24.5: init %.2 = array_init (%.loc12_24.4) to %x.var [template = constants.%array]
// CHECK:STDOUT: %.loc12_25: init %.2 = converted %.loc12_24.1, %.loc12_24.5 [template = constants.%array]
// CHECK:STDOUT: assign %x.var, %.loc12_25
// CHECK:STDOUT: %b.ref: bool = name_ref b, %b
// CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else
// CHECK:STDOUT:
// CHECK:STDOUT: !if.expr.then:
// CHECK:STDOUT: %x.ref.loc13_20: ref %.3 = name_ref x, %x
// CHECK:STDOUT: %x.ref.loc13_20: ref %.2 = name_ref x, %x
// CHECK:STDOUT: %m.ref: i32 = name_ref m, %m
// CHECK:STDOUT: %.loc13_23.1: ref i32 = array_index %x.ref.loc13_20, %m.ref
// CHECK:STDOUT: %.loc13_23.2: i32 = bind_value %.loc13_23.1
// CHECK:STDOUT: br !if.expr.result(%.loc13_23.2)
// CHECK:STDOUT:
// CHECK:STDOUT: !if.expr.else:
// CHECK:STDOUT: %x.ref.loc13_30: ref %.3 = name_ref x, %x
// CHECK:STDOUT: %x.ref.loc13_30: ref %.2 = name_ref x, %x
// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n
// CHECK:STDOUT: %.loc13_33.1: ref i32 = array_index %x.ref.loc13_30, %n.ref
// CHECK:STDOUT: %.loc13_33.2: i32 = bind_value %.loc13_33.1