Skip to content

Commit e09419b

Browse files
authored
Make more tests into min-prelude (#5676)
This drops the wall clock time for running file_test from 10s to 8s on my machine. There's many more tests to convert, as each one takes the test from ~1s to ~100ms. Compiling the full prelude is a bit slow now since #5653, and before that file_test was taking about 3.5s. We introduce a few more flavours of min_prelude to support more tests.
1 parent effb0c9 commit e09419b

37 files changed

+1019
-835
lines changed

toolchain/check/testdata/array/index_not_literal.carbon

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
6+
//
57
// AUTOUPDATE
68
// TIP: To test this file alone, run:
79
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/index_not_literal.carbon
@@ -59,16 +61,16 @@ fn F(a: array({}, 3)) -> {} {
5961
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
6062
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
6163
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
62-
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
63-
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic]
64+
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
65+
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
6466
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
6567
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
66-
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete]
68+
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
6769
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
68-
// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
69-
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete]
70+
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
71+
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
7072
// CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
71-
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.3(%int_32) [concrete]
73+
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
7274
// CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
7375
// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
7476
// CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
@@ -81,7 +83,7 @@ fn F(a: array({}, 3)) -> {} {
8183
// CHECK:STDOUT: }
8284
// CHECK:STDOUT:
8385
// CHECK:STDOUT: imports {
84-
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
86+
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
8587
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
8688
// CHECK:STDOUT: }
8789
// CHECK:STDOUT:
@@ -107,7 +109,7 @@ fn F(a: array({}, 3)) -> {} {
107109
// CHECK:STDOUT: %int_1.loc10_23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
108110
// CHECK:STDOUT: %impl.elem0.loc10_20.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
109111
// CHECK:STDOUT: %bound_method.loc10_20.1: <bound method> = bound_method %int_1.loc10_13, %impl.elem0.loc10_20.1 [concrete = constants.%Convert.bound.ab5]
110-
// CHECK:STDOUT: %specific_fn.loc10_20.1: <specific function> = specific_function %impl.elem0.loc10_20.1, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
112+
// CHECK:STDOUT: %specific_fn.loc10_20.1: <specific function> = specific_function %impl.elem0.loc10_20.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
111113
// CHECK:STDOUT: %bound_method.loc10_20.2: <bound method> = bound_method %int_1.loc10_13, %specific_fn.loc10_20.1 [concrete = constants.%bound_method.9a1]
112114
// CHECK:STDOUT: %int.convert_checked.loc10_20.1: init %i32 = call %bound_method.loc10_20.2(%int_1.loc10_13) [concrete = constants.%int_1.5d2]
113115
// CHECK:STDOUT: %.loc10_20.2: init %i32 = converted %int_1.loc10_13, %int.convert_checked.loc10_20.1 [concrete = constants.%int_1.5d2]
@@ -117,7 +119,7 @@ fn F(a: array({}, 3)) -> {} {
117119
// CHECK:STDOUT: %.loc10_20.5: init %i32 = initialize_from %.loc10_20.2 to %.loc10_20.4 [concrete = constants.%int_1.5d2]
118120
// CHECK:STDOUT: %impl.elem0.loc10_20.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
119121
// CHECK:STDOUT: %bound_method.loc10_20.3: <bound method> = bound_method %int_2.loc10_16, %impl.elem0.loc10_20.2 [concrete = constants.%Convert.bound.ef9]
120-
// CHECK:STDOUT: %specific_fn.loc10_20.2: <specific function> = specific_function %impl.elem0.loc10_20.2, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
122+
// CHECK:STDOUT: %specific_fn.loc10_20.2: <specific function> = specific_function %impl.elem0.loc10_20.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
121123
// CHECK:STDOUT: %bound_method.loc10_20.4: <bound method> = bound_method %int_2.loc10_16, %specific_fn.loc10_20.2 [concrete = constants.%bound_method.b92]
122124
// CHECK:STDOUT: %int.convert_checked.loc10_20.2: init %i32 = call %bound_method.loc10_20.4(%int_2.loc10_16) [concrete = constants.%int_2.ef8]
123125
// CHECK:STDOUT: %.loc10_20.6: init %i32 = converted %int_2.loc10_16, %int.convert_checked.loc10_20.2 [concrete = constants.%int_2.ef8]
@@ -126,7 +128,7 @@ fn F(a: array({}, 3)) -> {} {
126128
// CHECK:STDOUT: %.loc10_20.8: init %i32 = initialize_from %.loc10_20.6 to %.loc10_20.7 [concrete = constants.%int_2.ef8]
127129
// CHECK:STDOUT: %impl.elem0.loc10_20.3: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
128130
// CHECK:STDOUT: %bound_method.loc10_20.5: <bound method> = bound_method %int_3, %impl.elem0.loc10_20.3 [concrete = constants.%Convert.bound.b30]
129-
// CHECK:STDOUT: %specific_fn.loc10_20.3: <specific function> = specific_function %impl.elem0.loc10_20.3, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
131+
// CHECK:STDOUT: %specific_fn.loc10_20.3: <specific function> = specific_function %impl.elem0.loc10_20.3, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
130132
// CHECK:STDOUT: %bound_method.loc10_20.6: <bound method> = bound_method %int_3, %specific_fn.loc10_20.3 [concrete = constants.%bound_method.047]
131133
// CHECK:STDOUT: %int.convert_checked.loc10_20.3: init %i32 = call %bound_method.loc10_20.6(%int_3) [concrete = constants.%int_3.822]
132134
// CHECK:STDOUT: %.loc10_20.9: init %i32 = converted %int_3, %int.convert_checked.loc10_20.3 [concrete = constants.%int_3.822]
@@ -139,7 +141,7 @@ fn F(a: array({}, 3)) -> {} {
139141
// CHECK:STDOUT: %.loc10_20.15: %array_type = bind_value %.loc10_20.14
140142
// CHECK:STDOUT: %impl.elem0.loc10_23: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
141143
// CHECK:STDOUT: %bound_method.loc10_23.1: <bound method> = bound_method %int_1.loc10_23, %impl.elem0.loc10_23 [concrete = constants.%Convert.bound.ab5]
142-
// CHECK:STDOUT: %specific_fn.loc10_23: <specific function> = specific_function %impl.elem0.loc10_23, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
144+
// CHECK:STDOUT: %specific_fn.loc10_23: <specific function> = specific_function %impl.elem0.loc10_23, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
143145
// CHECK:STDOUT: %bound_method.loc10_23.2: <bound method> = bound_method %int_1.loc10_23, %specific_fn.loc10_23 [concrete = constants.%bound_method.9a1]
144146
// CHECK:STDOUT: %int.convert_checked.loc10_23: init %i32 = call %bound_method.loc10_23.2(%int_1.loc10_23) [concrete = constants.%int_1.5d2]
145147
// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.convert_checked.loc10_23 [concrete = constants.%int_1.5d2]
@@ -163,23 +165,23 @@ fn F(a: array({}, 3)) -> {} {
163165
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
164166
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
165167
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
166-
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
167-
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic]
168+
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
169+
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
168170
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
169171
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
170-
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete]
172+
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
171173
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
172-
// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
173-
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete]
174+
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
175+
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
174176
// CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
175-
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.3(%int_32) [concrete]
177+
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
176178
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
177179
// CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
178180
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
179181
// CHECK:STDOUT: }
180182
// CHECK:STDOUT:
181183
// CHECK:STDOUT: imports {
182-
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
184+
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
183185
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
184186
// CHECK:STDOUT: }
185187
// CHECK:STDOUT:
@@ -195,7 +197,7 @@ fn F(a: array({}, 3)) -> {} {
195197
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
196198
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
197199
// CHECK:STDOUT: %bound_method.loc6_24.1: <bound method> = bound_method %.loc6_24.1, %impl.elem0 [concrete = constants.%Convert.bound]
198-
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
200+
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
199201
// CHECK:STDOUT: %bound_method.loc6_24.2: <bound method> = bound_method %.loc6_24.1, %specific_fn [concrete = constants.%bound_method]
200202
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc6_24.2(%.loc6_24.1) [concrete = constants.%int_2.ef8]
201203
// CHECK:STDOUT: %.loc6_24.2: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2.ef8]

0 commit comments

Comments
 (0)