Switch type literals to use builtin functions. (#3978)

Modifies the core package and literal handling to use factory functions
for standard type literals.

Updates function/builtin/import.carbon to stop depending on the prelude,
since it would list all the impls in the core file. Updates
alias/builtins.carbon to be failing (the type values cannot be aliased).
This commit is contained in:
Jon Ross-Perkins
2024-05-23 16:00:08 +00:00
committed by GitHub
parent 5c8fa6ad5c
commit 55300d1ebb
314 changed files with 12506 additions and 4323 deletions
+41 -13
View File
@@ -13,13 +13,15 @@ fn G() {
// CHECK:STDOUT: --- array_in_place.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.3: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: %struct.3: G = struct_value () [template]
// CHECK:STDOUT: %.4: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.5: type = array_type %.4, (i32, i32, i32) [template]
// CHECK:STDOUT: %.6: type = ptr_type (i32, i32, i32) [template]
@@ -36,31 +38,57 @@ fn G() {
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32)
// CHECK:STDOUT: %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17, %int.make_type_32.loc7_22)
// CHECK:STDOUT: %.loc7_25.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32]
// CHECK:STDOUT: %.loc7_25.3: type = converted %int.make_type_32.loc7_12, %.loc7_25.2 [template = i32]
// CHECK:STDOUT: %.loc7_25.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32]
// CHECK:STDOUT: %.loc7_25.5: type = converted %int.make_type_32.loc7_17, %.loc7_25.4 [template = i32]
// CHECK:STDOUT: %.loc7_25.6: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32]
// CHECK:STDOUT: %.loc7_25.7: type = converted %int.make_type_32.loc7_22, %.loc7_25.6 [template = i32]
// CHECK:STDOUT: %.loc7_25.8: type = converted %.loc7_25.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {}
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {}
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() -> (i32, i32, i32);
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc10_25.1: (type, type, type) = tuple_literal (i32, i32, i32)
// CHECK:STDOUT: %int.make_type_32.loc10_12: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc10_17: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc10_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_12, %int.make_type_32.loc10_17, %int.make_type_32.loc10_22)
// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.4]
// CHECK:STDOUT: %.loc10_25.2: type = converted %.loc10_25.1, constants.%.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc10_25.2: type = value_of_initializer %int.make_type_32.loc10_12 [template = i32]
// CHECK:STDOUT: %.loc10_25.3: type = converted %int.make_type_32.loc10_12, %.loc10_25.2 [template = i32]
// CHECK:STDOUT: %.loc10_25.4: type = value_of_initializer %int.make_type_32.loc10_17 [template = i32]
// CHECK:STDOUT: %.loc10_25.5: type = converted %int.make_type_32.loc10_17, %.loc10_25.4 [template = i32]
// CHECK:STDOUT: %.loc10_25.6: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32]
// CHECK:STDOUT: %.loc10_25.7: type = converted %int.make_type_32.loc10_22, %.loc10_25.6 [template = i32]
// CHECK:STDOUT: %.loc10_25.8: type = converted %.loc10_25.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.5]
// CHECK:STDOUT: %v.var: ref [(i32, i32, i32); 2] = var v
// CHECK:STDOUT: %v: ref [(i32, i32, i32); 2] = bind_name v, %v.var
// CHECK:STDOUT: %F.ref.loc10_34: F = name_ref F, file.%F.decl [template = constants.%struct.1]
// CHECK:STDOUT: %F.ref.loc10_34: F = name_ref F, file.%F.decl [template = constants.%struct.2]
// CHECK:STDOUT: %.loc10_42.3: ref (i32, i32, i32) = splice_block %.loc10_42.2 {
// CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 [template = constants.%.9]
// CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.call.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3
// CHECK:STDOUT: %F.ref.loc10_39: F = name_ref F, file.%F.decl [template = constants.%struct.1]
// CHECK:STDOUT: %F.ref.loc10_39: F = name_ref F, file.%F.decl [template = constants.%struct.2]
// CHECK:STDOUT: %.loc10_42.6: ref (i32, i32, i32) = splice_block %.loc10_42.5 {
// CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1 [template = constants.%.10]
// CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.4
+24 -4
View File
@@ -15,7 +15,9 @@ fn G() {
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: G = struct_value () [template]
// CHECK:STDOUT: %struct.1: G = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template]
@@ -35,12 +37,19 @@ fn G() {
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] {}
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] {}
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc9_16: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32]
// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32.loc9, %.loc9_11.1 [template = i32]
// CHECK:STDOUT: %.loc9_17: type = array_type %.loc9_16, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
// CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var
@@ -60,8 +69,17 @@ fn G() {
// CHECK:STDOUT: %.loc9_29.11: init [i32; 3] = array_init (%.loc9_29.4, %.loc9_29.7, %.loc9_29.10) to %a.var [template = constants.%array]
// CHECK:STDOUT: %.loc9_30: init [i32; 3] = converted %.loc9_29.1, %.loc9_29.11 [template = constants.%array]
// CHECK:STDOUT: assign %a.var, %.loc9_30
// CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (i32, i32, i32)
// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.7 [template = constants.%.7]
// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_11, %int.make_type_32.loc10_16, %int.make_type_32.loc10_21)
// CHECK:STDOUT: %.loc10_24.2: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32]
// CHECK:STDOUT: %.loc10_24.3: type = converted %int.make_type_32.loc10_11, %.loc10_24.2 [template = i32]
// CHECK:STDOUT: %.loc10_24.4: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32]
// CHECK:STDOUT: %.loc10_24.5: type = converted %int.make_type_32.loc10_16, %.loc10_24.4 [template = i32]
// CHECK:STDOUT: %.loc10_24.6: type = value_of_initializer %int.make_type_32.loc10_21 [template = i32]
// CHECK:STDOUT: %.loc10_24.7: type = converted %int.make_type_32.loc10_21, %.loc10_24.6 [template = i32]
// CHECK:STDOUT: %.loc10_24.8: type = converted %.loc10_24.1, constants.%.7 [template = constants.%.7]
// CHECK:STDOUT: %b.var: ref (i32, i32, i32) = var b
// CHECK:STDOUT: %b: ref (i32, i32, i32) = bind_name b, %b.var
// CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.5]
@@ -80,3 +98,5 @@ fn G() {
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
+22 -10
View File
@@ -13,15 +13,17 @@ fn Run() {
// CHECK:STDOUT: --- assign_return_value.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.3: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template]
// CHECK:STDOUT: %Run: type = fn_type @Run [template]
// CHECK:STDOUT: %struct.2: Run = struct_value () [template]
// CHECK:STDOUT: %struct.3: Run = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: type = array_type %.5, i32 [template]
// CHECK:STDOUT: %.7: type = ptr_type [i32; 1] [template]
@@ -34,14 +36,21 @@ fn Run() {
// CHECK:STDOUT: .Run = %Run.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32)
// CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (%int.make_type_32)
// CHECK:STDOUT: %.loc7_16.2: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc7_16.3: type = converted %int.make_type_32, %.loc7_16.2 [template = i32]
// CHECK:STDOUT: %.loc7_16.4: type = converted %.loc7_16.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: @F.%return: ref (i32,) = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {}
// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] {}
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() -> (i32,) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.4]
@@ -53,11 +62,14 @@ fn Run() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32, %.loc10_11.1 [template = i32]
// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.6]
// CHECK:STDOUT: %t.var: ref [i32; 1] = var t
// CHECK:STDOUT: %t: ref [i32; 1] = bind_name t, %t.var
// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1]
// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2]
// CHECK:STDOUT: %F.call: init (i32,) = call %F.ref()
// CHECK:STDOUT: %.loc10_22.1: ref (i32,) = temporary_storage
// CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary %.loc10_22.1, %F.call
+44 -23
View File
@@ -10,16 +10,19 @@ var b: [i32; 3] = a;
// CHECK:STDOUT: --- assign_var.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [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: %tuple: (i32, i32, i32) = tuple_value (%.4, %.5, %.6) [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: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.4: type = ptr_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.7: i32 = int_literal 3 [template]
// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.5, %.6, %.7) [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: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -29,45 +32,63 @@ var b: [i32; 3] = a;
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc7_22.1: (type, type, type) = tuple_literal (i32, i32, i32)
// CHECK:STDOUT: %.loc7_22.2: type = converted %.loc7_22.1, constants.%.2 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc7_22.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14, %int.make_type_32.loc7_19)
// CHECK:STDOUT: %.loc7_22.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32]
// CHECK:STDOUT: %.loc7_22.3: type = converted %int.make_type_32.loc7_9, %.loc7_22.2 [template = i32]
// CHECK:STDOUT: %.loc7_22.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32]
// CHECK:STDOUT: %.loc7_22.5: type = converted %int.make_type_32.loc7_14, %.loc7_22.4 [template = i32]
// CHECK:STDOUT: %.loc7_22.6: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32]
// CHECK:STDOUT: %.loc7_22.7: type = converted %int.make_type_32.loc7_19, %.loc7_22.6 [template = i32]
// CHECK:STDOUT: %.loc7_22.8: type = converted %.loc7_22.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref (i32, i32, i32) = var a
// CHECK:STDOUT: %a: ref (i32, i32, i32) = bind_name a, %a.var
// 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: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.7]
// CHECK:STDOUT: %.loc8_9.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32]
// CHECK:STDOUT: %.loc8_9.2: type = converted %int.make_type_32.loc8, %.loc8_9.1 [template = i32]
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.8]
// CHECK:STDOUT: %b.var: ref [i32; 3] = var b
// CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_34.1: (i32, i32, i32) = tuple_literal (%.loc7_27, %.loc7_30, %.loc7_33)
// CHECK:STDOUT: %.loc7_34.2: ref i32 = tuple_access file.%a.var, element0
// CHECK:STDOUT: %.loc7_34.3: init i32 = initialize_from %.loc7_27 to %.loc7_34.2 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_34.3: init i32 = initialize_from %.loc7_27 to %.loc7_34.2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_34.4: ref i32 = tuple_access file.%a.var, element1
// CHECK:STDOUT: %.loc7_34.5: init i32 = initialize_from %.loc7_30 to %.loc7_34.4 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_34.5: init i32 = initialize_from %.loc7_30 to %.loc7_34.4 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_34.6: ref i32 = tuple_access file.%a.var, element2
// CHECK:STDOUT: %.loc7_34.7: init i32 = initialize_from %.loc7_33 to %.loc7_34.6 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_34.7: init i32 = initialize_from %.loc7_33 to %.loc7_34.6 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_34.8: init (i32, i32, i32) = tuple_init (%.loc7_34.3, %.loc7_34.5, %.loc7_34.7) to file.%a.var [template = constants.%tuple]
// CHECK:STDOUT: %.loc7_35: init (i32, i32, i32) = converted %.loc7_34.1, %.loc7_34.8 [template = constants.%tuple]
// CHECK:STDOUT: assign file.%a.var, %.loc7_35
// CHECK:STDOUT: %a.ref: ref (i32, i32, i32) = name_ref a, file.%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.%.9]
// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc8_19.4: ref i32 = array_index file.%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.%.4]
// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc8_19.9: ref i32 = array_index file.%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.%.5]
// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc8_19.14: ref i32 = array_index file.%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 file.%b.var
+59 -41
View File
@@ -11,27 +11,32 @@ var c: [(); 5] = ((), (), (), (), (),);
// CHECK:STDOUT: --- base.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array.1: [i32; 1] = tuple_value (%.1) [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 = float_literal 11.100000000000001 [template]
// CHECK:STDOUT: %.10: f64 = float_literal 2.2000000000000002 [template]
// CHECK:STDOUT: %.11: type = tuple_type (f64, f64) [template]
// CHECK:STDOUT: %array.2: [f64; 2] = tuple_value (%.9, %.10) [template]
// CHECK:STDOUT: %.12: type = tuple_type () [template]
// CHECK:STDOUT: %.13: i32 = int_literal 5 [template]
// CHECK:STDOUT: %.14: type = array_type %.13, () [template]
// CHECK:STDOUT: %.15: type = ptr_type [(); 5] [template]
// CHECK:STDOUT: %.16: type = tuple_type ((), (), (), (), ()) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 1] [template]
// CHECK:STDOUT: %.5: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.6: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array.1: [i32; 1] = tuple_value (%.2) [template]
// CHECK:STDOUT: %.7: i32 = int_literal 64 [template]
// CHECK:STDOUT: %Float: type = fn_type @Float [template]
// CHECK:STDOUT: %struct.2: Float = struct_value () [template]
// CHECK:STDOUT: %.8: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.9: type = array_type %.8, f64 [template]
// CHECK:STDOUT: %.10: type = ptr_type [f64; 2] [template]
// CHECK:STDOUT: %.11: f64 = float_literal 11.100000000000001 [template]
// CHECK:STDOUT: %.12: f64 = float_literal 2.2000000000000002 [template]
// CHECK:STDOUT: %.13: type = tuple_type (f64, f64) [template]
// CHECK:STDOUT: %array.2: [f64; 2] = tuple_value (%.11, %.12) [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: %tuple: () = tuple_value () [template]
// CHECK:STDOUT: %.17: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.18: i32 = int_literal 4 [template]
// CHECK:STDOUT: %.18: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.19: i32 = int_literal 4 [template]
// CHECK:STDOUT: %array.3: [(); 5] = tuple_value (%tuple, %tuple, %tuple, %tuple, %tuple) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -43,41 +48,54 @@ var c: [(); 5] = ((), (), (), (), (),);
// CHECK:STDOUT: .c = %c
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32, %.loc7_9.1 [template = i32]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
// CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var
// 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: %.loc8_9.1: i32 = int_literal 64 [template = constants.%.7]
// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.2(%.loc8_9.1) [template = f64]
// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.8]
// CHECK:STDOUT: %.loc8_9.2: type = value_of_initializer %float.make_type [template = f64]
// CHECK:STDOUT: %.loc8_9.3: type = converted %float.make_type, %.loc8_9.2 [template = f64]
// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.9]
// CHECK:STDOUT: %b.var: ref [f64; 2] = var b
// CHECK:STDOUT: %b: ref [f64; 2] = bind_name b, %b.var
// CHECK:STDOUT: %.loc9_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.13]
// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.12 [template = constants.%.12]
// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.14]
// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.14]
// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.1 [template = constants.%.1]
// 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: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_22.1: (i32,) = tuple_literal (%.loc7_20)
// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_22.3: ref i32 = array_index file.%a.var, %.loc7_22.2
// CHECK:STDOUT: %.loc7_22.4: init i32 = initialize_from %.loc7_20 to %.loc7_22.3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_22.4: init i32 = initialize_from %.loc7_20 to %.loc7_22.3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_22.5: init [i32; 1] = array_init (%.loc7_22.4) to file.%a.var [template = constants.%array.1]
// CHECK:STDOUT: %.loc7_23: init [i32; 1] = converted %.loc7_22.1, %.loc7_22.5 [template = constants.%array.1]
// CHECK:STDOUT: assign file.%a.var, %.loc7_23
// CHECK:STDOUT: %.loc8_20: f64 = float_literal 11.100000000000001 [template = constants.%.9]
// CHECK:STDOUT: %.loc8_26: f64 = float_literal 2.2000000000000002 [template = constants.%.10]
// CHECK:STDOUT: %.loc8_20: f64 = float_literal 11.100000000000001 [template = constants.%.11]
// CHECK:STDOUT: %.loc8_26: f64 = float_literal 2.2000000000000002 [template = constants.%.12]
// CHECK:STDOUT: %.loc8_30.1: (f64, f64) = tuple_literal (%.loc8_20, %.loc8_26)
// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.6]
// CHECK:STDOUT: %.loc8_30.3: ref f64 = array_index file.%b.var, %.loc8_30.2
// CHECK:STDOUT: %.loc8_30.4: init f64 = initialize_from %.loc8_20 to %.loc8_30.3 [template = constants.%.9]
// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc8_30.4: init f64 = initialize_from %.loc8_20 to %.loc8_30.3 [template = constants.%.11]
// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc8_30.6: ref f64 = array_index file.%b.var, %.loc8_30.5
// CHECK:STDOUT: %.loc8_30.7: init f64 = initialize_from %.loc8_26 to %.loc8_30.6 [template = constants.%.10]
// CHECK:STDOUT: %.loc8_30.7: init f64 = initialize_from %.loc8_26 to %.loc8_30.6 [template = constants.%.12]
// CHECK:STDOUT: %.loc8_30.8: init [f64; 2] = array_init (%.loc8_30.4, %.loc8_30.7) to file.%b.var [template = constants.%array.2]
// CHECK:STDOUT: %.loc8_31: init [f64; 2] = converted %.loc8_30.1, %.loc8_30.8 [template = constants.%array.2]
// CHECK:STDOUT: assign file.%b.var, %.loc8_31
@@ -87,23 +105,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.%.5]
// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.6]
// CHECK:STDOUT: %.loc9_38.3: ref () = array_index file.%c.var, %.loc9_38.2
// CHECK:STDOUT: %.loc9_20.2: init () = tuple_init () to %.loc9_38.3 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.4: init () = converted %.loc9_20.1, %.loc9_20.2 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.5: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc9_38.5: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc9_38.6: ref () = array_index file.%c.var, %.loc9_38.5
// CHECK:STDOUT: %.loc9_24.2: init () = tuple_init () to %.loc9_38.6 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.7: init () = converted %.loc9_24.1, %.loc9_24.2 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 2 [template = constants.%.8]
// CHECK:STDOUT: %.loc9_38.9: ref () = array_index file.%c.var, %.loc9_38.8
// CHECK:STDOUT: %.loc9_28.2: init () = tuple_init () to %.loc9_38.9 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.10: init () = converted %.loc9_28.1, %.loc9_28.2 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.11: i32 = int_literal 3 [template = constants.%.17]
// CHECK:STDOUT: %.loc9_38.11: i32 = int_literal 3 [template = constants.%.18]
// CHECK:STDOUT: %.loc9_38.12: ref () = array_index file.%c.var, %.loc9_38.11
// CHECK:STDOUT: %.loc9_32.2: init () = tuple_init () to %.loc9_38.12 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.13: init () = converted %.loc9_32.1, %.loc9_32.2 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.14: i32 = int_literal 4 [template = constants.%.18]
// CHECK:STDOUT: %.loc9_38.14: i32 = int_literal 4 [template = constants.%.19]
// CHECK:STDOUT: %.loc9_38.15: ref () = array_index file.%c.var, %.loc9_38.14
// CHECK:STDOUT: %.loc9_36.2: init () = tuple_init () to %.loc9_38.15 [template = constants.%tuple]
// CHECK:STDOUT: %.loc9_38.16: init () = converted %.loc9_36.1, %.loc9_36.2 [template = constants.%tuple]
+28 -4
View File
@@ -12,9 +12,11 @@ let b: [i32; 3]* = &a;
// CHECK:STDOUT: --- canonicalize_index.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Add: type = fn_type @Add [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Add = struct_value () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %Add: type = fn_type @Add [template]
// CHECK:STDOUT: %struct.2: Add = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.4: i32 = int_literal 3 [template]
@@ -32,21 +34,41 @@ let b: [i32; 3]* = &a;
// CHECK:STDOUT: .a = %a.loc9
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32]
// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32]
// CHECK:STDOUT: %a.loc7_8.1: i32 = param a
// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1
// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32]
// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32]
// CHECK:STDOUT: %b.loc7_16.1: i32 = param b
// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1
// CHECK:STDOUT: %int.make_type_32.loc7_27: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %int.make_type_32.loc7_27 [template = i32]
// CHECK:STDOUT: %.loc7_27.2: type = converted %int.make_type_32.loc7_27, %.loc7_27.1 [template = i32]
// CHECK:STDOUT: @Add.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct]
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.2]
// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc9_21: i32 = int_literal 2 [template = constants.%.3]
// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.4]
// CHECK:STDOUT: %.loc9_9.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32]
// CHECK:STDOUT: %.loc9_9.2: type = converted %int.make_type_32.loc9, %.loc9_9.1 [template = i32]
// CHECK:STDOUT: %.loc9_23: type = array_type %int.sadd, i32 [template = constants.%.5]
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
// CHECK:STDOUT: %a.loc9: ref [i32; 3] = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 [template = constants.%.4]
// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32]
// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32.loc10, %.loc10_9.1 [template = i32]
// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.5]
// CHECK:STDOUT: %.loc10_16: type = ptr_type [i32; 3] [template = constants.%.6]
// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a.loc9
@@ -54,6 +76,8 @@ let b: [i32; 3]* = &a;
// CHECK:STDOUT: %b.loc10: [i32; 3]* = bind_name b, %.loc10_20
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Add(%a: i32, %b: i32) -> i32 = "int.sadd";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
+20 -4
View File
@@ -14,9 +14,11 @@ var a: [i32; Negate(1)];
// CHECK:STDOUT: --- fail_bound_negative.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Negate: type = fn_type @Negate [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Negate = struct_value () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %Negate: type = fn_type @Negate [template]
// CHECK:STDOUT: %struct.2: Negate = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: i32 = int_literal -1 [template]
// CHECK:STDOUT: }
@@ -28,18 +30,32 @@ var a: [i32; Negate(1)];
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32]
// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32.loc7_14, %.loc7_14.1 [template = i32]
// CHECK:STDOUT: %n.loc7_11.1: i32 = param n
// CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc7_11.1
// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_22.1: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32]
// CHECK:STDOUT: %.loc7_22.2: type = converted %int.make_type_32.loc7_22, %.loc7_22.1 [template = i32]
// CHECK:STDOUT: @Negate.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2]
// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.3]
// CHECK:STDOUT: %.loc12_9.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32]
// CHECK:STDOUT: %.loc12_9.2: type = converted %int.make_type_32.loc12, %.loc12_9.1 [template = i32]
// CHECK:STDOUT: %.loc12_23: type = array_type %int.snegate, i32 [template = <error>]
// CHECK:STDOUT: %a.var: ref <error> = var a
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Negate(%n: i32) -> i32 = "int.snegate";
// CHECK:STDOUT:
+12 -3
View File
@@ -25,7 +25,10 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: --- fail_bound_overflow.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -35,12 +38,18 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc14: type = array_type <error>, i32 [template = <error>]
// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32, %.loc14_9.1 [template = i32]
// CHECK:STDOUT: %.loc14_34: type = array_type <error>, i32 [template = <error>]
// CHECK:STDOUT: %a.var: ref <error> = var a
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
// CHECK:STDOUT: %.loc23_9: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc23_9: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc23_32: type = array_type <error>, <error> [template = <error>]
// CHECK:STDOUT: %b.var: ref <error> = var b
// CHECK:STDOUT: %b: ref <error> = bind_name b, %b.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
+20 -11
View File
@@ -12,12 +12,15 @@ var a: [i32; 1] = (1, 2, 3);
// CHECK:STDOUT: --- fail_out_of_bound.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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 2 [template]
// CHECK:STDOUT: %.5: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 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: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -26,17 +29,23 @@ var a: [i32; 1] = (1, 2, 3);
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32, %.loc10_9.1 [template = i32]
// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
// CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// 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_20: i32 = int_literal 1 [template = constants.%.2]
// 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_27: (i32, i32, i32) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_26)
// CHECK:STDOUT: assign file.%a.var, <error>
// CHECK:STDOUT: return
@@ -13,16 +13,19 @@ var b: i32 = a[{.index = 3}.index];
// CHECK:STDOUT: --- fail_out_of_bound_non_literal.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// 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: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.7: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.4, %.5, %.1) [template]
// CHECK:STDOUT: %.8: type = struct_type {.index: i32} [template]
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.1) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.8: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.2) [template]
// CHECK:STDOUT: %.9: type = struct_type {.index: i32} [template]
// CHECK:STDOUT: %struct.2: {.index: i32} = struct_value (%.2) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -32,38 +35,48 @@ var b: i32 = a[{.index = 3}.index];
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
// CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_27.1: (i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26)
// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_27.3: ref i32 = array_index file.%a.var, %.loc7_27.2
// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.6: ref i32 = array_index file.%a.var, %.loc7_27.5
// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_27.9: ref i32 = array_index file.%a.var, %.loc7_27.8
// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_27.11: init [i32; 3] = array_init (%.loc7_27.4, %.loc7_27.7, %.loc7_27.10) to file.%a.var [template = constants.%array]
// CHECK:STDOUT: %.loc7_28: init [i32; 3] = converted %.loc7_27.1, %.loc7_27.11 [template = constants.%array]
// CHECK:STDOUT: assign file.%a.var, %.loc7_28
// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, file.%a
// CHECK:STDOUT: %.loc11_26: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc11_26: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc11_27.1: {.index: i32} = struct_literal (%.loc11_26)
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc11_26) [template = constants.%struct]
// CHECK:STDOUT: %.loc11_27.2: {.index: i32} = converted %.loc11_27.1, %struct [template = constants.%struct]
// CHECK:STDOUT: %.loc11_28: i32 = struct_access %.loc11_27.2, element0 [template = constants.%.1]
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc11_26) [template = constants.%struct.2]
// CHECK:STDOUT: %.loc11_27.2: {.index: i32} = converted %.loc11_27.1, %struct [template = constants.%struct.2]
// CHECK:STDOUT: %.loc11_28: i32 = struct_access %.loc11_27.2, element0 [template = constants.%.2]
// CHECK:STDOUT: %.loc11_34.1: ref i32 = array_index %a.ref, %.loc11_28 [template = <error>]
// CHECK:STDOUT: %.loc11_34.2: i32 = bind_value %.loc11_34.1
// CHECK:STDOUT: assign file.%b.var, %.loc11_34.2
+69 -36
View File
@@ -32,22 +32,25 @@ var d: [i32; 3] = t2;
// CHECK:STDOUT: --- fail_type_mismatch.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template]
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.5: type = ptr_type String [template]
// CHECK:STDOUT: %.6: String = string_literal "Hello" [template]
// CHECK:STDOUT: %.7: String = string_literal "World" [template]
// CHECK:STDOUT: %.8: type = tuple_type (i32, String, String) [template]
// CHECK:STDOUT: %.9: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.10: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %.11: type = tuple_type (i32, String*, String*) [template]
// CHECK:STDOUT: %.12: type = ptr_type (i32, String*, String*) [template]
// CHECK:STDOUT: %.13: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.14: type = tuple_type (i32, i32) [template]
// CHECK:STDOUT: %.15: type = tuple_type (type, type) [template]
// CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: type = ptr_type String [template]
// CHECK:STDOUT: %.7: String = string_literal "Hello" [template]
// CHECK:STDOUT: %.8: String = string_literal "World" [template]
// CHECK:STDOUT: %.9: type = tuple_type (i32, String, String) [template]
// CHECK:STDOUT: %.10: i32 = int_literal 0 [template]
// 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 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 {
@@ -61,52 +64,82 @@ var d: [i32; 3] = t2;
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32]
// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
// CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var
// CHECK:STDOUT: %.loc13_29.1: (type, type, type) = tuple_literal (i32, String, String)
// CHECK:STDOUT: %.loc13_29.2: type = converted %.loc13_29.1, constants.%.8 [template = constants.%.8]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc13_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc13, String, String)
// CHECK:STDOUT: %.loc13_29.2: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
// CHECK:STDOUT: %.loc13_29.3: type = converted %int.make_type_32.loc13, %.loc13_29.2 [template = i32]
// CHECK:STDOUT: %.loc13_29.4: type = converted %.loc13_29.1, constants.%.9 [template = constants.%.9]
// CHECK:STDOUT: %t1.var: ref (i32, String, String) = var t1
// CHECK:STDOUT: %t1: ref (i32, String, String) = bind_name t1, %t1.var
// CHECK:STDOUT: %.loc18_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc18_15: type = array_type %.loc18_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc18_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32]
// CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32.loc18, %.loc18_9.1 [template = i32]
// CHECK:STDOUT: %.loc18_15: type = array_type %.loc18_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %b.var: ref [i32; 3] = var b
// CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var
// CHECK:STDOUT: %.loc24_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc24_15: type = array_type %.loc24_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc24_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc24_9.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32]
// CHECK:STDOUT: %.loc24_9.2: type = converted %int.make_type_32.loc24, %.loc24_9.1 [template = i32]
// CHECK:STDOUT: %.loc24_15: type = array_type %.loc24_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %c.var: ref [i32; 3] = var c
// CHECK:STDOUT: %c: ref [i32; 3] = bind_name c, %c.var
// CHECK:STDOUT: %.loc26_18.1: (type, type) = tuple_literal (i32, i32)
// CHECK:STDOUT: %.loc26_18.2: type = converted %.loc26_18.1, constants.%.14 [template = constants.%.14]
// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc26_10: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc26_15: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc26_18.1: (type, type) = tuple_literal (%int.make_type_32.loc26_10, %int.make_type_32.loc26_15)
// CHECK:STDOUT: %.loc26_18.2: type = value_of_initializer %int.make_type_32.loc26_10 [template = i32]
// CHECK:STDOUT: %.loc26_18.3: type = converted %int.make_type_32.loc26_10, %.loc26_18.2 [template = i32]
// CHECK:STDOUT: %.loc26_18.4: type = value_of_initializer %int.make_type_32.loc26_15 [template = i32]
// CHECK:STDOUT: %.loc26_18.5: type = converted %int.make_type_32.loc26_15, %.loc26_18.4 [template = i32]
// CHECK:STDOUT: %.loc26_18.6: type = converted %.loc26_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: %.loc30_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc30_15: type = array_type %.loc30_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc30_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc30_9.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32]
// CHECK:STDOUT: %.loc30_9.2: type = converted %int.make_type_32.loc30, %.loc30_9.1 [template = i32]
// CHECK:STDOUT: %.loc30_15: type = array_type %.loc30_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %d.var: ref [i32; 3] = var d
// CHECK:STDOUT: %d: ref [i32; 3] = bind_name d, %d.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc11_23: String = string_literal "Hello" [template = constants.%.6]
// CHECK:STDOUT: %.loc11_32: String = string_literal "World" [template = constants.%.7]
// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc11_23: String = string_literal "Hello" [template = constants.%.7]
// CHECK:STDOUT: %.loc11_32: String = string_literal "World" [template = constants.%.8]
// CHECK:STDOUT: %.loc11_39.1: (i32, String, String) = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_32)
// CHECK:STDOUT: %.loc11_39.2: i32 = int_literal 0 [template = constants.%.9]
// CHECK:STDOUT: %.loc11_39.2: i32 = int_literal 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc11_39.3: ref i32 = array_index file.%a.var, %.loc11_39.2
// CHECK:STDOUT: %.loc11_39.4: init i32 = initialize_from %.loc11_20 to %.loc11_39.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc11_39.4: init i32 = initialize_from %.loc11_20 to %.loc11_39.3 [template = constants.%.5]
// CHECK:STDOUT: assign file.%a.var, <error>
// CHECK:STDOUT: %t1.ref: ref (i32, String, String) = name_ref t1, file.%t1
// CHECK:STDOUT: %.loc18_19.1: ref i32 = tuple_access %t1.ref, element0
// CHECK:STDOUT: %.loc18_19.2: i32 = bind_value %.loc18_19.1
// CHECK:STDOUT: %.loc18_19.3: i32 = int_literal 0 [template = constants.%.9]
// CHECK:STDOUT: %.loc18_19.3: i32 = int_literal 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc18_19.4: ref i32 = array_index file.%b.var, %.loc18_19.3
// CHECK:STDOUT: %.loc18_19.5: init i32 = initialize_from %.loc18_19.2 to %.loc18_19.4
// CHECK:STDOUT: %.loc18_19.6: ref String = tuple_access %t1.ref, element1
// CHECK:STDOUT: assign file.%b.var, <error>
// CHECK:STDOUT: %.loc24_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc24_23: i32 = int_literal 2 [template = constants.%.13]
// CHECK:STDOUT: %.loc24_20: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc24_23: i32 = int_literal 2 [template = constants.%.14]
// CHECK:STDOUT: %.loc24_24: (i32, i32) = tuple_literal (%.loc24_20, %.loc24_23)
// CHECK:STDOUT: assign file.%c.var, <error>
// CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, file.%t2
@@ -11,5 +11,13 @@ var a: [i32; ];
// CHECK:STDOUT: --- fail_undefined_bound.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {}
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
+33 -13
View File
@@ -15,19 +15,21 @@ fn G() -> i32 {
// CHECK:STDOUT: --- function_param.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.3: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: %struct.3: G = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.8: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.1) [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.2) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -37,20 +39,38 @@ fn G() -> i32 {
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32]
// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7_12, %.loc7_12.1 [template = i32]
// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3]
// CHECK:STDOUT: %arr.loc7_6.1: [i32; 3] = param arr
// CHECK:STDOUT: @F.%arr: [i32; 3] = bind_name arr, %arr.loc7_6.1
// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_24.1: type = value_of_initializer %int.make_type_32.loc7_24 [template = i32]
// CHECK:STDOUT: %.loc7_24.2: type = converted %int.make_type_32.loc7_24, %.loc7_24.1 [template = i32]
// CHECK:STDOUT: %i.loc7_21.1: i32 = param i
// CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc7_21.1
// CHECK:STDOUT: %int.make_type_32.loc7_32: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_32.1: type = value_of_initializer %int.make_type_32.loc7_32 [template = i32]
// CHECK:STDOUT: %.loc7_32.2: type = converted %int.make_type_32.loc7_32, %.loc7_32.1 [template = i32]
// CHECK:STDOUT: @F.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: @G.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%arr: [i32; 3], %i: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %arr.ref: [i32; 3] = name_ref arr, %arr
@@ -63,10 +83,10 @@ fn G() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1]
// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2]
// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.2]
// 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.%.5]
// CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage
@@ -78,7 +98,7 @@ fn G() -> i32 {
// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7 [template = constants.%.6]
// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.6]
// 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 [template = constants.%.1]
// CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10 [template = constants.%.2]
// CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2 [template = constants.%array]
// CHECK:STDOUT: %.loc12_11.1: init [i32; 3] = converted %.loc12_20.1, %.loc12_20.12 [template = constants.%array]
// CHECK:STDOUT: %.loc12_11.2: ref [i32; 3] = temporary %.loc12_20.2, %.loc12_11.1
+38 -25
View File
@@ -10,16 +10,19 @@ var b: i32 = a[{.index = 2}.index];
// CHECK:STDOUT: --- index_not_literal.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// 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: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.7: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.4, %.5, %.1) [template]
// CHECK:STDOUT: %.8: type = struct_type {.index: i32} [template]
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.5) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.8: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.2) [template]
// CHECK:STDOUT: %.9: type = struct_type {.index: i32} [template]
// CHECK:STDOUT: %struct.2: {.index: i32} = struct_value (%.6) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -29,38 +32,48 @@ var b: i32 = a[{.index = 2}.index];
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
// CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32]
// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_27.1: (i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26)
// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_27.3: ref i32 = array_index file.%a.var, %.loc7_27.2
// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.6: ref i32 = array_index file.%a.var, %.loc7_27.5
// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_27.9: ref i32 = array_index file.%a.var, %.loc7_27.8
// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_27.11: init [i32; 3] = array_init (%.loc7_27.4, %.loc7_27.7, %.loc7_27.10) to file.%a.var [template = constants.%array]
// CHECK:STDOUT: %.loc7_28: init [i32; 3] = converted %.loc7_27.1, %.loc7_27.11 [template = constants.%array]
// CHECK:STDOUT: assign file.%a.var, %.loc7_28
// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, file.%a
// CHECK:STDOUT: %.loc8_26: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc8_26: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc8_27.1: {.index: i32} = struct_literal (%.loc8_26)
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc8_26) [template = constants.%struct]
// CHECK:STDOUT: %.loc8_27.2: {.index: i32} = converted %.loc8_27.1, %struct [template = constants.%struct]
// CHECK:STDOUT: %.loc8_28: i32 = struct_access %.loc8_27.2, element0 [template = constants.%.5]
// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc8_26) [template = constants.%struct.2]
// CHECK:STDOUT: %.loc8_27.2: {.index: i32} = converted %.loc8_27.1, %struct [template = constants.%struct.2]
// CHECK:STDOUT: %.loc8_28: i32 = struct_access %.loc8_27.2, element0 [template = constants.%.6]
// CHECK:STDOUT: %.loc8_34.1: ref i32 = array_index %a.ref, %.loc8_28
// CHECK:STDOUT: %.loc8_34.2: i32 = bind_value %.loc8_34.1
// CHECK:STDOUT: assign file.%b.var, %.loc8_34.2
+52 -43
View File
@@ -9,20 +9,23 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
// CHECK:STDOUT: --- nine_elements.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 9 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// CHECK:STDOUT: %.3: type = ptr_type [i32; 9] [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: i32 = int_literal 4 [template]
// CHECK:STDOUT: %.8: i32 = int_literal 5 [template]
// 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: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template]
// CHECK:STDOUT: %.13: i32 = int_literal 0 [template]
// CHECK:STDOUT: %array: [i32; 9] = tuple_value (%.4, %.5, %.6, %.7, %.8, %.9, %.10, %.11, %.1) [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 9 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %.4: type = ptr_type [i32; 9] [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.7: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.8: i32 = int_literal 4 [template]
// CHECK:STDOUT: %.9: i32 = int_literal 5 [template]
// CHECK:STDOUT: %.10: i32 = int_literal 6 [template]
// CHECK:STDOUT: %.11: i32 = int_literal 7 [template]
// CHECK:STDOUT: %.12: i32 = int_literal 8 [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: %array: [i32; 9] = tuple_value (%.5, %.6, %.7, %.8, %.9, %.10, %.11, %.12, %.2) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -31,51 +34,57 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32]
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9 [template = constants.%.2]
// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32, %.loc7_9.1 [template = i32]
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3]
// CHECK:STDOUT: %a.var: ref [i32; 9] = var a
// CHECK:STDOUT: %a: ref [i32; 9] = bind_name a, %a.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5 [template = constants.%.8]
// 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.%.1]
// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5 [template = constants.%.9]
// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 [template = constants.%.10]
// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 [template = constants.%.11]
// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 [template = constants.%.12]
// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.2]
// 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.%.13]
// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.14]
// CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index file.%a.var, %.loc7_45.2
// CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_45.6: ref i32 = array_index file.%a.var, %.loc7_45.5
// CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_45.9: ref i32 = array_index file.%a.var, %.loc7_45.8
// CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.6]
// CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_45.12: ref i32 = array_index file.%a.var, %.loc7_45.11
// CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.7]
// CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_45.15: ref i32 = array_index file.%a.var, %.loc7_45.14
// CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.8]
// CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15 [template = constants.%.9]
// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.9]
// CHECK:STDOUT: %.loc7_45.18: ref i32 = array_index file.%a.var, %.loc7_45.17
// CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18 [template = constants.%.9]
// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.9]
// CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18 [template = constants.%.10]
// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.10]
// CHECK:STDOUT: %.loc7_45.21: ref i32 = array_index file.%a.var, %.loc7_45.20
// CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21 [template = constants.%.10]
// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.10]
// CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21 [template = constants.%.11]
// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.11]
// CHECK:STDOUT: %.loc7_45.24: ref i32 = array_index file.%a.var, %.loc7_45.23
// CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24 [template = constants.%.11]
// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.11]
// CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24 [template = constants.%.12]
// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.12]
// CHECK:STDOUT: %.loc7_45.27: ref i32 = array_index file.%a.var, %.loc7_45.26
// CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27 [template = constants.%.2]
// 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 file.%a.var [template = constants.%array]
// CHECK:STDOUT: %.loc7_46: init [i32; 9] = converted %.loc7_45.1, %.loc7_45.29 [template = constants.%array]
// CHECK:STDOUT: assign file.%a.var, %.loc7_46