mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:11:12 +01:00
Deduplicate and canonicalize all constants. (#3611)
Rather than producing multiple constants with the same value, fold all instances of a given constant to the same constant instruction. A future PR will use this to replace the current type canonicalization system.
This commit is contained in:
+10
-11
@@ -16,12 +16,11 @@ var b: [i32; 3] = a;
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.7: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.8: type = array_type %.7, i32 [template]
|
||||
// CHECK:STDOUT: %.9: type = ptr_type [i32; 3] [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.12: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.7: type = array_type %.6, i32 [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type [i32; 3] [template]
|
||||
// CHECK:STDOUT: %.9: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -43,24 +42,24 @@ var b: [i32; 3] = a;
|
||||
// CHECK:STDOUT: %.loc7_34.8: init (i32, i32, i32) = tuple_init (%.loc7_34.3, %.loc7_34.5, %.loc7_34.7) to %a.var
|
||||
// CHECK:STDOUT: %.loc7_34.9: init (i32, i32, i32) = converted %.loc7_34.1, %.loc7_34.8
|
||||
// CHECK:STDOUT: assign %a.var, %.loc7_34.9
|
||||
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %b.var: ref [i32; 3] = var b
|
||||
// CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var
|
||||
// CHECK:STDOUT: %a.ref: ref (i32, i32, i32) = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc8_19.1: ref i32 = tuple_access %a.ref, element0
|
||||
// CHECK:STDOUT: %.loc8_19.2: i32 = bind_value %.loc8_19.1
|
||||
// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc8_19.4: ref i32 = array_index %b.var, %.loc8_19.3
|
||||
// CHECK:STDOUT: %.loc8_19.5: init i32 = initialize_from %.loc8_19.2 to %.loc8_19.4
|
||||
// CHECK:STDOUT: %.loc8_19.6: ref i32 = tuple_access %a.ref, element1
|
||||
// CHECK:STDOUT: %.loc8_19.7: i32 = bind_value %.loc8_19.6
|
||||
// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc8_19.9: ref i32 = array_index %b.var, %.loc8_19.8
|
||||
// CHECK:STDOUT: %.loc8_19.10: init i32 = initialize_from %.loc8_19.7 to %.loc8_19.9
|
||||
// CHECK:STDOUT: %.loc8_19.11: ref i32 = tuple_access %a.ref, element2
|
||||
// CHECK:STDOUT: %.loc8_19.12: i32 = bind_value %.loc8_19.11
|
||||
// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc8_19.14: ref i32 = array_index %b.var, %.loc8_19.13
|
||||
// CHECK:STDOUT: %.loc8_19.15: init i32 = initialize_from %.loc8_19.12 to %.loc8_19.14
|
||||
// CHECK:STDOUT: %.loc8_19.16: init [i32; 3] = array_init (%.loc8_19.5, %.loc8_19.10, %.loc8_19.15) to %b.var
|
||||
|
||||
+33
-37
@@ -14,27 +14,23 @@ var c: [(); 5] = ((), (), (), (), (),);
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.5: type = tuple_type (i32) [template]
|
||||
// CHECK:STDOUT: %.6: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.7: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.8: type = array_type %.7, f64 [template]
|
||||
// CHECK:STDOUT: %.9: type = ptr_type [f64; 2] [template]
|
||||
// CHECK:STDOUT: %.10: f64 = real_literal 111e-1 [template]
|
||||
// CHECK:STDOUT: %.11: f64 = real_literal 22e-1 [template]
|
||||
// CHECK:STDOUT: %.12: type = tuple_type (f64, f64) [template]
|
||||
// CHECK:STDOUT: %.13: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.15: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %.16: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.17: type = array_type %.16, () [template]
|
||||
// CHECK:STDOUT: %.18: type = ptr_type [(); 5] [template]
|
||||
// CHECK:STDOUT: %.19: type = tuple_type ((), (), (), (), ()) [template]
|
||||
// CHECK:STDOUT: %.20: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.21: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.22: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.23: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.24: i32 = int_literal 4 [template]
|
||||
// CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.7: type = array_type %.6, f64 [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type [f64; 2] [template]
|
||||
// CHECK:STDOUT: %.9: f64 = real_literal 111e-1 [template]
|
||||
// CHECK:STDOUT: %.10: f64 = real_literal 22e-1 [template]
|
||||
// CHECK:STDOUT: %.11: type = tuple_type (f64, f64) [template]
|
||||
// CHECK:STDOUT: %.12: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.13: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.15: type = array_type %.14, () [template]
|
||||
// CHECK:STDOUT: %.16: type = ptr_type [(); 5] [template]
|
||||
// CHECK:STDOUT: %.17: type = tuple_type ((), (), (), (), ()) [template]
|
||||
// CHECK:STDOUT: %.18: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.19: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.20: i32 = int_literal 4 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -43,34 +39,34 @@ var c: [(); 5] = ((), (), (), (), (),);
|
||||
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
|
||||
// CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var
|
||||
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_22.1: (i32,) = tuple_literal (%.loc7_20)
|
||||
// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc7_22.3: ref i32 = array_index %a.var, %.loc7_22.2
|
||||
// CHECK:STDOUT: %.loc7_22.4: init i32 = initialize_from %.loc7_20 to %.loc7_22.3
|
||||
// CHECK:STDOUT: %.loc7_22.5: init [i32; 1] = array_init (%.loc7_22.4) to %a.var
|
||||
// CHECK:STDOUT: %.loc7_22.6: init [i32; 1] = converted %.loc7_22.1, %.loc7_22.5
|
||||
// CHECK:STDOUT: assign %a.var, %.loc7_22.6
|
||||
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %b.var: ref [f64; 2] = var b
|
||||
// CHECK:STDOUT: %b: ref [f64; 2] = bind_name b, %b.var
|
||||
// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc8_30.1: (f64, f64) = tuple_literal (%.loc8_20, %.loc8_26)
|
||||
// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.13]
|
||||
// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc8_30.3: ref f64 = array_index %b.var, %.loc8_30.2
|
||||
// CHECK:STDOUT: %.loc8_30.4: init f64 = initialize_from %.loc8_20 to %.loc8_30.3
|
||||
// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc8_30.6: ref f64 = array_index %b.var, %.loc8_30.5
|
||||
// CHECK:STDOUT: %.loc8_30.7: init f64 = initialize_from %.loc8_26 to %.loc8_30.6
|
||||
// CHECK:STDOUT: %.loc8_30.8: init [f64; 2] = array_init (%.loc8_30.4, %.loc8_30.7) to %b.var
|
||||
// CHECK:STDOUT: %.loc8_30.9: init [f64; 2] = converted %.loc8_30.1, %.loc8_30.8
|
||||
// CHECK:STDOUT: assign %b.var, %.loc8_30.9
|
||||
// CHECK:STDOUT: %.loc9_10.1: () = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.15 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.17]
|
||||
// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.13 [template = constants.%.13]
|
||||
// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.15]
|
||||
// CHECK:STDOUT: %c.var: ref [(); 5] = var c
|
||||
// CHECK:STDOUT: %c: ref [(); 5] = bind_name c, %c.var
|
||||
// CHECK:STDOUT: %.loc9_20.1: () = tuple_literal ()
|
||||
@@ -79,23 +75,23 @@ var c: [(); 5] = ((), (), (), (), (),);
|
||||
// CHECK:STDOUT: %.loc9_32.1: () = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc9_36.1: () = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc9_38.1: ((), (), (), (), ()) = tuple_literal (%.loc9_20.1, %.loc9_24.1, %.loc9_28.1, %.loc9_32.1, %.loc9_36.1)
|
||||
// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc9_38.3: ref () = array_index %c.var, %.loc9_38.2
|
||||
// CHECK:STDOUT: %.loc9_20.2: init () = tuple_init () to %.loc9_38.3
|
||||
// CHECK:STDOUT: %.loc9_20.3: init () = converted %.loc9_20.1, %.loc9_20.2
|
||||
// CHECK:STDOUT: %.loc9_38.4: i32 = int_literal 1 [template = constants.%.21]
|
||||
// CHECK:STDOUT: %.loc9_38.4: i32 = int_literal 1 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc9_38.5: ref () = array_index %c.var, %.loc9_38.4
|
||||
// CHECK:STDOUT: %.loc9_24.2: init () = tuple_init () to %.loc9_38.5
|
||||
// CHECK:STDOUT: %.loc9_24.3: init () = converted %.loc9_24.1, %.loc9_24.2
|
||||
// CHECK:STDOUT: %.loc9_38.6: i32 = int_literal 2 [template = constants.%.22]
|
||||
// CHECK:STDOUT: %.loc9_38.6: i32 = int_literal 2 [template = constants.%.18]
|
||||
// CHECK:STDOUT: %.loc9_38.7: ref () = array_index %c.var, %.loc9_38.6
|
||||
// CHECK:STDOUT: %.loc9_28.2: init () = tuple_init () to %.loc9_38.7
|
||||
// CHECK:STDOUT: %.loc9_28.3: init () = converted %.loc9_28.1, %.loc9_28.2
|
||||
// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 3 [template = constants.%.23]
|
||||
// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 3 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc9_38.9: ref () = array_index %c.var, %.loc9_38.8
|
||||
// CHECK:STDOUT: %.loc9_32.2: init () = tuple_init () to %.loc9_38.9
|
||||
// CHECK:STDOUT: %.loc9_32.3: init () = converted %.loc9_32.1, %.loc9_32.2
|
||||
// CHECK:STDOUT: %.loc9_38.10: i32 = int_literal 4 [template = constants.%.24]
|
||||
// CHECK:STDOUT: %.loc9_38.10: i32 = int_literal 4 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc9_38.11: ref () = array_index %c.var, %.loc9_38.10
|
||||
// CHECK:STDOUT: %.loc9_36.2: init () = tuple_init () to %.loc9_38.11
|
||||
// CHECK:STDOUT: %.loc9_36.3: init () = converted %.loc9_36.1, %.loc9_36.2
|
||||
|
||||
@@ -22,27 +22,29 @@ var p: Incomplete* = &a[0];
|
||||
// CHECK:STDOUT: --- fail_incomplete_element.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.2: type = array_type %.1, Incomplete [template]
|
||||
// CHECK:STDOUT: %.3: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type <error> [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type Incomplete [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.5: type = ptr_type <error> [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace package, {.Incomplete = %Incomplete.decl, .a = %a, .p = %p} [template]
|
||||
// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, ()
|
||||
// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [template = %Incomplete]
|
||||
// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete]
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [template = constants.%Incomplete]
|
||||
// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref <error> = var a
|
||||
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete [template = %Incomplete]
|
||||
// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template]
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete [template = constants.%Incomplete]
|
||||
// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template = constants.%.3]
|
||||
// CHECK:STDOUT: %p.var: ref Incomplete* = var p
|
||||
// CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
|
||||
// CHECK:STDOUT: %a.ref: ref <error> = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc20_22: <error>* = addr_of <error>
|
||||
// CHECK:STDOUT: assign %p.var, <error>
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+4
-5
@@ -13,16 +13,15 @@ var a: [1; 1];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.3: type = array_type %.2, <error> [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type [<error>; 1] [template]
|
||||
// CHECK:STDOUT: %.2: type = array_type %.1, <error> [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type [<error>; 1] [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace package, {.a = %a} [template]
|
||||
// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, <error> [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, <error> [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [<error>; 1] = var a
|
||||
// CHECK:STDOUT: %a: ref [<error>; 1] = bind_name a, %a.var
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+6
-7
@@ -15,10 +15,9 @@ var a: [i32; 1] = (1, 2, 3);
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -27,9 +26,9 @@ var a: [i32; 1] = (1, 2, 3);
|
||||
// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
|
||||
// CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var
|
||||
// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc10_27: (i32, i32, i32) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_26)
|
||||
// CHECK:STDOUT: assign %a.var, <error>
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+14
-23
@@ -42,19 +42,10 @@ var d: [i32; 3] = t2;
|
||||
// CHECK:STDOUT: %.11: type = tuple_type (type, type, type) [template]
|
||||
// CHECK:STDOUT: %.12: type = tuple_type (i32, String*, String*) [template]
|
||||
// CHECK:STDOUT: %.13: type = ptr_type (i32, String*, String*) [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.15: type = array_type %.14, i32 [template]
|
||||
// CHECK:STDOUT: %.16: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.17: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.18: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.19: type = array_type %.18, i32 [template]
|
||||
// CHECK:STDOUT: %.20: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.21: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.22: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.23: type = tuple_type (type, type) [template]
|
||||
// CHECK:STDOUT: %.24: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.25: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.26: type = array_type %.25, i32 [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.16: type = tuple_type (type, type) [template]
|
||||
// CHECK:STDOUT: %.17: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -75,32 +66,32 @@ var d: [i32; 3] = t2;
|
||||
// CHECK:STDOUT: %.loc12_29.2: type = converted %.loc12_29.1, constants.%.8 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %t1.var: ref (i32, String, String) = var t1
|
||||
// CHECK:STDOUT: %t1: ref (i32, String, String) = bind_name t1, %t1.var
|
||||
// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %b.var: ref [i32; 3] = var b
|
||||
// CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var
|
||||
// CHECK:STDOUT: %t1.ref: ref (i32, String, String) = name_ref t1, %t1
|
||||
// CHECK:STDOUT: %.loc16_19.1: ref i32 = tuple_access %t1.ref, element0
|
||||
// CHECK:STDOUT: %.loc16_19.2: i32 = bind_value %.loc16_19.1
|
||||
// CHECK:STDOUT: %.loc16_19.3: i32 = int_literal 0 [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc16_19.3: i32 = int_literal 0 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc16_19.4: ref i32 = array_index %b.var, %.loc16_19.3
|
||||
// CHECK:STDOUT: %.loc16_19.5: init i32 = initialize_from %.loc16_19.2 to %.loc16_19.4
|
||||
// CHECK:STDOUT: %.loc16_19.6: ref String = tuple_access %t1.ref, element1
|
||||
// CHECK:STDOUT: assign %b.var, <error>
|
||||
// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3 [template = constants.%.18]
|
||||
// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %c.var: ref [i32; 3] = var c
|
||||
// CHECK:STDOUT: %c: ref [i32; 3] = bind_name c, %c.var
|
||||
// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2 [template = constants.%.21]
|
||||
// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc21_24: (i32, i32) = tuple_literal (%.loc21_20, %.loc21_23)
|
||||
// CHECK:STDOUT: assign %c.var, <error>
|
||||
// CHECK:STDOUT: %.loc23_18.1: (type, type) = tuple_literal (i32, i32)
|
||||
// CHECK:STDOUT: %.loc23_18.2: type = converted %.loc23_18.1, constants.%.22 [template = constants.%.22]
|
||||
// CHECK:STDOUT: %.loc23_18.2: type = converted %.loc23_18.1, constants.%.15 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %t2.var: ref (i32, i32) = var t2
|
||||
// CHECK:STDOUT: %t2: ref (i32, i32) = bind_name t2, %t2.var
|
||||
// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3 [template = constants.%.25]
|
||||
// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32 [template = constants.%.26]
|
||||
// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %d.var: ref [i32; 3] = var d
|
||||
// CHECK:STDOUT: %d: ref [i32; 3] = bind_name d, %d.var
|
||||
// CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, %t2
|
||||
|
||||
+8
-10
@@ -20,12 +20,10 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: %.7: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.8: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.9: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.9: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -49,17 +47,17 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %F.ref: <function> = name_ref F, file.%F [template = file.%F]
|
||||
// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19)
|
||||
// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage
|
||||
// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3
|
||||
// CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4
|
||||
// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %.loc12_20.7: ref i32 = array_index %.loc12_20.2, %.loc12_20.6
|
||||
// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7
|
||||
// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc12_20.10: ref i32 = array_index %.loc12_20.2, %.loc12_20.9
|
||||
// CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10
|
||||
// CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2
|
||||
|
||||
+20
-21
@@ -20,17 +20,16 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
// CHECK:STDOUT: %.9: i32 = int_literal 6 [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 7 [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 8 [template]
|
||||
// CHECK:STDOUT: %.12: i32 = int_literal 9 [template]
|
||||
// CHECK:STDOUT: %.13: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.15: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.16: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.17: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.18: i32 = int_literal 4 [template]
|
||||
// CHECK:STDOUT: %.19: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.20: i32 = int_literal 6 [template]
|
||||
// CHECK:STDOUT: %.21: i32 = int_literal 7 [template]
|
||||
// CHECK:STDOUT: %.22: i32 = int_literal 8 [template]
|
||||
// CHECK:STDOUT: %.12: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template]
|
||||
// CHECK:STDOUT: %.13: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.15: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.16: i32 = int_literal 3 [template]
|
||||
// CHECK:STDOUT: %.17: i32 = int_literal 4 [template]
|
||||
// CHECK:STDOUT: %.18: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.19: i32 = int_literal 6 [template]
|
||||
// CHECK:STDOUT: %.20: i32 = int_literal 7 [template]
|
||||
// CHECK:STDOUT: %.21: i32 = int_literal 8 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -47,33 +46,33 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26, %.loc7_29, %.loc7_32, %.loc7_35, %.loc7_38, %.loc7_41, %.loc7_44)
|
||||
// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.13]
|
||||
// CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index %a.var, %.loc7_45.2
|
||||
// CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3
|
||||
// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc7_45.6: ref i32 = array_index %a.var, %.loc7_45.5
|
||||
// CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6
|
||||
// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %.loc7_45.9: ref i32 = array_index %a.var, %.loc7_45.8
|
||||
// CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9
|
||||
// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.17]
|
||||
// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc7_45.12: ref i32 = array_index %a.var, %.loc7_45.11
|
||||
// CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12
|
||||
// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.18]
|
||||
// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.17]
|
||||
// CHECK:STDOUT: %.loc7_45.15: ref i32 = array_index %a.var, %.loc7_45.14
|
||||
// CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15
|
||||
// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.18]
|
||||
// CHECK:STDOUT: %.loc7_45.18: ref i32 = array_index %a.var, %.loc7_45.17
|
||||
// CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18
|
||||
// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc7_45.21: ref i32 = array_index %a.var, %.loc7_45.20
|
||||
// CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21
|
||||
// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.21]
|
||||
// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc7_45.24: ref i32 = array_index %a.var, %.loc7_45.23
|
||||
// CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24
|
||||
// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.22]
|
||||
// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.21]
|
||||
// CHECK:STDOUT: %.loc7_45.27: ref i32 = array_index %a.var, %.loc7_45.26
|
||||
// CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27
|
||||
// CHECK:STDOUT: %.loc7_45.29: init [i32; 9] = array_init (%.loc7_45.4, %.loc7_45.7, %.loc7_45.10, %.loc7_45.13, %.loc7_45.16, %.loc7_45.19, %.loc7_45.22, %.loc7_45.25, %.loc7_45.28) to %a.var
|
||||
|
||||
Reference in New Issue
Block a user