From 55300d1ebbdf3e367b5a2f3ed4f7b527f95f2321 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Thu, 23 May 2024 09:00:08 -0700 Subject: [PATCH] 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). --- core/prelude.carbon | 6 - core/prelude/operators/comparison.carbon | 2 + core/prelude/types.carbon | 7 +- core/prelude/types/bool.carbon | 7 + core/prelude/types/i32.carbon | 2 + toolchain/check/handle_literal.cpp | 39 +- .../check/testdata/alias/builtins.carbon | 36 -- .../testdata/alias/fail_bool_value.carbon | 9 + .../check/testdata/alias/fail_builtins.carbon | 46 ++ .../testdata/array/array_in_place.carbon | 54 ++- .../testdata/array/array_vs_tuple.carbon | 28 +- .../testdata/array/assign_return_value.carbon | 32 +- .../check/testdata/array/assign_var.carbon | 67 ++- toolchain/check/testdata/array/base.carbon | 100 ++-- .../testdata/array/canonicalize_index.carbon | 32 +- .../testdata/array/fail_bound_negative.carbon | 24 +- .../testdata/array/fail_bound_overflow.carbon | 15 +- .../testdata/array/fail_out_of_bound.carbon | 31 +- .../fail_out_of_bound_non_literal.carbon | 63 ++- .../testdata/array/fail_type_mismatch.carbon | 105 +++-- .../array/fail_undefined_bound.carbon | 8 + .../testdata/array/function_param.carbon | 46 +- .../testdata/array/index_not_literal.carbon | 63 ++- .../check/testdata/array/nine_elements.carbon | 95 ++-- .../testdata/as/adapter_conversion.carbon | 145 ++++-- toolchain/check/testdata/as/as_type.carbon | 23 +- toolchain/check/testdata/as/basic.carbon | 22 +- .../testdata/as/fail_no_conversion.carbon | 39 +- .../check/testdata/as/fail_not_type.carbon | 17 +- .../testdata/basics/builtin_types.carbon | 37 +- .../testdata/basics/fail_bad_run_2.carbon | 14 +- .../fail_numeric_literal_overflow.carbon | 35 ++ .../basics/fail_qualifier_unsupported.carbon | 16 + .../testdata/basics/numeric_literals.carbon | 68 ++- toolchain/check/testdata/basics/parens.carbon | 21 +- .../check/testdata/basics/run_i32.carbon | 14 +- .../testdata/basics/type_literals.carbon | 142 ++++-- .../check/testdata/builtins/float/add.carbon | 214 +++++++-- .../check/testdata/builtins/float/div.carbon | 256 +++++++++-- .../check/testdata/builtins/float/eq.carbon | 115 +++-- .../testdata/builtins/float/greater.carbon | 159 ++++--- .../testdata/builtins/float/greater_eq.carbon | 159 ++++--- .../check/testdata/builtins/float/less.carbon | 159 ++++--- .../testdata/builtins/float/less_eq.carbon | 159 ++++--- .../testdata/builtins/float/make_type.carbon | 52 ++- .../check/testdata/builtins/float/mul.carbon | 214 +++++++-- .../testdata/builtins/float/negate.carbon | 189 ++++++-- .../check/testdata/builtins/float/neq.carbon | 115 +++-- .../check/testdata/builtins/float/sub.carbon | 214 +++++++-- .../check/testdata/builtins/int/and.carbon | 50 +- .../testdata/builtins/int/complement.carbon | 60 ++- .../check/testdata/builtins/int/eq.carbon | 74 ++- .../testdata/builtins/int/greater.carbon | 74 ++- .../testdata/builtins/int/greater_eq.carbon | 74 ++- .../testdata/builtins/int/left_shift.carbon | 134 +++++- .../check/testdata/builtins/int/less.carbon | 74 ++- .../testdata/builtins/int/less_eq.carbon | 74 ++- .../builtins/int/make_type_signed.carbon | 74 ++- .../builtins/int/make_type_unsigned.carbon | 74 ++- .../check/testdata/builtins/int/neq.carbon | 52 ++- .../check/testdata/builtins/int/or.carbon | 50 +- .../testdata/builtins/int/right_shift.carbon | 172 +++++-- .../check/testdata/builtins/int/sadd.carbon | 230 ++++++++-- .../check/testdata/builtins/int/sdiv.carbon | 166 +++++-- .../check/testdata/builtins/int/smod.carbon | 166 +++++-- .../check/testdata/builtins/int/smul.carbon | 84 +++- .../testdata/builtins/int/snegate.carbon | 236 ++++++++-- .../check/testdata/builtins/int/ssub.carbon | 94 +++- .../check/testdata/builtins/int/uadd.carbon | 230 ++++++++-- .../check/testdata/builtins/int/udiv.carbon | 166 +++++-- .../check/testdata/builtins/int/umod.carbon | 166 +++++-- .../check/testdata/builtins/int/umul.carbon | 84 +++- .../testdata/builtins/int/unegate.carbon | 236 ++++++++-- .../check/testdata/builtins/int/usub.carbon | 94 +++- .../check/testdata/builtins/int/xor.carbon | 50 +- toolchain/check/testdata/class/adapt.carbon | 37 +- toolchain/check/testdata/class/base.carbon | 70 ++- .../check/testdata/class/base_field.carbon | 76 ++- .../check/testdata/class/base_method.carbon | 36 +- .../class/base_method_qualified.carbon | 74 ++- toolchain/check/testdata/class/basic.carbon | 58 ++- .../class/complete_in_member_fn.carbon | 24 +- .../testdata/class/compound_field.carbon | 102 +++-- .../class/cross_package_import.carbon | 18 +- .../testdata/class/derived_to_base.carbon | 108 +++-- .../check/testdata/class/extend_adapt.carbon | 101 ++-- .../check/testdata/class/fail_abstract.carbon | 58 ++- .../class/fail_adapt_with_subobjects.carbon | 69 ++- .../testdata/class/fail_base_bad_type.carbon | 152 ++++-- .../class/fail_compound_type_mismatch.carbon | 40 +- .../class/fail_derived_to_base.carbon | 60 ++- .../class/fail_field_modifiers.carbon | 45 +- .../testdata/class/fail_incomplete.carbon | 54 ++- .../check/testdata/class/fail_init.carbon | 30 +- .../class/fail_init_as_inplace.carbon | 44 +- .../testdata/class/fail_member_of_let.carbon | 18 +- .../check/testdata/class/fail_scope.carbon | 22 +- .../class/fail_self_type_member.carbon | 21 +- .../testdata/class/fail_todo_modifiers.carbon | 40 +- .../testdata/class/fail_unbound_field.carbon | 36 +- .../testdata/class/fail_unknown_member.carbon | 26 +- .../check/testdata/class/field_access.carbon | 46 +- .../class/field_access_in_value.carbon | 46 +- .../check/testdata/class/generic/call.carbon | 94 +++- .../class/generic/fail_todo_use.carbon | 20 +- .../testdata/class/generic/redeclare.carbon | 42 +- toolchain/check/testdata/class/import.carbon | 44 +- .../check/testdata/class/import_base.carbon | 30 +- toolchain/check/testdata/class/init.carbon | 44 +- .../check/testdata/class/init_adapt.carbon | 112 +++-- toolchain/check/testdata/class/init_as.carbon | 40 +- .../check/testdata/class/init_nested.carbon | 38 +- toolchain/check/testdata/class/method.carbon | 138 ++++-- .../check/testdata/class/nested_name.carbon | 34 +- .../check/testdata/class/raw_self.carbon | 70 ++- .../check/testdata/class/redeclaration.carbon | 20 +- .../check/testdata/class/reenter_scope.carbon | 32 +- toolchain/check/testdata/class/reorder.carbon | 24 +- .../testdata/class/reorder_qualified.carbon | 84 ++-- toolchain/check/testdata/class/scope.carbon | 48 +- toolchain/check/testdata/class/self.carbon | 46 +- .../testdata/class/self_conversion.carbon | 60 ++- .../check/testdata/class/self_type.carbon | 26 +- .../check/testdata/class/static_method.carbon | 24 +- toolchain/check/testdata/const/basic.carbon | 52 ++- .../check/testdata/const/collapse.carbon | 38 +- .../check/testdata/const/fail_collapse.carbon | 40 +- toolchain/check/testdata/const/import.carbon | 63 ++- .../check/testdata/eval/aggregate.carbon | 209 ++++++--- .../check/testdata/eval/fail_aggregate.carbon | 81 ++-- .../check/testdata/eval/fail_symbolic.carbon | 20 +- .../expr_category/in_place_tuple_init.carbon | 70 ++- .../testdata/function/builtin/call.carbon | 28 +- .../function/builtin/definition.carbon | 22 +- .../function/builtin/fail_redefined.carbon | 96 +++- .../testdata/function/builtin/method.carbon | 34 +- .../no_prelude/call_from_operator.carbon | 56 ++- .../builtin/{ => no_prelude}/import.carbon | 48 +- .../function/call/fail_not_callable.carbon | 14 +- .../function/call/fail_param_count.carbon | 36 +- .../function/call/fail_param_type.carbon | 20 +- .../call/fail_return_type_mismatch.carbon | 34 +- .../check/testdata/function/call/i32.carbon | 32 +- .../function/call/more_param_ir.carbon | 32 +- .../testdata/function/call/params_one.carbon | 20 +- .../function/call/params_one_comma.carbon | 22 +- .../testdata/function/call/params_two.carbon | 24 +- .../function/call/params_two_comma.carbon | 26 +- .../declaration/fail_param_in_type.carbon | 18 +- .../declaration/fail_param_redecl.carbon | 18 +- .../function/declaration/import.carbon | 432 ++++++++++++------ .../declaration/param_same_name.carbon | 22 +- .../function/definition/import.carbon | 92 +++- .../fail_decl_param_mismatch.carbon | 49 +- .../function/definition/params_one.carbon | 14 +- .../definition/params_one_comma.carbon | 14 +- .../function/definition/params_two.carbon | 18 +- .../definition/params_two_comma.carbon | 18 +- .../generic/fail_todo_param_in_type.carbon | 18 +- toolchain/check/testdata/global/decl.carbon | 12 + .../check/testdata/global/simple_init.carbon | 13 +- .../testdata/global/simple_with_fun.carbon | 20 +- toolchain/check/testdata/if/else.carbon | 12 +- .../if/fail_reachable_fallthrough.carbon | 46 +- toolchain/check/testdata/if/fail_scope.carbon | 30 +- toolchain/check/testdata/if/no_else.carbon | 12 +- .../if/unreachable_fallthrough.carbon | 22 +- toolchain/check/testdata/if_expr/basic.carbon | 34 +- .../if_expr/constant_condition.carbon | 104 +++-- .../testdata/if_expr/control_flow.carbon | 42 +- .../if_expr/fail_not_in_function.carbon | 28 +- .../if_expr/fail_partial_constant.carbon | 50 +- .../check/testdata/if_expr/nested.carbon | 30 +- .../check/testdata/if_expr/struct.carbon | 52 ++- toolchain/check/testdata/impl/compound.carbon | 66 ++- .../check/testdata/impl/declaration.carbon | 9 + toolchain/check/testdata/impl/empty.carbon | 13 +- .../testdata/impl/fail_call_invalid.carbon | 20 +- .../impl/fail_extend_impl_scope.carbon | 13 +- .../impl/fail_extend_impl_type_as.carbon | 17 +- .../impl/fail_extend_non_interface.carbon | 14 +- .../impl/fail_impl_bad_assoc_const.carbon | 9 + .../impl/fail_impl_bad_assoc_fn.carbon | 164 +++++-- .../impl/fail_impl_bad_interface.carbon | 13 +- .../testdata/impl/fail_redefinition.carbon | 17 +- .../impl/fail_todo_impl_assoc_const.carbon | 9 + .../lookup/fail_todo_undefined_impl.carbon | 18 +- .../check/testdata/impl/lookup/import.carbon | 16 +- .../impl/lookup/instance_method.carbon | 34 +- .../check/testdata/impl/redeclaration.carbon | 23 +- .../index/array_element_access.carbon | 59 ++- .../check/testdata/index/expr_category.carbon | 80 ++-- .../index/fail_array_large_index.carbon | 47 +- .../index/fail_array_non_int_indexing.carbon | 41 +- .../fail_array_out_of_bound_access.carbon | 39 +- .../testdata/index/fail_expr_category.carbon | 50 +- .../testdata/index/fail_invalid_base.carbon | 50 +- .../testdata/index/fail_name_not_found.carbon | 14 +- .../index/fail_negative_indexing.carbon | 68 +-- .../index/fail_non_deterministic_type.carbon | 49 +- .../fail_out_of_bound_not_literal.carbon | 55 ++- .../index/fail_tuple_index_error.carbon | 41 +- .../index/fail_tuple_large_index.carbon | 47 +- .../index/fail_tuple_non_int_indexing.carbon | 45 +- .../fail_tuple_out_of_bound_access.carbon | 45 +- .../testdata/index/index_not_literal.carbon | 55 ++- .../index/tuple_element_access.carbon | 39 +- .../index/tuple_return_value_access.carbon | 32 +- .../testdata/interface/assoc_const.carbon | 17 +- .../fail_todo_assoc_const_default.carbon | 43 +- .../fail_todo_define_default_fn_inline.carbon | 24 +- ..._todo_define_default_fn_out_of_line.carbon | 44 +- .../fail_assoc_const_not_constant.carbon | 10 +- .../interface/todo_define_not_default.carbon | 44 +- .../ir/duplicate_name_same_line.carbon | 16 +- toolchain/check/testdata/let/convert.carbon | 46 +- .../testdata/let/fail_duplicate_decl.carbon | 24 +- .../check/testdata/let/fail_generic.carbon | 24 +- .../testdata/let/fail_generic_import.carbon | 11 +- .../testdata/let/fail_missing_value.carbon | 18 +- .../check/testdata/let/fail_modifiers.carbon | 71 ++- .../testdata/let/fail_todo_modifiers.carbon | 15 +- .../testdata/let/fail_use_in_init.carbon | 12 +- toolchain/check/testdata/let/generic.carbon | 14 +- .../check/testdata/let/generic_import.carbon | 11 +- toolchain/check/testdata/let/global.carbon | 24 +- toolchain/check/testdata/let/import.carbon | 30 +- toolchain/check/testdata/let/local.carbon | 22 +- .../check/testdata/let/shadowed_decl.carbon | 26 +- .../testdata/namespace/add_to_import.carbon | 24 +- .../check/testdata/namespace/alias.carbon | 38 +- .../namespace/fail_decl_in_alias.carbon | 16 +- .../check/testdata/namespace/shadow.carbon | 20 +- .../testdata/operators/builtin/and.carbon | 76 ++- .../operators/builtin/assignment.carbon | 44 +- .../fail_and_or_not_in_function.carbon | 40 +- .../fail_and_or_partial_constant.carbon | 52 ++- .../fail_assignment_to_non_assignable.carbon | 54 ++- .../fail_redundant_compound_access.carbon | 28 +- .../builtin/fail_type_mismatch.carbon | 12 +- .../fail_type_mismatch_assignment.carbon | 16 +- .../builtin/fail_type_mismatch_once.carbon | 34 +- .../builtin/fail_unimplemented_op.carbon | 32 +- .../testdata/operators/builtin/or.carbon | 76 ++- .../operators/builtin/unary_op.carbon | 42 +- .../testdata/operators/overloaded/eq.carbon | 198 +++++--- .../operators/overloaded/ordered.carbon | 238 ++++++---- .../package_expr/fail_not_found.carbon | 12 +- .../check/testdata/package_expr/syntax.carbon | 51 ++- .../fail_conflict_no_namespaces.carbon | 14 +- .../packages/fail_import_type_error.carbon | 24 + .../testdata/pointer/address_of_deref.carbon | 22 +- .../testdata/pointer/address_of_lvalue.carbon | 62 ++- toolchain/check/testdata/pointer/basic.carbon | 28 +- .../pointer/fail_address_of_value.carbon | 70 ++- .../testdata/pointer/fail_deref_error.carbon | 20 +- .../pointer/fail_deref_not_pointer.carbon | 24 +- .../testdata/pointer/fail_deref_type.carbon | 20 +- .../check/testdata/pointer/import.carbon | 38 +- .../testdata/pointer/nested_const.carbon | 40 +- toolchain/check/testdata/pointer/types.carbon | 40 +- .../testdata/return/code_after_return.carbon | 9 +- .../return/code_after_return_value.carbon | 23 +- .../testdata/return/fail_call_in_type.carbon | 14 +- .../testdata/return/fail_let_in_type.carbon | 10 +- .../return/fail_missing_return.carbon | 14 +- .../fail_return_var_no_returned_var.carbon | 14 +- .../fail_return_with_returned_var.carbon | 40 +- .../return/fail_returned_var_shadow.carbon | 54 ++- .../return/fail_returned_var_type.carbon | 28 +- .../testdata/return/fail_type_mismatch.carbon | 14 +- .../testdata/return/fail_value_missing.carbon | 14 +- .../testdata/return/fail_var_in_type.carbon | 14 +- .../check/testdata/return/returned_var.carbon | 48 +- .../testdata/return/returned_var_scope.carbon | 54 ++- toolchain/check/testdata/return/struct.carbon | 24 +- toolchain/check/testdata/return/tuple.carbon | 26 +- toolchain/check/testdata/return/value.carbon | 14 +- .../testdata/struct/fail_assign_empty.carbon | 15 +- .../struct/fail_duplicate_name.carbon | 58 ++- .../struct/fail_field_name_mismatch.carbon | 25 +- .../struct/fail_field_type_mismatch.carbon | 19 +- .../struct/fail_member_access_type.carbon | 33 +- .../struct/fail_non_member_access.carbon | 27 +- .../struct/fail_too_few_values.carbon | 25 +- .../testdata/struct/fail_type_assign.carbon | 19 +- toolchain/check/testdata/struct/import.carbon | 132 ++++-- .../struct/literal_member_access.carbon | 36 +- .../testdata/struct/member_access.carbon | 51 ++- .../struct/nested_struct_in_place.carbon | 70 ++- .../check/testdata/struct/one_entry.carbon | 29 +- .../testdata/struct/reorder_fields.carbon | 77 +++- .../testdata/struct/tuple_as_element.carbon | 59 ++- .../check/testdata/struct/two_entries.carbon | 75 ++- .../testdata/tuples/fail_assign_nested.carbon | 73 +-- .../tuples/fail_element_type_mismatch.carbon | 35 +- .../tuples/fail_nested_incomplete.carbon | 25 +- .../tuples/fail_too_few_element.carbon | 29 +- .../testdata/tuples/fail_type_assign.carbon | 21 +- toolchain/check/testdata/tuples/import.carbon | 168 ++++--- .../check/testdata/tuples/nested_tuple.carbon | 61 ++- .../tuples/nested_tuple_in_place.carbon | 106 ++++- .../check/testdata/tuples/one_element.carbon | 31 +- .../check/testdata/tuples/two_elements.carbon | 77 +++- .../var/fail_todo_control_flow_init.carbon | 12 + .../testdata/while/break_continue.carbon | 90 ++-- .../testdata/while/unreachable_end.carbon | 38 +- toolchain/check/testdata/while/while.carbon | 38 +- toolchain/lower/testdata/class/adapt.carbon | 4 +- toolchain/lower/testdata/class/base.carbon | 4 +- .../function/call/struct_param.carbon | 4 +- .../testdata/pointer/address_of_field.carbon | 4 +- .../testdata/struct/member_access.carbon | 8 +- .../lower/testdata/struct/two_entries.carbon | 4 +- 314 files changed, 12506 insertions(+), 4323 deletions(-) create mode 100644 core/prelude/types/bool.carbon delete mode 100644 toolchain/check/testdata/alias/builtins.carbon create mode 100644 toolchain/check/testdata/alias/fail_builtins.carbon rename toolchain/check/testdata/function/builtin/{ => no_prelude}/import.carbon (63%) diff --git a/core/prelude.carbon b/core/prelude.carbon index 1fd925feb8d6..a6a9e2a9d7a2 100644 --- a/core/prelude.carbon +++ b/core/prelude.carbon @@ -8,9 +8,3 @@ package Core library "prelude"; export import library "prelude/operators"; export import library "prelude/types"; - -// TODO: Uncomment once name deduplication works. -// TODO: These are here for name lookup. Add a way to export import and move them out. -// fn Int32() -> type = "int.make_type_32"; -// fn Float(size: i32) -> type = "float.make_type"; -// fn Bool() -> type = "bool.make_type"; diff --git a/core/prelude/operators/comparison.carbon b/core/prelude/operators/comparison.carbon index f8c01c70deaa..03e2ea3069d2 100644 --- a/core/prelude/operators/comparison.carbon +++ b/core/prelude/operators/comparison.carbon @@ -4,6 +4,8 @@ package Core library "prelude/operators/comparison"; +export import library "prelude/types/bool"; + // Equality comparison: `a == b` and `a != b`. interface Eq { fn Equal[self: Self](other: Self) -> bool; diff --git a/core/prelude/types.carbon b/core/prelude/types.carbon index 57895ab555e1..96a4ec7648e1 100644 --- a/core/prelude/types.carbon +++ b/core/prelude/types.carbon @@ -4,9 +4,14 @@ package Core library "prelude/types"; -// TODO: Add a mechanism to re-export the names declared here. +export import library "prelude/types/bool"; // TODO: Start importing `prelude/types/i32` here once we stop eagerly importing // all `impl`s from all imported files. Currently, this introduces too much // noise in the toolchain tests. // import library "prelude/types/i32"; + +fn Int32() -> type = "int.make_type_32"; +fn Int(size: i32) -> type = "int.make_type_signed"; +fn UInt(size: i32) -> type = "int.make_type_unsigned"; +fn Float(size: i32) -> type = "float.make_type"; diff --git a/core/prelude/types/bool.carbon b/core/prelude/types/bool.carbon new file mode 100644 index 000000000000..212086e256e6 --- /dev/null +++ b/core/prelude/types/bool.carbon @@ -0,0 +1,7 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +package Core library "prelude/types/bool"; + +fn Bool() -> type = "bool.make_type"; diff --git a/core/prelude/types/i32.carbon b/core/prelude/types/i32.carbon index 9250f6a8745f..7cd2c00611de 100644 --- a/core/prelude/types/i32.carbon +++ b/core/prelude/types/i32.carbon @@ -4,6 +4,8 @@ package Core library "prelude/types/i32"; +// For Int32(): +import library "prelude/types"; import library "prelude/operators"; impl i32 as Add { diff --git a/toolchain/check/handle_literal.cpp b/toolchain/check/handle_literal.cpp index c84f80d848f2..5a1d822cfb87 100644 --- a/toolchain/check/handle_literal.cpp +++ b/toolchain/check/handle_literal.cpp @@ -113,11 +113,9 @@ auto HandleStringLiteral(Context& context, Parse::StringLiteralId node_id) auto HandleBoolTypeLiteral(Context& context, Parse::BoolTypeLiteralId node_id) -> bool { - // TODO: Migrate once functions can be in prelude.carbon. - // auto fn_inst_id = context.LookupNameInCore(node_id, "Bool"); - // auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {}); - // context.node_stack().Push(node_id, type_inst_id); - context.node_stack().Push(node_id, SemIR::InstId::BuiltinBoolType); + auto fn_inst_id = context.LookupNameInCore(node_id, "Bool"); + auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {}); + context.node_stack().Push(node_id, type_inst_id); return true; } @@ -135,13 +133,11 @@ static auto HandleIntOrUnsignedIntTypeLiteral(Context& context, node_id, IntWidthNotMultipleOf8, int_kind.is_signed() ? "Int" : "UInt", llvm::APSInt(context.ints().Get(size_id), /*isUnsigned=*/true)); } - // TODO: Migrate to a call to `Core.Int` or `Core.UInt`. auto width_id = MakeI32Literal(context, node_id, size_id); - context.AddInstAndPush( - {node_id, SemIR::IntType{.type_id = context.GetBuiltinType( - SemIR::BuiltinKind::TypeType), - .int_kind = int_kind, - .bit_width_id = width_id}}); + auto fn_inst_id = context.LookupNameInCore( + node_id, int_kind == SemIR::IntKind::Signed ? "Int" : "UInt"); + auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {width_id}); + context.node_stack().Push(node_id, type_inst_id); return true; } @@ -152,7 +148,9 @@ auto HandleIntTypeLiteral(Context& context, Parse::IntTypeLiteralId node_id) // Special case: `i32` has a custom builtin for now. // TODO: Remove this special case. if (context.ints().Get(size_id) == 32) { - context.node_stack().Push(node_id, SemIR::InstId::BuiltinIntType); + auto fn_inst_id = context.LookupNameInCore(node_id, "Int32"); + auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {}); + context.node_stack().Push(node_id, type_inst_id); return true; } return HandleIntOrUnsignedIntTypeLiteral(context, node_id, @@ -175,17 +173,12 @@ auto HandleFloatTypeLiteral(Context& context, Parse::FloatTypeLiteralId node_id) if (text != "f64") { return context.TODO(node_id, "Currently only f64 is allowed"); } - // TODO: Migrate once functions can be in prelude.carbon. - // auto fn_inst_id = context.LookupNameInCore(node_id, "Float"); - // auto width_inst_id = context.AddInstInNoBlock( - // {node_id, - // SemIR::IntLiteral{ - // context.GetBuiltinType(SemIR::BuiltinKind::IntType), - // context.ints().Add(llvm::APInt(/*numBits=*/32, /*val=*/64))}}); - // auto type_inst_id = - // PerformCall(context, node_id, fn_inst_id, {width_inst_id}); - // context.node_stack().Push(node_id, type_inst_id); - context.node_stack().Push(node_id, SemIR::InstId::BuiltinFloatType); + auto tok_id = context.parse_tree().node_token(node_id); + auto size_id = context.tokens().GetTypeLiteralSize(tok_id); + auto width_id = MakeI32Literal(context, node_id, size_id); + auto fn_inst_id = context.LookupNameInCore(node_id, "Float"); + auto type_inst_id = PerformCall(context, node_id, fn_inst_id, {width_id}); + context.node_stack().Push(node_id, type_inst_id); return true; } diff --git a/toolchain/check/testdata/alias/builtins.carbon b/toolchain/check/testdata/alias/builtins.carbon deleted file mode 100644 index d6188bddfa75..000000000000 --- a/toolchain/check/testdata/alias/builtins.carbon +++ /dev/null @@ -1,36 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// AUTOUPDATE - -alias a = i32; -let a_test: a = 0; - -alias b = bool; -let b_test: b = false; - -// CHECK:STDOUT: --- builtins.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .a = %a -// CHECK:STDOUT: .b = %b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %a: type = bind_alias a, i32 [template = i32] -// CHECK:STDOUT: %a.ref: type = name_ref a, %a [template = i32] -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %a_test: i32 = bind_name a_test, %.loc8 -// CHECK:STDOUT: %b: type = bind_alias b, bool [template = bool] -// CHECK:STDOUT: %b.ref: type = name_ref b, %b [template = bool] -// CHECK:STDOUT: %.loc11: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %b_test: bool = bind_name b_test, %.loc11 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/fail_bool_value.carbon b/toolchain/check/testdata/alias/fail_bool_value.carbon index 1255d44d9a61..72dc20c7ea29 100644 --- a/toolchain/check/testdata/alias/fail_bool_value.carbon +++ b/toolchain/check/testdata/alias/fail_bool_value.carbon @@ -14,6 +14,9 @@ let a_test: bool = a; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal false [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,7 +27,13 @@ let a_test: bool = a; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc10: bool = bool_literal false [template = constants.%.1] // CHECK:STDOUT: %a: = bind_alias a, [template = ] +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_13.2: type = converted %bool.make_type, %.loc11_13.1 [template = bool] // CHECK:STDOUT: %a.ref: = name_ref a, %a [template = ] // CHECK:STDOUT: %a_test: bool = bind_name a_test, // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/fail_builtins.carbon b/toolchain/check/testdata/alias/fail_builtins.carbon new file mode 100644 index 000000000000..abe6aefdfe91 --- /dev/null +++ b/toolchain/check/testdata/alias/fail_builtins.carbon @@ -0,0 +1,46 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE + +// CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: ERROR: Alias initializer must be a name reference. +// CHECK:STDERR: alias a = i32; +// CHECK:STDERR: ^~~ +// CHECK:STDERR: +alias a = i32; + +// CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: ERROR: Alias initializer must be a name reference. +// CHECK:STDERR: alias b = bool; +// CHECK:STDERR: ^~~~ +alias b = bool; + +// CHECK:STDOUT: --- fail_builtins.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// 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: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = %Core +// CHECK:STDOUT: .a = %a +// CHECK:STDOUT: .b = %b +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %a: = bind_alias a, [template = ] +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %b: = bind_alias b, [template = ] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index 882175d4387f..af4fc07f90b8 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -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 [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 // 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 diff --git a/toolchain/check/testdata/array/array_vs_tuple.carbon b/toolchain/check/testdata/array/array_vs_tuple.carbon index 1bdb1c672320..a54c2fa3749c 100644 --- a/toolchain/check/testdata/array/array_vs_tuple.carbon +++ b/toolchain/check/testdata/array/array_vs_tuple.carbon @@ -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 [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: diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index 608e3c83af5f..98917a99dda7 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -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 [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 // 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 diff --git a/toolchain/check/testdata/array/assign_var.carbon b/toolchain/check/testdata/array/assign_var.carbon index 8acde8a25e64..993173b62c7a 100644 --- a/toolchain/check/testdata/array/assign_var.carbon +++ b/toolchain/check/testdata/array/assign_var.carbon @@ -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 [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 diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index ba766f5f4d2b..ec7f07734f2e 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -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 [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] diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index 94341137c903..aa8c5452942d 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -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 [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 // 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() { diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index bc65beb2f78f..d631e4c864ea 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -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 [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 // 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 = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = 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: diff --git a/toolchain/check/testdata/array/fail_bound_overflow.carbon b/toolchain/check/testdata/array/fail_bound_overflow.carbon index 8dc7e0e28a3d..8dfe35f2c5a5 100644 --- a/toolchain/check/testdata/array/fail_bound_overflow.carbon +++ b/toolchain/check/testdata/array/fail_bound_overflow.carbon @@ -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 [template] {} -// CHECK:STDOUT: %.loc14: type = array_type , i32 [template = ] +// 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 , i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = 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 , [template = ] // CHECK:STDOUT: %b.var: ref = var b // CHECK:STDOUT: %b: ref = bind_name b, %b.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/fail_out_of_bound.carbon b/toolchain/check/testdata/array/fail_out_of_bound.carbon index a68e377ae5a0..5be48b859cf2 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound.carbon @@ -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 [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, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon index 8b817c343ca4..62039573a52e 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon @@ -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 [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 = ] // CHECK:STDOUT: %.loc11_34.2: i32 = bind_value %.loc11_34.1 // CHECK:STDOUT: assign file.%b.var, %.loc11_34.2 diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index e9ec934e953a..1f3a94f1daed 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -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 [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, // 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, -// 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, // CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, file.%t2 diff --git a/toolchain/check/testdata/array/fail_undefined_bound.carbon b/toolchain/check/testdata/array/fail_undefined_bound.carbon index 0bbab92ba714..1f21ae9a58cd 100644 --- a/toolchain/check/testdata/array/fail_undefined_bound.carbon +++ b/toolchain/check/testdata/array/fail_undefined_bound.carbon @@ -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: diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index c5ec40912b74..2e974911025a 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -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 [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 // 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 // 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 diff --git a/toolchain/check/testdata/array/index_not_literal.carbon b/toolchain/check/testdata/array/index_not_literal.carbon index c5656da82b5e..1cc9885b222c 100644 --- a/toolchain/check/testdata/array/index_not_literal.carbon +++ b/toolchain/check/testdata/array/index_not_literal.carbon @@ -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 [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 diff --git a/toolchain/check/testdata/array/nine_elements.carbon b/toolchain/check/testdata/array/nine_elements.carbon index d48acf92686f..c91582db225b 100644 --- a/toolchain/check/testdata/array/nine_elements.carbon +++ b/toolchain/check/testdata/array/nine_elements.carbon @@ -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 [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 diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index 5a7bce54f6d5..b5718ac797a3 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -102,15 +102,17 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A, 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 = unbound_element_type A, i32 [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] // CHECK:STDOUT: %.3: type = struct_type {.x: i32, .y: i32} [template] // CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .y: i32} [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.2: A = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %struct.3: A = struct_value (%.5, %.6) [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.7: type = ptr_type B [template] // CHECK:STDOUT: } @@ -125,6 +127,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// 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: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %A.ref.loc17: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a_ref.var: ref A = var a_ref @@ -153,17 +157,23 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc5: = field_decl x, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl y, element1 [template] -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl x, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl y, element1 [template] +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %return.var: ref A = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .x = %.loc5 -// CHECK:STDOUT: .y = %.loc6 +// CHECK:STDOUT: .x = %.loc5_8 +// CHECK:STDOUT: .y = %.loc6_8 // CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: } // CHECK:STDOUT: @@ -175,6 +185,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> @A.%return.var: A { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.5] @@ -184,8 +196,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %.loc9_27.3: init i32 = initialize_from %.loc9_18 to %.loc9_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc9_27.4: ref i32 = class_element_access @A.%return.var, element1 // CHECK:STDOUT: %.loc9_27.5: init i32 = initialize_from %.loc9_26 to %.loc9_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_27.6: init A = class_init (%.loc9_27.3, %.loc9_27.5), @A.%return.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_28: init A = converted %.loc9_27.1, %.loc9_27.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_27.6: init A = class_init (%.loc9_27.3, %.loc9_27.5), @A.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_28: init A = converted %.loc9_27.1, %.loc9_27.6 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc9_28 to @A.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -198,11 +210,11 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %.loc17_31.3: init i32 = initialize_from %.loc17_22 to %.loc17_31.2 [template = constants.%.5] // CHECK:STDOUT: %.loc17_31.4: ref i32 = class_element_access file.%a_ref.var, element1 // CHECK:STDOUT: %.loc17_31.5: init i32 = initialize_from %.loc17_30 to %.loc17_31.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_31.6: init A = class_init (%.loc17_31.3, %.loc17_31.5), file.%a_ref.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc17_32: init A = converted %.loc17_31.1, %.loc17_31.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc17_31.6: init A = class_init (%.loc17_31.3, %.loc17_31.5), file.%a_ref.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_32: init A = converted %.loc17_31.1, %.loc17_31.6 [template = constants.%struct.3] // CHECK:STDOUT: assign file.%a_ref.var, %.loc17_32 // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %Make.ref: Make = name_ref Make, @A.%Make.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, @A.%Make.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc24_5: ref B = splice_block file.%b_factory.var {} // CHECK:STDOUT: %Make.call: init A = call %Make.ref() to %.loc24_5 // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] @@ -216,7 +228,10 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// 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 { @@ -226,25 +241,43 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %A.ref.loc8_8: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc8_13: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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_18.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_18.2: type = converted %int.make_type_32.loc8, %.loc8_18.1 [template = i32] // CHECK:STDOUT: %A.ref.loc8_26: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc8_23.1: A = as_compatible %.loc8_13 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_23.2: A = converted %.loc8_13, %.loc8_23.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_23.1: A = as_compatible %.loc8_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_23.2: A = converted %.loc8_13, %.loc8_23.1 [template = constants.%.2] // CHECK:STDOUT: %a: A = bind_name a, %.loc8_23.2 +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc9_8: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9_8 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9_8, %.loc9_8.1 [template = i32] // CHECK:STDOUT: %a.ref: A = name_ref a, %a +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc9_19: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_19.1: type = value_of_initializer %int.make_type_32.loc9_19 [template = i32] +// CHECK:STDOUT: %.loc9_19.2: type = converted %int.make_type_32.loc9_19, %.loc9_19.1 [template = i32] // CHECK:STDOUT: %.loc9_16.1: i32 = as_compatible %a.ref // CHECK:STDOUT: %.loc9_16.2: i32 = converted %a.ref, %.loc9_16.1 // CHECK:STDOUT: %n: i32 = bind_name n, %.loc9_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc5_12.2: type = converted %int.make_type_32, %.loc5_12.1 [template = i32] // CHECK:STDOUT: adapt_decl i32 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- multi_level_adapt.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -316,13 +349,16 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.x: i32, .y: 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 = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.x: i32, .y: i32} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = ptr_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: A = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: A = struct_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -334,18 +370,20 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// 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: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %B.ref.loc13_14: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc13_25: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_33: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_25: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_33: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc13_34.1: {.x: i32, .y: i32} = struct_literal (%.loc13_25, %.loc13_33) // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc13_34.2: ref A = temporary_storage // CHECK:STDOUT: %.loc13_34.3: ref i32 = class_element_access %.loc13_34.2, element0 -// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_25 to %.loc13_34.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_25 to %.loc13_34.3 [template = constants.%.5] // CHECK:STDOUT: %.loc13_34.5: ref i32 = class_element_access %.loc13_34.2, element1 -// CHECK:STDOUT: %.loc13_34.6: init i32 = initialize_from %.loc13_33 to %.loc13_34.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_34.7: init A = class_init (%.loc13_34.4, %.loc13_34.6), %.loc13_34.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_34.6: init i32 = initialize_from %.loc13_33 to %.loc13_34.5 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_34.7: init A = class_init (%.loc13_34.4, %.loc13_34.6), %.loc13_34.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_34.8: ref A = temporary %.loc13_34.2, %.loc13_34.7 // CHECK:STDOUT: %.loc13_36: ref A = converted %.loc13_34.1, %.loc13_34.8 // CHECK:STDOUT: %B.ref.loc13_45: type = name_ref B, %B.decl [template = constants.%B] @@ -359,13 +397,19 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc5: = field_decl x, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl y, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl x, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl y, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .x = %.loc5 -// CHECK:STDOUT: .y = %.loc6 +// CHECK:STDOUT: .x = %.loc5_8 +// CHECK:STDOUT: .y = %.loc6_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -376,18 +420,20 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: .Self = constants.%B // 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: %.loc24_24: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc24_32: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_24: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_32: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc24_33.1: {.x: i32, .y: i32} = struct_literal (%.loc24_24, %.loc24_32) // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc24_33.2: ref A = temporary_storage // CHECK:STDOUT: %.loc24_33.3: ref i32 = class_element_access %.loc24_33.2, element0 -// CHECK:STDOUT: %.loc24_33.4: init i32 = initialize_from %.loc24_24 to %.loc24_33.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc24_33.4: init i32 = initialize_from %.loc24_24 to %.loc24_33.3 [template = constants.%.5] // CHECK:STDOUT: %.loc24_33.5: ref i32 = class_element_access %.loc24_33.2, element1 -// CHECK:STDOUT: %.loc24_33.6: init i32 = initialize_from %.loc24_32 to %.loc24_33.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc24_33.7: init A = class_init (%.loc24_33.4, %.loc24_33.6), %.loc24_33.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc24_33.6: init i32 = initialize_from %.loc24_32 to %.loc24_33.5 [template = constants.%.6] +// CHECK:STDOUT: %.loc24_33.7: init A = class_init (%.loc24_33.4, %.loc24_33.6), %.loc24_33.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc24_33.8: ref A = temporary %.loc24_33.2, %.loc24_33.7 // CHECK:STDOUT: %.loc24_35: ref A = converted %.loc24_33.1, %.loc24_33.8 // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] @@ -402,11 +448,14 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.x: 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: type = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = ptr_type {.x: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = ptr_type {.x: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -418,6 +467,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %b.var: ref B = var b @@ -425,11 +475,14 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc5: = field_decl x, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl x, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .x = %.loc5 +// CHECK:STDOUT: .x = %.loc5_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -440,9 +493,11 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: .Self = constants.%B // 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: %.loc18_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_18: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc18_19: {.x: i32} = struct_literal (%.loc18_18) // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: assign file.%b.var, diff --git a/toolchain/check/testdata/as/as_type.carbon b/toolchain/check/testdata/as/as_type.carbon index 66760d4b3e0a..3924b2a24d38 100644 --- a/toolchain/check/testdata/as/as_type.carbon +++ b/toolchain/check/testdata/as/as_type.carbon @@ -9,8 +9,11 @@ let t: type = (i32, i32) as type; // CHECK:STDOUT: --- as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_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: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -18,8 +21,18 @@ let t: type = (i32, i32) as type; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_24: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_26: type = converted %.loc7_24, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %t: type = bind_name t, %.loc7_26 +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7_16: 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_21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_24: (type, type) = tuple_literal (%int.make_type_32.loc7_16, %int.make_type_32.loc7_21) +// CHECK:STDOUT: %.loc7_26.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] +// CHECK:STDOUT: %.loc7_26.2: type = converted %int.make_type_32.loc7_16, %.loc7_26.1 [template = i32] +// CHECK:STDOUT: %.loc7_26.3: type = value_of_initializer %int.make_type_32.loc7_21 [template = i32] +// CHECK:STDOUT: %.loc7_26.4: type = converted %int.make_type_32.loc7_21, %.loc7_26.3 [template = i32] +// CHECK:STDOUT: %.loc7_26.5: type = converted %.loc7_24, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %t: type = bind_name t, %.loc7_26.5 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 518ddf685098..bfa996c2afe9 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -11,9 +11,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -23,14 +25,24 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } +// 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 @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc8_10: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_15.2: type = converted %int.make_type_32, %.loc8_15.1 [template = i32] +// CHECK:STDOUT: return %.loc8_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_no_conversion.carbon b/toolchain/check/testdata/as/fail_no_conversion.carbon index c2fe6c90c89c..58d375cb1d17 100644 --- a/toolchain/check/testdata/as/fail_no_conversion.carbon +++ b/toolchain/check/testdata/as/fail_no_conversion.carbon @@ -12,10 +12,13 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: --- fail_no_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: 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: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,11 +26,29 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_35.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_35.2: type = converted %.loc10_35.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.loc10_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.loc10_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) +// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] +// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] +// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] +// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] +// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_35.1: (type, type) = tuple_literal (%int.make_type_32.loc10_27, %int.make_type_32.loc10_32) +// CHECK:STDOUT: %.loc10_35.2: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] +// CHECK:STDOUT: %.loc10_35.3: type = converted %int.make_type_32.loc10_27, %.loc10_35.2 [template = i32] +// CHECK:STDOUT: %.loc10_35.4: type = value_of_initializer %int.make_type_32.loc10_32 [template = i32] +// CHECK:STDOUT: %.loc10_35.5: type = converted %int.make_type_32.loc10_32, %.loc10_35.4 [template = i32] +// CHECK:STDOUT: %.loc10_35.6: type = converted %.loc10_35.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %n: (i32, i32) = bind_name n, // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_not_type.carbon b/toolchain/check/testdata/as/fail_not_type.carbon index cd347402b6c0..1110bda816a5 100644 --- a/toolchain/check/testdata/as/fail_not_type.carbon +++ b/toolchain/check/testdata/as/fail_not_type.carbon @@ -12,8 +12,11 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: --- fail_not_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [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: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -21,8 +24,14 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2 [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_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index e492f7117418..76b07c0539b9 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -12,10 +12,16 @@ var test_type: type = i32; // CHECK:STDOUT: --- builtin_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0.10000000000000001 [template] -// CHECK:STDOUT: %.3: type = ptr_type String [template] -// CHECK:STDOUT: %.4: String = string_literal "Test" [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 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.2: Float = struct_value () [template] +// CHECK:STDOUT: %.4: f64 = float_literal 0.10000000000000001 [template] +// CHECK:STDOUT: %.5: type = ptr_type String [template] +// CHECK:STDOUT: %.6: String = string_literal "Test" [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,23 +32,38 @@ var test_type: type = i32; // CHECK:STDOUT: .test_type = %test_type // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_15.2: type = converted %int.make_type_32, %.loc7_15.1 [template = i32] // CHECK:STDOUT: %test_i32.var: ref i32 = var test_i32 // CHECK:STDOUT: %test_i32: ref i32 = bind_name test_i32, %test_i32.var +// CHECK:STDOUT: %.loc8_15.1: i32 = int_literal 64 [template = constants.%.3] +// 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_15.1) [template = f64] +// CHECK:STDOUT: %.loc8_15.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc8_15.3: type = converted %float.make_type, %.loc8_15.2 [template = f64] // CHECK:STDOUT: %test_f64.var: ref f64 = var test_f64 // CHECK:STDOUT: %test_f64: ref f64 = bind_name test_f64, %test_f64.var -// CHECK:STDOUT: %.loc9: String = string_literal "Test" [template = constants.%.4] +// CHECK:STDOUT: %.loc9: String = string_literal "Test" [template = constants.%.6] // CHECK:STDOUT: %test_str: String = bind_name test_str, %.loc9 // CHECK:STDOUT: %test_type.var: ref type = var test_type // CHECK:STDOUT: %test_type: ref type = bind_name test_type, %test_type.var +// CHECK:STDOUT: %import_ref.3: 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 @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%test_i32.var, %.loc7 -// CHECK:STDOUT: %.loc8: f64 = float_literal 0.10000000000000001 [template = constants.%.2] +// CHECK:STDOUT: %.loc8: f64 = float_literal 0.10000000000000001 [template = constants.%.4] // CHECK:STDOUT: assign file.%test_f64.var, %.loc8 -// CHECK:STDOUT: assign file.%test_type.var, i32 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: assign file.%test_type.var, %int.make_type_32 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index e4e4d1bfb97a..aaadbf31ff93 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -12,9 +12,11 @@ fn Run(n: i32) {} // CHECK:STDOUT: --- fail_bad_run_2.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,12 +25,18 @@ fn Run(n: i32) {} // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// 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: %n.loc10_8.1: i32 = param n // CHECK:STDOUT: @Run.%n: i32 = bind_name n, %n.loc10_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Run(%n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon index 09606a96a14c..a88b335e81e0 100644 --- a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +++ b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon @@ -35,15 +35,50 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: --- fail_numeric_literal_overflow.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// 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 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.2: Float = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: 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: %a: i32 = bind_name a, +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] // CHECK:STDOUT: %b: i32 = bind_name b, +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_8.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_8.2: type = converted %int.make_type_32.loc23, %.loc23_8.1 [template = i32] // CHECK:STDOUT: %c: i32 = bind_name c, +// CHECK:STDOUT: %.loc29_8.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %float.make_type.loc29: init type = call constants.%struct.2(%.loc29_8.1) [template = f64] +// CHECK:STDOUT: %.loc29_8.2: type = value_of_initializer %float.make_type.loc29 [template = f64] +// CHECK:STDOUT: %.loc29_8.3: type = converted %float.make_type.loc29, %.loc29_8.2 [template = f64] // CHECK:STDOUT: %d: f64 = bind_name d, +// CHECK:STDOUT: %.loc34_8.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %float.make_type.loc34: init type = call constants.%struct.2(%.loc34_8.1) [template = f64] +// CHECK:STDOUT: %.loc34_8.2: type = value_of_initializer %float.make_type.loc34 [template = f64] +// CHECK:STDOUT: %.loc34_8.3: type = converted %float.make_type.loc34, %.loc34_8.2 [template = f64] // CHECK:STDOUT: %e: f64 = bind_name e, // 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: diff --git a/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon b/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon index 94847b6bfa65..31dc5d2cf78c 100644 --- a/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon +++ b/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon @@ -12,6 +12,12 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_qualifier_unsupported.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: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -19,12 +25,22 @@ var y: i32 = x.b; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: 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_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: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.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: %x.ref: ref i32 = name_ref x, file.%x diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index a1cfaee2d821..c424e00185ba 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -30,7 +30,9 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: F = 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 6 [template] // CHECK:STDOUT: %.3: type = array_type %.2, i32 [template] // CHECK:STDOUT: %.4: type = ptr_type [i32; 6] [template] @@ -45,16 +47,19 @@ fn F() { // CHECK:STDOUT: %.13: i32 = int_literal 4 [template] // CHECK:STDOUT: %.14: i32 = int_literal 5 [template] // CHECK:STDOUT: %array.1: [i32; 6] = tuple_value (%.5, %.6, %.5, %.5, %.7, %.7) [template] -// CHECK:STDOUT: %.15: type = array_type %.2, f64 [template] -// CHECK:STDOUT: %.16: type = ptr_type [f64; 6] [template] -// CHECK:STDOUT: %.17: f64 = float_literal 0.90000000000000002 [template] -// CHECK:STDOUT: %.18: f64 = float_literal 8 [template] -// CHECK:STDOUT: %.19: f64 = float_literal 80 [template] -// CHECK:STDOUT: %.20: f64 = float_literal 1.0E+7 [template] -// CHECK:STDOUT: %.21: f64 = float_literal 1.0E+8 [template] -// CHECK:STDOUT: %.22: f64 = float_literal 1.0E-8 [template] -// CHECK:STDOUT: %.23: type = tuple_type (f64, f64, f64, f64, f64, f64) [template] -// CHECK:STDOUT: %array.2: [f64; 6] = tuple_value (%.17, %.18, %.19, %.20, %.21, %.22) [template] +// CHECK:STDOUT: %.15: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.3: Float = struct_value () [template] +// CHECK:STDOUT: %.16: type = array_type %.2, f64 [template] +// CHECK:STDOUT: %.17: type = ptr_type [f64; 6] [template] +// CHECK:STDOUT: %.18: f64 = float_literal 0.90000000000000002 [template] +// CHECK:STDOUT: %.19: f64 = float_literal 8 [template] +// CHECK:STDOUT: %.20: f64 = float_literal 80 [template] +// CHECK:STDOUT: %.21: f64 = float_literal 1.0E+7 [template] +// CHECK:STDOUT: %.22: f64 = float_literal 1.0E+8 [template] +// CHECK:STDOUT: %.23: f64 = float_literal 1.0E-8 [template] +// CHECK:STDOUT: %.24: type = tuple_type (f64, f64, f64, f64, f64, f64) [template] +// CHECK:STDOUT: %array.2: [f64; 6] = tuple_value (%.18, %.19, %.20, %.21, %.22, %.23) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -63,12 +68,17 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] // CHECK:STDOUT: %.loc10_19: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_32, %.loc10_14.1 [template = i32] // CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32 [template = constants.%.3] // CHECK:STDOUT: %ints.var: ref [i32; 6] = var ints // CHECK:STDOUT: %ints: ref [i32; 6] = bind_name ints, %ints.var @@ -100,38 +110,46 @@ fn F() { // CHECK:STDOUT: %.loc17_3.20: init [i32; 6] = array_init (%.loc17_3.4, %.loc17_3.7, %.loc17_3.10, %.loc17_3.13, %.loc17_3.16, %.loc17_3.19) to %ints.var [template = constants.%array.1] // CHECK:STDOUT: %.loc17_4: init [i32; 6] = converted %.loc17_3.1, %.loc17_3.20 [template = constants.%array.1] // CHECK:STDOUT: assign %ints.var, %.loc17_4 +// CHECK:STDOUT: %.loc18_16.1: i32 = int_literal 64 [template = constants.%.15] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc18_16.1) [template = f64] // CHECK:STDOUT: %.loc18_21: i32 = int_literal 6 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_22: type = array_type %.loc18_21, f64 [template = constants.%.15] +// CHECK:STDOUT: %.loc18_16.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc18_16.3: type = converted %float.make_type, %.loc18_16.2 [template = f64] +// CHECK:STDOUT: %.loc18_22: type = array_type %.loc18_21, f64 [template = constants.%.16] // CHECK:STDOUT: %floats.var: ref [f64; 6] = var floats // CHECK:STDOUT: %floats: ref [f64; 6] = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc19: f64 = float_literal 0.90000000000000002 [template = constants.%.17] -// CHECK:STDOUT: %.loc20: f64 = float_literal 8 [template = constants.%.18] -// CHECK:STDOUT: %.loc21: f64 = float_literal 80 [template = constants.%.19] -// CHECK:STDOUT: %.loc22: f64 = float_literal 1.0E+7 [template = constants.%.20] -// CHECK:STDOUT: %.loc23: f64 = float_literal 1.0E+8 [template = constants.%.21] -// CHECK:STDOUT: %.loc24: f64 = float_literal 1.0E-8 [template = constants.%.22] +// CHECK:STDOUT: %.loc19: f64 = float_literal 0.90000000000000002 [template = constants.%.18] +// CHECK:STDOUT: %.loc20: f64 = float_literal 8 [template = constants.%.19] +// CHECK:STDOUT: %.loc21: f64 = float_literal 80 [template = constants.%.20] +// CHECK:STDOUT: %.loc22: f64 = float_literal 1.0E+7 [template = constants.%.21] +// CHECK:STDOUT: %.loc23: f64 = float_literal 1.0E+8 [template = constants.%.22] +// CHECK:STDOUT: %.loc24: f64 = float_literal 1.0E-8 [template = constants.%.23] // CHECK:STDOUT: %.loc25_3.1: (f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc19, %.loc20, %.loc21, %.loc22, %.loc23, %.loc24) // CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc25_3.3: ref f64 = array_index %floats.var, %.loc25_3.2 -// CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc19 to %.loc25_3.3 [template = constants.%.17] +// CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc19 to %.loc25_3.3 [template = constants.%.18] // CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc25_3.6: ref f64 = array_index %floats.var, %.loc25_3.5 -// CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc20 to %.loc25_3.6 [template = constants.%.18] +// CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc20 to %.loc25_3.6 [template = constants.%.19] // CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.11] // CHECK:STDOUT: %.loc25_3.9: ref f64 = array_index %floats.var, %.loc25_3.8 -// CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc21 to %.loc25_3.9 [template = constants.%.19] +// CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc21 to %.loc25_3.9 [template = constants.%.20] // CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.12] // CHECK:STDOUT: %.loc25_3.12: ref f64 = array_index %floats.var, %.loc25_3.11 -// CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc22 to %.loc25_3.12 [template = constants.%.20] +// CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc22 to %.loc25_3.12 [template = constants.%.21] // CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.13] // CHECK:STDOUT: %.loc25_3.15: ref f64 = array_index %floats.var, %.loc25_3.14 -// CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc23 to %.loc25_3.15 [template = constants.%.21] +// CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc23 to %.loc25_3.15 [template = constants.%.22] // CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.14] // CHECK:STDOUT: %.loc25_3.18: ref f64 = array_index %floats.var, %.loc25_3.17 -// CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc24 to %.loc25_3.18 [template = constants.%.22] +// CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc24 to %.loc25_3.18 [template = constants.%.23] // CHECK:STDOUT: %.loc25_3.20: init [f64; 6] = array_init (%.loc25_3.4, %.loc25_3.7, %.loc25_3.10, %.loc25_3.13, %.loc25_3.16, %.loc25_3.19) to %floats.var [template = constants.%array.2] // CHECK:STDOUT: %.loc25_4: init [f64; 6] = converted %.loc25_3.1, %.loc25_3.20 [template = constants.%array.2] // CHECK:STDOUT: assign %floats.var, %.loc25_4 // CHECK:STDOUT: return // 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: diff --git a/toolchain/check/testdata/basics/parens.carbon b/toolchain/check/testdata/basics/parens.carbon index cc1f5904b5f2..04be58b03aba 100644 --- a/toolchain/check/testdata/basics/parens.carbon +++ b/toolchain/check/testdata/basics/parens.carbon @@ -10,8 +10,11 @@ var b: i32 = ((2)); // CHECK:STDOUT: --- parens.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [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: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -21,17 +24,27 @@ var b: i32 = ((2)); // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.2: 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_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: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign file.%a.var, %.loc7 -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: assign file.%b.var, %.loc8 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index 806bdc229582..0c5fd570b184 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -9,9 +9,11 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: --- run_i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -21,11 +23,17 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32, %.loc7_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] diff --git a/toolchain/check/testdata/basics/type_literals.carbon b/toolchain/check/testdata/basics/type_literals.carbon index 9c4b8c5cbc0a..597fd42e0c05 100644 --- a/toolchain/check/testdata/basics/type_literals.carbon +++ b/toolchain/check/testdata/basics/type_literals.carbon @@ -111,11 +111,14 @@ var test_f128: f128; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 16 [template] -// CHECK:STDOUT: %.4: type = int_type signed, %.3 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 64 [template] -// CHECK:STDOUT: %.6: type = int_type signed, %.5 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %.3: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 16 [template] +// CHECK:STDOUT: %.5: type = int_type signed, %.4 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 64 [template] +// CHECK:STDOUT: %.7: type = int_type signed, %.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -127,27 +130,41 @@ var test_f128: f128; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 8 [template = constants.%.1] -// CHECK:STDOUT: %.loc3_14.2: type = int_type signed, %.loc3_14.1 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.1: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc3: init type = call constants.%struct(%.loc3_14.1) [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %int.make_type_signed.loc3 [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.3: type = converted %int.make_type_signed.loc3, %.loc3_14.2 [template = constants.%.3] // CHECK:STDOUT: %test_i8.var: ref i8 = var test_i8 // CHECK:STDOUT: %test_i8: ref i8 = bind_name test_i8, %test_i8.var -// CHECK:STDOUT: %.loc4_15.1: i32 = int_literal 16 [template = constants.%.3] -// CHECK:STDOUT: %.loc4_15.2: type = int_type signed, %.loc4_15.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc4_15.1: i32 = int_literal 16 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.2: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc4: init type = call constants.%struct(%.loc4_15.1) [template = constants.%.5] +// CHECK:STDOUT: %.loc4_15.2: type = value_of_initializer %int.make_type_signed.loc4 [template = constants.%.5] +// CHECK:STDOUT: %.loc4_15.3: type = converted %int.make_type_signed.loc4, %.loc4_15.2 [template = constants.%.5] // CHECK:STDOUT: %test_i16.var: ref i16 = var test_i16 // CHECK:STDOUT: %test_i16: ref i16 = bind_name test_i16, %test_i16.var -// CHECK:STDOUT: %.loc5_15.1: i32 = int_literal 64 [template = constants.%.5] -// CHECK:STDOUT: %.loc5_15.2: type = int_type signed, %.loc5_15.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc5_15.1: i32 = int_literal 64 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc5: init type = call constants.%struct(%.loc5_15.1) [template = constants.%.7] +// CHECK:STDOUT: %.loc5_15.2: type = value_of_initializer %int.make_type_signed.loc5 [template = constants.%.7] +// CHECK:STDOUT: %.loc5_15.3: type = converted %int.make_type_signed.loc5, %.loc5_15.2 [template = constants.%.7] // CHECK:STDOUT: %test_i64.var: ref i64 = var test_i64 // CHECK:STDOUT: %test_i64: ref i64 = bind_name test_i64, %test_i64.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int(%size: i32) -> type = "int.make_type_signed"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_iN_bad_width.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 15 [template] -// CHECK:STDOUT: %.4: type = int_type signed, %.3 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1000000000 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %.3: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 15 [template] +// CHECK:STDOUT: %.5: type = int_type signed, %.4 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -164,31 +181,48 @@ var test_f128: f128; // CHECK:STDOUT: %test_i0.var: ref = var test_i0 // CHECK:STDOUT: %test_i0: ref = bind_name test_i0, %test_i0.var // CHECK:STDOUT: %.loc12_14.1: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_14.2: type = int_type signed, %.loc12_14.1 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.1: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc12: init type = call constants.%struct(%.loc12_14.1) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_14.2: type = value_of_initializer %int.make_type_signed.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_14.3: type = converted %int.make_type_signed.loc12, %.loc12_14.2 [template = constants.%.3] // CHECK:STDOUT: %test_i1.var: ref i1 = var test_i1 // CHECK:STDOUT: %test_i1: ref i1 = bind_name test_i1, %test_i1.var -// CHECK:STDOUT: %.loc17_15.1: i32 = int_literal 15 [template = constants.%.3] -// CHECK:STDOUT: %.loc17_15.2: type = int_type signed, %.loc17_15.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_15.1: i32 = int_literal 15 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.2: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc17: init type = call constants.%struct(%.loc17_15.1) [template = constants.%.5] +// CHECK:STDOUT: %.loc17_15.2: type = value_of_initializer %int.make_type_signed.loc17 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_15.3: type = converted %int.make_type_signed.loc17, %.loc17_15.2 [template = constants.%.5] // CHECK:STDOUT: %test_i15.var: ref i15 = var test_i15 // CHECK:STDOUT: %test_i15: ref i15 = bind_name test_i15, %test_i15.var -// CHECK:STDOUT: %.loc22_23.1: i32 = int_literal 1000000000 [template = constants.%.5] -// CHECK:STDOUT: %.loc22_23.2: type = int_type signed, %.loc22_23.1 [template = ] +// CHECK:STDOUT: %.loc22_23.1: i32 = int_literal 1000000000 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc22: init type = call constants.%struct(%.loc22_23.1) [template = ] +// CHECK:STDOUT: %.loc22_23.2: type = value_of_initializer %int.make_type_signed.loc22 [template = ] +// CHECK:STDOUT: %.loc22_23.3: type = converted %int.make_type_signed.loc22, %.loc22_23.2 [template = ] // CHECK:STDOUT: %test_i1000000000.var: ref = var test_i1000000000 // CHECK:STDOUT: %test_i1000000000: ref = bind_name test_i1000000000, %test_i1000000000.var -// CHECK:STDOUT: %.loc28: type = int_type signed, [template = ] +// CHECK:STDOUT: %import_ref.4: Int = import_ref ir3, inst+13, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_signed.loc28: init type = call constants.%struct() [template = ] +// CHECK:STDOUT: %.loc28_33.1: type = value_of_initializer %int.make_type_signed.loc28 [template = ] +// CHECK:STDOUT: %.loc28_33.2: type = converted %int.make_type_signed.loc28, %.loc28_33.1 [template = ] // CHECK:STDOUT: %test_i10000000000000000000.var: ref = var test_i10000000000000000000 // CHECK:STDOUT: %test_i10000000000000000000: ref = bind_name test_i10000000000000000000, %test_i10000000000000000000.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int(%size: i32) -> type = "int.make_type_signed"; +// CHECK:STDOUT: // CHECK:STDOUT: --- uN.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 16 [template] -// CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 64 [template] -// CHECK:STDOUT: %.6: type = int_type unsigned, %.5 [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: %.3: type = int_type unsigned, %.1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 16 [template] +// CHECK:STDOUT: %.5: type = int_type unsigned, %.4 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 64 [template] +// CHECK:STDOUT: %.7: type = int_type unsigned, %.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -200,27 +234,41 @@ var test_f128: f128; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 8 [template = constants.%.1] -// CHECK:STDOUT: %.loc3_14.2: type = int_type unsigned, %.loc3_14.1 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.1: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc3: init type = call constants.%struct(%.loc3_14.1) [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %int.make_type_unsigned.loc3 [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.3: type = converted %int.make_type_unsigned.loc3, %.loc3_14.2 [template = constants.%.3] // CHECK:STDOUT: %test_u8.var: ref u8 = var test_u8 // CHECK:STDOUT: %test_u8: ref u8 = bind_name test_u8, %test_u8.var -// CHECK:STDOUT: %.loc4_15.1: i32 = int_literal 16 [template = constants.%.3] -// CHECK:STDOUT: %.loc4_15.2: type = int_type unsigned, %.loc4_15.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc4_15.1: i32 = int_literal 16 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.2: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc4: init type = call constants.%struct(%.loc4_15.1) [template = constants.%.5] +// CHECK:STDOUT: %.loc4_15.2: type = value_of_initializer %int.make_type_unsigned.loc4 [template = constants.%.5] +// CHECK:STDOUT: %.loc4_15.3: type = converted %int.make_type_unsigned.loc4, %.loc4_15.2 [template = constants.%.5] // CHECK:STDOUT: %test_u16.var: ref u16 = var test_u16 // CHECK:STDOUT: %test_u16: ref u16 = bind_name test_u16, %test_u16.var -// CHECK:STDOUT: %.loc5_15.1: i32 = int_literal 64 [template = constants.%.5] -// CHECK:STDOUT: %.loc5_15.2: type = int_type unsigned, %.loc5_15.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc5_15.1: i32 = int_literal 64 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc5: init type = call constants.%struct(%.loc5_15.1) [template = constants.%.7] +// CHECK:STDOUT: %.loc5_15.2: type = value_of_initializer %int.make_type_unsigned.loc5 [template = constants.%.7] +// CHECK:STDOUT: %.loc5_15.3: type = converted %int.make_type_unsigned.loc5, %.loc5_15.2 [template = constants.%.7] // CHECK:STDOUT: %test_u64.var: ref u64 = var test_u64 // CHECK:STDOUT: %test_u64: ref u64 = bind_name test_u64, %test_u64.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @UInt(%size: i32) -> type = "int.make_type_unsigned"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_uN_bad_width.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 15 [template] -// CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1000000000 [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: %.3: type = int_type unsigned, %.1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 15 [template] +// CHECK:STDOUT: %.5: type = int_type unsigned, %.4 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -237,22 +285,36 @@ var test_f128: f128; // CHECK:STDOUT: %test_u0.var: ref = var test_u0 // CHECK:STDOUT: %test_u0: ref = bind_name test_u0, %test_u0.var // CHECK:STDOUT: %.loc12_14.1: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_14.2: type = int_type unsigned, %.loc12_14.1 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.1: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc12: init type = call constants.%struct(%.loc12_14.1) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_14.2: type = value_of_initializer %int.make_type_unsigned.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_14.3: type = converted %int.make_type_unsigned.loc12, %.loc12_14.2 [template = constants.%.3] // CHECK:STDOUT: %test_u1.var: ref u1 = var test_u1 // CHECK:STDOUT: %test_u1: ref u1 = bind_name test_u1, %test_u1.var -// CHECK:STDOUT: %.loc17_15.1: i32 = int_literal 15 [template = constants.%.3] -// CHECK:STDOUT: %.loc17_15.2: type = int_type unsigned, %.loc17_15.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_15.1: i32 = int_literal 15 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.2: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc17: init type = call constants.%struct(%.loc17_15.1) [template = constants.%.5] +// CHECK:STDOUT: %.loc17_15.2: type = value_of_initializer %int.make_type_unsigned.loc17 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_15.3: type = converted %int.make_type_unsigned.loc17, %.loc17_15.2 [template = constants.%.5] // CHECK:STDOUT: %test_u15.var: ref u15 = var test_u15 // CHECK:STDOUT: %test_u15: ref u15 = bind_name test_u15, %test_u15.var -// CHECK:STDOUT: %.loc22_23.1: i32 = int_literal 1000000000 [template = constants.%.5] -// CHECK:STDOUT: %.loc22_23.2: type = int_type unsigned, %.loc22_23.1 [template = ] +// CHECK:STDOUT: %.loc22_23.1: i32 = int_literal 1000000000 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc22: init type = call constants.%struct(%.loc22_23.1) [template = ] +// CHECK:STDOUT: %.loc22_23.2: type = value_of_initializer %int.make_type_unsigned.loc22 [template = ] +// CHECK:STDOUT: %.loc22_23.3: type = converted %int.make_type_unsigned.loc22, %.loc22_23.2 [template = ] // CHECK:STDOUT: %test_u1000000000.var: ref = var test_u1000000000 // CHECK:STDOUT: %test_u1000000000: ref = bind_name test_u1000000000, %test_u1000000000.var -// CHECK:STDOUT: %.loc28: type = int_type unsigned, [template = ] +// CHECK:STDOUT: %import_ref.4: UInt = import_ref ir3, inst+22, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_unsigned.loc28: init type = call constants.%struct() [template = ] +// CHECK:STDOUT: %.loc28_33.1: type = value_of_initializer %int.make_type_unsigned.loc28 [template = ] +// CHECK:STDOUT: %.loc28_33.2: type = converted %int.make_type_unsigned.loc28, %.loc28_33.1 [template = ] // CHECK:STDOUT: %test_u10000000000000000000.var: ref = var test_u10000000000000000000 // CHECK:STDOUT: %test_u10000000000000000000: ref = bind_name test_u10000000000000000000, %test_u10000000000000000000.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @UInt(%size: i32) -> type = "int.make_type_unsigned"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_fN_bad_width.carbon // CHECK:STDOUT: // CHECK:STDOUT: file {} diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index 521f4fd91057..5ca9279d221a 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -49,14 +49,17 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_add.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Add: type = fn_type @Add [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Add = struct_value () [template] +// CHECK:STDOUT: %struct.2: Add = struct_value () [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 2.2000000000000002 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 2.3000000000000003 [template] -// CHECK:STDOUT: %.4: f64 = float_literal 4.5 [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 2.2000000000000002 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 2.3000000000000003 [template] +// CHECK:STDOUT: %.5: f64 = float_literal 4.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -67,29 +70,66 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc2_11.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%struct.1(%.loc2_11.1) [template = f64] +// CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64] +// CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64] // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Add.%a: f64 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %.loc2_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%struct.1(%.loc2_19.1) [template = f64] +// CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64] +// CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64] // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Add.%b: f64 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %.loc2_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_27: init type = call constants.%struct.1(%.loc2_27.1) [template = f64] +// CHECK:STDOUT: %.loc2_27.2: type = value_of_initializer %float.make_type.loc2_27 [template = f64] +// CHECK:STDOUT: %.loc2_27.3: type = converted %float.make_type.loc2_27, %.loc2_27.2 [template = f64] // CHECK:STDOUT: @Add.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc4_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%struct.1(%.loc4_19.1) [template = f64] +// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] +// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 +// CHECK:STDOUT: %.loc4_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%struct.1(%.loc4_27.1) [template = f64] +// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] +// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 +// CHECK:STDOUT: %.loc4_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%struct.1(%.loc4_35.1) [template = f64] +// CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %float.make_type.loc4_35 [template = f64] +// CHECK:STDOUT: %.loc4_35.3: type = converted %float.make_type.loc4_35, %.loc4_35.2 [template = f64] // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %.loc8_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_8.1) [template = f64] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type.loc8, %.loc8_8.2 [template = f64] // CHECK:STDOUT: %x.var: ref f64 = var x // CHECK:STDOUT: %x: ref f64 = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Add(%a: f64, %b: f64) -> f64 = "float.add"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%a.ref, %b.ref) @@ -100,10 +140,10 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2.2000000000000002 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 2.3000000000000003 [template = constants.%.3] -// CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2.2000000000000002 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 2.3000000000000003 [template = constants.%.4] +// CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%.loc8_18, %.loc8_23) [template = constants.%.5] // CHECK:STDOUT: assign file.%x.var, %float.add // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -111,21 +151,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -140,68 +185,175 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc8_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_14: init type = call constants.%struct.1(%.loc8_14.1) [template = f64] +// CHECK:STDOUT: %.loc8_14.2: type = value_of_initializer %float.make_type.loc8_14 [template = f64] +// CHECK:STDOUT: %.loc8_14.3: type = converted %float.make_type.loc8_14, %.loc8_14.2 [template = f64] // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %.loc8_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_22: init type = call constants.%struct.1(%.loc8_22.1) [template = f64] +// CHECK:STDOUT: %.loc8_22.2: type = value_of_initializer %float.make_type.loc8_22 [template = f64] +// CHECK:STDOUT: %.loc8_22.3: type = converted %float.make_type.loc8_22, %.loc8_22.2 [template = f64] // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc13_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%struct.1(%.loc13_15.1) [template = f64] +// CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64] +// CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64] // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %.loc13_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%struct.1(%.loc13_23.1) [template = f64] +// CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64] +// CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64] // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %.loc13_31.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%struct.1(%.loc13_31.1) [template = f64] +// CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64] +// CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64] // CHECK:STDOUT: %c.loc13_28.1: f64 = param c // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %.loc13_39.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_39: init type = call constants.%struct.1(%.loc13_39.1) [template = f64] +// CHECK:STDOUT: %.loc13_39.2: type = value_of_initializer %float.make_type.loc13_39 [template = f64] +// CHECK:STDOUT: %.loc13_39.3: type = converted %float.make_type.loc13_39, %.loc13_39.2 [template = f64] // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc17_21.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_21: init type = call constants.%struct.1(%.loc17_21.1) [template = f64] +// CHECK:STDOUT: %.loc17_21.2: type = value_of_initializer %float.make_type.loc17_21 [template = f64] +// CHECK:STDOUT: %.loc17_21.3: type = converted %float.make_type.loc17_21, %.loc17_21.2 [template = f64] // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 +// CHECK:STDOUT: %.loc17_29.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_29: init type = call constants.%struct.1(%.loc17_29.1) [template = f64] +// CHECK:STDOUT: %.loc17_29.2: type = value_of_initializer %float.make_type.loc17_29 [template = f64] +// CHECK:STDOUT: %.loc17_29.3: type = converted %float.make_type.loc17_29, %.loc17_29.2 [template = f64] // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc17_37.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_37.2: type = converted %bool.make_type.loc17, %.loc17_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc18_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_17: init type = call constants.%struct.1(%.loc18_17.1) [template = f64] +// CHECK:STDOUT: %.loc18_17.2: type = value_of_initializer %float.make_type.loc18_17 [template = f64] +// CHECK:STDOUT: %.loc18_17.3: type = converted %float.make_type.loc18_17, %.loc18_17.2 [template = f64] // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 +// CHECK:STDOUT: %.loc18_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_25: init type = call constants.%struct.1(%.loc18_25.1) [template = f64] +// CHECK:STDOUT: %.loc18_25.2: type = value_of_initializer %float.make_type.loc18_25 [template = f64] +// CHECK:STDOUT: %.loc18_25.3: type = converted %float.make_type.loc18_25, %.loc18_25.2 [template = f64] // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 +// CHECK:STDOUT: %.loc18_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_33: init type = call constants.%struct.1(%.loc18_33.1) [template = f64] +// CHECK:STDOUT: %.loc18_33.2: type = value_of_initializer %float.make_type.loc18_33 [template = f64] +// CHECK:STDOUT: %.loc18_33.3: type = converted %float.make_type.loc18_33, %.loc18_33.2 [template = f64] // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc20_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%struct.1(%.loc20_25.1) [template = f64] +// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] +// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 +// CHECK:STDOUT: %.loc20_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%struct.1(%.loc20_33.1) [template = f64] +// CHECK:STDOUT: %.loc20_33.2: type = value_of_initializer %float.make_type.loc20_33 [template = f64] +// CHECK:STDOUT: %.loc20_33.3: type = converted %float.make_type.loc20_33, %.loc20_33.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc24_26.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%struct.1(%.loc24_26.1) [template = f64] +// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] +// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 +// CHECK:STDOUT: %.loc24_34.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%struct.1(%.loc24_34.1) [template = f64] +// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] +// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] // CHECK:STDOUT: %b.loc24_31.1: f64 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: f64 = bind_name b, %b.loc24_31.1 +// CHECK:STDOUT: %.loc24_42.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%struct.1(%.loc24_42.1) [template = f64] +// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] +// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] // CHECK:STDOUT: %c.loc24_39.1: f64 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 +// CHECK:STDOUT: %.loc24_50.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%struct.1(%.loc24_50.1) [template = f64] +// CHECK:STDOUT: %.loc24_50.2: type = value_of_initializer %float.make_type.loc24_50 [template = f64] +// CHECK:STDOUT: %.loc24_50.3: type = converted %float.make_type.loc24_50, %.loc24_50.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %.loc28_32.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%struct.1(%.loc28_32.1) [template = f64] +// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] +// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 +// CHECK:STDOUT: %.loc28_40.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%struct.1(%.loc28_40.1) [template = f64] +// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] +// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] // CHECK:STDOUT: %b.loc28_37.1: f64 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: f64 = bind_name b, %b.loc28_37.1 +// CHECK:STDOUT: %bool.make_type.loc28: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc28_48.1: type = value_of_initializer %bool.make_type.loc28 [template = bool] +// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type.loc28, %.loc28_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: f64) -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: f64, %b: f64, %c: f64) -> f64; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: f64, %b: f64) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: f64, %b: f64) -> f64 = "float.add"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -211,7 +363,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -223,7 +375,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index b6efaa45bbaf..466c0b651a76 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -51,18 +51,21 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Div: type = fn_type @Div [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 10 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 2.5 [template] -// CHECK:STDOUT: %.4: f64 = float_literal 4 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.6: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.7: f64 = float_literal +Inf [template] -// CHECK:STDOUT: %.8: f64 = float_literal NaN [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 10 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 2.5 [template] +// CHECK:STDOUT: %.5: f64 = float_literal 4 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.7: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.8: f64 = float_literal +Inf [template] +// CHECK:STDOUT: %.9: f64 = float_literal NaN [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -73,43 +76,90 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .a = %a.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc2_11.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%struct.1(%.loc2_11.1) [template = f64] +// CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64] +// CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64] // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Div.%a: f64 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %.loc2_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%struct.1(%.loc2_19.1) [template = f64] +// CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64] +// CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64] // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Div.%b: f64 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %.loc2_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_27: init type = call constants.%struct.1(%.loc2_27.1) [template = f64] +// CHECK:STDOUT: %.loc2_27.2: type = value_of_initializer %float.make_type.loc2_27 [template = f64] +// CHECK:STDOUT: %.loc2_27.3: type = converted %float.make_type.loc2_27, %.loc2_27.2 [template = f64] // CHECK:STDOUT: @Div.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc4_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%struct.1(%.loc4_19.1) [template = f64] +// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] +// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 +// CHECK:STDOUT: %.loc4_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%struct.1(%.loc4_27.1) [template = f64] +// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] +// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 +// CHECK:STDOUT: %.loc4_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%struct.1(%.loc4_35.1) [template = f64] +// CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %float.make_type.loc4_35 [template = f64] +// CHECK:STDOUT: %.loc4_35.3: type = converted %float.make_type.loc4_35, %.loc4_35.2 [template = f64] // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %.loc8_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_8.1) [template = f64] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type.loc8, %.loc8_8.2 [template = f64] // CHECK:STDOUT: %a.var: ref f64 = var a // CHECK:STDOUT: %a.loc8: ref f64 = bind_name a, %a.var -// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_18: f64 = float_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_23: f64 = float_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %float.div.loc9: init f64 = call %Div.ref.loc9(%.loc9_18, %.loc9_23) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_27.1: f64 = value_of_initializer %float.div.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_27.2: f64 = converted %float.div.loc9, %.loc9_27.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc9: init type = call constants.%struct.1(%.loc9_8.1) [template = f64] +// CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %float.make_type.loc9 [template = f64] +// CHECK:STDOUT: %.loc9_8.3: type = converted %float.make_type.loc9, %.loc9_8.2 [template = f64] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_18: f64 = float_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_23: f64 = float_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %float.div.loc9: init f64 = call %Div.ref.loc9(%.loc9_18, %.loc9_23) [template = constants.%.8] +// CHECK:STDOUT: %.loc9_27.1: f64 = value_of_initializer %float.div.loc9 [template = constants.%.8] +// CHECK:STDOUT: %.loc9_27.2: f64 = converted %float.div.loc9, %.loc9_27.1 [template = constants.%.8] // CHECK:STDOUT: %b.loc9: f64 = bind_name b, %.loc9_27.2 -// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_18: f64 = float_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_23: f64 = float_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %float.div.loc10: init f64 = call %Div.ref.loc10(%.loc10_18, %.loc10_23) [template = constants.%.8] -// CHECK:STDOUT: %.loc10_27.1: f64 = value_of_initializer %float.div.loc10 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_27.2: f64 = converted %float.div.loc10, %.loc10_27.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.9: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc10: init type = call constants.%struct.1(%.loc10_8.1) [template = f64] +// CHECK:STDOUT: %.loc10_8.2: type = value_of_initializer %float.make_type.loc10 [template = f64] +// CHECK:STDOUT: %.loc10_8.3: type = converted %float.make_type.loc10, %.loc10_8.2 [template = f64] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc10_18: f64 = float_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_23: f64 = float_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %float.div.loc10: init f64 = call %Div.ref.loc10(%.loc10_18, %.loc10_23) [template = constants.%.9] +// CHECK:STDOUT: %.loc10_27.1: f64 = value_of_initializer %float.div.loc10 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_27.2: f64 = converted %float.div.loc10, %.loc10_27.1 [template = constants.%.9] // CHECK:STDOUT: %c: f64 = bind_name c, %.loc10_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: f64, %b: f64) -> f64 = "float.div"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%a.ref, %b.ref) @@ -120,10 +170,10 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_24: f64 = float_literal 2.5 [template = constants.%.3] -// CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%.loc8_18, %.loc8_24) [template = constants.%.4] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 10 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_24: f64 = float_literal 2.5 [template = constants.%.4] +// CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%.loc8_18, %.loc8_24) [template = constants.%.5] // CHECK:STDOUT: assign file.%a.var, %float.div // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -131,21 +181,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -160,68 +215,175 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc8_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_14: init type = call constants.%struct.1(%.loc8_14.1) [template = f64] +// CHECK:STDOUT: %.loc8_14.2: type = value_of_initializer %float.make_type.loc8_14 [template = f64] +// CHECK:STDOUT: %.loc8_14.3: type = converted %float.make_type.loc8_14, %.loc8_14.2 [template = f64] // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %.loc8_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_22: init type = call constants.%struct.1(%.loc8_22.1) [template = f64] +// CHECK:STDOUT: %.loc8_22.2: type = value_of_initializer %float.make_type.loc8_22 [template = f64] +// CHECK:STDOUT: %.loc8_22.3: type = converted %float.make_type.loc8_22, %.loc8_22.2 [template = f64] // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc13_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%struct.1(%.loc13_15.1) [template = f64] +// CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64] +// CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64] // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %.loc13_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%struct.1(%.loc13_23.1) [template = f64] +// CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64] +// CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64] // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %.loc13_31.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%struct.1(%.loc13_31.1) [template = f64] +// CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64] +// CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64] // CHECK:STDOUT: %c.loc13_28.1: f64 = param c // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %.loc13_39.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_39: init type = call constants.%struct.1(%.loc13_39.1) [template = f64] +// CHECK:STDOUT: %.loc13_39.2: type = value_of_initializer %float.make_type.loc13_39 [template = f64] +// CHECK:STDOUT: %.loc13_39.3: type = converted %float.make_type.loc13_39, %.loc13_39.2 [template = f64] // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc17_21.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_21: init type = call constants.%struct.1(%.loc17_21.1) [template = f64] +// CHECK:STDOUT: %.loc17_21.2: type = value_of_initializer %float.make_type.loc17_21 [template = f64] +// CHECK:STDOUT: %.loc17_21.3: type = converted %float.make_type.loc17_21, %.loc17_21.2 [template = f64] // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 +// CHECK:STDOUT: %.loc17_29.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_29: init type = call constants.%struct.1(%.loc17_29.1) [template = f64] +// CHECK:STDOUT: %.loc17_29.2: type = value_of_initializer %float.make_type.loc17_29 [template = f64] +// CHECK:STDOUT: %.loc17_29.3: type = converted %float.make_type.loc17_29, %.loc17_29.2 [template = f64] // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc17_37.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_37.2: type = converted %bool.make_type.loc17, %.loc17_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc18_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_17: init type = call constants.%struct.1(%.loc18_17.1) [template = f64] +// CHECK:STDOUT: %.loc18_17.2: type = value_of_initializer %float.make_type.loc18_17 [template = f64] +// CHECK:STDOUT: %.loc18_17.3: type = converted %float.make_type.loc18_17, %.loc18_17.2 [template = f64] // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 +// CHECK:STDOUT: %.loc18_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_25: init type = call constants.%struct.1(%.loc18_25.1) [template = f64] +// CHECK:STDOUT: %.loc18_25.2: type = value_of_initializer %float.make_type.loc18_25 [template = f64] +// CHECK:STDOUT: %.loc18_25.3: type = converted %float.make_type.loc18_25, %.loc18_25.2 [template = f64] // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 +// CHECK:STDOUT: %.loc18_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_33: init type = call constants.%struct.1(%.loc18_33.1) [template = f64] +// CHECK:STDOUT: %.loc18_33.2: type = value_of_initializer %float.make_type.loc18_33 [template = f64] +// CHECK:STDOUT: %.loc18_33.3: type = converted %float.make_type.loc18_33, %.loc18_33.2 [template = f64] // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc20_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%struct.1(%.loc20_25.1) [template = f64] +// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] +// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 +// CHECK:STDOUT: %.loc20_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%struct.1(%.loc20_33.1) [template = f64] +// CHECK:STDOUT: %.loc20_33.2: type = value_of_initializer %float.make_type.loc20_33 [template = f64] +// CHECK:STDOUT: %.loc20_33.3: type = converted %float.make_type.loc20_33, %.loc20_33.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc24_26.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%struct.1(%.loc24_26.1) [template = f64] +// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] +// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 +// CHECK:STDOUT: %.loc24_34.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%struct.1(%.loc24_34.1) [template = f64] +// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] +// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] // CHECK:STDOUT: %b.loc24_31.1: f64 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: f64 = bind_name b, %b.loc24_31.1 +// CHECK:STDOUT: %.loc24_42.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%struct.1(%.loc24_42.1) [template = f64] +// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] +// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] // CHECK:STDOUT: %c.loc24_39.1: f64 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 +// CHECK:STDOUT: %.loc24_50.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%struct.1(%.loc24_50.1) [template = f64] +// CHECK:STDOUT: %.loc24_50.2: type = value_of_initializer %float.make_type.loc24_50 [template = f64] +// CHECK:STDOUT: %.loc24_50.3: type = converted %float.make_type.loc24_50, %.loc24_50.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %.loc28_32.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%struct.1(%.loc28_32.1) [template = f64] +// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] +// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 +// CHECK:STDOUT: %.loc28_40.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%struct.1(%.loc28_40.1) [template = f64] +// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] +// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] // CHECK:STDOUT: %b.loc28_37.1: f64 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: f64 = bind_name b, %b.loc28_37.1 +// CHECK:STDOUT: %bool.make_type.loc28: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc28_48.1: type = value_of_initializer %bool.make_type.loc28 [template = bool] +// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type.loc28, %.loc28_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: f64) -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: f64, %b: f64, %c: f64) -> f64; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: f64, %b: f64) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: f64, %b: f64) -> f64 = "float.div"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -231,7 +393,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -243,7 +405,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index d189a04017dd..4920d360ad3a 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -32,21 +32,26 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: --- float_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %Eq: type = fn_type @Eq [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Eq = struct_value () [template] +// CHECK:STDOUT: %struct.3: Eq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: bool = bool_literal true [template] -// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: bool = bool_literal true [template] +// CHECK:STDOUT: %.7: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.8: bool = bool_literal false [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.5: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,16 +64,30 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_10.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_10: init type = call constants.%struct.1(%.loc2_10.1) [template = f64] +// CHECK:STDOUT: %.loc2_10.2: type = value_of_initializer %float.make_type.loc2_10 [template = f64] +// CHECK:STDOUT: %.loc2_10.3: type = converted %float.make_type.loc2_10, %.loc2_10.2 [template = f64] // CHECK:STDOUT: %a.loc2_7.1: f64 = param a // CHECK:STDOUT: @Eq.%a: f64 = bind_name a, %a.loc2_7.1 +// CHECK:STDOUT: %.loc2_18.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_18: init type = call constants.%struct.1(%.loc2_18.1) [template = f64] +// CHECK:STDOUT: %.loc2_18.2: type = value_of_initializer %float.make_type.loc2_18 [template = f64] +// CHECK:STDOUT: %.loc2_18.3: type = converted %float.make_type.loc2_18, %.loc2_18.2 [template = f64] // CHECK:STDOUT: %b.loc2_15.1: f64 = param b // CHECK:STDOUT: @Eq.%b: f64 = bind_name b, %b.loc2_15.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_26.2: type = converted %bool.make_type.loc2, %.loc2_26.1 [template = bool] // CHECK:STDOUT: @Eq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -76,11 +95,25 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc12_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc12_19: init type = call constants.%struct.1(%.loc12_19.1) [template = f64] +// CHECK:STDOUT: %.loc12_19.2: type = value_of_initializer %float.make_type.loc12_19 [template = f64] +// CHECK:STDOUT: %.loc12_19.3: type = converted %float.make_type.loc12_19, %.loc12_19.2 [template = f64] // CHECK:STDOUT: %a.loc12_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc12_16.1 +// CHECK:STDOUT: %.loc12_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc12_27: init type = call constants.%struct.1(%.loc12_27.1) [template = f64] +// CHECK:STDOUT: %.loc12_27.2: type = value_of_initializer %float.make_type.loc12_27 [template = f64] +// CHECK:STDOUT: %.loc12_27.3: type = converted %float.make_type.loc12_27, %.loc12_27.2 [template = f64] // CHECK:STDOUT: %b.loc12_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc12_24.1 +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc12_35.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type.loc12, %.loc12_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -95,17 +128,21 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Eq(%a: f64, %b: f64) -> bool = "float.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_19: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_24: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_24) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %float.eq.loc8 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %float.eq.loc8, %.loc8_13.1 [template = constants.%.5] +// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc8_19: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_24: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_24) [template = constants.%.6] +// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %float.eq.loc8 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_13.2: bool = converted %float.eq.loc8, %.loc8_13.1 [template = constants.%.6] // CHECK:STDOUT: if %.loc8_13.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8: @@ -119,12 +156,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_20: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_25: f64 = float_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %float.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_25) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.eq.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.eq.loc9, %.loc9_14.1 [template = constants.%.7] +// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_20: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_25: f64 = float_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %float.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_25) [template = constants.%.8] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.eq.loc9 [template = constants.%.8] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.eq.loc9, %.loc9_14.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -142,7 +179,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.eq: init bool = call %Eq.ref(%a.ref, %b.ref) @@ -154,9 +191,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: %struct.2: WrongResult = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -165,14 +205,31 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc7_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_19: init type = call constants.%struct.1(%.loc7_19.1) [template = f64] +// CHECK:STDOUT: %.loc7_19.2: type = value_of_initializer %float.make_type.loc7_19 [template = f64] +// CHECK:STDOUT: %.loc7_19.3: type = converted %float.make_type.loc7_19, %.loc7_19.2 [template = f64] // CHECK:STDOUT: %a.loc7_16.1: f64 = param a // CHECK:STDOUT: @WrongResult.%a: f64 = bind_name a, %a.loc7_16.1 +// CHECK:STDOUT: %.loc7_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_27: init type = call constants.%struct.1(%.loc7_27.1) [template = f64] +// CHECK:STDOUT: %.loc7_27.2: type = value_of_initializer %float.make_type.loc7_27 [template = f64] +// CHECK:STDOUT: %.loc7_27.3: type = converted %float.make_type.loc7_27, %.loc7_27.2 [template = f64] // CHECK:STDOUT: %b.loc7_24.1: f64 = param b // CHECK:STDOUT: @WrongResult.%b: f64 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %.loc7_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_35: init type = call constants.%struct.1(%.loc7_35.1) [template = f64] +// CHECK:STDOUT: %.loc7_35.2: type = value_of_initializer %float.make_type.loc7_35 [template = f64] +// CHECK:STDOUT: %.loc7_35.3: type = converted %float.make_type.loc7_35, %.loc7_35.2 [template = f64] // CHECK:STDOUT: @WrongResult.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @WrongResult(%a: f64, %b: f64) -> f64; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/greater.carbon b/toolchain/check/testdata/builtins/float/greater.carbon index 3c61fd32141c..92f140b3ef81 100644 --- a/toolchain/check/testdata/builtins/float/greater.carbon +++ b/toolchain/check/testdata/builtins/float/greater.carbon @@ -27,25 +27,30 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_greater.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %Greater: type = fn_type @Greater [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Greater = struct_value () [template] +// CHECK:STDOUT: %struct.3: Greater = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal false [template] -// CHECK:STDOUT: %.7: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.8: bool = bool_literal true [template] -// CHECK:STDOUT: %.9: f64 = float_literal -1 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %.8: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.9: bool = bool_literal true [template] +// CHECK:STDOUT: %.10: f64 = float_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +64,45 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_15: init type = call constants.%struct.1(%.loc2_15.1) [template = f64] +// CHECK:STDOUT: %.loc2_15.2: type = value_of_initializer %float.make_type.loc2_15 [template = f64] +// CHECK:STDOUT: %.loc2_15.3: type = converted %float.make_type.loc2_15, %.loc2_15.2 [template = f64] // CHECK:STDOUT: %a.loc2_12.1: f64 = param a // CHECK:STDOUT: @Greater.%a: f64 = bind_name a, %a.loc2_12.1 +// CHECK:STDOUT: %.loc2_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_23: init type = call constants.%struct.1(%.loc2_23.1) [template = f64] +// CHECK:STDOUT: %.loc2_23.2: type = value_of_initializer %float.make_type.loc2_23 [template = f64] +// CHECK:STDOUT: %.loc2_23.3: type = converted %float.make_type.loc2_23, %.loc2_23.2 [template = f64] // CHECK:STDOUT: %b.loc2_20.1: f64 = param b // CHECK:STDOUT: @Greater.%b: f64 = bind_name b, %b.loc2_20.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_31.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_31.2: type = converted %bool.make_type.loc2, %.loc2_31.1 [template = bool] // CHECK:STDOUT: @Greater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_14: init type = call constants.%struct.1(%.loc3_14.1) [template = f64] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %float.make_type.loc3_14 [template = f64] +// CHECK:STDOUT: %.loc3_14.3: type = converted %float.make_type.loc3_14, %.loc3_14.2 [template = f64] // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %.loc3_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_22: init type = call constants.%struct.1(%.loc3_22.1) [template = f64] +// CHECK:STDOUT: %.loc3_22.2: type = value_of_initializer %float.make_type.loc3_22 [template = f64] +// CHECK:STDOUT: %.loc3_22.3: type = converted %float.make_type.loc3_22, %.loc3_22.2 [template = f64] // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +110,25 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc16_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%struct.1(%.loc16_19.1) [template = f64] +// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] +// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %.loc16_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%struct.1(%.loc16_27.1) [template = f64] +// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] +// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] // CHECK:STDOUT: %b.loc16_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +143,10 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Greater(%a: f64, %b: f64) -> bool = "float.greater"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: f64) -> f64 = "float.negate"; @@ -107,12 +154,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_25: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_30: f64 = float_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %float.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_30) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.greater.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.greater.loc9, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_25: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_30: f64 = float_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %float.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_30) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.greater.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.greater.loc9, %.loc9_14.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -126,12 +173,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_25: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_30: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_30) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %float.greater.loc10 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %float.greater.loc10, %.loc10_14.1 [template = constants.%.6] +// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_25: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_30: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_30) [template = constants.%.7] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %float.greater.loc10 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %float.greater.loc10, %.loc10_14.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -145,12 +192,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %float.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %float.greater.loc11 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %float.greater.loc11, %.loc11_13.1 [template = constants.%.8] +// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %float.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.9] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %float.greater.loc11 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %float.greater.loc11, %.loc11_13.1 [template = constants.%.9] // CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -164,16 +211,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_32: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_38: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_24.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_24.2: f64 = converted %float.negate.loc12, %.loc12_24.1 [template = constants.%.9] -// CHECK:STDOUT: %float.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_24.2, %.loc12_38) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %float.greater.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %float.greater.loc12, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc12_32: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.10] +// CHECK:STDOUT: %.loc12_38: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_24.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_24.2: f64 = converted %float.negate.loc12, %.loc12_24.1 [template = constants.%.10] +// CHECK:STDOUT: %float.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_24.2, %.loc12_38) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %float.greater.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %float.greater.loc12, %.loc12_14.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -187,16 +234,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.2: f64 = converted %float.negate.loc13, %.loc13_23.1 [template = constants.%.9] -// CHECK:STDOUT: %float.greater.loc13: init bool = call %Greater.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %float.greater.loc13 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %float.greater.loc13, %.loc13_13.1 [template = constants.%.8] +// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.10] +// CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_23.2: f64 = converted %float.negate.loc13, %.loc13_23.1 [template = constants.%.10] +// CHECK:STDOUT: %float.greater.loc13: init bool = call %Greater.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.9] +// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %float.greater.loc13 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %float.greater.loc13, %.loc13_13.1 [template = constants.%.9] // CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: @@ -214,7 +261,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.greater: init bool = call %Greater.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/greater_eq.carbon b/toolchain/check/testdata/builtins/float/greater_eq.carbon index 5c02ab4b6b66..24f9b3cad9eb 100644 --- a/toolchain/check/testdata/builtins/float/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/float/greater_eq.carbon @@ -27,25 +27,30 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_greater_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %GreaterEq: type = fn_type @GreaterEq [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: GreaterEq = struct_value () [template] +// CHECK:STDOUT: %struct.3: GreaterEq = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal false [template] -// CHECK:STDOUT: %.7: bool = bool_literal true [template] -// CHECK:STDOUT: %.8: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.9: f64 = float_literal -1 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %.8: bool = bool_literal true [template] +// CHECK:STDOUT: %.9: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.10: f64 = float_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +64,45 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_17: init type = call constants.%struct.1(%.loc2_17.1) [template = f64] +// CHECK:STDOUT: %.loc2_17.2: type = value_of_initializer %float.make_type.loc2_17 [template = f64] +// CHECK:STDOUT: %.loc2_17.3: type = converted %float.make_type.loc2_17, %.loc2_17.2 [template = f64] // CHECK:STDOUT: %a.loc2_14.1: f64 = param a // CHECK:STDOUT: @GreaterEq.%a: f64 = bind_name a, %a.loc2_14.1 +// CHECK:STDOUT: %.loc2_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_25: init type = call constants.%struct.1(%.loc2_25.1) [template = f64] +// CHECK:STDOUT: %.loc2_25.2: type = value_of_initializer %float.make_type.loc2_25 [template = f64] +// CHECK:STDOUT: %.loc2_25.3: type = converted %float.make_type.loc2_25, %.loc2_25.2 [template = f64] // CHECK:STDOUT: %b.loc2_22.1: f64 = param b // CHECK:STDOUT: @GreaterEq.%b: f64 = bind_name b, %b.loc2_22.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_33.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_33.2: type = converted %bool.make_type.loc2, %.loc2_33.1 [template = bool] // CHECK:STDOUT: @GreaterEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_14: init type = call constants.%struct.1(%.loc3_14.1) [template = f64] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %float.make_type.loc3_14 [template = f64] +// CHECK:STDOUT: %.loc3_14.3: type = converted %float.make_type.loc3_14, %.loc3_14.2 [template = f64] // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %.loc3_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_22: init type = call constants.%struct.1(%.loc3_22.1) [template = f64] +// CHECK:STDOUT: %.loc3_22.2: type = value_of_initializer %float.make_type.loc3_22 [template = f64] +// CHECK:STDOUT: %.loc3_22.3: type = converted %float.make_type.loc3_22, %.loc3_22.2 [template = f64] // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +110,25 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc16_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%struct.1(%.loc16_19.1) [template = f64] +// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] +// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %.loc16_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%struct.1(%.loc16_27.1) [template = f64] +// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] +// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] // CHECK:STDOUT: %b.loc16_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +143,10 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @GreaterEq(%a: f64, %b: f64) -> bool = "float.greater_eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: f64) -> f64 = "float.negate"; @@ -107,12 +154,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_27: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_32: f64 = float_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %float.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_32) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.greater_eq.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.greater_eq.loc9, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_27: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_32: f64 = float_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %float.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_32) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.greater_eq.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.greater_eq.loc9, %.loc9_14.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -126,12 +173,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_26: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_31: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_31) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %float.greater_eq.loc10 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %float.greater_eq.loc10, %.loc10_13.1 [template = constants.%.7] +// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_26: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_31: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_31) [template = constants.%.8] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %float.greater_eq.loc10 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %float.greater_eq.loc10, %.loc10_13.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -145,12 +192,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc11_26: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_31: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %float.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_31) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %float.greater_eq.loc11 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %float.greater_eq.loc11, %.loc11_13.1 [template = constants.%.7] +// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc11_26: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_31: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %float.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_31) [template = constants.%.8] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %float.greater_eq.loc11 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %float.greater_eq.loc11, %.loc11_13.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -164,16 +211,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_34: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_40: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_26.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_26.2: f64 = converted %float.negate.loc12, %.loc12_26.1 [template = constants.%.9] -// CHECK:STDOUT: %float.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_26.2, %.loc12_40) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %float.greater_eq.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %float.greater_eq.loc12, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc12_34: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.10] +// CHECK:STDOUT: %.loc12_40: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_26.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_26.2: f64 = converted %float.negate.loc12, %.loc12_26.1 [template = constants.%.10] +// CHECK:STDOUT: %float.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_26.2, %.loc12_40) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %float.greater_eq.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %float.greater_eq.loc12, %.loc12_14.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -187,16 +234,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_26: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_38: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_38) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_25.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_25.2: f64 = converted %float.negate.loc13, %.loc13_25.1 [template = constants.%.9] -// CHECK:STDOUT: %float.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26, %.loc13_25.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %float.greater_eq.loc13 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %float.greater_eq.loc13, %.loc13_13.1 [template = constants.%.7] +// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_26: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_38: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_38) [template = constants.%.10] +// CHECK:STDOUT: %.loc13_25.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_25.2: f64 = converted %float.negate.loc13, %.loc13_25.1 [template = constants.%.10] +// CHECK:STDOUT: %float.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26, %.loc13_25.2) [template = constants.%.8] +// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %float.greater_eq.loc13 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %float.greater_eq.loc13, %.loc13_13.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: @@ -214,7 +261,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/less.carbon b/toolchain/check/testdata/builtins/float/less.carbon index 336c1e643984..6d33b967eebb 100644 --- a/toolchain/check/testdata/builtins/float/less.carbon +++ b/toolchain/check/testdata/builtins/float/less.carbon @@ -27,25 +27,30 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_less.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %Less: type = fn_type @Less [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %struct.3: Less = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal true [template] -// CHECK:STDOUT: %.7: bool = bool_literal false [template] -// CHECK:STDOUT: %.8: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.9: f64 = float_literal -1 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.7: bool = bool_literal true [template] +// CHECK:STDOUT: %.8: bool = bool_literal false [template] +// CHECK:STDOUT: %.9: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.10: f64 = float_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +64,45 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_12.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_12: init type = call constants.%struct.1(%.loc2_12.1) [template = f64] +// CHECK:STDOUT: %.loc2_12.2: type = value_of_initializer %float.make_type.loc2_12 [template = f64] +// CHECK:STDOUT: %.loc2_12.3: type = converted %float.make_type.loc2_12, %.loc2_12.2 [template = f64] // CHECK:STDOUT: %a.loc2_9.1: f64 = param a // CHECK:STDOUT: @Less.%a: f64 = bind_name a, %a.loc2_9.1 +// CHECK:STDOUT: %.loc2_20.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_20: init type = call constants.%struct.1(%.loc2_20.1) [template = f64] +// CHECK:STDOUT: %.loc2_20.2: type = value_of_initializer %float.make_type.loc2_20 [template = f64] +// CHECK:STDOUT: %.loc2_20.3: type = converted %float.make_type.loc2_20, %.loc2_20.2 [template = f64] // CHECK:STDOUT: %b.loc2_17.1: f64 = param b // CHECK:STDOUT: @Less.%b: f64 = bind_name b, %b.loc2_17.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_28.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_28.2: type = converted %bool.make_type.loc2, %.loc2_28.1 [template = bool] // CHECK:STDOUT: @Less.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_14: init type = call constants.%struct.1(%.loc3_14.1) [template = f64] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %float.make_type.loc3_14 [template = f64] +// CHECK:STDOUT: %.loc3_14.3: type = converted %float.make_type.loc3_14, %.loc3_14.2 [template = f64] // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %.loc3_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_22: init type = call constants.%struct.1(%.loc3_22.1) [template = f64] +// CHECK:STDOUT: %.loc3_22.2: type = value_of_initializer %float.make_type.loc3_22 [template = f64] +// CHECK:STDOUT: %.loc3_22.3: type = converted %float.make_type.loc3_22, %.loc3_22.2 [template = f64] // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +110,25 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc16_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%struct.1(%.loc16_19.1) [template = f64] +// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] +// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %.loc16_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%struct.1(%.loc16_27.1) [template = f64] +// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] +// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] // CHECK:STDOUT: %b.loc16_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +143,10 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Less(%a: f64, %b: f64) -> bool = "float.less"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: f64) -> f64 = "float.negate"; @@ -107,12 +154,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_26: f64 = float_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %float.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %float.less.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %float.less.loc9, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_26: f64 = float_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %float.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %float.less.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %float.less.loc9, %.loc9_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -126,12 +173,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_22: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_27) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %float.less.loc10 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %float.less.loc10, %.loc10_14.1 [template = constants.%.7] +// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_22: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_27: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_27) [template = constants.%.8] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %float.less.loc10 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %float.less.loc10, %.loc10_14.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -145,12 +192,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc11_22: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_27: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %float.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_27) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %float.less.loc11 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %float.less.loc11, %.loc11_14.1 [template = constants.%.7] +// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc11_22: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %float.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_27) [template = constants.%.8] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %float.less.loc11 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %float.less.loc11, %.loc11_14.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -164,16 +211,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_28: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_34: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_20.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_20.2: f64 = converted %float.negate.loc12, %.loc12_20.1 [template = constants.%.9] -// CHECK:STDOUT: %float.less.loc12: init bool = call %Less.ref.loc12(%.loc12_20.2, %.loc12_34) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %float.less.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %float.less.loc12, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc12_28: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.10] +// CHECK:STDOUT: %.loc12_34: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_20.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_20.2: f64 = converted %float.negate.loc12, %.loc12_20.1 [template = constants.%.10] +// CHECK:STDOUT: %float.less.loc12: init bool = call %Less.ref.loc12(%.loc12_20.2, %.loc12_34) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %float.less.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %float.less.loc12, %.loc12_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -187,16 +234,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_22: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_34: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_21.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_21.2: f64 = converted %float.negate.loc13, %.loc13_21.1 [template = constants.%.9] -// CHECK:STDOUT: %float.less.loc13: init bool = call %Less.ref.loc13(%.loc13_22, %.loc13_21.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %float.less.loc13 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %float.less.loc13, %.loc13_14.1 [template = constants.%.7] +// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_22: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_34: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.10] +// CHECK:STDOUT: %.loc13_21.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_21.2: f64 = converted %float.negate.loc13, %.loc13_21.1 [template = constants.%.10] +// CHECK:STDOUT: %float.less.loc13: init bool = call %Less.ref.loc13(%.loc13_22, %.loc13_21.2) [template = constants.%.8] +// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %float.less.loc13 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %float.less.loc13, %.loc13_14.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: @@ -214,7 +261,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.less: init bool = call %Less.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index ce8eb1886ace..cfadbc60a27b 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -27,25 +27,30 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %LessEq: type = fn_type @LessEq [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: LessEq = struct_value () [template] +// CHECK:STDOUT: %struct.3: LessEq = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal true [template] -// CHECK:STDOUT: %.7: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.8: bool = bool_literal false [template] -// CHECK:STDOUT: %.9: f64 = float_literal -1 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.7: bool = bool_literal true [template] +// CHECK:STDOUT: %.8: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.9: bool = bool_literal false [template] +// CHECK:STDOUT: %.10: f64 = float_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +64,45 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_14: init type = call constants.%struct.1(%.loc2_14.1) [template = f64] +// CHECK:STDOUT: %.loc2_14.2: type = value_of_initializer %float.make_type.loc2_14 [template = f64] +// CHECK:STDOUT: %.loc2_14.3: type = converted %float.make_type.loc2_14, %.loc2_14.2 [template = f64] // CHECK:STDOUT: %a.loc2_11.1: f64 = param a // CHECK:STDOUT: @LessEq.%a: f64 = bind_name a, %a.loc2_11.1 +// CHECK:STDOUT: %.loc2_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_22: init type = call constants.%struct.1(%.loc2_22.1) [template = f64] +// CHECK:STDOUT: %.loc2_22.2: type = value_of_initializer %float.make_type.loc2_22 [template = f64] +// CHECK:STDOUT: %.loc2_22.3: type = converted %float.make_type.loc2_22, %.loc2_22.2 [template = f64] // CHECK:STDOUT: %b.loc2_19.1: f64 = param b // CHECK:STDOUT: @LessEq.%b: f64 = bind_name b, %b.loc2_19.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_30.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_30.2: type = converted %bool.make_type.loc2, %.loc2_30.1 [template = bool] // CHECK:STDOUT: @LessEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %.loc3_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_14: init type = call constants.%struct.1(%.loc3_14.1) [template = f64] +// CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %float.make_type.loc3_14 [template = f64] +// CHECK:STDOUT: %.loc3_14.3: type = converted %float.make_type.loc3_14, %.loc3_14.2 [template = f64] // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %.loc3_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc3_22: init type = call constants.%struct.1(%.loc3_22.1) [template = f64] +// CHECK:STDOUT: %.loc3_22.2: type = value_of_initializer %float.make_type.loc3_22 [template = f64] +// CHECK:STDOUT: %.loc3_22.3: type = converted %float.make_type.loc3_22, %.loc3_22.2 [template = f64] // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +110,25 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc16_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%struct.1(%.loc16_19.1) [template = f64] +// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] +// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %.loc16_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%struct.1(%.loc16_27.1) [template = f64] +// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] +// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] // CHECK:STDOUT: %b.loc16_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +143,10 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @LessEq(%a: f64, %b: f64) -> bool = "float.less_eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: f64) -> f64 = "float.negate"; @@ -107,12 +154,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_23: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_28: f64 = float_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %float.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %float.less_eq.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %float.less_eq.loc9, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_23: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_28: f64 = float_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %float.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_28) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %float.less_eq.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %float.less_eq.loc9, %.loc9_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -126,12 +173,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_23: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_28: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %float.less_eq.loc10 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %float.less_eq.loc10, %.loc10_13.1 [template = constants.%.6] +// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_23: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_28: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_28) [template = constants.%.7] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %float.less_eq.loc10 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %float.less_eq.loc10, %.loc10_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -145,12 +192,12 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %float.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %float.less_eq.loc11 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %float.less_eq.loc11, %.loc11_14.1 [template = constants.%.8] +// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %float.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.9] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %float.less_eq.loc11 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %float.less_eq.loc11, %.loc11_14.1 [template = constants.%.9] // CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -164,16 +211,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_30: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_36: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_22.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_22.2: f64 = converted %float.negate.loc12, %.loc12_22.1 [template = constants.%.9] -// CHECK:STDOUT: %float.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_22.2, %.loc12_36) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %float.less_eq.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %float.less_eq.loc12, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc12_30: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.10] +// CHECK:STDOUT: %.loc12_36: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_22.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_22.2: f64 = converted %float.negate.loc12, %.loc12_22.1 [template = constants.%.10] +// CHECK:STDOUT: %float.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_22.2, %.loc12_36) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %float.less_eq.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %float.less_eq.loc12, %.loc12_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -187,16 +234,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.2: f64 = converted %float.negate.loc13, %.loc13_23.1 [template = constants.%.9] -// CHECK:STDOUT: %float.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %float.less_eq.loc13 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %float.less_eq.loc13, %.loc13_14.1 [template = constants.%.8] +// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.10] +// CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_23.2: f64 = converted %float.negate.loc13, %.loc13_23.1 [template = constants.%.10] +// CHECK:STDOUT: %float.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.9] +// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %float.less_eq.loc13 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %float.less_eq.loc13, %.loc13_14.1 [template = constants.%.9] // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: @@ -214,7 +261,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 5090b1519a1e..935ac9631540 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -43,9 +43,11 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Float = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.2: Float = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,13 +56,19 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: .Float = %Float.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float.decl: Float = fn_decl @Float [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Float.decl: Float = fn_decl @Float [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_16.2: type = converted %int.make_type_32, %.loc4_16.1 [template = i32] // CHECK:STDOUT: %size.loc4_10.1: i32 = param size // CHECK:STDOUT: @Float.%size: i32 = bind_name size, %size.loc4_10.1 // CHECK:STDOUT: @Float.%return: ref type = var // CHECK:STDOUT: } // 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: --- use_types.carbon @@ -71,27 +79,33 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 64 [template] // CHECK:STDOUT: %.3: f64 = float_literal 0 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %GetFloat: type = fn_type @GetFloat [template] -// CHECK:STDOUT: %struct.2: GetFloat = struct_value () [template] +// CHECK:STDOUT: %struct.3: GetFloat = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Float = %import_ref +// CHECK:STDOUT: .Float = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .f = %f // CHECK:STDOUT: .GetFloat = %GetFloat.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Float = import_ref ir1, inst+5, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir1, inst+14, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float.ref: Float = name_ref Float, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Float.ref: Float = name_ref Float, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%.loc6_14) [template = f64] // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc6_16.2: type = converted %float.make_type, %.loc6_16.1 [template = f64] // CHECK:STDOUT: %f.var: ref f64 = var f // CHECK:STDOUT: %f: ref f64 = bind_name f, %f.var -// CHECK:STDOUT: %GetFloat.decl: GetFloat = fn_decl @GetFloat [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %GetFloat.decl: GetFloat = fn_decl @GetFloat [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_23.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_23.2: type = converted %int.make_type_32, %.loc8_23.1 [template = i32] // CHECK:STDOUT: %dyn_size.loc8_13.1: i32 = param dyn_size // CHECK:STDOUT: @GetFloat.%dyn_size: i32 = bind_name dyn_size, %dyn_size.loc8_13.1 // CHECK:STDOUT: @GetFloat.%return: ref type = var @@ -100,9 +114,11 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @GetFloat(%dyn_size: i32) -> type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Float.ref: Float = name_ref Float, file.%import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Float.ref: Float = name_ref Float, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %dyn_size.ref: i32 = name_ref dyn_size, %dyn_size // CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%dyn_size.ref) // CHECK:STDOUT: %.loc9_25.1: type = value_of_initializer %float.make_type @@ -122,31 +138,37 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Float: type = fn_type @Float [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Float = struct_value () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 32 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 64 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Float = %import_ref +// CHECK:STDOUT: .Float = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .invalid_float = %invalid_float // CHECK:STDOUT: .dyn_size = %dyn_size // CHECK:STDOUT: .dyn = %dyn // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Float = import_ref ir1, inst+5, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir1, inst+14, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float.ref.loc10: Float = name_ref Float, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %Float.ref.loc10: Float = name_ref Float, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 32 [template = constants.%.2] // CHECK:STDOUT: %float.make_type.loc10: init type = call %Float.ref.loc10(%.loc10_26) [template = ] // CHECK:STDOUT: %.loc10_28.1: type = value_of_initializer %float.make_type.loc10 [template = ] // CHECK:STDOUT: %.loc10_28.2: type = converted %float.make_type.loc10, %.loc10_28.1 [template = ] // CHECK:STDOUT: %invalid_float.var: ref = var invalid_float // CHECK:STDOUT: %invalid_float: ref = bind_name invalid_float, %invalid_float.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_15.2: type = converted %int.make_type_32, %.loc12_15.1 [template = i32] // CHECK:STDOUT: %dyn_size.var: ref i32 = var dyn_size // CHECK:STDOUT: %dyn_size: ref i32 = bind_name dyn_size, %dyn_size.var -// CHECK:STDOUT: %Float.ref.loc16: Float = name_ref Float, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %Float.ref.loc16: Float = name_ref Float, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %dyn_size.ref: ref i32 = name_ref dyn_size, %dyn_size // CHECK:STDOUT: %.loc16_16: i32 = bind_value %dyn_size.ref // CHECK:STDOUT: %float.make_type.loc16: init type = call %Float.ref.loc16(%.loc16_16) @@ -158,6 +180,8 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc12: i32 = int_literal 64 [template = constants.%.3] diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index 8135d0bdec3b..ac802dd40b83 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -49,14 +49,17 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- mul_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Mul: type = fn_type @Mul [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %struct.2: Mul = struct_value () [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 0.5 [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 0.5 [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -67,29 +70,66 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc2_11.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%struct.1(%.loc2_11.1) [template = f64] +// CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64] +// CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64] // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Mul.%a: f64 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %.loc2_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%struct.1(%.loc2_19.1) [template = f64] +// CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64] +// CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64] // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Mul.%b: f64 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %.loc2_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_27: init type = call constants.%struct.1(%.loc2_27.1) [template = f64] +// CHECK:STDOUT: %.loc2_27.2: type = value_of_initializer %float.make_type.loc2_27 [template = f64] +// CHECK:STDOUT: %.loc2_27.3: type = converted %float.make_type.loc2_27, %.loc2_27.2 [template = f64] // CHECK:STDOUT: @Mul.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc4_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%struct.1(%.loc4_19.1) [template = f64] +// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] +// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 +// CHECK:STDOUT: %.loc4_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%struct.1(%.loc4_27.1) [template = f64] +// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] +// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 +// CHECK:STDOUT: %.loc4_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%struct.1(%.loc4_35.1) [template = f64] +// CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %float.make_type.loc4_35 [template = f64] +// CHECK:STDOUT: %.loc4_35.3: type = converted %float.make_type.loc4_35, %.loc4_35.2 [template = f64] // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %.loc8_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_8.1) [template = f64] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type.loc8, %.loc8_8.2 [template = f64] // CHECK:STDOUT: %x.var: ref f64 = var x // CHECK:STDOUT: %x: ref f64 = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a: f64, %b: f64) -> f64 = "float.mul"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%a.ref, %b.ref) @@ -100,10 +140,10 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.3] -// CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.4] +// CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%.loc8_18, %.loc8_23) [template = constants.%.5] // CHECK:STDOUT: assign file.%x.var, %float.mul // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -111,21 +151,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -140,68 +185,175 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc8_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_14: init type = call constants.%struct.1(%.loc8_14.1) [template = f64] +// CHECK:STDOUT: %.loc8_14.2: type = value_of_initializer %float.make_type.loc8_14 [template = f64] +// CHECK:STDOUT: %.loc8_14.3: type = converted %float.make_type.loc8_14, %.loc8_14.2 [template = f64] // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %.loc8_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_22: init type = call constants.%struct.1(%.loc8_22.1) [template = f64] +// CHECK:STDOUT: %.loc8_22.2: type = value_of_initializer %float.make_type.loc8_22 [template = f64] +// CHECK:STDOUT: %.loc8_22.3: type = converted %float.make_type.loc8_22, %.loc8_22.2 [template = f64] // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc13_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%struct.1(%.loc13_15.1) [template = f64] +// CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64] +// CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64] // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %.loc13_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%struct.1(%.loc13_23.1) [template = f64] +// CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64] +// CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64] // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %.loc13_31.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%struct.1(%.loc13_31.1) [template = f64] +// CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64] +// CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64] // CHECK:STDOUT: %c.loc13_28.1: f64 = param c // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %.loc13_39.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_39: init type = call constants.%struct.1(%.loc13_39.1) [template = f64] +// CHECK:STDOUT: %.loc13_39.2: type = value_of_initializer %float.make_type.loc13_39 [template = f64] +// CHECK:STDOUT: %.loc13_39.3: type = converted %float.make_type.loc13_39, %.loc13_39.2 [template = f64] // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc17_21.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_21: init type = call constants.%struct.1(%.loc17_21.1) [template = f64] +// CHECK:STDOUT: %.loc17_21.2: type = value_of_initializer %float.make_type.loc17_21 [template = f64] +// CHECK:STDOUT: %.loc17_21.3: type = converted %float.make_type.loc17_21, %.loc17_21.2 [template = f64] // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 +// CHECK:STDOUT: %.loc17_29.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_29: init type = call constants.%struct.1(%.loc17_29.1) [template = f64] +// CHECK:STDOUT: %.loc17_29.2: type = value_of_initializer %float.make_type.loc17_29 [template = f64] +// CHECK:STDOUT: %.loc17_29.3: type = converted %float.make_type.loc17_29, %.loc17_29.2 [template = f64] // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc17_37.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_37.2: type = converted %bool.make_type.loc17, %.loc17_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc18_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_17: init type = call constants.%struct.1(%.loc18_17.1) [template = f64] +// CHECK:STDOUT: %.loc18_17.2: type = value_of_initializer %float.make_type.loc18_17 [template = f64] +// CHECK:STDOUT: %.loc18_17.3: type = converted %float.make_type.loc18_17, %.loc18_17.2 [template = f64] // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 +// CHECK:STDOUT: %.loc18_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_25: init type = call constants.%struct.1(%.loc18_25.1) [template = f64] +// CHECK:STDOUT: %.loc18_25.2: type = value_of_initializer %float.make_type.loc18_25 [template = f64] +// CHECK:STDOUT: %.loc18_25.3: type = converted %float.make_type.loc18_25, %.loc18_25.2 [template = f64] // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 +// CHECK:STDOUT: %.loc18_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_33: init type = call constants.%struct.1(%.loc18_33.1) [template = f64] +// CHECK:STDOUT: %.loc18_33.2: type = value_of_initializer %float.make_type.loc18_33 [template = f64] +// CHECK:STDOUT: %.loc18_33.3: type = converted %float.make_type.loc18_33, %.loc18_33.2 [template = f64] // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc20_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%struct.1(%.loc20_25.1) [template = f64] +// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] +// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 +// CHECK:STDOUT: %.loc20_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%struct.1(%.loc20_33.1) [template = f64] +// CHECK:STDOUT: %.loc20_33.2: type = value_of_initializer %float.make_type.loc20_33 [template = f64] +// CHECK:STDOUT: %.loc20_33.3: type = converted %float.make_type.loc20_33, %.loc20_33.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc24_26.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%struct.1(%.loc24_26.1) [template = f64] +// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] +// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 +// CHECK:STDOUT: %.loc24_34.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%struct.1(%.loc24_34.1) [template = f64] +// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] +// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] // CHECK:STDOUT: %b.loc24_31.1: f64 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: f64 = bind_name b, %b.loc24_31.1 +// CHECK:STDOUT: %.loc24_42.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%struct.1(%.loc24_42.1) [template = f64] +// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] +// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] // CHECK:STDOUT: %c.loc24_39.1: f64 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 +// CHECK:STDOUT: %.loc24_50.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%struct.1(%.loc24_50.1) [template = f64] +// CHECK:STDOUT: %.loc24_50.2: type = value_of_initializer %float.make_type.loc24_50 [template = f64] +// CHECK:STDOUT: %.loc24_50.3: type = converted %float.make_type.loc24_50, %.loc24_50.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %.loc28_32.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%struct.1(%.loc28_32.1) [template = f64] +// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] +// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 +// CHECK:STDOUT: %.loc28_40.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%struct.1(%.loc28_40.1) [template = f64] +// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] +// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] // CHECK:STDOUT: %b.loc28_37.1: f64 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: f64 = bind_name b, %b.loc28_37.1 +// CHECK:STDOUT: %bool.make_type.loc28: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc28_48.1: type = value_of_initializer %bool.make_type.loc28 [template = bool] +// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type.loc28, %.loc28_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: f64) -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: f64, %b: f64, %c: f64) -> f64; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: f64, %b: f64) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: f64, %b: f64) -> f64 = "float.mul"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -211,7 +363,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -223,7 +375,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index 37773e72b5b5..eb73f6b94825 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -70,13 +70,16 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_negate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 1.5 [template] -// CHECK:STDOUT: %.3: f64 = float_literal -1.5 [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 1.5 [template] +// CHECK:STDOUT: %.4: f64 = float_literal -1.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -86,31 +89,63 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc2_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_14: init type = call constants.%struct.1(%.loc2_14.1) [template = f64] +// CHECK:STDOUT: %.loc2_14.2: type = value_of_initializer %float.make_type.loc2_14 [template = f64] +// CHECK:STDOUT: %.loc2_14.3: type = converted %float.make_type.loc2_14, %.loc2_14.2 [template = f64] // CHECK:STDOUT: %a.loc2_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc2_11.1 +// CHECK:STDOUT: %.loc2_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_22: init type = call constants.%struct.1(%.loc2_22.1) [template = f64] +// CHECK:STDOUT: %.loc2_22.2: type = value_of_initializer %float.make_type.loc2_22 [template = f64] +// CHECK:STDOUT: %.loc2_22.3: type = converted %float.make_type.loc2_22, %.loc2_22.2 [template = f64] // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc4_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%struct.1(%.loc4_19.1) [template = f64] +// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] +// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 +// CHECK:STDOUT: %.loc4_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%struct.1(%.loc4_27.1) [template = f64] +// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] +// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 +// CHECK:STDOUT: %.loc4_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%struct.1(%.loc4_35.1) [template = f64] +// CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %float.make_type.loc4_35 [template = f64] +// CHECK:STDOUT: %.loc4_35.3: type = converted %float.make_type.loc4_35, %.loc4_35.2 [template = f64] // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_21: f64 = float_literal 1.5 [template = constants.%.2] -// CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%.loc8_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_25.1: f64 = value_of_initializer %float.negate [template = constants.%.3] -// CHECK:STDOUT: %.loc8_25.2: f64 = converted %float.negate, %.loc8_25.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_8.1) [template = f64] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type.loc8, %.loc8_8.2 [template = f64] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_21: f64 = float_literal 1.5 [template = constants.%.3] +// CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%.loc8_21) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_25.1: f64 = value_of_initializer %float.negate [template = constants.%.4] +// CHECK:STDOUT: %.loc8_25.2: f64 = converted %float.negate, %.loc8_25.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc8: f64 = bind_name a, %.loc8_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: f64) -> f64 = "float.negate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc5_19.1: f64 = value_of_initializer %float.negate @@ -121,21 +156,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -150,60 +190,147 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc8_16.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_16.1) [template = f64] +// CHECK:STDOUT: %.loc8_16.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_16.3: type = converted %float.make_type.loc8, %.loc8_16.2 [template = f64] // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc13_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%struct.1(%.loc13_15.1) [template = f64] +// CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64] +// CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64] // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %.loc13_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%struct.1(%.loc13_23.1) [template = f64] +// CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64] +// CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64] // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %.loc13_31.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%struct.1(%.loc13_31.1) [template = f64] +// CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64] +// CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64] // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc18_21.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18: init type = call constants.%struct.1(%.loc18_21.1) [template = f64] +// CHECK:STDOUT: %.loc18_21.2: type = value_of_initializer %float.make_type.loc18 [template = f64] +// CHECK:STDOUT: %.loc18_21.3: type = converted %float.make_type.loc18, %.loc18_21.2 [template = f64] // CHECK:STDOUT: %a.loc18_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_29.2: type = converted %bool.make_type.loc18, %.loc18_29.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc19_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc19_17: init type = call constants.%struct.1(%.loc19_17.1) [template = f64] +// CHECK:STDOUT: %.loc19_17.2: type = value_of_initializer %float.make_type.loc19_17 [template = f64] +// CHECK:STDOUT: %.loc19_17.3: type = converted %float.make_type.loc19_17, %.loc19_17.2 [template = f64] // CHECK:STDOUT: %a.loc19_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc19_14.1 +// CHECK:STDOUT: %.loc19_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc19_25: init type = call constants.%struct.1(%.loc19_25.1) [template = f64] +// CHECK:STDOUT: %.loc19_25.2: type = value_of_initializer %float.make_type.loc19_25 [template = f64] +// CHECK:STDOUT: %.loc19_25.3: type = converted %float.make_type.loc19_25, %.loc19_25.2 [template = f64] // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.9: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.10: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc21_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc21_25: init type = call constants.%struct.1(%.loc21_25.1) [template = f64] +// CHECK:STDOUT: %.loc21_25.2: type = value_of_initializer %float.make_type.loc21_25 [template = f64] +// CHECK:STDOUT: %.loc21_25.3: type = converted %float.make_type.loc21_25, %.loc21_25.2 [template = f64] // CHECK:STDOUT: %a.loc21_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc21_22.1 +// CHECK:STDOUT: %.loc21_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc21_33: init type = call constants.%struct.1(%.loc21_33.1) [template = f64] +// CHECK:STDOUT: %.loc21_33.2: type = value_of_initializer %float.make_type.loc21_33 [template = f64] +// CHECK:STDOUT: %.loc21_33.3: type = converted %float.make_type.loc21_33, %.loc21_33.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.11: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc32_26.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc32_26: init type = call constants.%struct.1(%.loc32_26.1) [template = f64] +// CHECK:STDOUT: %.loc32_26.2: type = value_of_initializer %float.make_type.loc32_26 [template = f64] +// CHECK:STDOUT: %.loc32_26.3: type = converted %float.make_type.loc32_26, %.loc32_26.2 [template = f64] // CHECK:STDOUT: %a.loc32_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc32_23.1 +// CHECK:STDOUT: %.loc32_34.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc32_34: init type = call constants.%struct.1(%.loc32_34.1) [template = f64] +// CHECK:STDOUT: %.loc32_34.2: type = value_of_initializer %float.make_type.loc32_34 [template = f64] +// CHECK:STDOUT: %.loc32_34.3: type = converted %float.make_type.loc32_34, %.loc32_34.2 [template = f64] // CHECK:STDOUT: %b.loc32_31.1: f64 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: f64 = bind_name b, %b.loc32_31.1 +// CHECK:STDOUT: %.loc32_42.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc32_42: init type = call constants.%struct.1(%.loc32_42.1) [template = f64] +// CHECK:STDOUT: %.loc32_42.2: type = value_of_initializer %float.make_type.loc32_42 [template = f64] +// CHECK:STDOUT: %.loc32_42.3: type = converted %float.make_type.loc32_42, %.loc32_42.2 [template = f64] // CHECK:STDOUT: %c.loc32_39.1: f64 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc32_39.1 +// CHECK:STDOUT: %.loc32_50.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc32_50: init type = call constants.%struct.1(%.loc32_50.1) [template = f64] +// CHECK:STDOUT: %.loc32_50.2: type = value_of_initializer %float.make_type.loc32_50 [template = f64] +// CHECK:STDOUT: %.loc32_50.3: type = converted %float.make_type.loc32_50, %.loc32_50.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.15: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %.loc43_32.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc43_32: init type = call constants.%struct.1(%.loc43_32.1) [template = f64] +// CHECK:STDOUT: %.loc43_32.2: type = value_of_initializer %float.make_type.loc43_32 [template = f64] +// CHECK:STDOUT: %.loc43_32.3: type = converted %float.make_type.loc43_32, %.loc43_32.2 [template = f64] // CHECK:STDOUT: %a.loc43_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc43_29.1 +// CHECK:STDOUT: %.loc43_40.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc43_40: init type = call constants.%struct.1(%.loc43_40.1) [template = f64] +// CHECK:STDOUT: %.loc43_40.2: type = value_of_initializer %float.make_type.loc43_40 [template = f64] +// CHECK:STDOUT: %.loc43_40.3: type = converted %float.make_type.loc43_40, %.loc43_40.2 [template = f64] // CHECK:STDOUT: %b.loc43_37.1: f64 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: f64 = bind_name b, %b.loc43_37.1 +// CHECK:STDOUT: %bool.make_type.loc43: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc43_48.1: type = value_of_initializer %bool.make_type.loc43 [template = bool] +// CHECK:STDOUT: %.loc43_48.2: type = converted %bool.make_type.loc43, %.loc43_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew() -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: f64, %b: f64) -> f64; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: f64) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: f64) -> f64 = "float.negate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc29_19.1: f64 = value_of_initializer %TooFew.call [template = ] @@ -213,7 +340,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -225,7 +352,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index 148beed225a9..c6377187cad5 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -32,21 +32,26 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: --- float_neq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %Neq: type = fn_type @Neq [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Neq = struct_value () [template] +// CHECK:STDOUT: %struct.3: Neq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal true [template] -// CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.7: bool = bool_literal true [template] +// CHECK:STDOUT: %.8: bool = bool_literal false [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.5: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,16 +64,30 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc2_11.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%struct.1(%.loc2_11.1) [template = f64] +// CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64] +// CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64] // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Neq.%a: f64 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %.loc2_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%struct.1(%.loc2_19.1) [template = f64] +// CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64] +// CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64] // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Neq.%b: f64 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_27.2: type = converted %bool.make_type.loc2, %.loc2_27.1 [template = bool] // CHECK:STDOUT: @Neq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -76,11 +95,25 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc12_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc12_19: init type = call constants.%struct.1(%.loc12_19.1) [template = f64] +// CHECK:STDOUT: %.loc12_19.2: type = value_of_initializer %float.make_type.loc12_19 [template = f64] +// CHECK:STDOUT: %.loc12_19.3: type = converted %float.make_type.loc12_19, %.loc12_19.2 [template = f64] // CHECK:STDOUT: %a.loc12_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc12_16.1 +// CHECK:STDOUT: %.loc12_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc12_27: init type = call constants.%struct.1(%.loc12_27.1) [template = f64] +// CHECK:STDOUT: %.loc12_27.2: type = value_of_initializer %float.make_type.loc12_27 [template = f64] +// CHECK:STDOUT: %.loc12_27.3: type = converted %float.make_type.loc12_27, %.loc12_27.2 [template = f64] // CHECK:STDOUT: %b.loc12_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc12_24.1 +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc12_35.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type.loc12, %.loc12_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -95,17 +128,21 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Neq(%a: f64, %b: f64) -> bool = "float.neq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_20: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_25: f64 = float_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %float.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_20, %.loc8_25) [template = constants.%.6] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %float.neq.loc8 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %float.neq.loc8, %.loc8_13.1 [template = constants.%.6] +// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc8_20: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_25: f64 = float_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %float.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_20, %.loc8_25) [template = constants.%.7] +// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %float.neq.loc8 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_13.2: bool = converted %float.neq.loc8, %.loc8_13.1 [template = constants.%.7] // CHECK:STDOUT: if %.loc8_13.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8: @@ -119,12 +156,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_26: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %float.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.neq.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.neq.loc9, %.loc9_14.1 [template = constants.%.7] +// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_26: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %float.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.8] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %float.neq.loc9 [template = constants.%.8] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %float.neq.loc9, %.loc9_14.1 [template = constants.%.8] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -142,7 +179,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.neq: init bool = call %Neq.ref(%a.ref, %b.ref) @@ -154,9 +191,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: %struct.2: WrongResult = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -165,14 +205,31 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc7_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_19: init type = call constants.%struct.1(%.loc7_19.1) [template = f64] +// CHECK:STDOUT: %.loc7_19.2: type = value_of_initializer %float.make_type.loc7_19 [template = f64] +// CHECK:STDOUT: %.loc7_19.3: type = converted %float.make_type.loc7_19, %.loc7_19.2 [template = f64] // CHECK:STDOUT: %a.loc7_16.1: f64 = param a // CHECK:STDOUT: @WrongResult.%a: f64 = bind_name a, %a.loc7_16.1 +// CHECK:STDOUT: %.loc7_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_27: init type = call constants.%struct.1(%.loc7_27.1) [template = f64] +// CHECK:STDOUT: %.loc7_27.2: type = value_of_initializer %float.make_type.loc7_27 [template = f64] +// CHECK:STDOUT: %.loc7_27.3: type = converted %float.make_type.loc7_27, %.loc7_27.2 [template = f64] // CHECK:STDOUT: %b.loc7_24.1: f64 = param b // CHECK:STDOUT: @WrongResult.%b: f64 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %.loc7_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc7_35: init type = call constants.%struct.1(%.loc7_35.1) [template = f64] +// CHECK:STDOUT: %.loc7_35.2: type = value_of_initializer %float.make_type.loc7_35 [template = f64] +// CHECK:STDOUT: %.loc7_35.3: type = converted %float.make_type.loc7_35, %.loc7_35.2 [template = f64] // CHECK:STDOUT: @WrongResult.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @WrongResult(%a: f64, %b: f64) -> f64; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index 43eb7b63c292..58785f466c82 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -49,14 +49,17 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 0.5 [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1.5 [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 0.5 [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -67,29 +70,66 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc2_11.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%struct.1(%.loc2_11.1) [template = f64] +// CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64] +// CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64] // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Sub.%a: f64 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %.loc2_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%struct.1(%.loc2_19.1) [template = f64] +// CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64] +// CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64] // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Sub.%b: f64 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %.loc2_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc2_27: init type = call constants.%struct.1(%.loc2_27.1) [template = f64] +// CHECK:STDOUT: %.loc2_27.2: type = value_of_initializer %float.make_type.loc2_27 [template = f64] +// CHECK:STDOUT: %.loc2_27.3: type = converted %float.make_type.loc2_27, %.loc2_27.2 [template = f64] // CHECK:STDOUT: @Sub.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc4_19.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%struct.1(%.loc4_19.1) [template = f64] +// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] +// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 +// CHECK:STDOUT: %.loc4_27.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%struct.1(%.loc4_27.1) [template = f64] +// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] +// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 +// CHECK:STDOUT: %.loc4_35.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%struct.1(%.loc4_35.1) [template = f64] +// CHECK:STDOUT: %.loc4_35.2: type = value_of_initializer %float.make_type.loc4_35 [template = f64] +// CHECK:STDOUT: %.loc4_35.3: type = converted %float.make_type.loc4_35, %.loc4_35.2 [template = f64] // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %.loc8_8.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.1(%.loc8_8.1) [template = f64] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type.loc8, %.loc8_8.2 [template = f64] // CHECK:STDOUT: %x.var: ref f64 = var x // CHECK:STDOUT: %x: ref f64 = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: f64, %b: f64) -> f64 = "float.sub"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%a.ref, %b.ref) @@ -100,10 +140,10 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.3] -// CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.4] +// CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%.loc8_18, %.loc8_23) [template = constants.%.5] // CHECK:STDOUT: assign file.%x.var, %float.sub // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -111,21 +151,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -140,68 +185,175 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc8_14.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_14: init type = call constants.%struct.1(%.loc8_14.1) [template = f64] +// CHECK:STDOUT: %.loc8_14.2: type = value_of_initializer %float.make_type.loc8_14 [template = f64] +// CHECK:STDOUT: %.loc8_14.3: type = converted %float.make_type.loc8_14, %.loc8_14.2 [template = f64] // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %.loc8_22.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc8_22: init type = call constants.%struct.1(%.loc8_22.1) [template = f64] +// CHECK:STDOUT: %.loc8_22.2: type = value_of_initializer %float.make_type.loc8_22 [template = f64] +// CHECK:STDOUT: %.loc8_22.3: type = converted %float.make_type.loc8_22, %.loc8_22.2 [template = f64] // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc13_15.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%struct.1(%.loc13_15.1) [template = f64] +// CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64] +// CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64] // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %.loc13_23.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%struct.1(%.loc13_23.1) [template = f64] +// CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64] +// CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64] // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %.loc13_31.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%struct.1(%.loc13_31.1) [template = f64] +// CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64] +// CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64] // CHECK:STDOUT: %c.loc13_28.1: f64 = param c // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %.loc13_39.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc13_39: init type = call constants.%struct.1(%.loc13_39.1) [template = f64] +// CHECK:STDOUT: %.loc13_39.2: type = value_of_initializer %float.make_type.loc13_39 [template = f64] +// CHECK:STDOUT: %.loc13_39.3: type = converted %float.make_type.loc13_39, %.loc13_39.2 [template = f64] // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %.loc17_21.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_21: init type = call constants.%struct.1(%.loc17_21.1) [template = f64] +// CHECK:STDOUT: %.loc17_21.2: type = value_of_initializer %float.make_type.loc17_21 [template = f64] +// CHECK:STDOUT: %.loc17_21.3: type = converted %float.make_type.loc17_21, %.loc17_21.2 [template = f64] // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 +// CHECK:STDOUT: %.loc17_29.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc17_29: init type = call constants.%struct.1(%.loc17_29.1) [template = f64] +// CHECK:STDOUT: %.loc17_29.2: type = value_of_initializer %float.make_type.loc17_29 [template = f64] +// CHECK:STDOUT: %.loc17_29.3: type = converted %float.make_type.loc17_29, %.loc17_29.2 [template = f64] // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc17_37.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_37.2: type = converted %bool.make_type.loc17, %.loc17_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %.loc18_17.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_17: init type = call constants.%struct.1(%.loc18_17.1) [template = f64] +// CHECK:STDOUT: %.loc18_17.2: type = value_of_initializer %float.make_type.loc18_17 [template = f64] +// CHECK:STDOUT: %.loc18_17.3: type = converted %float.make_type.loc18_17, %.loc18_17.2 [template = f64] // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 +// CHECK:STDOUT: %.loc18_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_25: init type = call constants.%struct.1(%.loc18_25.1) [template = f64] +// CHECK:STDOUT: %.loc18_25.2: type = value_of_initializer %float.make_type.loc18_25 [template = f64] +// CHECK:STDOUT: %.loc18_25.3: type = converted %float.make_type.loc18_25, %.loc18_25.2 [template = f64] // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 +// CHECK:STDOUT: %.loc18_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc18_33: init type = call constants.%struct.1(%.loc18_33.1) [template = f64] +// CHECK:STDOUT: %.loc18_33.2: type = value_of_initializer %float.make_type.loc18_33 [template = f64] +// CHECK:STDOUT: %.loc18_33.3: type = converted %float.make_type.loc18_33, %.loc18_33.2 [template = f64] // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc20_25.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%struct.1(%.loc20_25.1) [template = f64] +// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] +// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 +// CHECK:STDOUT: %.loc20_33.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%struct.1(%.loc20_33.1) [template = f64] +// CHECK:STDOUT: %.loc20_33.2: type = value_of_initializer %float.make_type.loc20_33 [template = f64] +// CHECK:STDOUT: %.loc20_33.3: type = converted %float.make_type.loc20_33, %.loc20_33.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc24_26.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%struct.1(%.loc24_26.1) [template = f64] +// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] +// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 +// CHECK:STDOUT: %.loc24_34.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%struct.1(%.loc24_34.1) [template = f64] +// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] +// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] // CHECK:STDOUT: %b.loc24_31.1: f64 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: f64 = bind_name b, %b.loc24_31.1 +// CHECK:STDOUT: %.loc24_42.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%struct.1(%.loc24_42.1) [template = f64] +// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] +// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] // CHECK:STDOUT: %c.loc24_39.1: f64 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 +// CHECK:STDOUT: %.loc24_50.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%struct.1(%.loc24_50.1) [template = f64] +// CHECK:STDOUT: %.loc24_50.2: type = value_of_initializer %float.make_type.loc24_50 [template = f64] +// CHECK:STDOUT: %.loc24_50.3: type = converted %float.make_type.loc24_50, %.loc24_50.2 [template = f64] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %.loc28_32.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%struct.1(%.loc28_32.1) [template = f64] +// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] +// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 +// CHECK:STDOUT: %.loc28_40.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%struct.1(%.loc28_40.1) [template = f64] +// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] +// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] // CHECK:STDOUT: %b.loc28_37.1: f64 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: f64 = bind_name b, %b.loc28_37.1 +// CHECK:STDOUT: %bool.make_type.loc28: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc28_48.1: type = value_of_initializer %bool.make_type.loc28 [template = bool] +// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type.loc28, %.loc28_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: f64) -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: f64, %b: f64, %c: f64) -> f64; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: f64, %b: f64) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: f64, %b: f64) -> f64 = "float.sub"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -211,7 +363,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -223,7 +375,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index fb0ef520405f..ceaa44730ce6 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -18,16 +18,18 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %And: type = fn_type @And [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: And = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %And: type = fn_type @And [template] +// CHECK:STDOUT: %struct.2: And = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: %.3: i32 = int_literal 10 [template] // CHECK:STDOUT: %.4: i32 = int_literal 8 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 8] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,40 +40,74 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.1] { +// 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: %And.decl: And = fn_decl @And [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.3] // CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_27: type = array_type %int.and, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 8] = var arr // CHECK:STDOUT: %arr: ref [i32; 8] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 8] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 8] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 8]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 8]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @And(%a: i32, %b: i32) -> i32 = "int.and"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %And.ref: And = name_ref And, file.%And.decl [template = constants.%struct.1] +// CHECK:STDOUT: %And.ref: And = name_ref And, file.%And.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.and: init i32 = call %And.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index 43aae3bbb994..d91c6d54e8b0 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -19,11 +19,13 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: --- int_complement.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Complement: type = fn_type @Complement [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Complement = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Complement: type = fn_type @Complement [template] +// CHECK:STDOUT: %struct.2: Complement = struct_value () [template] // CHECK:STDOUT: %And: type = fn_type @And [template] -// CHECK:STDOUT: %struct.2: And = struct_value () [template] +// CHECK:STDOUT: %struct.3: And = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1193046 [template] // CHECK:STDOUT: %.3: i32 = int_literal -1193047 [template] // CHECK:STDOUT: %.4: i32 = int_literal 16777215 [template] @@ -31,7 +33,7 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %.6: type = array_type %.5, i32 [template] // CHECK:STDOUT: %.7: type = ptr_type [i32; 15584169] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,49 +45,87 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Complement.decl: Complement = fn_decl @Complement [template = constants.%struct.1] { +// 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: %Complement.decl: Complement = fn_decl @Complement [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_18.1: type = value_of_initializer %int.make_type_32.loc2_18 [template = i32] +// CHECK:STDOUT: %.loc2_18.2: type = converted %int.make_type_32.loc2_18, %.loc2_18.1 [template = i32] // CHECK:STDOUT: %a.loc2_15.1: i32 = param a // CHECK:STDOUT: @Complement.%a: i32 = bind_name a, %a.loc2_15.1 +// CHECK:STDOUT: %int.make_type_32.loc2_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %int.make_type_32.loc2_26 [template = i32] +// CHECK:STDOUT: %.loc2_26.2: type = converted %int.make_type_32.loc2_26, %.loc2_26.1 [template = i32] // CHECK:STDOUT: @Complement.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %And.decl: And = fn_decl @And [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc3_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_11.1: type = value_of_initializer %int.make_type_32.loc3_11 [template = i32] +// CHECK:STDOUT: %.loc3_11.2: type = converted %int.make_type_32.loc3_11, %.loc3_11.1 [template = i32] // CHECK:STDOUT: %a.loc3_8.1: i32 = param a // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc3_8.1 +// CHECK:STDOUT: %int.make_type_32.loc3_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_19.1: type = value_of_initializer %int.make_type_32.loc3_19 [template = i32] +// CHECK:STDOUT: %.loc3_19.2: type = converted %int.make_type_32.loc3_19, %.loc3_19.1 [template = i32] // CHECK:STDOUT: %b.loc3_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc3_16.1 +// CHECK:STDOUT: %int.make_type_32.loc3_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_27.1: type = value_of_initializer %int.make_type_32.loc3_27 [template = i32] +// CHECK:STDOUT: %.loc3_27.2: type = converted %int.make_type_32.loc3_27, %.loc3_27.1 [template = i32] // CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, %Complement.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, %Complement.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc5_31: i32 = int_literal 1193046 [template = constants.%.2] // CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.3] // CHECK:STDOUT: %.loc5_42: i32 = int_literal 16777215 [template = constants.%.4] // CHECK:STDOUT: %.loc5_19.1: i32 = value_of_initializer %int.complement [template = constants.%.3] // CHECK:STDOUT: %.loc5_19.2: i32 = converted %int.complement, %.loc5_19.1 [template = constants.%.3] // CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_19.2, %.loc5_42) [template = constants.%.5] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %.loc5_51: type = array_type %int.and, i32 [template = constants.%.6] // CHECK:STDOUT: %arr.var: ref [i32; 15584169] = var arr // CHECK:STDOUT: %arr: ref [i32; 15584169] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 15584169 [template = constants.%.5] +// CHECK:STDOUT: %.loc6_13.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_13.2: type = converted %int.make_type_32.loc6, %.loc6_13.1 [template = i32] // CHECK:STDOUT: %.loc6_26: type = array_type %.loc6_18, i32 [template = constants.%.6] // CHECK:STDOUT: %.loc6_27: type = ptr_type [i32; 15584169] [template = constants.%.7] // CHECK:STDOUT: %arr.ref: ref [i32; 15584169] = name_ref arr, %arr // CHECK:STDOUT: %.loc6_31: [i32; 15584169]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 15584169]* = bind_name arr_p, %.loc6_31 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc8_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32.loc8_19 [template = i32] +// CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32.loc8_19, %.loc8_19.1 [template = i32] // CHECK:STDOUT: %a.loc8_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc8_16.1 +// CHECK:STDOUT: %int.make_type_32.loc8_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_27.1: type = value_of_initializer %int.make_type_32.loc8_27 [template = i32] +// CHECK:STDOUT: %.loc8_27.2: type = converted %int.make_type_32.loc8_27, %.loc8_27.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Complement(%a: i32) -> i32 = "int.complement"; // CHECK:STDOUT: // CHECK:STDOUT: fn @And(%a: i32, %b: i32) -> i32 = "int.and"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, file.%Complement.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, file.%Complement.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%a.ref) // CHECK:STDOUT: %.loc9_23.1: i32 = value_of_initializer %int.complement diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index b9c185b2a8f9..4fe728af6905 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -32,21 +32,25 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: --- int_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Eq: type = fn_type @Eq [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Eq = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %Eq: type = fn_type @Eq [template] +// CHECK:STDOUT: %struct.3: Eq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: bool = bool_literal true [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: %.7: bool = bool_literal false [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.5: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,16 +63,28 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_10.1: type = value_of_initializer %int.make_type_32.loc2_10 [template = i32] +// CHECK:STDOUT: %.loc2_10.2: type = converted %int.make_type_32.loc2_10, %.loc2_10.1 [template = i32] // CHECK:STDOUT: %a.loc2_7.1: i32 = param a // CHECK:STDOUT: @Eq.%a: i32 = bind_name a, %a.loc2_7.1 +// CHECK:STDOUT: %int.make_type_32.loc2_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_18.1: type = value_of_initializer %int.make_type_32.loc2_18 [template = i32] +// CHECK:STDOUT: %.loc2_18.2: type = converted %int.make_type_32.loc2_18, %.loc2_18.1 [template = i32] // CHECK:STDOUT: %b.loc2_15.1: i32 = param b // CHECK:STDOUT: @Eq.%b: i32 = bind_name b, %b.loc2_15.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_26.2: type = converted %bool.make_type.loc2, %.loc2_26.1 [template = bool] // CHECK:STDOUT: @Eq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -76,11 +92,23 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc12_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32.loc12_19 [template = i32] +// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32.loc12_19, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %a.loc12_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 +// CHECK:STDOUT: %int.make_type_32.loc12_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_27.1: type = value_of_initializer %int.make_type_32.loc12_27 [template = i32] +// CHECK:STDOUT: %.loc12_27.2: type = converted %int.make_type_32.loc12_27, %.loc12_27.1 [template = i32] // CHECK:STDOUT: %b.loc12_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc12_24.1 +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc12_35.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type.loc12, %.loc12_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -95,12 +123,16 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Eq(%a: i32, %b: i32) -> bool = "int.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc8_19: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_22) [template = constants.%.5] @@ -119,7 +151,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] @@ -142,7 +174,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.eq: init bool = call %Eq.ref(%a.ref, %b.ref) @@ -154,9 +186,11 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] +// CHECK:STDOUT: %struct.2: WrongResult = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -165,14 +199,28 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [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: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct.2] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @WrongResult.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @WrongResult.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @WrongResult.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @WrongResult(%a: i32, %b: i32) -> i32; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index 53fba1308fef..96332830688d 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -27,16 +27,20 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_greater.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Greater = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %struct.3: Greater = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -45,7 +49,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.8: bool = bool_literal true [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +63,41 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_15.1: type = value_of_initializer %int.make_type_32.loc2_15 [template = i32] +// CHECK:STDOUT: %.loc2_15.2: type = converted %int.make_type_32.loc2_15, %.loc2_15.1 [template = i32] // CHECK:STDOUT: %a.loc2_12.1: i32 = param a // CHECK:STDOUT: @Greater.%a: i32 = bind_name a, %a.loc2_12.1 +// CHECK:STDOUT: %int.make_type_32.loc2_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_23.1: type = value_of_initializer %int.make_type_32.loc2_23 [template = i32] +// CHECK:STDOUT: %.loc2_23.2: type = converted %int.make_type_32.loc2_23, %.loc2_23.1 [template = i32] // CHECK:STDOUT: %b.loc2_20.1: i32 = param b // CHECK:STDOUT: @Greater.%b: i32 = bind_name b, %b.loc2_20.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_31.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_31.2: type = converted %bool.make_type.loc2, %.loc2_31.1 [template = bool] // CHECK:STDOUT: @Greater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc3_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_14.1: type = value_of_initializer %int.make_type_32.loc3_14 [template = i32] +// CHECK:STDOUT: %.loc3_14.2: type = converted %int.make_type_32.loc3_14, %.loc3_14.1 [template = i32] // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %int.make_type_32.loc3_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_22.1: type = value_of_initializer %int.make_type_32.loc3_22 [template = i32] +// CHECK:STDOUT: %.loc3_22.2: type = converted %int.make_type_32.loc3_22, %.loc3_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +105,23 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc16_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16_19 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16_19, %.loc16_19.1 [template = i32] // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_27.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32] +// CHECK:STDOUT: %.loc16_27.2: type = converted %int.make_type_32.loc16_27, %.loc16_27.1 [template = i32] // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +136,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Greater(%a: i32, %b: i32) -> bool = "int.greater"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; @@ -107,7 +147,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_28: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_28) [template = constants.%.6] @@ -126,7 +166,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_28: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_28) [template = constants.%.6] @@ -145,7 +185,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] @@ -164,8 +204,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_32: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.9] // CHECK:STDOUT: %.loc12_36: i32 = int_literal 0 [template = constants.%.7] @@ -187,9 +227,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] // CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -214,7 +254,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.greater: init bool = call %Greater.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index f7b4ee5ceb60..70636bfb0b08 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -27,16 +27,20 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_greater_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %GreaterEq: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: GreaterEq = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %GreaterEq: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %struct.3: GreaterEq = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -45,7 +49,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +63,41 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_17.1: type = value_of_initializer %int.make_type_32.loc2_17 [template = i32] +// CHECK:STDOUT: %.loc2_17.2: type = converted %int.make_type_32.loc2_17, %.loc2_17.1 [template = i32] // CHECK:STDOUT: %a.loc2_14.1: i32 = param a // CHECK:STDOUT: @GreaterEq.%a: i32 = bind_name a, %a.loc2_14.1 +// CHECK:STDOUT: %int.make_type_32.loc2_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_25.1: type = value_of_initializer %int.make_type_32.loc2_25 [template = i32] +// CHECK:STDOUT: %.loc2_25.2: type = converted %int.make_type_32.loc2_25, %.loc2_25.1 [template = i32] // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @GreaterEq.%b: i32 = bind_name b, %b.loc2_22.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_33.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_33.2: type = converted %bool.make_type.loc2, %.loc2_33.1 [template = bool] // CHECK:STDOUT: @GreaterEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc3_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_14.1: type = value_of_initializer %int.make_type_32.loc3_14 [template = i32] +// CHECK:STDOUT: %.loc3_14.2: type = converted %int.make_type_32.loc3_14, %.loc3_14.1 [template = i32] // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %int.make_type_32.loc3_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_22.1: type = value_of_initializer %int.make_type_32.loc3_22 [template = i32] +// CHECK:STDOUT: %.loc3_22.2: type = converted %int.make_type_32.loc3_22, %.loc3_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +105,23 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc16_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16_19 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16_19, %.loc16_19.1 [template = i32] // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_27.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32] +// CHECK:STDOUT: %.loc16_27.2: type = converted %int.make_type_32.loc16_27, %.loc16_27.1 [template = i32] // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +136,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @GreaterEq(%a: i32, %b: i32) -> bool = "int.greater_eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; @@ -107,7 +147,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_27: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_30: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_30) [template = constants.%.6] @@ -126,7 +166,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_29) [template = constants.%.7] @@ -145,7 +185,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc11_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_29: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_29) [template = constants.%.7] @@ -164,8 +204,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.9] // CHECK:STDOUT: %.loc12_38: i32 = int_literal 0 [template = constants.%.8] @@ -187,9 +227,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13_26: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc13_36: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] // CHECK:STDOUT: %.loc13_25.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -214,7 +254,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 810e012ce57f..e4938273defd 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -62,16 +62,18 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: --- int_left_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: LeftShift = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %struct.2: LeftShift = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 5 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 20 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 20] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -82,40 +84,74 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.1] { +// 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: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_17.1: type = value_of_initializer %int.make_type_32.loc2_17 [template = i32] +// CHECK:STDOUT: %.loc2_17.2: type = converted %int.make_type_32.loc2_17, %.loc2_17.1 [template = i32] // CHECK:STDOUT: %a.loc2_14.1: i32 = param a // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc2_14.1 +// CHECK:STDOUT: %int.make_type_32.loc2_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_25.1: type = value_of_initializer %int.make_type_32.loc2_25 [template = i32] +// CHECK:STDOUT: %.loc2_25.2: type = converted %int.make_type_32.loc2_25, %.loc2_25.1 [template = i32] // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc2_22.1 +// CHECK:STDOUT: %int.make_type_32.loc2_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_33.1: type = value_of_initializer %int.make_type_32.loc2_33 [template = i32] +// CHECK:STDOUT: %.loc2_33.2: type = converted %int.make_type_32.loc2_33, %.loc2_33.1 [template = i32] // CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_26: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %.loc4_29: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_31: type = array_type %int.left_shift, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 20] = var arr // CHECK:STDOUT: %arr: ref [i32; 20] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 20 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 20] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 20] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_25: [i32; 20]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 20]* = bind_name arr_p, %.loc5_25 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift(%a: i32, %b: i32) -> i32 = "int.left_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, file.%LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, file.%LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%a.ref, %b.ref) @@ -127,11 +163,13 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: --- fail_bad_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: LeftShift = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %struct.2: LeftShift = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 31 [template] // CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] @@ -149,70 +187,122 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.1] { +// 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: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_17.1: type = value_of_initializer %int.make_type_32.loc4_17 [template = i32] +// CHECK:STDOUT: %.loc4_17.2: type = converted %int.make_type_32.loc4_17, %.loc4_17.1 [template = i32] // CHECK:STDOUT: %a.loc4_14.1: i32 = param a // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc4_14.1 +// CHECK:STDOUT: %int.make_type_32.loc4_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_25.1: type = value_of_initializer %int.make_type_32.loc4_25 [template = i32] +// CHECK:STDOUT: %.loc4_25.2: type = converted %int.make_type_32.loc4_25, %.loc4_25.1 [template = i32] // CHECK:STDOUT: %b.loc4_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc4_22.1 +// CHECK:STDOUT: %int.make_type_32.loc4_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int.make_type_32.loc4_33 [template = i32] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int.make_type_32.loc4_33, %.loc4_33.1 [template = i32] // CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_14.1: type = value_of_initializer %int.make_type_32.loc5_14 [template = i32] +// CHECK:STDOUT: %.loc5_14.2: type = converted %int.make_type_32.loc5_14, %.loc5_14.1 [template = i32] // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 +// CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_22.1: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32] +// CHECK:STDOUT: %.loc5_22.2: type = converted %int.make_type_32.loc5_22, %.loc5_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LeftShift.ref.loc8: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: 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_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc8: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_32: i32 = int_literal 31 [template = constants.%.3] // CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.4] // CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.4] // CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.4] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc13: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc13: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc13_32: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc13: init i32 = call %LeftShift.ref.loc13(%.loc13_29, %.loc13_32) [template = ] // CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %int.left_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_35.2: i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc18: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_13.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_13.2: type = converted %int.make_type_32.loc18, %.loc18_13.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc18: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc18_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc18_32: i32 = int_literal 33 [template = constants.%.6] // CHECK:STDOUT: %int.left_shift.loc18: init i32 = call %LeftShift.ref.loc18(%.loc18_29, %.loc18_32) [template = ] // CHECK:STDOUT: %.loc18_35.1: i32 = value_of_initializer %int.left_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_35.2: i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc21: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_17.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_17.2: type = converted %int.make_type_32.loc21, %.loc21_17.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc21: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc21_33: i32 = int_literal 1000 [template = constants.%.7] // CHECK:STDOUT: %.loc21_39: i32 = int_literal 31 [template = constants.%.3] // CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.8] // CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.8] // CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.8] // CHECK:STDOUT: %overflow_1: i32 = bind_name overflow_1, %.loc21_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc26: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_17.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_17.2: type = converted %int.make_type_32.loc26, %.loc26_17.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc26: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc26_33: i32 = int_literal 1000 [template = constants.%.7] // CHECK:STDOUT: %.loc26_39: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc26: init i32 = call %LeftShift.ref.loc26(%.loc26_33, %.loc26_39) [template = ] // CHECK:STDOUT: %.loc26_42.1: i32 = value_of_initializer %int.left_shift.loc26 [template = ] // CHECK:STDOUT: %.loc26_42.2: i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] // CHECK:STDOUT: %overflow_2: i32 = bind_name overflow_2, %.loc26_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc29: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_20.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_20.2: type = converted %int.make_type_32.loc29, %.loc29_20.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc29: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc29_36: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc29_39: i32 = int_literal 31 [template = constants.%.3] // CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.8] // CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.8] // CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.8] // CHECK:STDOUT: %no_overflow_1: i32 = bind_name no_overflow_1, %.loc29_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc34: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_20.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_20.2: type = converted %int.make_type_32.loc34, %.loc34_20.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc34: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc34_36: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc34_39: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc34: init i32 = call %LeftShift.ref.loc34(%.loc34_36, %.loc34_39) [template = ] // CHECK:STDOUT: %.loc34_42.1: i32 = value_of_initializer %int.left_shift.loc34 [template = ] // CHECK:STDOUT: %.loc34_42.2: i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] // CHECK:STDOUT: %no_overflow_2: i32 = bind_name no_overflow_2, %.loc34_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc40: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc40: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc40_15.1: type = value_of_initializer %int.make_type_32.loc40 [template = i32] +// CHECK:STDOUT: %.loc40_15.2: type = converted %int.make_type_32.loc40, %.loc40_15.1 [template = i32] +// CHECK:STDOUT: %LeftShift.ref.loc40: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc40_31: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc40_41: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.9] // CHECK:STDOUT: %.loc40_30.1: i32 = value_of_initializer %int.snegate [template = constants.%.9] @@ -223,6 +313,8 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc40_44.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift(%a: i32, %b: i32) -> i32 = "int.left_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index be28dce3503e..765ae175812d 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -27,16 +27,20 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_less.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %struct.3: Less = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -45,7 +49,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +63,41 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_12.1: type = value_of_initializer %int.make_type_32.loc2_12 [template = i32] +// CHECK:STDOUT: %.loc2_12.2: type = converted %int.make_type_32.loc2_12, %.loc2_12.1 [template = i32] // CHECK:STDOUT: %a.loc2_9.1: i32 = param a // CHECK:STDOUT: @Less.%a: i32 = bind_name a, %a.loc2_9.1 +// CHECK:STDOUT: %int.make_type_32.loc2_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_20.1: type = value_of_initializer %int.make_type_32.loc2_20 [template = i32] +// CHECK:STDOUT: %.loc2_20.2: type = converted %int.make_type_32.loc2_20, %.loc2_20.1 [template = i32] // CHECK:STDOUT: %b.loc2_17.1: i32 = param b // CHECK:STDOUT: @Less.%b: i32 = bind_name b, %b.loc2_17.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_28.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_28.2: type = converted %bool.make_type.loc2, %.loc2_28.1 [template = bool] // CHECK:STDOUT: @Less.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc3_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_14.1: type = value_of_initializer %int.make_type_32.loc3_14 [template = i32] +// CHECK:STDOUT: %.loc3_14.2: type = converted %int.make_type_32.loc3_14, %.loc3_14.1 [template = i32] // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %int.make_type_32.loc3_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_22.1: type = value_of_initializer %int.make_type_32.loc3_22 [template = i32] +// CHECK:STDOUT: %.loc3_22.2: type = converted %int.make_type_32.loc3_22, %.loc3_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +105,23 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc16_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16_19 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16_19, %.loc16_19.1 [template = i32] // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_27.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32] +// CHECK:STDOUT: %.loc16_27.2: type = converted %int.make_type_32.loc16_27, %.loc16_27.1 [template = i32] // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +136,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Less(%a: i32, %b: i32) -> bool = "int.less"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; @@ -107,7 +147,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_24: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_24) [template = constants.%.6] @@ -126,7 +166,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_25) [template = constants.%.7] @@ -145,7 +185,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc11_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_25: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_25) [template = constants.%.7] @@ -164,8 +204,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_28: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.9] // CHECK:STDOUT: %.loc12_32: i32 = int_literal 0 [template = constants.%.8] @@ -187,9 +227,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13_22: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc13_32: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_32) [template = constants.%.9] // CHECK:STDOUT: %.loc13_21.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -214,7 +254,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.less: init bool = call %Less.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index d195cd2f677a..1bec83f426b6 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -27,16 +27,20 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %LessEq: type = fn_type @LessEq [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: LessEq = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %LessEq: type = fn_type @LessEq [template] +// CHECK:STDOUT: %struct.3: LessEq = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -45,7 +49,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.8: bool = bool_literal false [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,21 +63,41 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_14.1: type = value_of_initializer %int.make_type_32.loc2_14 [template = i32] +// CHECK:STDOUT: %.loc2_14.2: type = converted %int.make_type_32.loc2_14, %.loc2_14.1 [template = i32] // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @LessEq.%a: i32 = bind_name a, %a.loc2_11.1 +// CHECK:STDOUT: %int.make_type_32.loc2_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_22.1: type = value_of_initializer %int.make_type_32.loc2_22 [template = i32] +// CHECK:STDOUT: %.loc2_22.2: type = converted %int.make_type_32.loc2_22, %.loc2_22.1 [template = i32] // CHECK:STDOUT: %b.loc2_19.1: i32 = param b // CHECK:STDOUT: @LessEq.%b: i32 = bind_name b, %b.loc2_19.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_30.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_30.2: type = converted %bool.make_type.loc2, %.loc2_30.1 [template = bool] // CHECK:STDOUT: @LessEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc3_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_14.1: type = value_of_initializer %int.make_type_32.loc3_14 [template = i32] +// CHECK:STDOUT: %.loc3_14.2: type = converted %int.make_type_32.loc3_14, %.loc3_14.1 [template = i32] // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 +// CHECK:STDOUT: %int.make_type_32.loc3_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc3_22.1: type = value_of_initializer %int.make_type_32.loc3_22 [template = i32] +// CHECK:STDOUT: %.loc3_22.2: type = converted %int.make_type_32.loc3_22, %.loc3_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,11 +105,23 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc16_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16_19 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16_19, %.loc16_19.1 [template = i32] // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 +// CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_27.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32] +// CHECK:STDOUT: %.loc16_27.2: type = converted %int.make_type_32.loc16_27, %.loc16_27.1 [template = i32] // CHECK:STDOUT: %b.loc16_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc16_24.1 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type.loc16, %.loc16_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -100,6 +136,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @LessEq(%a: i32, %b: i32) -> bool = "int.less_eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; @@ -107,7 +147,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_26: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_26) [template = constants.%.6] @@ -126,7 +166,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_26) [template = constants.%.6] @@ -145,7 +185,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] @@ -164,8 +204,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_30: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.9] // CHECK:STDOUT: %.loc12_34: i32 = int_literal 0 [template = constants.%.7] @@ -187,9 +227,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] // CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -214,7 +254,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index ca9b6ccad856..48613f740d3b 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -68,9 +68,11 @@ var m: Int(1000000000); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %struct.2: Int = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -79,13 +81,19 @@ var m: Int(1000000000); // CHECK:STDOUT: .Int = %Int.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int.decl: Int = fn_decl @Int [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Int.decl: Int = fn_decl @Int [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %n.loc4_8.1: i32 = param n // CHECK:STDOUT: @Int.%n: i32 = bind_name n, %n.loc4_8.1 // CHECK:STDOUT: @Int.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Int(%n: i32) -> type = "int.make_type_signed"; // CHECK:STDOUT: // CHECK:STDOUT: --- use_types.carbon @@ -102,31 +110,33 @@ var m: Int(1000000000); // CHECK:STDOUT: %.5: type = int_type signed, %.4 [template] // CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.4: Int32 = struct_value () [template] // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] // CHECK:STDOUT: %.6: type = int_type signed, %N [symbolic] // CHECK:STDOUT: %Symbolic: type = fn_type @Symbolic [template] -// CHECK:STDOUT: %struct.4: Symbolic = struct_value () [template] +// CHECK:STDOUT: %struct.5: Symbolic = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Int = %import_ref +// CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .Symbolic = %Symbolic.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.1: Int = import_ref ir1, inst+14, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Int.ref.loc6_9: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc6_9: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc6_13: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.3] // CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.3] // CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.3] // CHECK:STDOUT: %n.loc6_6.1: i64 = param n // CHECK:STDOUT: @F.%n: i64 = bind_name n, %n.loc6_6.1 -// CHECK:STDOUT: %Int.ref.loc6_21: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc6_21: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc6_25: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.3] // CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.3] @@ -134,31 +144,35 @@ var m: Int(1000000000); // CHECK:STDOUT: @F.%return: ref i64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Int.ref.loc10_9: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc10_9: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_13: i32 = int_literal 13 [template = constants.%.4] // CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.5] // CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.5] // CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.5] // CHECK:STDOUT: %n.loc10_6.1: i13 = param n // CHECK:STDOUT: @G.%n: i13 = bind_name n, %n.loc10_6.1 -// CHECK:STDOUT: %Int.ref.loc10_21: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc10_21: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 13 [template = constants.%.4] // CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.5] // CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.5] // CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.5] // CHECK:STDOUT: @G.%return: ref i13 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_17.2: type = converted %int.make_type_32, %.loc14_17.1 [template = i32] // CHECK:STDOUT: %N.loc14_13.1: i32 = param N // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N 0, %N.loc14_13.1 [symbolic = constants.%N] -// CHECK:STDOUT: %Int.ref.loc14_25: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc14_25: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_29: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] // CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = constants.%.6] // CHECK:STDOUT: %x.loc14_22.1: Core.Int(N) = param x // CHECK:STDOUT: @Symbolic.%x: Core.Int(N) = bind_name x, %x.loc14_22.1 -// CHECK:STDOUT: %Int.ref.loc14_36: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref.loc14_36: Int = name_ref Int, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_40: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] // CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = constants.%.6] @@ -181,6 +195,8 @@ var m: Int(1000000000); // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Symbolic(%N: i32, %x: Core.Int(N)) -> Core.Int(N) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: Core.Int(N) = name_ref x, %x @@ -202,7 +218,7 @@ var m: Int(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+14, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct] // CHECK:STDOUT: %.loc10_12: i32 = int_literal 0 [template = constants.%.2] @@ -218,31 +234,41 @@ var m: Int(1000000000); // CHECK:STDOUT: --- fail_negative_size.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.1: 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: %Int: type = fn_type @Int [template] -// CHECK:STDOUT: %struct.2: Int = struct_value () [template] +// CHECK:STDOUT: %struct.3: Int = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Int = %import_ref +// CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .n = %n.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.1: Int = import_ref ir1, inst+14, loaded [template = constants.%struct.3] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir4, 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.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref.1 [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_19: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.3] // CHECK:STDOUT: %.loc12_11.1: i32 = value_of_initializer %int.snegate [template = constants.%.3] @@ -254,6 +280,8 @@ var m: Int(1000000000); // CHECK:STDOUT: %n.loc12: ref = bind_name n, %n.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: // CHECK:STDOUT: fn @Int(%n: i32) -> type = "int.make_type_signed"; @@ -273,7 +301,7 @@ var m: Int(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+14, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct] // CHECK:STDOUT: %.loc9_12: i32 = int_literal 1000000000 [template = constants.%.2] diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 82346226f160..99e1a24eaff7 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -68,9 +68,11 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %struct.2: UInt = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -79,13 +81,19 @@ var m: UInt(1000000000); // CHECK:STDOUT: .UInt = %UInt.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UInt.decl: UInt = fn_decl @UInt [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.decl: UInt = fn_decl @UInt [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_12.2: type = converted %int.make_type_32, %.loc4_12.1 [template = i32] // CHECK:STDOUT: %n.loc4_9.1: i32 = param n // CHECK:STDOUT: @UInt.%n: i32 = bind_name n, %n.loc4_9.1 // CHECK:STDOUT: @UInt.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @UInt(%n: i32) -> type = "int.make_type_unsigned"; // CHECK:STDOUT: // CHECK:STDOUT: --- use_types.carbon @@ -102,31 +110,33 @@ var m: UInt(1000000000); // CHECK:STDOUT: %.5: type = int_type unsigned, %.4 [template] // CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.4: Int32 = struct_value () [template] // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] // CHECK:STDOUT: %.6: type = int_type unsigned, %N [symbolic] // CHECK:STDOUT: %Symbolic: type = fn_type @Symbolic [template] -// CHECK:STDOUT: %struct.4: Symbolic = struct_value () [template] +// CHECK:STDOUT: %struct.5: Symbolic = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .UInt = %import_ref +// CHECK:STDOUT: .UInt = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .Symbolic = %Symbolic.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.1: UInt = import_ref ir1, inst+14, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %UInt.ref.loc6_9: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc6_9: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.3] // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.3] // CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.3] // CHECK:STDOUT: %n.loc6_6.1: u64 = param n // CHECK:STDOUT: @F.%n: u64 = bind_name n, %n.loc6_6.1 -// CHECK:STDOUT: %UInt.ref.loc6_22: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc6_22: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc6_27: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.3] // CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.3] @@ -134,31 +144,35 @@ var m: UInt(1000000000); // CHECK:STDOUT: @F.%return: ref u64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %UInt.ref.loc10_9: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc10_9: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_14: i32 = int_literal 13 [template = constants.%.4] // CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.5] // CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.5] // CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.5] // CHECK:STDOUT: %n.loc10_6.1: u13 = param n // CHECK:STDOUT: @G.%n: u13 = bind_name n, %n.loc10_6.1 -// CHECK:STDOUT: %UInt.ref.loc10_22: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc10_22: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_27: i32 = int_literal 13 [template = constants.%.4] // CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.5] // CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.5] // CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.5] // CHECK:STDOUT: @G.%return: ref u13 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_17.2: type = converted %int.make_type_32, %.loc14_17.1 [template = i32] // CHECK:STDOUT: %N.loc14_13.1: i32 = param N // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N 0, %N.loc14_13.1 [symbolic = constants.%N] -// CHECK:STDOUT: %UInt.ref.loc14_25: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc14_25: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_30: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] // CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = constants.%.6] // CHECK:STDOUT: %x.loc14_22.1: Core.UInt(N) = param x // CHECK:STDOUT: @Symbolic.%x: Core.UInt(N) = bind_name x, %x.loc14_22.1 -// CHECK:STDOUT: %UInt.ref.loc14_37: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref.loc14_37: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_42: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] // CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.6] // CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = constants.%.6] @@ -181,6 +195,8 @@ var m: UInt(1000000000); // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Symbolic(%N: i32, %x: Core.UInt(N)) -> Core.UInt(N) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: Core.UInt(N) = name_ref x, %x @@ -202,7 +218,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+14, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct] // CHECK:STDOUT: %.loc10_13: i32 = int_literal 0 [template = constants.%.2] @@ -218,31 +234,41 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- fail_negative_size.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.1: 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: %UInt: type = fn_type @UInt [template] -// CHECK:STDOUT: %struct.2: UInt = struct_value () [template] +// CHECK:STDOUT: %struct.3: UInt = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .UInt = %import_ref +// CHECK:STDOUT: .UInt = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .n = %n.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.1: UInt = import_ref ir1, inst+14, loaded [template = constants.%struct.3] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir4, 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.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref.1 [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_20: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.3] // CHECK:STDOUT: %.loc12_12.1: i32 = value_of_initializer %int.snegate [template = constants.%.3] @@ -254,6 +280,8 @@ var m: UInt(1000000000); // CHECK:STDOUT: %n.loc12: ref = bind_name n, %n.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: // CHECK:STDOUT: fn @UInt(%n: i32) -> type = "int.make_type_unsigned"; @@ -273,7 +301,7 @@ var m: UInt(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+14, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct] // CHECK:STDOUT: %.loc9_13: i32 = int_literal 1000000000 [template = constants.%.2] diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index da15567bac77..b7a2f81456a5 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -23,21 +23,25 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_neq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Neq: type = fn_type @Neq [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Neq = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] +// CHECK:STDOUT: %Neq: type = fn_type @Neq [template] +// CHECK:STDOUT: %struct.3: Neq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: bool = bool_literal false [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: %.7: bool = bool_literal true [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.5: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,16 +54,28 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.1] { +// 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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Neq.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Neq.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %bool.make_type.loc2: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %bool.make_type.loc2 [template = bool] +// CHECK:STDOUT: %.loc2_27.2: type = converted %bool.make_type.loc2, %.loc2_27.1 [template = bool] // CHECK:STDOUT: @Neq.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -67,11 +83,23 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [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: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc12_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32.loc12_19 [template = i32] +// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32.loc12_19, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %a.loc12_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 +// CHECK:STDOUT: %int.make_type_32.loc12_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_27.1: type = value_of_initializer %int.make_type_32.loc12_27 [template = i32] +// CHECK:STDOUT: %.loc12_27.2: type = converted %int.make_type_32.loc12_27, %.loc12_27.1 [template = i32] // CHECK:STDOUT: %b.loc12_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc12_24.1 +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc12_35.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type.loc12, %.loc12_35.1 [template = bool] // CHECK:STDOUT: @RuntimeCall.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -86,12 +114,16 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: .Self = constants.%False // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Neq(%a: i32, %b: i32) -> bool = "int.neq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc8_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21, %.loc8_24) [template = constants.%.5] @@ -110,7 +142,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_14.3: type = block_arg !if.expr.result.loc8 [template = constants.%False] // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] @@ -133,7 +165,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.neq: init bool = call %Neq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 1be60c8ccbc8..ea51ae9762b1 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -18,16 +18,18 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_or.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Or: type = fn_type @Or [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Or = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Or: type = fn_type @Or [template] +// CHECK:STDOUT: %struct.2: Or = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: %.3: i32 = int_literal 10 [template] // CHECK:STDOUT: %.4: i32 = int_literal 14 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 14] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,40 +40,74 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.1] { +// 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: %Or.decl: Or = fn_decl @Or [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_10.1: type = value_of_initializer %int.make_type_32.loc2_10 [template = i32] +// CHECK:STDOUT: %.loc2_10.2: type = converted %int.make_type_32.loc2_10, %.loc2_10.1 [template = i32] // CHECK:STDOUT: %a.loc2_7.1: i32 = param a // CHECK:STDOUT: @Or.%a: i32 = bind_name a, %a.loc2_7.1 +// CHECK:STDOUT: %int.make_type_32.loc2_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_18.1: type = value_of_initializer %int.make_type_32.loc2_18 [template = i32] +// CHECK:STDOUT: %.loc2_18.2: type = converted %int.make_type_32.loc2_18, %.loc2_18.1 [template = i32] // CHECK:STDOUT: %b.loc2_15.1: i32 = param b // CHECK:STDOUT: @Or.%b: i32 = bind_name b, %b.loc2_15.1 +// CHECK:STDOUT: %int.make_type_32.loc2_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %int.make_type_32.loc2_26 [template = i32] +// CHECK:STDOUT: %.loc2_26.2: type = converted %int.make_type_32.loc2_26, %.loc2_26.1 [template = i32] // CHECK:STDOUT: @Or.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Or.ref: Or = name_ref Or, %Or.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Or.ref: Or = name_ref Or, %Or.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_19: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 10 [template = constants.%.3] // CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_26: type = array_type %int.or, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 14] = var arr // CHECK:STDOUT: %arr: ref [i32; 14] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 14 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 14] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 14] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_25: [i32; 14]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 14]* = bind_name arr_p, %.loc5_25 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Or(%a: i32, %b: i32) -> i32 = "int.or"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Or.ref: Or = name_ref Or, file.%Or.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Or.ref: Or = name_ref Or, file.%Or.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 743465fb75ac..c8134c0d614f 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -63,16 +63,18 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- int_right_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %struct.2: RightShift = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 22 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 5 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 5] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -83,40 +85,74 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { +// 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: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_18.1: type = value_of_initializer %int.make_type_32.loc2_18 [template = i32] +// CHECK:STDOUT: %.loc2_18.2: type = converted %int.make_type_32.loc2_18, %.loc2_18.1 [template = i32] // CHECK:STDOUT: %a.loc2_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc2_15.1 +// CHECK:STDOUT: %int.make_type_32.loc2_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %int.make_type_32.loc2_26 [template = i32] +// CHECK:STDOUT: %.loc2_26.2: type = converted %int.make_type_32.loc2_26, %.loc2_26.1 [template = i32] // CHECK:STDOUT: %b.loc2_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc2_23.1 +// CHECK:STDOUT: %int.make_type_32.loc2_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_34.1: type = value_of_initializer %int.make_type_32.loc2_34 [template = i32] +// CHECK:STDOUT: %.loc2_34.2: type = converted %int.make_type_32.loc2_34, %.loc2_34.1 [template = i32] // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_27: i32 = int_literal 22 [template = constants.%.2] // CHECK:STDOUT: %.loc4_31: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_33: type = array_type %int.right_shift, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 5] = var arr // CHECK:STDOUT: %arr: ref [i32; 5] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 5 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 5] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 5] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 5]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 5]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift(%a: i32, %b: i32) -> i32 = "int.right_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, file.%RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, file.%RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%a.ref, %b.ref) @@ -128,11 +164,13 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- arith_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %struct.2: RightShift = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] @@ -155,21 +193,43 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: .arr2 = %arr2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { +// 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: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc6_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %int.make_type_32.loc6_18 [template = i32] +// CHECK:STDOUT: %.loc6_18.2: type = converted %int.make_type_32.loc6_18, %.loc6_18.1 [template = i32] // CHECK:STDOUT: %a.loc6_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc6_15.1 +// CHECK:STDOUT: %int.make_type_32.loc6_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_26.1: type = value_of_initializer %int.make_type_32.loc6_26 [template = i32] +// CHECK:STDOUT: %.loc6_26.2: type = converted %int.make_type_32.loc6_26, %.loc6_26.1 [template = i32] // CHECK:STDOUT: %b.loc6_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc6_23.1 +// CHECK:STDOUT: %int.make_type_32.loc6_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int.make_type_32.loc6_34 [template = i32] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int.make_type_32.loc6_34, %.loc6_34.1 [template = i32] // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// 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: %a.loc7_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.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 // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc10_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %RightShift.ref.loc10: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc10_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: 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: %Negate.ref.loc10_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %RightShift.ref.loc10: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc10_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_42: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.3] // CHECK:STDOUT: %.loc10_46: i32 = int_literal 1 [template = constants.%.2] @@ -179,18 +239,26 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.3] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.right_shift.loc10, %.loc10_23.1 [template = constants.%.3] // CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_23.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc10_12.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_12.2: type = converted %int.make_type_32.loc10, %.loc10_12.1 [template = i32] // CHECK:STDOUT: %.loc10_49: type = array_type %int.snegate.loc10_23, i32 [template = constants.%.4] // CHECK:STDOUT: %arr1.var: ref [i32; 1] = var arr1 // CHECK:STDOUT: %arr1: ref [i32; 1] = bind_name arr1, %arr1.var +// CHECK:STDOUT: %import_ref.7: 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_19: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11, %.loc11_14.1 [template = i32] // CHECK:STDOUT: %.loc11_20: type = array_type %.loc11_19, i32 [template = constants.%.4] // CHECK:STDOUT: %.loc11_21: type = ptr_type [i32; 1] [template = constants.%.5] // CHECK:STDOUT: %arr1.ref: ref [i32; 1] = name_ref arr1, %arr1 // CHECK:STDOUT: %.loc11_25: [i32; 1]* = addr_of %arr1.ref // CHECK:STDOUT: %arr1_p: [i32; 1]* = bind_name arr1_p, %.loc11_25 -// CHECK:STDOUT: %Negate.ref.loc14_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %RightShift.ref.loc14: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc14_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Negate.ref.loc14_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %RightShift.ref.loc14: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc14_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc14_42: i32 = int_literal 10 [template = constants.%.6] // CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.7] // CHECK:STDOUT: %.loc14_47: i32 = int_literal 2 [template = constants.%.8] @@ -200,10 +268,16 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %.loc14_23.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.9] // CHECK:STDOUT: %.loc14_23.2: i32 = converted %int.right_shift.loc14, %.loc14_23.1 [template = constants.%.9] // CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_23.2) [template = constants.%.10] +// CHECK:STDOUT: %.loc14_12.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_12.2: type = converted %int.make_type_32.loc14, %.loc14_12.1 [template = i32] // CHECK:STDOUT: %.loc14_50: type = array_type %int.snegate.loc14_23, i32 [template = constants.%.11] // CHECK:STDOUT: %arr2.var: ref [i32; 3] = var arr2 // CHECK:STDOUT: %arr2: ref [i32; 3] = bind_name arr2, %arr2.var +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc15_19: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] // CHECK:STDOUT: %.loc15_20: type = array_type %.loc15_19, i32 [template = constants.%.11] // CHECK:STDOUT: %.loc15_21: type = ptr_type [i32; 3] [template = constants.%.12] // CHECK:STDOUT: %arr2.ref: ref [i32; 3] = name_ref arr2, %arr2 @@ -211,6 +285,8 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %arr2_p: [i32; 3]* = bind_name arr2_p, %.loc15_25 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift(%a: i32, %b: i32) -> i32 = "int.right_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; @@ -218,11 +294,13 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- fail_bad_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %struct.2: RightShift = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 31 [template] // CHECK:STDOUT: %.4: i32 = int_literal 0 [template] @@ -238,42 +316,78 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { +// 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: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_18.1: type = value_of_initializer %int.make_type_32.loc4_18 [template = i32] +// CHECK:STDOUT: %.loc4_18.2: type = converted %int.make_type_32.loc4_18, %.loc4_18.1 [template = i32] // CHECK:STDOUT: %a.loc4_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc4_15.1 +// CHECK:STDOUT: %int.make_type_32.loc4_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_26.1: type = value_of_initializer %int.make_type_32.loc4_26 [template = i32] +// CHECK:STDOUT: %.loc4_26.2: type = converted %int.make_type_32.loc4_26, %.loc4_26.1 [template = i32] // CHECK:STDOUT: %b.loc4_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc4_23.1 +// CHECK:STDOUT: %int.make_type_32.loc4_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_34.1: type = value_of_initializer %int.make_type_32.loc4_34 [template = i32] +// CHECK:STDOUT: %.loc4_34.2: type = converted %int.make_type_32.loc4_34, %.loc4_34.1 [template = i32] // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { +// 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: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_14.1: type = value_of_initializer %int.make_type_32.loc5_14 [template = i32] +// CHECK:STDOUT: %.loc5_14.2: type = converted %int.make_type_32.loc5_14, %.loc5_14.1 [template = i32] // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 +// CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_22.1: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32] +// CHECK:STDOUT: %.loc5_22.2: type = converted %int.make_type_32.loc5_22, %.loc5_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RightShift.ref.loc8: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: 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_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %RightShift.ref.loc8: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_33: i32 = int_literal 31 [template = constants.%.3] // CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.4] // CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.4] // CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.4] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_36.2 -// CHECK:STDOUT: %RightShift.ref.loc13: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] +// CHECK:STDOUT: %RightShift.ref.loc13: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_30: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc13_33: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.right_shift.loc13: init i32 = call %RightShift.ref.loc13(%.loc13_30, %.loc13_33) [template = ] // CHECK:STDOUT: %.loc13_36.1: i32 = value_of_initializer %int.right_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_36.2: i32 = converted %int.right_shift.loc13, %.loc13_36.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_36.2 -// CHECK:STDOUT: %RightShift.ref.loc18: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_13.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_13.2: type = converted %int.make_type_32.loc18, %.loc18_13.1 [template = i32] +// CHECK:STDOUT: %RightShift.ref.loc18: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc18_30: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc18_33: i32 = int_literal 33 [template = constants.%.6] // CHECK:STDOUT: %int.right_shift.loc18: init i32 = call %RightShift.ref.loc18(%.loc18_30, %.loc18_33) [template = ] // CHECK:STDOUT: %.loc18_36.1: i32 = value_of_initializer %int.right_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_36.2: i32 = converted %int.right_shift.loc18, %.loc18_36.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_36.2 -// CHECK:STDOUT: %RightShift.ref.loc24: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_15.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_15.2: type = converted %int.make_type_32.loc24, %.loc24_15.1 [template = i32] +// CHECK:STDOUT: %RightShift.ref.loc24: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc24_32: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc24_42: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.7] // CHECK:STDOUT: %.loc24_31.1: i32 = value_of_initializer %int.snegate [template = constants.%.7] @@ -284,6 +398,8 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc24_45.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift(%a: i32, %b: i32) -> i32 = "int.right_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index d14faa99be13..f9901dcfc61c 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -88,16 +88,18 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- int_add.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.1: 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] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -108,40 +110,74 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { +// 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.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 3] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 3]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 3]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // 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 @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%a.ref, %b.ref) @@ -153,24 +189,28 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = 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] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -189,94 +229,192 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// 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: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer %int.make_type_32.loc8_14 [template = i32] +// CHECK:STDOUT: %.loc8_14.2: type = converted %int.make_type_32.loc8_14, %.loc8_14.1 [template = i32] // CHECK:STDOUT: %a.loc8_11.1: i32 = param a // CHECK:STDOUT: @TooFew.%a: i32 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %int.make_type_32.loc8_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_22.1: type = value_of_initializer %int.make_type_32.loc8_22 [template = i32] +// CHECK:STDOUT: %.loc8_22.2: type = converted %int.make_type_32.loc8_22, %.loc8_22.1 [template = i32] // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc13_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15.1: type = value_of_initializer %int.make_type_32.loc13_15 [template = i32] +// CHECK:STDOUT: %.loc13_15.2: type = converted %int.make_type_32.loc13_15, %.loc13_15.1 [template = i32] // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %int.make_type_32.loc13_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_23.1: type = value_of_initializer %int.make_type_32.loc13_23 [template = i32] +// CHECK:STDOUT: %.loc13_23.2: type = converted %int.make_type_32.loc13_23, %.loc13_23.1 [template = i32] // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %int.make_type_32.loc13_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13_31 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13_31, %.loc13_31.1 [template = i32] // CHECK:STDOUT: %c.loc13_28.1: i32 = param c // CHECK:STDOUT: @TooMany.%c: i32 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %int.make_type_32.loc13_39: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_39.1: type = value_of_initializer %int.make_type_32.loc13_39 [template = i32] +// CHECK:STDOUT: %.loc13_39.2: type = converted %int.make_type_32.loc13_39, %.loc13_39.1 [template = i32] // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc18_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_21.1: type = value_of_initializer %int.make_type_32.loc18_21 [template = i32] +// CHECK:STDOUT: %.loc18_21.2: type = converted %int.make_type_32.loc18_21, %.loc18_21.1 [template = i32] // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %int.make_type_32.loc18_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %int.make_type_32.loc18_29 [template = i32] +// CHECK:STDOUT: %.loc18_29.2: type = converted %int.make_type_32.loc18_29, %.loc18_29.1 [template = i32] // CHECK:STDOUT: %b.loc18_26.1: i32 = param b // CHECK:STDOUT: @BadReturnType.%b: i32 = bind_name b, %b.loc18_26.1 +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc18_37.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_37.2: type = converted %bool.make_type.loc18, %.loc18_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc19_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_17.1: type = value_of_initializer %int.make_type_32.loc19_17 [template = i32] +// CHECK:STDOUT: %.loc19_17.2: type = converted %int.make_type_32.loc19_17, %.loc19_17.1 [template = i32] // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 +// CHECK:STDOUT: %int.make_type_32.loc19_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_25.1: type = value_of_initializer %int.make_type_32.loc19_25 [template = i32] +// CHECK:STDOUT: %.loc19_25.2: type = converted %int.make_type_32.loc19_25, %.loc19_25.1 [template = i32] // CHECK:STDOUT: %b.loc19_22.1: i32 = param b // CHECK:STDOUT: @JustRight.%b: i32 = bind_name b, %b.loc19_22.1 +// CHECK:STDOUT: %int.make_type_32.loc19_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_33.1: type = value_of_initializer %int.make_type_32.loc19_33 [template = i32] +// CHECK:STDOUT: %.loc19_33.2: type = converted %int.make_type_32.loc19_33, %.loc19_33.1 [template = i32] // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25) // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.6] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc44_37: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %int.sadd: init i32 = call %JustRight.ref() [template = ] +// CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] +// CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_39: type = array_type %int.sadd, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %int.make_type_32.loc46_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_25.1: type = value_of_initializer %int.make_type_32.loc46_25 [template = i32] +// CHECK:STDOUT: %.loc46_25.2: type = converted %int.make_type_32.loc46_25, %.loc46_25.1 [template = i32] // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 +// CHECK:STDOUT: %int.make_type_32.loc46_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_33.1: type = value_of_initializer %int.make_type_32.loc46_33 [template = i32] +// CHECK:STDOUT: %.loc46_33.2: type = converted %int.make_type_32.loc46_33, %.loc46_33.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.19: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.22: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc50_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc50_26.1: type = value_of_initializer %int.make_type_32.loc50_26 [template = i32] +// CHECK:STDOUT: %.loc50_26.2: type = converted %int.make_type_32.loc50_26, %.loc50_26.1 [template = i32] // CHECK:STDOUT: %a.loc50_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc50_23.1 +// CHECK:STDOUT: %int.make_type_32.loc50_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc50_34.1: type = value_of_initializer %int.make_type_32.loc50_34 [template = i32] +// CHECK:STDOUT: %.loc50_34.2: type = converted %int.make_type_32.loc50_34, %.loc50_34.1 [template = i32] // CHECK:STDOUT: %b.loc50_31.1: i32 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc50_31.1 +// CHECK:STDOUT: %int.make_type_32.loc50_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc50_42.1: type = value_of_initializer %int.make_type_32.loc50_42 [template = i32] +// CHECK:STDOUT: %.loc50_42.2: type = converted %int.make_type_32.loc50_42, %.loc50_42.1 [template = i32] // CHECK:STDOUT: %c.loc50_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc50_39.1 +// CHECK:STDOUT: %int.make_type_32.loc50_50: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc50_50.1: type = value_of_initializer %int.make_type_32.loc50_50 [template = i32] +// CHECK:STDOUT: %.loc50_50.2: type = converted %int.make_type_32.loc50_50, %.loc50_50.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.23: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.24: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.25: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc54_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc54_32.1: type = value_of_initializer %int.make_type_32.loc54_32 [template = i32] +// CHECK:STDOUT: %.loc54_32.2: type = converted %int.make_type_32.loc54_32, %.loc54_32.1 [template = i32] // CHECK:STDOUT: %a.loc54_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc54_29.1 +// CHECK:STDOUT: %int.make_type_32.loc54_40: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc54_40.1: type = value_of_initializer %int.make_type_32.loc54_40 [template = i32] +// CHECK:STDOUT: %.loc54_40.2: type = converted %int.make_type_32.loc54_40, %.loc54_40.1 [template = i32] // CHECK:STDOUT: %b.loc54_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc54_37.1 +// CHECK:STDOUT: %bool.make_type.loc54: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc54_48.1: type = value_of_initializer %bool.make_type.loc54 [template = bool] +// CHECK:STDOUT: %.loc54_48.2: type = converted %bool.make_type.loc54, %.loc54_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: i32, %b: i32, %c: i32) -> i32; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: i32, %b: i32) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: i32, %b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc47_19.1: i32 = value_of_initializer %TooFew.call @@ -286,7 +424,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -298,7 +436,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) @@ -310,9 +448,11 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_overflow.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 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -325,21 +465,41 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref.loc6: 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.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %Add.ref.loc6: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %.loc6_30: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.2] // CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.2] // CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Add.ref.loc10: Add = name_ref Add, %Add.decl [template = constants.%struct] +// 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_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %Add.ref.loc10: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %.loc10_30: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.5] @@ -348,5 +508,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_32.2 // 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: diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 93a490dabb5c..2b2b3f2a7882 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -56,16 +56,18 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -76,40 +78,74 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { +// 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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.sdiv, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.sdiv"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%a.ref, %b.ref) @@ -121,13 +157,15 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -143,30 +181,66 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { +// 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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.9: 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: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] -// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.3] @@ -177,9 +251,13 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.2] // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.10: 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: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] @@ -193,16 +271,20 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.6] // CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc19: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc19: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc19_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_8.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_8.2: type = converted %int.make_type_32.loc19, %.loc19_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc19: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc19: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc19_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc19_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.3] // CHECK:STDOUT: %.loc19_43: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.3] // CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.snegate.loc19_28, %.loc19_21.1 [template = constants.%.3] // CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_21.2, %.loc19_43) [template = constants.%.6] -// CHECK:STDOUT: %Negate.ref.loc19_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc19_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc19_54: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.5] // CHECK:STDOUT: %.loc19_17.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.6] @@ -215,6 +297,8 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc19_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.sdiv"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.ssub"; @@ -224,9 +308,11 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -237,21 +323,41 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.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.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.sdiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.sdiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.sdiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a.loc10: i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.sdiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] @@ -260,5 +366,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %b.loc15: i32 = bind_name b, %.loc15_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.sdiv"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 36f572295597..05aafb25953f 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -59,16 +59,18 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 5 [template] // CHECK:STDOUT: %.3: i32 = int_literal 3 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 2] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -79,40 +81,74 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { +// 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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.3] // CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.smod, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 2] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 2]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 2]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.smod"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%a.ref, %b.ref) @@ -124,13 +160,15 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -147,30 +185,66 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { +// 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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.9: 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: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] -// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.3] @@ -181,9 +255,13 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.6] // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.6] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.10: 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: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] @@ -197,16 +275,20 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.6] // CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc20: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc20: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc20_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_8.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_8.2: type = converted %int.make_type_32.loc20, %.loc20_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc20: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc20: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc20_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc20_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.3] // CHECK:STDOUT: %.loc20_43: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.3] // CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.snegate.loc20_28, %.loc20_21.1 [template = constants.%.3] // CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_21.2, %.loc20_43) [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc20_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc20_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc20_54: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.5] // CHECK:STDOUT: %.loc20_17.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.7] @@ -219,6 +301,8 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc20_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.smod"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.ssub"; @@ -228,9 +312,11 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -241,21 +327,41 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.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.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.smod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.smod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.smod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] @@ -264,5 +370,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %b.loc17: i32 = bind_name b, %.loc17_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.smod"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index f879239f6aa5..cf9e6bd4508b 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -30,16 +30,18 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- int_mul.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %struct.2: Mul = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 6 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,40 +52,74 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { +// 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: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.smul, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a: i32, %b: i32) -> i32 = "int.smul"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%a.ref, %b.ref) @@ -95,9 +131,11 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Mul = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %struct.2: Mul = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 32767 [template] // CHECK:STDOUT: %.3: i32 = int_literal 65536 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2147418112 [template] @@ -111,21 +149,41 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [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: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.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.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.2] // CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.3] // CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.4] // CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.4] // CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc10: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// 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_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %Mul.ref.loc10: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 32768 [template = constants.%.5] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 65536 [template = constants.%.3] // CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.6] @@ -134,5 +192,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a: i32, %b: i32) -> i32 = "int.smul"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 788d54037695..a47c13387f09 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -115,9 +115,11 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- int_negate.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.1: 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 123 [template] // CHECK:STDOUT: %.3: i32 = int_literal -123 [template] // CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] @@ -125,7 +127,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] // CHECK:STDOUT: %.7: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -136,47 +138,81 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// 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.loc2_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_14.1: type = value_of_initializer %int.make_type_32.loc2_14 [template = i32] +// CHECK:STDOUT: %.loc2_14.2: type = converted %int.make_type_32.loc2_14, %.loc2_14.1 [template = i32] // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc2_11.1 +// CHECK:STDOUT: %int.make_type_32.loc2_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_22.1: type = value_of_initializer %int.make_type_32.loc2_22 [template = i32] +// CHECK:STDOUT: %.loc2_22.2: type = converted %int.make_type_32.loc2_22, %.loc2_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.3] // CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.3] // CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.snegate.loc4_29, %.loc4_22.1 [template = constants.%.3] // CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_35: type = array_type %int.snegate.loc4_22, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.4] // CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.5] // CHECK:STDOUT: %arr.ref: ref [i32; 123] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_26: [i32; 123]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 -// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %int.snegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate.loc7, %.loc7_23.1 [template = constants.%.7] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc9_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_19.1: type = value_of_initializer %int.make_type_32.loc9_19 [template = i32] +// CHECK:STDOUT: %.loc9_19.2: type = converted %int.make_type_32.loc9_19, %.loc9_19.1 [template = i32] // CHECK:STDOUT: %a.loc9_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc9_16.1 +// CHECK:STDOUT: %int.make_type_32.loc9_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_27.1: type = value_of_initializer %int.make_type_32.loc9_27 [template = i32] +// CHECK:STDOUT: %.loc9_27.2: type = converted %int.make_type_32.loc9_27, %.loc9_27.1 [template = i32] // CHECK:STDOUT: %b.loc9_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc9_24.1 +// CHECK:STDOUT: %int.make_type_32.loc9_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_35.1: type = value_of_initializer %int.make_type_32.loc9_35 [template = i32] +// CHECK:STDOUT: %.loc9_35.2: type = converted %int.make_type_32.loc9_35, %.loc9_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.snegate @@ -187,23 +223,27 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -222,82 +262,164 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_16.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_16.2: type = converted %int.make_type_32.loc8, %.loc8_16.1 [template = i32] // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// 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: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc13_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15.1: type = value_of_initializer %int.make_type_32.loc13_15 [template = i32] +// CHECK:STDOUT: %.loc13_15.2: type = converted %int.make_type_32.loc13_15, %.loc13_15.1 [template = i32] // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %int.make_type_32.loc13_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_23.1: type = value_of_initializer %int.make_type_32.loc13_23 [template = i32] +// CHECK:STDOUT: %.loc13_23.2: type = converted %int.make_type_32.loc13_23, %.loc13_23.1 [template = i32] // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %int.make_type_32.loc13_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13_31 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13_31, %.loc13_31.1 [template = i32] // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_21.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_21.2: type = converted %int.make_type_32.loc18, %.loc18_21.1 [template = i32] // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_29.2: type = converted %bool.make_type.loc18, %.loc18_29.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc19_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_17.1: type = value_of_initializer %int.make_type_32.loc19_17 [template = i32] +// CHECK:STDOUT: %.loc19_17.2: type = converted %int.make_type_32.loc19_17, %.loc19_17.1 [template = i32] // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 +// CHECK:STDOUT: %int.make_type_32.loc19_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_25.1: type = value_of_initializer %int.make_type_32.loc19_25 [template = i32] +// CHECK:STDOUT: %.loc19_25.2: type = converted %int.make_type_32.loc19_25, %.loc19_25.1 [template = i32] // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.6] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.snegate: init i32 = call %JustRight.ref() [template = ] +// CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] +// CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_36: type = array_type %int.snegate, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %int.make_type_32.loc46_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_25.1: type = value_of_initializer %int.make_type_32.loc46_25 [template = i32] +// CHECK:STDOUT: %.loc46_25.2: type = converted %int.make_type_32.loc46_25, %.loc46_25.1 [template = i32] // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 +// CHECK:STDOUT: %int.make_type_32.loc46_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_33.1: type = value_of_initializer %int.make_type_32.loc46_33 [template = i32] +// CHECK:STDOUT: %.loc46_33.2: type = converted %int.make_type_32.loc46_33, %.loc46_33.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc57_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_26.1: type = value_of_initializer %int.make_type_32.loc57_26 [template = i32] +// CHECK:STDOUT: %.loc57_26.2: type = converted %int.make_type_32.loc57_26, %.loc57_26.1 [template = i32] // CHECK:STDOUT: %a.loc57_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc57_23.1 +// CHECK:STDOUT: %int.make_type_32.loc57_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_34.1: type = value_of_initializer %int.make_type_32.loc57_34 [template = i32] +// CHECK:STDOUT: %.loc57_34.2: type = converted %int.make_type_32.loc57_34, %.loc57_34.1 [template = i32] // CHECK:STDOUT: %b.loc57_31.1: i32 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc57_31.1 +// CHECK:STDOUT: %int.make_type_32.loc57_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_42.1: type = value_of_initializer %int.make_type_32.loc57_42 [template = i32] +// CHECK:STDOUT: %.loc57_42.2: type = converted %int.make_type_32.loc57_42, %.loc57_42.1 [template = i32] // CHECK:STDOUT: %c.loc57_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc57_39.1 +// CHECK:STDOUT: %int.make_type_32.loc57_50: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_50.1: type = value_of_initializer %int.make_type_32.loc57_50 [template = i32] +// CHECK:STDOUT: %.loc57_50.2: type = converted %int.make_type_32.loc57_50, %.loc57_50.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc68_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc68_32.1: type = value_of_initializer %int.make_type_32.loc68_32 [template = i32] +// CHECK:STDOUT: %.loc68_32.2: type = converted %int.make_type_32.loc68_32, %.loc68_32.1 [template = i32] // CHECK:STDOUT: %a.loc68_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc68_29.1 +// CHECK:STDOUT: %int.make_type_32.loc68_40: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc68_40.1: type = value_of_initializer %int.make_type_32.loc68_40 [template = i32] +// CHECK:STDOUT: %.loc68_40.2: type = converted %int.make_type_32.loc68_40, %.loc68_40.1 [template = i32] // CHECK:STDOUT: %b.loc68_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc68_37.1 +// CHECK:STDOUT: %bool.make_type.loc68: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc68_48.1: type = value_of_initializer %bool.make_type.loc68 [template = bool] +// CHECK:STDOUT: %.loc68_48.2: type = converted %bool.make_type.loc68, %.loc68_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: i32, %b: i32) -> i32; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: i32) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: i32) -> i32 = "int.snegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] @@ -307,7 +429,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -319,7 +441,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] @@ -331,11 +453,13 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_overflow.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.1: 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: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -349,20 +473,44 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// 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.loc4_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_14.1: type = value_of_initializer %int.make_type_32.loc4_14 [template = i32] +// CHECK:STDOUT: %.loc4_14.2: type = converted %int.make_type_32.loc4_14, %.loc4_14.1 [template = i32] // CHECK:STDOUT: %a.loc4_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc4_11.1 +// CHECK:STDOUT: %int.make_type_32.loc4_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_22.1: type = value_of_initializer %int.make_type_32.loc4_22 [template = i32] +// CHECK:STDOUT: %.loc4_22.2: type = converted %int.make_type_32.loc4_22, %.loc4_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: 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: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.3] // CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.3] @@ -371,9 +519,13 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.2] // CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc14_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc14_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_8.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_8.2: type = converted %int.make_type_32.loc14, %.loc14_8.1 [template = i32] +// CHECK:STDOUT: %Negate.ref.loc14_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc14_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc14_32: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.3] // CHECK:STDOUT: %.loc14_45: i32 = int_literal 1 [template = constants.%.4] @@ -388,6 +540,8 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %b.loc14: i32 = bind_name b, %.loc14_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.ssub"; diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 71a953c9d9da..1ccbf99937e7 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -31,16 +31,18 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- int_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -51,40 +53,74 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.ssub, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.ssub"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%a.ref, %b.ref) @@ -96,9 +132,11 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal -2147483647 [template] @@ -113,22 +151,42 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.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.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.4] // CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.4] // CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] -// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.4] @@ -139,8 +197,12 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.6] // CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc11_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] -// CHECK:STDOUT: %Sub.ref.loc11_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.6: 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: %Sub.ref.loc11_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc11_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc11_22: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc11_25: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.4] @@ -153,5 +215,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc11_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.ssub"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index 69f7c8d4f06a..c4384c8b6107 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -85,16 +85,18 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- int_add.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.1: 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] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -105,40 +107,74 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { +// 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.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.uadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 3] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 3]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 3]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // 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.uadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%a.ref, %b.ref) @@ -150,24 +186,28 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = 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] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -186,94 +226,192 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// 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: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer %int.make_type_32.loc8_14 [template = i32] +// CHECK:STDOUT: %.loc8_14.2: type = converted %int.make_type_32.loc8_14, %.loc8_14.1 [template = i32] // CHECK:STDOUT: %a.loc8_11.1: i32 = param a // CHECK:STDOUT: @TooFew.%a: i32 = bind_name a, %a.loc8_11.1 +// CHECK:STDOUT: %int.make_type_32.loc8_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_22.1: type = value_of_initializer %int.make_type_32.loc8_22 [template = i32] +// CHECK:STDOUT: %.loc8_22.2: type = converted %int.make_type_32.loc8_22, %.loc8_22.1 [template = i32] // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc13_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15.1: type = value_of_initializer %int.make_type_32.loc13_15 [template = i32] +// CHECK:STDOUT: %.loc13_15.2: type = converted %int.make_type_32.loc13_15, %.loc13_15.1 [template = i32] // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %int.make_type_32.loc13_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_23.1: type = value_of_initializer %int.make_type_32.loc13_23 [template = i32] +// CHECK:STDOUT: %.loc13_23.2: type = converted %int.make_type_32.loc13_23, %.loc13_23.1 [template = i32] // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %int.make_type_32.loc13_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13_31 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13_31, %.loc13_31.1 [template = i32] // CHECK:STDOUT: %c.loc13_28.1: i32 = param c // CHECK:STDOUT: @TooMany.%c: i32 = bind_name c, %c.loc13_28.1 +// CHECK:STDOUT: %int.make_type_32.loc13_39: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_39.1: type = value_of_initializer %int.make_type_32.loc13_39 [template = i32] +// CHECK:STDOUT: %.loc13_39.2: type = converted %int.make_type_32.loc13_39, %.loc13_39.1 [template = i32] // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc18_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_21.1: type = value_of_initializer %int.make_type_32.loc18_21 [template = i32] +// CHECK:STDOUT: %.loc18_21.2: type = converted %int.make_type_32.loc18_21, %.loc18_21.1 [template = i32] // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %int.make_type_32.loc18_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %int.make_type_32.loc18_29 [template = i32] +// CHECK:STDOUT: %.loc18_29.2: type = converted %int.make_type_32.loc18_29, %.loc18_29.1 [template = i32] // CHECK:STDOUT: %b.loc18_26.1: i32 = param b // CHECK:STDOUT: @BadReturnType.%b: i32 = bind_name b, %b.loc18_26.1 +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc18_37.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_37.2: type = converted %bool.make_type.loc18, %.loc18_37.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc19_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_17.1: type = value_of_initializer %int.make_type_32.loc19_17 [template = i32] +// CHECK:STDOUT: %.loc19_17.2: type = converted %int.make_type_32.loc19_17, %.loc19_17.1 [template = i32] // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 +// CHECK:STDOUT: %int.make_type_32.loc19_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_25.1: type = value_of_initializer %int.make_type_32.loc19_25 [template = i32] +// CHECK:STDOUT: %.loc19_25.2: type = converted %int.make_type_32.loc19_25, %.loc19_25.1 [template = i32] // CHECK:STDOUT: %b.loc19_22.1: i32 = param b // CHECK:STDOUT: @JustRight.%b: i32 = bind_name b, %b.loc19_22.1 +// CHECK:STDOUT: %int.make_type_32.loc19_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_33.1: type = value_of_initializer %int.make_type_32.loc19_33 [template = i32] +// CHECK:STDOUT: %.loc19_33.2: type = converted %int.make_type_32.loc19_33, %.loc19_33.1 [template = i32] // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25) // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc43: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.6] // CHECK:STDOUT: %.loc43_31: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc43_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc43_37: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %int.uadd: init i32 = call %JustRight.ref() [template = ] +// CHECK:STDOUT: %.loc43_16.1: type = value_of_initializer %int.make_type_32.loc43 [template = i32] +// CHECK:STDOUT: %.loc43_16.2: type = converted %int.make_type_32.loc43, %.loc43_16.1 [template = i32] // CHECK:STDOUT: %.loc43_39: type = array_type %int.uadd, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %int.make_type_32.loc45_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc45_25.1: type = value_of_initializer %int.make_type_32.loc45_25 [template = i32] +// CHECK:STDOUT: %.loc45_25.2: type = converted %int.make_type_32.loc45_25, %.loc45_25.1 [template = i32] // CHECK:STDOUT: %a.loc45_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc45_22.1 +// CHECK:STDOUT: %int.make_type_32.loc45_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc45_33.1: type = value_of_initializer %int.make_type_32.loc45_33 [template = i32] +// CHECK:STDOUT: %.loc45_33.2: type = converted %int.make_type_32.loc45_33, %.loc45_33.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.19: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.22: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc49_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_26.1: type = value_of_initializer %int.make_type_32.loc49_26 [template = i32] +// CHECK:STDOUT: %.loc49_26.2: type = converted %int.make_type_32.loc49_26, %.loc49_26.1 [template = i32] // CHECK:STDOUT: %a.loc49_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc49_23.1 +// CHECK:STDOUT: %int.make_type_32.loc49_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_34.1: type = value_of_initializer %int.make_type_32.loc49_34 [template = i32] +// CHECK:STDOUT: %.loc49_34.2: type = converted %int.make_type_32.loc49_34, %.loc49_34.1 [template = i32] // CHECK:STDOUT: %b.loc49_31.1: i32 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc49_31.1 +// CHECK:STDOUT: %int.make_type_32.loc49_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_42.1: type = value_of_initializer %int.make_type_32.loc49_42 [template = i32] +// CHECK:STDOUT: %.loc49_42.2: type = converted %int.make_type_32.loc49_42, %.loc49_42.1 [template = i32] // CHECK:STDOUT: %c.loc49_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc49_39.1 +// CHECK:STDOUT: %int.make_type_32.loc49_50: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_50.1: type = value_of_initializer %int.make_type_32.loc49_50 [template = i32] +// CHECK:STDOUT: %.loc49_50.2: type = converted %int.make_type_32.loc49_50, %.loc49_50.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.23: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.24: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.25: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc53_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_32.1: type = value_of_initializer %int.make_type_32.loc53_32 [template = i32] +// CHECK:STDOUT: %.loc53_32.2: type = converted %int.make_type_32.loc53_32, %.loc53_32.1 [template = i32] // CHECK:STDOUT: %a.loc53_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc53_29.1 +// CHECK:STDOUT: %int.make_type_32.loc53_40: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_40.1: type = value_of_initializer %int.make_type_32.loc53_40 [template = i32] +// CHECK:STDOUT: %.loc53_40.2: type = converted %int.make_type_32.loc53_40, %.loc53_40.1 [template = i32] // CHECK:STDOUT: %b.loc53_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc53_37.1 +// CHECK:STDOUT: %bool.make_type.loc53: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc53_48.1: type = value_of_initializer %bool.make_type.loc53 [template = bool] +// CHECK:STDOUT: %.loc53_48.2: type = converted %bool.make_type.loc53, %.loc53_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew(%a: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: i32, %b: i32, %c: i32) -> i32; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: i32, %b: i32) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: i32, %b: i32) -> i32 = "int.uadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc46_19.1: i32 = value_of_initializer %TooFew.call @@ -283,7 +421,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -295,7 +433,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) @@ -307,9 +445,11 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- overflow.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 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -322,21 +462,41 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref.loc7: 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.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Add.ref.loc7: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_18: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %.loc7_30: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.2] // CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.2] // CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc7: i32 = bind_name a, %.loc7_32.2 -// CHECK:STDOUT: %Add.ref.loc8: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: 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: %Add.ref.loc8: Add = name_ref Add, %Add.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_18: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.5] @@ -345,5 +505,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %b.loc8: i32 = bind_name b, %.loc8_32.2 // 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.uadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 674a3c0f9b94..3a2560ca1f33 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -52,16 +52,18 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -72,40 +74,74 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { +// 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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.udiv, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.udiv"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%a.ref, %b.ref) @@ -117,13 +153,15 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -140,30 +178,66 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { +// 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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.9: 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: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] -// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.3] @@ -174,9 +248,13 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.6] // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.6] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.10: 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: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] @@ -190,16 +268,20 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.7] // CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.7] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.3] // CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.3] // CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.3] // CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.5] // CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.7] @@ -212,6 +294,8 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.udiv"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.usub"; @@ -221,9 +305,11 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Div = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %struct.2: Div = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -234,21 +320,41 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [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: %Div.decl: Div = fn_decl @Div [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.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.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.udiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.udiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.udiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a.loc10: i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] @@ -257,5 +363,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %b.loc15: i32 = bind_name b, %.loc15_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a: i32, %b: i32) -> i32 = "int.udiv"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index af8cb16c4d8d..c69bf51d9135 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -54,16 +54,18 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 5 [template] // CHECK:STDOUT: %.3: i32 = int_literal 3 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 2] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -74,40 +76,74 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { +// 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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.3] // CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.umod, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 2] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 2]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 2]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.umod"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%a.ref, %b.ref) @@ -119,13 +155,15 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %Negate: type = fn_type @Negate [template] -// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %struct.4: Negate = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -142,30 +180,66 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { +// 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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: type = value_of_initializer %int.make_type_32.loc6_14 [template = i32] +// CHECK:STDOUT: %.loc6_14.2: type = converted %int.make_type_32.loc6_14, %.loc6_14.1 [template = i32] // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 +// CHECK:STDOUT: %int.make_type_32.loc6_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_22.1: type = value_of_initializer %int.make_type_32.loc6_22 [template = i32] +// CHECK:STDOUT: %.loc6_22.2: type = converted %int.make_type_32.loc6_22, %.loc6_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.9: 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: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] -// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.3] @@ -176,9 +250,13 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.3] // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.10: 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: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] @@ -192,16 +270,20 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.7] // CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.7] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc15: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc15: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.3] // CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.3] // CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.3] // CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.6] -// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.5] // CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.6] @@ -214,6 +296,8 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.umod"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.usub"; @@ -223,9 +307,11 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Mod = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %struct.2: Mod = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -236,21 +322,41 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [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: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.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.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.umod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.umod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] +// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.umod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] @@ -259,5 +365,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %b.loc17: i32 = bind_name b, %.loc17_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mod(%a: i32, %b: i32) -> i32 = "int.umod"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index faaff2776f47..ab9115459caf 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -27,16 +27,18 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- int_mul.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %struct.2: Mul = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 6 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,40 +49,74 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { +// 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: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.umul, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a: i32, %b: i32) -> i32 = "int.umul"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%a.ref, %b.ref) @@ -92,9 +128,11 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Mul = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %struct.2: Mul = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 32767 [template] // CHECK:STDOUT: %.3: i32 = int_literal 65536 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2147418112 [template] @@ -108,21 +146,41 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [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: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.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.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.2] // CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.3] // CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.4] // CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.4] // CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc7: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Mul.ref.loc7: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_18: i32 = int_literal 32768 [template = constants.%.5] // CHECK:STDOUT: %.loc7_26: i32 = int_literal 65536 [template = constants.%.3] // CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.6] @@ -131,5 +189,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a: i32, %b: i32) -> i32 = "int.umul"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 742cda4447e5..7271a9f0e11b 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -111,9 +111,11 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- int_negate.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.1: 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 123 [template] // CHECK:STDOUT: %.3: i32 = int_literal -123 [template] // CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] @@ -121,7 +123,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] // CHECK:STDOUT: %.7: i32 = int_literal -1 [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -132,47 +134,81 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// 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.loc2_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_14.1: type = value_of_initializer %int.make_type_32.loc2_14 [template = i32] +// CHECK:STDOUT: %.loc2_14.2: type = converted %int.make_type_32.loc2_14, %.loc2_14.1 [template = i32] // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc2_11.1 +// CHECK:STDOUT: %int.make_type_32.loc2_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_22.1: type = value_of_initializer %int.make_type_32.loc2_22 [template = i32] +// CHECK:STDOUT: %.loc2_22.2: type = converted %int.make_type_32.loc2_22, %.loc2_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.3] // CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.3] // CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.unegate.loc4_29, %.loc4_22.1 [template = constants.%.3] // CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_35: type = array_type %int.unegate.loc4_22, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.4] // CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.5] // CHECK:STDOUT: %arr.ref: ref [i32; 123] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_26: [i32; 123]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 -// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %int.unegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate.loc7 [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate.loc7, %.loc7_23.1 [template = constants.%.7] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc9_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_19.1: type = value_of_initializer %int.make_type_32.loc9_19 [template = i32] +// CHECK:STDOUT: %.loc9_19.2: type = converted %int.make_type_32.loc9_19, %.loc9_19.1 [template = i32] // CHECK:STDOUT: %a.loc9_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc9_16.1 +// CHECK:STDOUT: %int.make_type_32.loc9_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_27.1: type = value_of_initializer %int.make_type_32.loc9_27 [template = i32] +// CHECK:STDOUT: %.loc9_27.2: type = converted %int.make_type_32.loc9_27, %.loc9_27.1 [template = i32] // CHECK:STDOUT: %b.loc9_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc9_24.1 +// CHECK:STDOUT: %int.make_type_32.loc9_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_35.1: type = value_of_initializer %int.make_type_32.loc9_35 [template = i32] +// CHECK:STDOUT: %.loc9_35.2: type = converted %int.make_type_32.loc9_35, %.loc9_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.unegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.unegate: init i32 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.unegate @@ -183,23 +219,27 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %struct.2: TooFew = struct_value () [template] // CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] -// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %struct.3: TooMany = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] -// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.5: BadReturnType = struct_value () [template] // CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] -// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %struct.6: JustRight = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %struct.7: RuntimeCallTooFew = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %struct.8: RuntimeCallTooMany = struct_value () [template] // CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: %struct.9: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -218,82 +258,164 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_16.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_16.2: type = converted %int.make_type_32.loc8, %.loc8_16.1 [template = i32] // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { +// 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: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc13_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15.1: type = value_of_initializer %int.make_type_32.loc13_15 [template = i32] +// CHECK:STDOUT: %.loc13_15.2: type = converted %int.make_type_32.loc13_15, %.loc13_15.1 [template = i32] // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 +// CHECK:STDOUT: %int.make_type_32.loc13_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_23.1: type = value_of_initializer %int.make_type_32.loc13_23 [template = i32] +// CHECK:STDOUT: %.loc13_23.2: type = converted %int.make_type_32.loc13_23, %.loc13_23.1 [template = i32] // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 +// CHECK:STDOUT: %int.make_type_32.loc13_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13_31 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13_31, %.loc13_31.1 [template = i32] // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_21.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_21.2: type = converted %int.make_type_32.loc18, %.loc18_21.1 [template = i32] // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_29.2: type = converted %bool.make_type.loc18, %.loc18_29.1 [template = bool] // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc19_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_17.1: type = value_of_initializer %int.make_type_32.loc19_17 [template = i32] +// CHECK:STDOUT: %.loc19_17.2: type = converted %int.make_type_32.loc19_17, %.loc19_17.1 [template = i32] // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 +// CHECK:STDOUT: %int.make_type_32.loc19_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_25.1: type = value_of_initializer %int.make_type_32.loc19_25 [template = i32] +// CHECK:STDOUT: %.loc19_25.2: type = converted %int.make_type_32.loc19_25, %.loc19_25.1 [template = i32] // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.6] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.unegate: init i32 = call %JustRight.ref() [template = ] +// CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] +// CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_36: type = array_type %int.unegate, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.7] { +// CHECK:STDOUT: %int.make_type_32.loc46_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_25.1: type = value_of_initializer %int.make_type_32.loc46_25 [template = i32] +// CHECK:STDOUT: %.loc46_25.2: type = converted %int.make_type_32.loc46_25, %.loc46_25.1 [template = i32] // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 +// CHECK:STDOUT: %int.make_type_32.loc46_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc46_33.1: type = value_of_initializer %int.make_type_32.loc46_33 [template = i32] +// CHECK:STDOUT: %.loc46_33.2: type = converted %int.make_type_32.loc46_33, %.loc46_33.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc57_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_26.1: type = value_of_initializer %int.make_type_32.loc57_26 [template = i32] +// CHECK:STDOUT: %.loc57_26.2: type = converted %int.make_type_32.loc57_26, %.loc57_26.1 [template = i32] // CHECK:STDOUT: %a.loc57_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc57_23.1 +// CHECK:STDOUT: %int.make_type_32.loc57_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_34.1: type = value_of_initializer %int.make_type_32.loc57_34 [template = i32] +// CHECK:STDOUT: %.loc57_34.2: type = converted %int.make_type_32.loc57_34, %.loc57_34.1 [template = i32] // CHECK:STDOUT: %b.loc57_31.1: i32 = param b // CHECK:STDOUT: @RuntimeCallTooMany.%b: i32 = bind_name b, %b.loc57_31.1 +// CHECK:STDOUT: %int.make_type_32.loc57_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_42.1: type = value_of_initializer %int.make_type_32.loc57_42 [template = i32] +// CHECK:STDOUT: %.loc57_42.2: type = converted %int.make_type_32.loc57_42, %.loc57_42.1 [template = i32] // CHECK:STDOUT: %c.loc57_39.1: i32 = param c // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc57_39.1 +// CHECK:STDOUT: %int.make_type_32.loc57_50: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_50.1: type = value_of_initializer %int.make_type_32.loc57_50 [template = i32] +// CHECK:STDOUT: %.loc57_50.2: type = converted %int.make_type_32.loc57_50, %.loc57_50.1 [template = i32] // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.19: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.20: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc68_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc68_32.1: type = value_of_initializer %int.make_type_32.loc68_32 [template = i32] +// CHECK:STDOUT: %.loc68_32.2: type = converted %int.make_type_32.loc68_32, %.loc68_32.1 [template = i32] // CHECK:STDOUT: %a.loc68_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc68_29.1 +// CHECK:STDOUT: %int.make_type_32.loc68_40: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc68_40.1: type = value_of_initializer %int.make_type_32.loc68_40 [template = i32] +// CHECK:STDOUT: %.loc68_40.2: type = converted %int.make_type_32.loc68_40, %.loc68_40.1 [template = i32] // CHECK:STDOUT: %b.loc68_37.1: i32 = param b // CHECK:STDOUT: @RuntimeCallBadReturnType.%b: i32 = bind_name b, %b.loc68_37.1 +// CHECK:STDOUT: %bool.make_type.loc68: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc68_48.1: type = value_of_initializer %bool.make_type.loc68 [template = bool] +// CHECK:STDOUT: %.loc68_48.2: type = converted %bool.make_type.loc68, %.loc68_48.1 [template = bool] // CHECK:STDOUT: @RuntimeCallBadReturnType.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TooFew() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @TooMany(%a: i32, %b: i32) -> i32; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @BadReturnType(%a: i32) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a: i32) -> i32 = "int.unegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] @@ -303,7 +425,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -315,7 +437,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.5] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] @@ -327,11 +449,13 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- overflow.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.1: 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: %Sub: type = fn_type @Sub [template] -// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.3: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -345,20 +469,44 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { +// 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.loc4_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_14.1: type = value_of_initializer %int.make_type_32.loc4_14 [template = i32] +// CHECK:STDOUT: %.loc4_14.2: type = converted %int.make_type_32.loc4_14, %.loc4_14.1 [template = i32] // CHECK:STDOUT: %a.loc4_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc4_11.1 +// CHECK:STDOUT: %int.make_type_32.loc4_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_22.1: type = value_of_initializer %int.make_type_32.loc4_22 [template = i32] +// CHECK:STDOUT: %.loc4_22.2: type = converted %int.make_type_32.loc4_22, %.loc4_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5_11, %.loc5_11.1 [template = i32] // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 +// CHECK:STDOUT: %int.make_type_32.loc5_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5_19 [template = i32] +// CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5_19, %.loc5_19.1 [template = i32] // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 +// CHECK:STDOUT: %int.make_type_32.loc5_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_27.1: type = value_of_initializer %int.make_type_32.loc5_27 [template = i32] +// CHECK:STDOUT: %.loc5_27.2: type = converted %int.make_type_32.loc5_27, %.loc5_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: 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: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.3] // CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.3] @@ -367,9 +515,13 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.2] // CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc11_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] -// CHECK:STDOUT: %Negate.ref.loc11_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: 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: %Negate.ref.loc11_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Negate.ref.loc11_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc11_32: i32 = int_literal 2147483647 [template = constants.%.2] // CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.3] // CHECK:STDOUT: %.loc11_45: i32 = int_literal 1 [template = constants.%.4] @@ -384,6 +536,8 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %b.loc11: i32 = bind_name b, %.loc11_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.unegate"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.usub"; diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index 0bb446e07451..72caf73651f8 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -28,16 +28,18 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- int_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 3 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -48,40 +50,74 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { +// 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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_25: type = array_type %int.usub, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.usub"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%a.ref, %b.ref) @@ -93,9 +129,11 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Sub = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: %.4: i32 = int_literal -2147483647 [template] @@ -110,22 +148,42 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [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: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc4_8.1 +// CHECK:STDOUT: %int.make_type_32.loc4_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32.loc4_19 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32.loc4_19, %.loc4_19.1 [template = i32] // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc4_16.1 +// CHECK:STDOUT: %int.make_type_32.loc4_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4_27 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4_27, %.loc4_27.1 [template = i32] // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.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.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.4] // CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.4] // CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] -// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.4] @@ -136,8 +194,12 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.6] // CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc8_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] -// CHECK:STDOUT: %Sub.ref.loc8_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %import_ref.6: 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: %Sub.ref.loc8_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Sub.ref.loc8_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25: i32 = int_literal 2147483647 [template = constants.%.3] // CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.4] @@ -150,5 +212,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %c: i32 = bind_name c, %.loc8_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a: i32, %b: i32) -> i32 = "int.usub"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index a8cd87882782..20354eecd5f7 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -18,16 +18,18 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_xor.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Xor: type = fn_type @Xor [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Xor = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Xor: type = fn_type @Xor [template] +// CHECK:STDOUT: %struct.2: Xor = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: %.3: i32 = int_literal 10 [template] // CHECK:STDOUT: %.4: i32 = int_literal 6 [template] // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] // CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] // CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,40 +40,74 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Xor.decl: Xor = fn_decl @Xor [template = constants.%struct.1] { +// 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: %Xor.decl: Xor = fn_decl @Xor [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc2_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_11.1: type = value_of_initializer %int.make_type_32.loc2_11 [template = i32] +// CHECK:STDOUT: %.loc2_11.2: type = converted %int.make_type_32.loc2_11, %.loc2_11.1 [template = i32] // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Xor.%a: i32 = bind_name a, %a.loc2_8.1 +// CHECK:STDOUT: %int.make_type_32.loc2_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_19.1: type = value_of_initializer %int.make_type_32.loc2_19 [template = i32] +// CHECK:STDOUT: %.loc2_19.2: type = converted %int.make_type_32.loc2_19, %.loc2_19.1 [template = i32] // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Xor.%b: i32 = bind_name b, %b.loc2_16.1 +// CHECK:STDOUT: %int.make_type_32.loc2_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %int.make_type_32.loc2_27 [template = i32] +// CHECK:STDOUT: %.loc2_27.2: type = converted %int.make_type_32.loc2_27, %.loc2_27.1 [template = i32] // CHECK:STDOUT: @Xor.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, %Xor.decl [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, %Xor.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.3] // CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_27: type = array_type %int.xor, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] // CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { +// 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: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.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: %b.loc7_24.1: i32 = param b // CHECK:STDOUT: @RuntimeCall.%b: i32 = bind_name b, %b.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32.loc7_35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_35.1: type = value_of_initializer %int.make_type_32.loc7_35 [template = i32] +// CHECK:STDOUT: %.loc7_35.2: type = converted %int.make_type_32.loc7_35, %.loc7_35.1 [template = i32] // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Xor(%a: i32, %b: i32) -> i32 = "int.xor"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, file.%Xor.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, file.%Xor.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/class/adapt.carbon b/toolchain/check/testdata/class/adapt.carbon index a88b2fa293fc..9fc79f680f88 100644 --- a/toolchain/check/testdata/class/adapt.carbon +++ b/toolchain/check/testdata/class/adapt.carbon @@ -45,10 +45,13 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %SomeClass: type = class_type @SomeClass [template] -// CHECK:STDOUT: %.1: type = unbound_element_type SomeClass, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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: type = unbound_element_type SomeClass, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %StructAdapter: type = class_type @StructAdapter [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,18 +64,28 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %SomeClassAdapter.decl: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} // CHECK:STDOUT: %StructAdapter.decl: type = class_decl @StructAdapter [template = constants.%StructAdapter] {} +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClass { -// CHECK:STDOUT: %.loc5: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%SomeClass -// CHECK:STDOUT: .a = %.loc5 -// CHECK:STDOUT: .b = %.loc6 +// CHECK:STDOUT: .a = %.loc5_8 +// CHECK:STDOUT: .b = %.loc6_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClassAdapter { @@ -84,13 +97,21 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @StructAdapter { -// CHECK:STDOUT: %.loc14: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc14_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_14.1: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32] +// CHECK:STDOUT: %.loc14_14.2: type = converted %int.make_type_32.loc14_14, %.loc14_14.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_23: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_23.1: type = value_of_initializer %int.make_type_32.loc14_23 [template = i32] +// CHECK:STDOUT: %.loc14_23.2: type = converted %int.make_type_32.loc14_23, %.loc14_23.1 [template = i32] +// CHECK:STDOUT: %.loc14_26: type = struct_type {.a: i32, .b: i32} [template = constants.%.3] // CHECK:STDOUT: adapt_decl {.a: i32, .b: i32} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%StructAdapter // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_not_extend.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index 6106465914e8..15f7f6812dcf 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -26,28 +26,30 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: 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 = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: i32} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.3: type = ptr_type {.b: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.b: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Base, .d: i32} [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] // CHECK:STDOUT: %.8: type = struct_type {.base: {.b: i32}*, .d: i32} [template] // CHECK:STDOUT: %.9: type = ptr_type {.base: {.b: i32}*, .d: i32} [template] // CHECK:STDOUT: %.10: type = ptr_type {.base: Base, .d: i32} [template] // CHECK:STDOUT: %.11: i32 = int_literal 4 [template] // CHECK:STDOUT: %.12: i32 = int_literal 7 [template] // CHECK:STDOUT: %.13: type = struct_type {.base: {.b: i32}, .d: i32} [template] -// CHECK:STDOUT: %struct.2: Base = struct_value (%.11) [template] -// CHECK:STDOUT: %struct.3: Derived = struct_value (%struct.2, %.12) [template] +// CHECK:STDOUT: %struct.3: Base = struct_value (%.11) [template] +// CHECK:STDOUT: %struct.4: Derived = struct_value (%struct.3, %.12) [template] // CHECK:STDOUT: %.14: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %Access: type = fn_type @Access [template] -// CHECK:STDOUT: %struct.4: Access = struct_value () [template] +// CHECK:STDOUT: %struct.5: Access = struct_value () [template] // CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,41 +63,59 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.5] { // CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc21_11.1: Derived = param d // CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc21_11.1 -// CHECK:STDOUT: %.loc21_35.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc21_35.2: type = converted %.loc21_35.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %int.make_type_32.loc21_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_35.1: (type, type) = tuple_literal (%int.make_type_32.loc21_27, %int.make_type_32.loc21_32) +// CHECK:STDOUT: %.loc21_35.2: type = value_of_initializer %int.make_type_32.loc21_27 [template = i32] +// CHECK:STDOUT: %.loc21_35.3: type = converted %int.make_type_32.loc21_27, %.loc21_35.2 [template = i32] +// CHECK:STDOUT: %.loc21_35.4: type = value_of_initializer %int.make_type_32.loc21_32 [template = i32] +// CHECK:STDOUT: %.loc21_35.5: type = converted %int.make_type_32.loc21_32, %.loc21_35.4 [template = i32] +// CHECK:STDOUT: %.loc21_35.6: type = converted %.loc21_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8: = field_decl b, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .b = %.loc8 +// CHECK:STDOUT: .b = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc14: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .d = %.loc14 +// CHECK:STDOUT: .d = %.loc14_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.11] @@ -105,26 +125,26 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %.loc18_35.2: ref Base = class_element_access %return, element0 // CHECK:STDOUT: %.loc18_26.2: ref i32 = class_element_access %.loc18_35.2, element0 // CHECK:STDOUT: %.loc18_26.3: init i32 = initialize_from %.loc18_25 to %.loc18_26.2 [template = constants.%.11] -// CHECK:STDOUT: %.loc18_26.4: init Base = class_init (%.loc18_26.3), %.loc18_35.2 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc18_35.3: init Base = converted %.loc18_26.1, %.loc18_26.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc18_26.4: init Base = class_init (%.loc18_26.3), %.loc18_35.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc18_35.3: init Base = converted %.loc18_26.1, %.loc18_26.4 [template = constants.%struct.3] // CHECK:STDOUT: %.loc18_35.4: ref i32 = class_element_access %return, element1 // CHECK:STDOUT: %.loc18_35.5: init i32 = initialize_from %.loc18_34 to %.loc18_35.4 [template = constants.%.12] -// CHECK:STDOUT: %.loc18_35.6: init Derived = class_init (%.loc18_35.3, %.loc18_35.5), %return [template = constants.%struct.3] -// CHECK:STDOUT: %.loc18_36: init Derived = converted %.loc18_35.1, %.loc18_35.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc18_35.6: init Derived = class_init (%.loc18_35.3, %.loc18_35.5), %return [template = constants.%struct.4] +// CHECK:STDOUT: %.loc18_36: init Derived = converted %.loc18_35.1, %.loc18_35.6 [template = constants.%struct.4] // CHECK:STDOUT: return %.loc18_36 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Access(%d: Derived) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.ref.loc22_11: Derived = name_ref d, %d -// CHECK:STDOUT: %d.ref.loc22_12: = name_ref d, @Derived.%.loc14 [template = @Derived.%.loc14] +// CHECK:STDOUT: %d.ref.loc22_12: = name_ref d, @Derived.%.loc14_8 [template = @Derived.%.loc14_8] // CHECK:STDOUT: %.loc22_12.1: ref i32 = class_element_access %d.ref.loc22_11, element1 // CHECK:STDOUT: %.loc22_12.2: i32 = bind_value %.loc22_12.1 // CHECK:STDOUT: %d.ref.loc22_16: Derived = name_ref d, %d // CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc12 [template = @Derived.%.loc12] // CHECK:STDOUT: %.loc22_17.1: ref Base = class_element_access %d.ref.loc22_16, element0 // CHECK:STDOUT: %.loc22_17.2: Base = bind_value %.loc22_17.1 -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc8 [template = @Base.%.loc8] +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc8_8 [template = @Base.%.loc8_8] // CHECK:STDOUT: %.loc22_22.1: ref i32 = class_element_access %.loc22_17.2, element0 // CHECK:STDOUT: %.loc22_22.2: i32 = bind_value %.loc22_22.1 // CHECK:STDOUT: %.loc22_24.1: (i32, i32) = tuple_literal (%.loc22_12.2, %.loc22_22.2) diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 88b49989b749..b1dbb269bfb9 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -25,18 +25,20 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32, .c: 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 = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32, .c: i32} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type Derived [template] -// CHECK:STDOUT: %.8: type = ptr_type i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type Derived [template] +// CHECK:STDOUT: %.9: type = ptr_type i32 [template] // CHECK:STDOUT: %Access: type = fn_type @Access [template] -// CHECK:STDOUT: %.9: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Access = struct_value () [template] +// CHECK:STDOUT: %struct.2: Access = struct_value () [template] // CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] // CHECK:STDOUT: %.11: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] // CHECK:STDOUT: %.12: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] @@ -51,48 +53,74 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// 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: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct] { +// 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: %Access.decl: Access = fn_decl @Access [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc20_21: type = ptr_type Derived [template = constants.%.7] +// CHECK:STDOUT: %.loc20_21: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc20_11.1: Derived* = param p // CHECK:STDOUT: @Access.%p: Derived* = bind_name p, %p.loc20_11.1 -// CHECK:STDOUT: %.loc20_30: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_30.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc20_30.2: type = converted %int.make_type_32, %.loc20_30.1 [template = i32] +// CHECK:STDOUT: %.loc20_30.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: @Access.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] -// CHECK:STDOUT: %.loc10: = field_decl c, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] +// CHECK:STDOUT: %.loc10_8: = field_decl c, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 -// CHECK:STDOUT: .c = %.loc10 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .c = %.loc10_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc14: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc16: = field_decl d, element1 [template] -// CHECK:STDOUT: %.loc17: = field_decl e, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32.loc16, %.loc16_10.1 [template = i32] +// CHECK:STDOUT: %.loc16_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32.loc17, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_8: = field_decl e, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc14 -// CHECK:STDOUT: .d = %.loc16 -// CHECK:STDOUT: .e = %.loc17 +// CHECK:STDOUT: .d = %.loc16_8 +// CHECK:STDOUT: .e = %.loc17_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Access(%p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc21_12: ref Derived = deref %p.ref -// CHECK:STDOUT: %c.ref: = name_ref c, @Base.%.loc10 [template = @Base.%.loc10] +// CHECK:STDOUT: %c.ref: = name_ref c, @Base.%.loc10_8 [template = @Base.%.loc10_8] // CHECK:STDOUT: %.loc21_15.1: ref Base = class_element_access %.loc21_12, element0 // CHECK:STDOUT: %.loc21_15.2: ref Base = converted %.loc21_12, %.loc21_15.1 // CHECK:STDOUT: %.loc21_15.3: ref i32 = class_element_access %.loc21_15.2, element2 diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 4b21c637ee96..48e5eb8fcabb 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -26,11 +26,13 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type Base [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 = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type Base [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 = struct_type {.a: i32} [template] // CHECK:STDOUT: %.5: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] @@ -39,7 +41,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %.8: type = struct_type {.base: Base} [template] // CHECK:STDOUT: %.9: type = ptr_type Derived [template] // CHECK:STDOUT: %Call: type = fn_type @Call [template] -// CHECK:STDOUT: %struct.2: Call = struct_value () [template] +// CHECK:STDOUT: %struct.3: Call = struct_value () [template] // CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*} [template] // CHECK:STDOUT: %.11: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: } @@ -53,15 +55,16 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: 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: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc13_26: type = ptr_type Base [template = constants.%.2] +// CHECK:STDOUT: %.loc13_26: type = ptr_type Base [template = constants.%.3] // CHECK:STDOUT: %self.loc13_16.1: Base* = param self // CHECK:STDOUT: @F.%self: Base* = bind_name self, %self.loc13_16.1 // CHECK:STDOUT: @F.%.loc13: Base* = addr_pattern @F.%self // CHECK:STDOUT: } // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.2] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %.loc21: type = ptr_type Derived [template = constants.%.9] // CHECK:STDOUT: %p.loc21_9.1: Derived* = param p @@ -70,10 +73,13 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] -// CHECK:STDOUT: %.loc10_23: type = ptr_type Base [template = constants.%.2] +// CHECK:STDOUT: %.loc10_23: type = ptr_type Base [template = constants.%.3] // CHECK:STDOUT: %self.loc10_13.1: Base* = param self // CHECK:STDOUT: %self.loc10_13.3: Base* = bind_name self, %self.loc10_13.1 // CHECK:STDOUT: %.loc10_8: Base* = addr_pattern %self.loc10_13.3 @@ -81,7 +87,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: @@ -95,11 +101,13 @@ fn Call(p: Derived*) { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[addr %self: Base*]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc14_4: ref Base = deref %self.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8 [template = @Base.%.loc8] +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] // CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 // CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: assign %.loc14_10, %.loc14_15 @@ -110,7 +118,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc22_4.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc22_7: = bound_method %.loc22_4.1, %F.ref // CHECK:STDOUT: %.loc22_4.2: Derived* = addr_of %.loc22_4.1 // CHECK:STDOUT: %.loc22_9.1: ref Derived = deref %.loc22_4.2 diff --git a/toolchain/check/testdata/class/base_method_qualified.carbon b/toolchain/check/testdata/class/base_method_qualified.carbon index fd89901c7bfe..995e224481cf 100644 --- a/toolchain/check/testdata/class/base_method_qualified.carbon +++ b/toolchain/check/testdata/class/base_method_qualified.carbon @@ -39,30 +39,32 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Derived: type = class_type @Derived [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %G.1: type = fn_type @G.1 [template] -// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] -// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %struct.5: G = struct_value () [template] // CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template] // CHECK:STDOUT: %Call: type = fn_type @Call [template] -// CHECK:STDOUT: %struct.5: Call = struct_value () [template] +// CHECK:STDOUT: %struct.6: Call = struct_value () [template] // CHECK:STDOUT: %.6: type = struct_type {.base: {}*} [template] // CHECK:STDOUT: %.7: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: %.8: type = ptr_type Derived [template] // CHECK:STDOUT: %CallIndirect: type = fn_type @CallIndirect [template] -// CHECK:STDOUT: %struct.6: CallIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.7: CallIndirect = struct_value () [template] // CHECK:STDOUT: %PassDerivedToBase: type = fn_type @PassDerivedToBase [template] -// CHECK:STDOUT: %struct.7: PassDerivedToBase = struct_value () [template] +// CHECK:STDOUT: %struct.8: PassDerivedToBase = struct_value () [template] // CHECK:STDOUT: %PassDerivedToBaseIndirect: type = fn_type @PassDerivedToBaseIndirect [template] -// CHECK:STDOUT: %struct.8: PassDerivedToBaseIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.9: PassDerivedToBaseIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -78,31 +80,49 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Derived.decl.loc7: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// 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: %Derived.decl.loc14: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.6] { // CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc21_9.1: Derived = param a // CHECK:STDOUT: @Call.%a: Derived = bind_name a, %a.loc21_9.1 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_24.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_24.2: type = converted %int.make_type_32.loc21, %.loc21_24.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallIndirect.decl: CallIndirect = fn_decl @CallIndirect [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallIndirect.decl: CallIndirect = fn_decl @CallIndirect [template = constants.%struct.7] { // CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %.loc25: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %.loc25_27: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc25_17.1: Derived* = param p // CHECK:STDOUT: @CallIndirect.%p: Derived* = bind_name p, %p.loc25_17.1 +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_33.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_33.2: type = converted %int.make_type_32.loc25, %.loc25_33.1 [template = i32] // CHECK:STDOUT: @CallIndirect.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PassDerivedToBase.decl: PassDerivedToBase = fn_decl @PassDerivedToBase [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PassDerivedToBase.decl: PassDerivedToBase = fn_decl @PassDerivedToBase [template = constants.%struct.8] { // CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc29_22.1: Derived = param a // CHECK:STDOUT: @PassDerivedToBase.%a: Derived = bind_name a, %a.loc29_22.1 +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_37.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_37.2: type = converted %int.make_type_32.loc29, %.loc29_37.1 [template = i32] // CHECK:STDOUT: @PassDerivedToBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: PassDerivedToBaseIndirect = fn_decl @PassDerivedToBaseIndirect [template = constants.%struct.8] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: PassDerivedToBaseIndirect = fn_decl @PassDerivedToBaseIndirect [template = constants.%struct.9] { // CHECK:STDOUT: %Derived.ref.loc33: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %.loc33: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %.loc33_40: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc33_30.1: Derived* = param p // CHECK:STDOUT: @PassDerivedToBaseIndirect.%p: Derived* = bind_name p, %p.loc33_30.1 +// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc33_46.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] +// CHECK:STDOUT: %.loc33_46.2: type = converted %int.make_type_32.loc33, %.loc33_46.1 [template = i32] // CHECK:STDOUT: @PassDerivedToBaseIndirect.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -110,12 +130,12 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc15: = base_decl Base, element0 [template] -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Derived [template = constants.%Derived] // CHECK:STDOUT: %self.loc17_8.1: Derived = param self // CHECK:STDOUT: %self.loc17_8.2: Derived = bind_name self, %self.loc17_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.4] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.5] { // CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Derived [template = constants.%Derived] // CHECK:STDOUT: %self.loc18_8.1: Derived = param self // CHECK:STDOUT: %self.loc18_8.2: Derived = bind_name self, %self.loc18_8.1 @@ -130,16 +150,22 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] // CHECK:STDOUT: %self.loc10_8.1: Base = param self // CHECK:STDOUT: %self.loc10_8.2: Base = bind_name self, %self.loc10_8.1 +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32.loc10, %.loc10_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc10: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %self.loc11_8.1: Derived = param self // CHECK:STDOUT: %self.loc11_8.2: Derived = bind_name self, %self.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_28.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_28.2: type = converted %int.make_type_32.loc11, %.loc11_28.1 [template = i32] // CHECK:STDOUT: %return.var.loc11: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -149,6 +175,8 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.1[@Base.%self.loc10_8.2: Base]() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @G.1[@Base.%self.loc11_8.2: Derived]() -> i32; @@ -161,7 +189,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc22_11: = bound_method %a.ref, %F.ref // CHECK:STDOUT: %.loc22_20.1: ref Base = class_element_access %a.ref, element0 // CHECK:STDOUT: %.loc22_20.2: ref Base = converted %a.ref, %.loc22_20.1 @@ -176,7 +204,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc26_11.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc26_11.2: = bound_method %.loc26_11.1, %F.ref // CHECK:STDOUT: %.loc26_21.1: ref Base = class_element_access %.loc26_11.1, element0 @@ -192,7 +220,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc30_11: = bound_method %a.ref, %G.ref // CHECK:STDOUT: %G.call: init i32 = call %.loc30_11(%a.ref) // CHECK:STDOUT: %.loc30_22.1: i32 = value_of_initializer %G.call @@ -204,7 +232,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc34_11.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc34_11.2: = bound_method %.loc34_11.1, %G.ref // CHECK:STDOUT: %.loc34_11.3: Derived = bind_value %.loc34_11.1 diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index 1ede495b078c..28c47970731c 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -26,15 +26,17 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [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: %.2: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.k: i32} [template] // CHECK:STDOUT: %Run: type = fn_type @Run [template] -// CHECK:STDOUT: %struct.3: Run = struct_value () [template] +// CHECK:STDOUT: %struct.4: Run = struct_value () [template] // CHECK:STDOUT: %.4: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -46,36 +48,70 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.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: %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: %import_ref.7: 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.loc17_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_15.1: type = value_of_initializer %int.make_type_32.loc17_15 [template = i32] +// CHECK:STDOUT: %.loc17_15.2: type = converted %int.make_type_32.loc17_15, %.loc17_15.1 [template = i32] // CHECK:STDOUT: %n.loc17_12.1: i32 = param n // CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc17_12.1 +// CHECK:STDOUT: %int.make_type_32.loc17_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_23.1: type = value_of_initializer %int.make_type_32.loc17_23 [template = i32] +// CHECK:STDOUT: %.loc17_23.2: type = converted %int.make_type_32.loc17_23, %.loc17_23.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_13.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_13.2: type = converted %int.make_type_32.loc21, %.loc21_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8_11 [template = i32] +// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8_11, %.loc8_11.1 [template = i32] // CHECK:STDOUT: %n.loc8_8.1: i32 = param n // CHECK:STDOUT: %n.loc8_8.2: i32 = bind_name n, %n.loc8_8.1 +// CHECK:STDOUT: %int.make_type_32.loc8_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32.loc8_19 [template = i32] +// CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32.loc8_19, %.loc8_19.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // 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: %int.make_type_32.loc12_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12_11 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12_11, %.loc12_11.1 [template = i32] // CHECK:STDOUT: %n.loc12_8.1: i32 = param n // CHECK:STDOUT: %n.loc12_8.2: i32 = bind_name n, %n.loc12_8.1 +// CHECK:STDOUT: %int.make_type_32.loc12_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32.loc12_19 [template = i32] +// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32.loc12_19, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = field_decl k, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .k = %.loc14 +// CHECK:STDOUT: .k = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(@Class.%n.loc8_8.2: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, @Class.%n.loc8_8.2 @@ -91,7 +127,7 @@ fn Run() -> i32 { // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.4] // CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc22_18) // CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %F.call diff --git a/toolchain/check/testdata/class/complete_in_member_fn.carbon b/toolchain/check/testdata/class/complete_in_member_fn.carbon index cf49eb55f2f7..9773404943ed 100644 --- a/toolchain/check/testdata/class/complete_in_member_fn.carbon +++ b/toolchain/check/testdata/class/complete_in_member_fn.carbon @@ -14,9 +14,11 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = unbound_element_type C, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] @@ -29,27 +31,37 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// 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: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.loc8_8.1: C = param c // CHECK:STDOUT: %c.loc8_8.2: C = bind_name c, %c.loc8_8.1 +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_17.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_17.2: type = converted %int.make_type_32.loc8, %.loc8_17.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] +// CHECK:STDOUT: %.loc10_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .a = %.loc10 +// CHECK:STDOUT: .a = %.loc10_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(@C.%c.loc8_8.2: C) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C = name_ref c, @C.%c.loc8_8.2 -// CHECK:STDOUT: %a.ref: = name_ref a, @C.%.loc10 [template = @C.%.loc10] +// CHECK:STDOUT: %a.ref: = name_ref a, @C.%.loc10_8 [template = @C.%.loc10_8] // CHECK:STDOUT: %.loc8_31.1: ref i32 = class_element_access %c.ref, element0 // CHECK:STDOUT: %.loc8_31.2: i32 = bind_value %.loc8_31.1 // CHECK:STDOUT: return %.loc8_31.2 diff --git a/toolchain/check/testdata/class/compound_field.carbon b/toolchain/check/testdata/class/compound_field.carbon index f0b5e2316616..07d980f815b4 100644 --- a/toolchain/check/testdata/class/compound_field.carbon +++ b/toolchain/check/testdata/class/compound_field.carbon @@ -37,27 +37,29 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32, .c: 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 = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32, .c: i32} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Base, .d: i32, .e: i32} [template] // CHECK:STDOUT: %AccessDerived: type = fn_type @AccessDerived [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: AccessDerived = struct_value () [template] +// CHECK:STDOUT: %struct.2: AccessDerived = struct_value () [template] // CHECK:STDOUT: %.8: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] // CHECK:STDOUT: %.9: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] // CHECK:STDOUT: %.10: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] // CHECK:STDOUT: %AccessBase: type = fn_type @AccessBase [template] -// CHECK:STDOUT: %struct.2: AccessBase = struct_value () [template] +// CHECK:STDOUT: %struct.3: AccessBase = struct_value () [template] // CHECK:STDOUT: %.11: type = ptr_type Derived [template] // CHECK:STDOUT: %.12: type = ptr_type i32 [template] // CHECK:STDOUT: %AccessDerivedIndirect: type = fn_type @AccessDerivedIndirect [template] -// CHECK:STDOUT: %struct.3: AccessDerivedIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.4: AccessDerivedIndirect = struct_value () [template] // CHECK:STDOUT: %AccessBaseIndirect: type = fn_type @AccessBaseIndirect [template] -// CHECK:STDOUT: %struct.4: AccessBaseIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.5: AccessBaseIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -72,68 +74,106 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// 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: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %AccessDerived.decl: AccessDerived = fn_decl @AccessDerived [template = constants.%struct.1] { +// 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: %AccessDerived.decl: AccessDerived = fn_decl @AccessDerived [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref.loc20: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc20_18.1: Derived = param d // CHECK:STDOUT: @AccessDerived.%d: Derived = bind_name d, %d.loc20_18.1 +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_33.2: type = converted %int.make_type_32.loc20, %.loc20_33.1 [template = i32] // CHECK:STDOUT: @AccessDerived.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessBase.decl: AccessBase = fn_decl @AccessBase [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessBase.decl: AccessBase = fn_decl @AccessBase [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc24_15.1: Derived = param d // CHECK:STDOUT: @AccessBase.%d: Derived = bind_name d, %d.loc24_15.1 +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_30.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_30.2: type = converted %int.make_type_32.loc24, %.loc24_30.1 [template = i32] // CHECK:STDOUT: @AccessBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessDerivedIndirect.decl: AccessDerivedIndirect = fn_decl @AccessDerivedIndirect [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessDerivedIndirect.decl: AccessDerivedIndirect = fn_decl @AccessDerivedIndirect [template = constants.%struct.4] { // CHECK:STDOUT: %Derived.ref.loc28: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %.loc28_36: type = ptr_type Derived [template = constants.%.11] // CHECK:STDOUT: %p.loc28_26.1: Derived* = param p // CHECK:STDOUT: @AccessDerivedIndirect.%p: Derived* = bind_name p, %p.loc28_26.1 -// CHECK:STDOUT: %.loc28_45: type = ptr_type i32 [template = constants.%.12] +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc28_45.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_45.2: type = converted %int.make_type_32.loc28, %.loc28_45.1 [template = i32] +// CHECK:STDOUT: %.loc28_45.3: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessDerivedIndirect.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessBaseIndirect.decl: AccessBaseIndirect = fn_decl @AccessBaseIndirect [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessBaseIndirect.decl: AccessBaseIndirect = fn_decl @AccessBaseIndirect [template = constants.%struct.5] { // CHECK:STDOUT: %Derived.ref.loc32: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %.loc32_33: type = ptr_type Derived [template = constants.%.11] // CHECK:STDOUT: %p.loc32_23.1: Derived* = param p // CHECK:STDOUT: @AccessBaseIndirect.%p: Derived* = bind_name p, %p.loc32_23.1 -// CHECK:STDOUT: %.loc32_42: type = ptr_type i32 [template = constants.%.12] +// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc32_42.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] +// CHECK:STDOUT: %.loc32_42.2: type = converted %int.make_type_32.loc32, %.loc32_42.1 [template = i32] +// CHECK:STDOUT: %.loc32_42.3: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessBaseIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] -// CHECK:STDOUT: %.loc10: = field_decl c, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] +// CHECK:STDOUT: %.loc10_8: = field_decl c, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 -// CHECK:STDOUT: .c = %.loc10 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .c = %.loc10_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc14: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc16: = field_decl d, element1 [template] -// CHECK:STDOUT: %.loc17: = field_decl e, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32.loc16, %.loc16_10.1 [template = i32] +// CHECK:STDOUT: %.loc16_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32.loc17, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_8: = field_decl e, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc14 -// CHECK:STDOUT: .d = %.loc16 -// CHECK:STDOUT: .e = %.loc17 +// CHECK:STDOUT: .d = %.loc16_8 +// CHECK:STDOUT: .e = %.loc17_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @AccessDerived(%d: Derived) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.ref.loc21_10: Derived = name_ref d, %d // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.ref.loc21_20: = name_ref d, @Derived.%.loc16 [template = @Derived.%.loc16] +// CHECK:STDOUT: %d.ref.loc21_20: = name_ref d, @Derived.%.loc16_8 [template = @Derived.%.loc16_8] // CHECK:STDOUT: %.loc21_11.1: ref i32 = class_element_access %d.ref.loc21_10, element1 // CHECK:STDOUT: %.loc21_11.2: i32 = bind_value %.loc21_11.1 // CHECK:STDOUT: return %.loc21_11.2 @@ -143,7 +183,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.ref: Derived = name_ref d, %d // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9 [template = @Base.%.loc9] +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9_8 [template = @Base.%.loc9_8] // CHECK:STDOUT: %.loc25_11.1: ref Base = class_element_access %d.ref, element0 // CHECK:STDOUT: %.loc25_11.2: ref Base = converted %d.ref, %.loc25_11.1 // CHECK:STDOUT: %.loc25_11.3: ref i32 = class_element_access %.loc25_11.2, element1 @@ -155,7 +195,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.ref: = name_ref d, @Derived.%.loc16 [template = @Derived.%.loc16] +// CHECK:STDOUT: %d.ref: = name_ref d, @Derived.%.loc16_8 [template = @Derived.%.loc16_8] // CHECK:STDOUT: %.loc29_12.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc29_12.2: ref i32 = class_element_access %.loc29_12.1, element1 // CHECK:STDOUT: %.loc29_10: i32* = addr_of %.loc29_12.2 @@ -166,7 +206,7 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9 [template = @Base.%.loc9] +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9_8 [template = @Base.%.loc9_8] // CHECK:STDOUT: %.loc33_12.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc33_12.2: ref Base = class_element_access %.loc33_12.1, element0 // CHECK:STDOUT: %.loc33_12.3: ref Base = converted %.loc33_12.1, %.loc33_12.2 diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index 465753eefcd4..7d41d44bfdd9 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -184,8 +184,8 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} // CHECK:STDOUT: %Other.ref: = name_ref Other, %Other [template = %Other] -// CHECK:STDOUT: %import_ref.1: type = import_ref ir7, inst+2, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.2 = import_ref ir7, inst+3, unloaded +// CHECK:STDOUT: %import_ref.1: type = import_ref ir8, inst+2, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.2 = import_ref ir8, inst+3, unloaded // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var @@ -221,7 +221,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} // CHECK:STDOUT: %Other.ref: = name_ref Other, %Other [template = %Other] -// CHECK:STDOUT: %import_ref: type = import_ref ir7, inst+2, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref: type = import_ref ir8, inst+2, loaded [template = constants.%C] // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref [template = constants.%C] // CHECK:STDOUT: %c.var: ref = var c // CHECK:STDOUT: %c: ref = bind_name c, %c.var @@ -255,9 +255,9 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} // CHECK:STDOUT: %Other.ref: = name_ref Other, %Other [template = %Other] -// CHECK:STDOUT: %import_ref.1: type = import_ref ir7, inst+2, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.2 = import_ref ir7, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir8, inst+2, unloaded +// CHECK:STDOUT: %import_ref.1: type = import_ref ir8, inst+2, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.2 = import_ref ir8, inst+3, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir9, inst+2, unloaded // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var @@ -296,9 +296,9 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} // CHECK:STDOUT: %Other.ref: = name_ref Other, %Other [template = %Other] -// CHECK:STDOUT: %import_ref.1: type = import_ref ir7, inst+2, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.2 = import_ref ir7, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir8, inst+2, unloaded +// CHECK:STDOUT: %import_ref.1: type = import_ref ir8, inst+2, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.2 = import_ref ir8, inst+3, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir9, inst+2, unloaded // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.1 [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index f650f829dd6d..bfa6bafdfa52 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -38,47 +38,49 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: 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 = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type B, A [template] -// CHECK:STDOUT: %.5: type = unbound_element_type B, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: A, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %.6: type = unbound_element_type B, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: A, .b: i32} [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: A, .b: i32} [template] -// CHECK:STDOUT: %.10: type = unbound_element_type C, B [template] -// CHECK:STDOUT: %.11: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.12: type = struct_type {.base: B, .c: i32} [template] -// CHECK:STDOUT: %.13: type = ptr_type C [template] -// CHECK:STDOUT: %.14: type = ptr_type B [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: A, .b: i32} [template] +// CHECK:STDOUT: %.11: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %.12: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.13: type = struct_type {.base: B, .c: i32} [template] +// CHECK:STDOUT: %.14: type = ptr_type C [template] +// CHECK:STDOUT: %.15: type = ptr_type B [template] // CHECK:STDOUT: %ConvertCToB: type = fn_type @ConvertCToB [template] -// CHECK:STDOUT: %.15: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: ConvertCToB = struct_value () [template] +// CHECK:STDOUT: %struct.2: ConvertCToB = struct_value () [template] // CHECK:STDOUT: %.16: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} [template] // CHECK:STDOUT: %.17: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} [template] // CHECK:STDOUT: %.18: type = ptr_type {.base: B, .c: i32} [template] // CHECK:STDOUT: %.19: type = ptr_type A [template] // CHECK:STDOUT: %ConvertBToA: type = fn_type @ConvertBToA [template] -// CHECK:STDOUT: %struct.2: ConvertBToA = struct_value () [template] +// CHECK:STDOUT: %struct.3: ConvertBToA = struct_value () [template] // CHECK:STDOUT: %ConvertCToA: type = fn_type @ConvertCToA [template] -// CHECK:STDOUT: %struct.3: ConvertCToA = struct_value () [template] +// CHECK:STDOUT: %struct.4: ConvertCToA = struct_value () [template] // CHECK:STDOUT: %ConvertValue: type = fn_type @ConvertValue [template] -// CHECK:STDOUT: %struct.4: ConvertValue = struct_value () [template] +// CHECK:STDOUT: %struct.5: ConvertValue = struct_value () [template] // CHECK:STDOUT: %ConvertRef: type = fn_type @ConvertRef [template] -// CHECK:STDOUT: %struct.5: ConvertRef = struct_value () [template] +// CHECK:STDOUT: %struct.6: ConvertRef = struct_value () [template] // CHECK:STDOUT: %ConvertInit: type = fn_type @ConvertInit [template] -// CHECK:STDOUT: %struct.6: ConvertInit = struct_value () [template] +// CHECK:STDOUT: %struct.7: ConvertInit = struct_value () [template] // CHECK:STDOUT: %.20: i32 = int_literal 1 [template] // CHECK:STDOUT: %.21: i32 = int_literal 2 [template] // CHECK:STDOUT: %.22: type = struct_type {.base: {.a: i32}, .b: i32} [template] // CHECK:STDOUT: %.23: i32 = int_literal 3 [template] // CHECK:STDOUT: %.24: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} [template] -// CHECK:STDOUT: %struct.7: A = struct_value (%.20) [template] -// CHECK:STDOUT: %struct.8: B = struct_value (%struct.7, %.21) [template] -// CHECK:STDOUT: %struct.9: C = struct_value (%struct.8, %.23) [template] +// CHECK:STDOUT: %struct.8: A = struct_value (%.20) [template] +// CHECK:STDOUT: %struct.9: B = struct_value (%struct.8, %.21) [template] +// CHECK:STDOUT: %struct.10: C = struct_value (%struct.9, %.23) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -96,84 +98,98 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %ConvertCToB.decl: ConvertCToB = fn_decl @ConvertCToB [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %ConvertCToB.decl: ConvertCToB = fn_decl @ConvertCToB [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc21_20: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %.loc21_20: type = ptr_type C [template = constants.%.14] // CHECK:STDOUT: %p.loc21_16.1: C* = param p // CHECK:STDOUT: @ConvertCToB.%p: C* = bind_name p, %p.loc21_16.1 // CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.14] +// CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.15] // CHECK:STDOUT: @ConvertCToB.%return: ref B* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertBToA.decl: ConvertBToA = fn_decl @ConvertBToA [template = constants.%struct.2] { +// CHECK:STDOUT: %ConvertBToA.decl: ConvertBToA = fn_decl @ConvertBToA [template = constants.%struct.3] { // CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc22_20: type = ptr_type B [template = constants.%.14] +// CHECK:STDOUT: %.loc22_20: type = ptr_type B [template = constants.%.15] // CHECK:STDOUT: %p.loc22_16.1: B* = param p // CHECK:STDOUT: @ConvertBToA.%p: B* = bind_name p, %p.loc22_16.1 // CHECK:STDOUT: %A.ref.loc22: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc22_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertBToA.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertCToA.decl: ConvertCToA = fn_decl @ConvertCToA [template = constants.%struct.3] { +// CHECK:STDOUT: %ConvertCToA.decl: ConvertCToA = fn_decl @ConvertCToA [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc23_20: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %.loc23_20: type = ptr_type C [template = constants.%.14] // CHECK:STDOUT: %p.loc23_16.1: C* = param p // CHECK:STDOUT: @ConvertCToA.%p: C* = bind_name p, %p.loc23_16.1 // CHECK:STDOUT: %A.ref.loc23: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc23_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertCToA.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertValue.decl: ConvertValue = fn_decl @ConvertValue [template = constants.%struct.4] { +// CHECK:STDOUT: %ConvertValue.decl: ConvertValue = fn_decl @ConvertValue [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %c.loc25_17.1: C = param c // CHECK:STDOUT: @ConvertValue.%c: C = bind_name c, %c.loc25_17.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertRef.decl: ConvertRef = fn_decl @ConvertRef [template = constants.%struct.5] { +// CHECK:STDOUT: %ConvertRef.decl: ConvertRef = fn_decl @ConvertRef [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc29_19: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %.loc29_19: type = ptr_type C [template = constants.%.14] // CHECK:STDOUT: %c.loc29_15.1: C* = param c // CHECK:STDOUT: @ConvertRef.%c: C* = bind_name c, %c.loc29_15.1 // CHECK:STDOUT: %A.ref.loc29: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %.loc29_26: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertRef.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertInit.decl: ConvertInit = fn_decl @ConvertInit [template = constants.%struct.6] {} +// CHECK:STDOUT: %ConvertInit.decl: ConvertInit = fn_decl @ConvertInit [template = constants.%struct.7] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] -// CHECK:STDOUT: %.loc13: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .b = %.loc13 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] -// CHECK:STDOUT: %.loc18: = field_decl c, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_10.2: type = converted %int.make_type_32, %.loc18_10.1 [template = i32] +// CHECK:STDOUT: %.loc18_8: = field_decl c, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .base = %.loc17 -// CHECK:STDOUT: .c = %.loc18 +// CHECK:STDOUT: .c = %.loc18_8 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertCToB(%p: C*) -> B* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: C* = name_ref p, %p @@ -244,15 +260,15 @@ fn ConvertInit() { // CHECK:STDOUT: %.loc34_48.2: ref A = class_element_access %.loc34_57.3, element0 // CHECK:STDOUT: %.loc34_39.2: ref i32 = class_element_access %.loc34_48.2, element0 // CHECK:STDOUT: %.loc34_39.3: init i32 = initialize_from %.loc34_38 to %.loc34_39.2 [template = constants.%.20] -// CHECK:STDOUT: %.loc34_39.4: init A = class_init (%.loc34_39.3), %.loc34_48.2 [template = constants.%struct.7] -// CHECK:STDOUT: %.loc34_48.3: init A = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%struct.7] +// CHECK:STDOUT: %.loc34_39.4: init A = class_init (%.loc34_39.3), %.loc34_48.2 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc34_48.3: init A = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%struct.8] // CHECK:STDOUT: %.loc34_48.4: ref i32 = class_element_access %.loc34_57.3, element1 // CHECK:STDOUT: %.loc34_48.5: init i32 = initialize_from %.loc34_47 to %.loc34_48.4 [template = constants.%.21] -// CHECK:STDOUT: %.loc34_48.6: init B = class_init (%.loc34_48.3, %.loc34_48.5), %.loc34_57.3 [template = constants.%struct.8] -// CHECK:STDOUT: %.loc34_57.4: init B = converted %.loc34_48.1, %.loc34_48.6 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc34_48.6: init B = class_init (%.loc34_48.3, %.loc34_48.5), %.loc34_57.3 [template = constants.%struct.9] +// CHECK:STDOUT: %.loc34_57.4: init B = converted %.loc34_48.1, %.loc34_48.6 [template = constants.%struct.9] // CHECK:STDOUT: %.loc34_57.5: ref i32 = class_element_access %.loc34_57.2, element1 // CHECK:STDOUT: %.loc34_57.6: init i32 = initialize_from %.loc34_56 to %.loc34_57.5 [template = constants.%.23] -// CHECK:STDOUT: %.loc34_57.7: init C = class_init (%.loc34_57.4, %.loc34_57.6), %.loc34_57.2 [template = constants.%struct.9] +// CHECK:STDOUT: %.loc34_57.7: init C = class_init (%.loc34_57.4, %.loc34_57.6), %.loc34_57.2 [template = constants.%struct.10] // CHECK:STDOUT: %.loc34_57.8: ref C = temporary %.loc34_57.2, %.loc34_57.7 // CHECK:STDOUT: %.loc34_59: ref C = converted %.loc34_57.1, %.loc34_57.8 // CHECK:STDOUT: %.loc34_63.1: ref B = class_element_access %.loc34_59, element0 diff --git a/toolchain/check/testdata/class/extend_adapt.carbon b/toolchain/check/testdata/class/extend_adapt.carbon index bf26a841d092..502afb6af76e 100644 --- a/toolchain/check/testdata/class/extend_adapt.carbon +++ b/toolchain/check/testdata/class/extend_adapt.carbon @@ -91,18 +91,20 @@ class StructAdapter { // CHECK:STDOUT: constants { // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] // CHECK:STDOUT: %SomeClass: type = class_type @SomeClass [template] -// CHECK:STDOUT: %.1: type = unbound_element_type SomeClass, 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 = unbound_element_type SomeClass, i32 [template] // CHECK:STDOUT: %StaticMemberFunction: type = fn_type @StaticMemberFunction [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: StaticMemberFunction = struct_value () [template] +// CHECK:STDOUT: %struct.2: StaticMemberFunction = struct_value () [template] // CHECK:STDOUT: %AdapterMethod: type = fn_type @AdapterMethod [template] -// CHECK:STDOUT: %struct.2: AdapterMethod = struct_value () [template] +// CHECK:STDOUT: %struct.3: AdapterMethod = struct_value () [template] // CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %TestStaticMemberFunction: type = fn_type @TestStaticMemberFunction [template] -// CHECK:STDOUT: %struct.3: TestStaticMemberFunction = struct_value () [template] +// CHECK:STDOUT: %struct.4: TestStaticMemberFunction = struct_value () [template] // CHECK:STDOUT: %TestAdapterMethod: type = fn_type @TestAdapterMethod [template] -// CHECK:STDOUT: %struct.4: TestAdapterMethod = struct_value () [template] +// CHECK:STDOUT: %struct.5: TestAdapterMethod = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -116,13 +118,15 @@ class StructAdapter { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClassAdapter.decl.loc4: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} +// 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: %SomeClassAdapter.decl.loc15: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} -// CHECK:STDOUT: %TestStaticMemberFunction.decl: TestStaticMemberFunction = fn_decl @TestStaticMemberFunction [template = constants.%struct.3] { +// CHECK:STDOUT: %TestStaticMemberFunction.decl: TestStaticMemberFunction = fn_decl @TestStaticMemberFunction [template = constants.%struct.4] { // CHECK:STDOUT: %SomeClassAdapter.ref.loc19: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc19_29.1: SomeClassAdapter = param a // CHECK:STDOUT: @TestStaticMemberFunction.%a: SomeClassAdapter = bind_name a, %a.loc19_29.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %TestAdapterMethod.decl: TestAdapterMethod = fn_decl @TestAdapterMethod [template = constants.%struct.4] { +// CHECK:STDOUT: %TestAdapterMethod.decl: TestAdapterMethod = fn_decl @TestAdapterMethod [template = constants.%struct.5] { // CHECK:STDOUT: %SomeClassAdapter.ref.loc23: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc23_22.1: SomeClassAdapter = param a // CHECK:STDOUT: @TestAdapterMethod.%a: SomeClassAdapter = bind_name a, %a.loc23_22.1 @@ -139,10 +143,16 @@ class StructAdapter { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClass { -// CHECK:STDOUT: %.loc7: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc8: = field_decl b, element1 [template] -// CHECK:STDOUT: %StaticMemberFunction.decl: StaticMemberFunction = fn_decl @StaticMemberFunction [template = constants.%struct.1] {} -// CHECK:STDOUT: %AdapterMethod.decl: AdapterMethod = fn_decl @AdapterMethod [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_10.2: type = converted %int.make_type_32.loc7, %.loc7_10.1 [template = i32] +// CHECK:STDOUT: %.loc7_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %StaticMemberFunction.decl: StaticMemberFunction = fn_decl @StaticMemberFunction [template = constants.%struct.2] {} +// CHECK:STDOUT: %AdapterMethod.decl: AdapterMethod = fn_decl @AdapterMethod [template = constants.%struct.3] { // CHECK:STDOUT: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, file.%SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %self.loc12_20.1: SomeClassAdapter = param self // CHECK:STDOUT: %self.loc12_20.2: SomeClassAdapter = bind_name self, %self.loc12_20.1 @@ -150,12 +160,14 @@ class StructAdapter { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%SomeClass -// CHECK:STDOUT: .a = %.loc7 -// CHECK:STDOUT: .b = %.loc8 +// CHECK:STDOUT: .a = %.loc7_8 +// CHECK:STDOUT: .b = %.loc8_8 // CHECK:STDOUT: .StaticMemberFunction = %StaticMemberFunction.decl // CHECK:STDOUT: .AdapterMethod = %AdapterMethod.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @StaticMemberFunction(); // CHECK:STDOUT: // CHECK:STDOUT: fn @AdapterMethod[@SomeClass.%self.loc12_20.2: SomeClassAdapter](); @@ -163,7 +175,7 @@ class StructAdapter { // CHECK:STDOUT: fn @TestStaticMemberFunction(%a: SomeClassAdapter) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %StaticMemberFunction.ref: StaticMemberFunction = name_ref StaticMemberFunction, @SomeClass.%StaticMemberFunction.decl [template = constants.%struct.1] +// CHECK:STDOUT: %StaticMemberFunction.ref: StaticMemberFunction = name_ref StaticMemberFunction, @SomeClass.%StaticMemberFunction.decl [template = constants.%struct.2] // CHECK:STDOUT: %StaticMemberFunction.call: init () = call %StaticMemberFunction.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -171,7 +183,7 @@ class StructAdapter { // CHECK:STDOUT: fn @TestAdapterMethod(%a: SomeClassAdapter) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %AdapterMethod.ref: AdapterMethod = name_ref AdapterMethod, @SomeClass.%AdapterMethod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %AdapterMethod.ref: AdapterMethod = name_ref AdapterMethod, @SomeClass.%AdapterMethod.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc24: = bound_method %a.ref, %AdapterMethod.ref // CHECK:STDOUT: %AdapterMethod.call: init () = call %.loc24(%a.ref) // CHECK:STDOUT: return @@ -244,13 +256,15 @@ class StructAdapter { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %SomeClass: type = class_type @SomeClass [template] -// CHECK:STDOUT: %.1: type = unbound_element_type SomeClass, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type SomeClass, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -262,23 +276,35 @@ class StructAdapter { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} +// 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: %SomeClassAdapter.decl: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// 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: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc13_6.1: SomeClassAdapter = param a // CHECK:STDOUT: @F.%a: SomeClassAdapter = bind_name a, %a.loc13_6.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_30.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_30.2: type = converted %int.make_type_32, %.loc13_30.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClass { -// CHECK:STDOUT: %.loc5: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%SomeClass -// CHECK:STDOUT: .a = %.loc5 -// CHECK:STDOUT: .b = %.loc6 +// CHECK:STDOUT: .a = %.loc5_8 +// CHECK:STDOUT: .b = %.loc6_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClassAdapter { @@ -290,10 +316,12 @@ class StructAdapter { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: SomeClassAdapter) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %b.ref: = name_ref b, @SomeClass.%.loc6 [template = @SomeClass.%.loc6] +// CHECK:STDOUT: %b.ref: = name_ref b, @SomeClass.%.loc6_8 [template = @SomeClass.%.loc6_8] // CHECK:STDOUT: %.loc18: i32 = class_element_access , element1 [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -302,8 +330,11 @@ class StructAdapter { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %StructAdapter: type = class_type @StructAdapter [template] -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: 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: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -313,10 +344,18 @@ class StructAdapter { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %StructAdapter.decl: type = class_decl @StructAdapter [template = constants.%StructAdapter] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @StructAdapter { -// CHECK:STDOUT: %.loc8: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc8_21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32.loc8_21 [template = i32] +// CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32.loc8_21, %.loc8_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8_30: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc8_30.1: type = value_of_initializer %int.make_type_32.loc8_30 [template = i32] +// CHECK:STDOUT: %.loc8_30.2: type = converted %int.make_type_32.loc8_30, %.loc8_30.1 [template = i32] +// CHECK:STDOUT: %.loc8_33: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: adapt_decl {.a: i32, .b: i32} // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -324,3 +363,5 @@ class StructAdapter { // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index bf5578da2f84..acaba022565c 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -30,16 +30,18 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Abstract, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: 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 = unbound_element_type Abstract, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Abstract [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: Abstract, .d: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, Abstract [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Abstract, .d: i32} [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] // CHECK:STDOUT: %.8: type = struct_type {.base: {.a: i32}*, .d: i32} [template] // CHECK:STDOUT: %.9: type = ptr_type {.base: {.a: i32}*, .d: i32} [template] // CHECK:STDOUT: %.10: type = ptr_type {.base: Abstract, .d: i32} [template] @@ -49,7 +51,7 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %.14: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %Access: type = fn_type @Access [template] -// CHECK:STDOUT: %struct.2: Access = struct_value () [template] +// CHECK:STDOUT: %struct.3: Access = struct_value () [template] // CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -63,41 +65,59 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc25_11.1: Derived = param d // CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc25_11.1 -// CHECK:STDOUT: %.loc25_35.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc25_35.2: type = converted %.loc25_35.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %int.make_type_32.loc25_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc25_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_35.1: (type, type) = tuple_literal (%int.make_type_32.loc25_27, %int.make_type_32.loc25_32) +// CHECK:STDOUT: %.loc25_35.2: type = value_of_initializer %int.make_type_32.loc25_27 [template = i32] +// CHECK:STDOUT: %.loc25_35.3: type = converted %int.make_type_32.loc25_27, %.loc25_35.2 [template = i32] +// CHECK:STDOUT: %.loc25_35.4: type = value_of_initializer %int.make_type_32.loc25_32 [template = i32] +// CHECK:STDOUT: %.loc25_35.5: type = converted %int.make_type_32.loc25_32, %.loc25_35.4 [template = i32] +// CHECK:STDOUT: %.loc25_35.6: type = converted %.loc25_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Abstract -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract] // CHECK:STDOUT: %.loc12: = base_decl Abstract, element0 [template] -// CHECK:STDOUT: %.loc14: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .d = %.loc14 +// CHECK:STDOUT: .d = %.loc14_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.11] @@ -110,14 +130,14 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: fn @Access(%d: Derived) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.ref.loc26_11: Derived = name_ref d, %d -// CHECK:STDOUT: %d.ref.loc26_12: = name_ref d, @Derived.%.loc14 [template = @Derived.%.loc14] +// CHECK:STDOUT: %d.ref.loc26_12: = name_ref d, @Derived.%.loc14_8 [template = @Derived.%.loc14_8] // CHECK:STDOUT: %.loc26_12.1: ref i32 = class_element_access %d.ref.loc26_11, element1 // CHECK:STDOUT: %.loc26_12.2: i32 = bind_value %.loc26_12.1 // CHECK:STDOUT: %d.ref.loc26_16: Derived = name_ref d, %d // CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc12 [template = @Derived.%.loc12] // CHECK:STDOUT: %.loc26_17.1: ref Abstract = class_element_access %d.ref.loc26_16, element0 // CHECK:STDOUT: %.loc26_17.2: Abstract = bind_value %.loc26_17.1 -// CHECK:STDOUT: %a.ref: = name_ref a, @Abstract.%.loc8 [template = @Abstract.%.loc8] +// CHECK:STDOUT: %a.ref: = name_ref a, @Abstract.%.loc8_8 [template = @Abstract.%.loc8_8] // CHECK:STDOUT: %.loc26_22.1: ref i32 = class_element_access %.loc26_17.2, element0 // CHECK:STDOUT: %.loc26_22.2: i32 = bind_value %.loc26_22.1 // CHECK:STDOUT: %.loc26_24.1: (i32, i32) = tuple_literal (%.loc26_12.2, %.loc26_22.2) diff --git a/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon b/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon index c7cf29a8f491..2454a83b76d6 100644 --- a/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon +++ b/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon @@ -76,7 +76,9 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %AdaptWithBase: type = class_type @AdaptWithBase [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type AdaptWithBase, Base [template] // CHECK:STDOUT: } @@ -90,6 +92,7 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %AdaptWithBase.decl: type = class_decl @AdaptWithBase [template = constants.%AdaptWithBase] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { @@ -98,6 +101,9 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithBase { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_12.2: type = converted %int.make_type_32, %.loc10_12.1 [template = i32] // CHECK:STDOUT: adapt_decl i32 // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc15: = base_decl Base, element0 [template] @@ -108,13 +114,18 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_adapt_with_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %AdaptWithField: type = class_type @AdaptWithField [template] -// CHECK:STDOUT: %.1: type = unbound_element_type AdaptWithField, 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: type = unbound_element_type AdaptWithField, i32 [template] // CHECK:STDOUT: %AdaptWithFields: type = class_type @AdaptWithFields [template] -// CHECK:STDOUT: %.2: type = unbound_element_type AdaptWithFields, i32 [template] +// CHECK:STDOUT: %.3: type = unbound_element_type AdaptWithFields, i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -125,31 +136,57 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %AdaptWithField.decl: type = class_decl @AdaptWithField [template = constants.%AdaptWithField] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %AdaptWithFields.decl: type = class_decl @AdaptWithFields [template = constants.%AdaptWithFields] {} +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithField { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc8_12.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_12.2: type = converted %int.make_type_32.loc8, %.loc8_12.1 [template = i32] // CHECK:STDOUT: adapt_decl i32 -// CHECK:STDOUT: %.loc13: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithField -// CHECK:STDOUT: .n = %.loc13 +// CHECK:STDOUT: .n = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithFields { +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc20_12.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_12.2: type = converted %int.make_type_32.loc20, %.loc20_12.1 [template = i32] // CHECK:STDOUT: adapt_decl i32 -// CHECK:STDOUT: %.loc25: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc26: = field_decl b, element1 [template] -// CHECK:STDOUT: %.loc27: = field_decl c, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc25_10.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_10.2: type = converted %int.make_type_32.loc25, %.loc25_10.1 [template = i32] +// CHECK:STDOUT: %.loc25_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc26_10.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_10.2: type = converted %int.make_type_32.loc26, %.loc26_10.1 [template = i32] +// CHECK:STDOUT: %.loc26_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc27_10.1: type = value_of_initializer %int.make_type_32.loc27 [template = i32] +// CHECK:STDOUT: %.loc27_10.2: type = converted %int.make_type_32.loc27, %.loc27_10.1 [template = i32] +// CHECK:STDOUT: %.loc27_8: = field_decl c, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithFields -// CHECK:STDOUT: .a = %.loc25 -// CHECK:STDOUT: .b = %.loc26 -// CHECK:STDOUT: .c = %.loc27 +// CHECK:STDOUT: .a = %.loc25_8 +// CHECK:STDOUT: .b = %.loc26_8 +// CHECK:STDOUT: .c = %.loc27_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_adapt_with_base_and_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -159,6 +196,8 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type AdaptWithBaseAndFields, Base [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] // CHECK:STDOUT: %.5: type = unbound_element_type AdaptWithBaseAndFields, i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -171,6 +210,7 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %AdaptWithBaseAndFields.decl: type = class_decl @AdaptWithBaseAndFields [template = constants.%AdaptWithBaseAndFields] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { @@ -181,7 +221,10 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: class @AdaptWithBaseAndFields { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc7: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc8: = field_decl n, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl n, element1 [template] // CHECK:STDOUT: %.loc15_10: {} = struct_literal () // CHECK:STDOUT: %.loc15_11: type = converted %.loc15_10, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: adapt_decl {} @@ -189,7 +232,9 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithBaseAndFields // CHECK:STDOUT: .base = %.loc7 -// CHECK:STDOUT: .n = %.loc8 +// CHECK:STDOUT: .n = %.loc8_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 2a90786d09a5..729128fe4254 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -134,25 +134,27 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %Final: type = class_type @Final [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Final, i32 [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Final, i32 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError [template] -// CHECK:STDOUT: %.4: type = ptr_type DeriveFromError [template] +// CHECK:STDOUT: %.5: type = ptr_type DeriveFromError [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseError: type = fn_type @AccessMemberWithInvalidBaseError [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: AccessMemberWithInvalidBaseError = struct_value () [template] +// CHECK:STDOUT: %struct.2: AccessMemberWithInvalidBaseError = struct_value () [template] // CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template] // CHECK:STDOUT: %.6: i32 = int_literal 32 [template] // CHECK:STDOUT: %.7: type = ptr_type DeriveFromNonType [template] // CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: type = fn_type @AccessMemberWithInvalidBasNonType [template] -// CHECK:STDOUT: %struct.2: AccessMemberWithInvalidBasNonType = struct_value () [template] +// CHECK:STDOUT: %struct.3: AccessMemberWithInvalidBasNonType = struct_value () [template] // CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32 [template] // CHECK:STDOUT: %.8: type = ptr_type DeriveFromi32 [template] // CHECK:STDOUT: %.9: type = ptr_type i32 [template] // CHECK:STDOUT: %ConvertToBadBasei32: type = fn_type @ConvertToBadBasei32 [template] -// CHECK:STDOUT: %struct.3: ConvertToBadBasei32 = struct_value () [template] +// CHECK:STDOUT: %struct.4: ConvertToBadBasei32 = struct_value () [template] // CHECK:STDOUT: %AccessMemberWithInvalidBasei32: type = fn_type @AccessMemberWithInvalidBasei32 [template] -// CHECK:STDOUT: %struct.4: AccessMemberWithInvalidBasei32 = struct_value () [template] +// CHECK:STDOUT: %struct.5: AccessMemberWithInvalidBasei32 = struct_value () [template] // CHECK:STDOUT: %DeriveFromTuple: type = class_type @DeriveFromTuple [template] // CHECK:STDOUT: %.10: type = tuple_type (type) [template] // CHECK:STDOUT: %.11: type = tuple_type (Base) [template] @@ -161,25 +163,25 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.14: type = ptr_type DeriveFromTuple [template] // CHECK:STDOUT: %.15: type = ptr_type (Base,) [template] // CHECK:STDOUT: %ConvertToBadBaseTuple: type = fn_type @ConvertToBadBaseTuple [template] -// CHECK:STDOUT: %struct.5: ConvertToBadBaseTuple = struct_value () [template] +// CHECK:STDOUT: %struct.6: ConvertToBadBaseTuple = struct_value () [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: type = fn_type @AccessMemberWithInvalidBaseTuple [template] -// CHECK:STDOUT: %struct.6: AccessMemberWithInvalidBaseTuple = struct_value () [template] +// CHECK:STDOUT: %struct.7: AccessMemberWithInvalidBaseTuple = struct_value () [template] // CHECK:STDOUT: %DeriveFromStruct: type = class_type @DeriveFromStruct [template] // CHECK:STDOUT: %.16: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.17: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.18: type = ptr_type DeriveFromStruct [template] // CHECK:STDOUT: %ConvertToBadBaseStruct: type = fn_type @ConvertToBadBaseStruct [template] -// CHECK:STDOUT: %struct.7: ConvertToBadBaseStruct = struct_value () [template] +// CHECK:STDOUT: %struct.8: ConvertToBadBaseStruct = struct_value () [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: type = fn_type @AccessMemberWithInvalidBaseStruct [template] -// CHECK:STDOUT: %struct.8: AccessMemberWithInvalidBaseStruct = struct_value () [template] +// CHECK:STDOUT: %struct.9: AccessMemberWithInvalidBaseStruct = struct_value () [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete [template] // CHECK:STDOUT: %.19: type = ptr_type DeriveFromIncomplete [template] // CHECK:STDOUT: %.20: type = ptr_type Incomplete [template] // CHECK:STDOUT: %ConvertToBadBaseIncomplete: type = fn_type @ConvertToBadBaseIncomplete [template] -// CHECK:STDOUT: %struct.9: ConvertToBadBaseIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.10: ConvertToBadBaseIncomplete = struct_value () [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: type = fn_type @AccessMemberWithInvalidBaseIncomplete [template] -// CHECK:STDOUT: %struct.10: AccessMemberWithInvalidBaseIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.11: AccessMemberWithInvalidBaseIncomplete = struct_value () [template] // CHECK:STDOUT: %DeriveFromFinal: type = class_type @DeriveFromFinal [template] // CHECK:STDOUT: %.21: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.22: type = unbound_element_type DeriveFromFinal, Final [template] @@ -187,13 +189,13 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.24: type = ptr_type DeriveFromFinal [template] // CHECK:STDOUT: %.25: type = ptr_type Final [template] // CHECK:STDOUT: %ConvertToBadBaseFinal: type = fn_type @ConvertToBadBaseFinal [template] -// CHECK:STDOUT: %struct.11: ConvertToBadBaseFinal = struct_value () [template] +// CHECK:STDOUT: %struct.12: ConvertToBadBaseFinal = struct_value () [template] // CHECK:STDOUT: %.26: type = struct_type {.base: {.a: i32}*} [template] // CHECK:STDOUT: %.27: type = ptr_type {.base: Final} [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: type = fn_type @AccessMemberWithInvalidBaseFinal_WithMember [template] -// CHECK:STDOUT: %struct.12: AccessMemberWithInvalidBaseFinal_WithMember = struct_value () [template] +// CHECK:STDOUT: %struct.13: AccessMemberWithInvalidBaseFinal_WithMember = struct_value () [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: type = fn_type @AccessMemberWithInvalidBaseFinal_NoMember [template] -// CHECK:STDOUT: %struct.13: AccessMemberWithInvalidBaseFinal_NoMember = struct_value () [template] +// CHECK:STDOUT: %struct.14: AccessMemberWithInvalidBaseFinal_NoMember = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -226,40 +228,58 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Final.decl: type = class_decl @Final [template = constants.%Final] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %DeriveFromError.decl: type = class_decl @DeriveFromError [template = constants.%DeriveFromError] {} -// CHECK:STDOUT: %AccessMemberWithInvalidBaseError.decl: AccessMemberWithInvalidBaseError = fn_decl @AccessMemberWithInvalidBaseError [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseError.decl: AccessMemberWithInvalidBaseError = fn_decl @AccessMemberWithInvalidBaseError [template = constants.%struct.2] { // CHECK:STDOUT: %DeriveFromError.ref: type = name_ref DeriveFromError, %DeriveFromError.decl [template = constants.%DeriveFromError] -// CHECK:STDOUT: %.loc21: type = ptr_type DeriveFromError [template = constants.%.4] +// CHECK:STDOUT: %.loc21_55: type = ptr_type DeriveFromError [template = constants.%.5] // CHECK:STDOUT: %p.loc21_37.1: DeriveFromError* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%p: DeriveFromError* = bind_name p, %p.loc21_37.1 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_61.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_61.2: type = converted %int.make_type_32.loc21, %.loc21_61.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromNonType.decl: type = class_decl @DeriveFromNonType [template = constants.%DeriveFromNonType] {} -// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType.decl: AccessMemberWithInvalidBasNonType = fn_decl @AccessMemberWithInvalidBasNonType [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType.decl: AccessMemberWithInvalidBasNonType = fn_decl @AccessMemberWithInvalidBasNonType [template = constants.%struct.3] { // CHECK:STDOUT: %DeriveFromNonType.ref: type = name_ref DeriveFromNonType, %DeriveFromNonType.decl [template = constants.%DeriveFromNonType] -// CHECK:STDOUT: %.loc31: type = ptr_type DeriveFromNonType [template = constants.%.7] +// CHECK:STDOUT: %.loc31_58: type = ptr_type DeriveFromNonType [template = constants.%.7] // CHECK:STDOUT: %p.loc31_38.1: DeriveFromNonType* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc31_38.1 +// CHECK:STDOUT: %int.make_type_32.loc31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc31_64.1: type = value_of_initializer %int.make_type_32.loc31 [template = i32] +// CHECK:STDOUT: %.loc31_64.2: type = converted %int.make_type_32.loc31, %.loc31_64.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromi32.decl: type = class_decl @DeriveFromi32 [template = constants.%DeriveFromi32] {} -// CHECK:STDOUT: %ConvertToBadBasei32.decl: ConvertToBadBasei32 = fn_decl @ConvertToBadBasei32 [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: %ConvertToBadBasei32.decl: ConvertToBadBasei32 = fn_decl @ConvertToBadBasei32 [template = constants.%struct.4] { // CHECK:STDOUT: %DeriveFromi32.ref.loc47: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] // CHECK:STDOUT: %.loc47_40: type = ptr_type DeriveFromi32 [template = constants.%.8] // CHECK:STDOUT: %p.loc47_24.1: DeriveFromi32* = param p // CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc47_24.1 -// CHECK:STDOUT: %.loc47_49: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: %int.make_type_32.loc47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc47_49.1: type = value_of_initializer %int.make_type_32.loc47 [template = i32] +// CHECK:STDOUT: %.loc47_49.2: type = converted %int.make_type_32.loc47, %.loc47_49.1 [template = i32] +// CHECK:STDOUT: %.loc47_49.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: @ConvertToBadBasei32.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBasei32.decl: AccessMemberWithInvalidBasei32 = fn_decl @AccessMemberWithInvalidBasei32 [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBasei32.decl: AccessMemberWithInvalidBasei32 = fn_decl @AccessMemberWithInvalidBasei32 [template = constants.%struct.5] { // CHECK:STDOUT: %DeriveFromi32.ref.loc49: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %.loc49: type = ptr_type DeriveFromi32 [template = constants.%.8] +// CHECK:STDOUT: %.loc49_51: type = ptr_type DeriveFromi32 [template = constants.%.8] // CHECK:STDOUT: %p.loc49_35.1: DeriveFromi32* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc49_35.1 +// CHECK:STDOUT: %int.make_type_32.loc49: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_57.1: type = value_of_initializer %int.make_type_32.loc49 [template = i32] +// CHECK:STDOUT: %.loc49_57.2: type = converted %int.make_type_32.loc49, %.loc49_57.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromTuple.decl: type = class_decl @DeriveFromTuple [template = constants.%DeriveFromTuple] {} -// CHECK:STDOUT: %ConvertToBadBaseTuple.decl: ConvertToBadBaseTuple = fn_decl @ConvertToBadBaseTuple [template = constants.%struct.5] { +// CHECK:STDOUT: %ConvertToBadBaseTuple.decl: ConvertToBadBaseTuple = fn_decl @ConvertToBadBaseTuple [template = constants.%struct.6] { // CHECK:STDOUT: %DeriveFromTuple.ref.loc63: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] // CHECK:STDOUT: %.loc63_44: type = ptr_type DeriveFromTuple [template = constants.%.14] // CHECK:STDOUT: %p.loc63_26.1: DeriveFromTuple* = param p @@ -270,33 +290,51 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc63_57.2: type = ptr_type (Base,) [template = constants.%.15] // CHECK:STDOUT: @ConvertToBadBaseTuple.%return: ref (Base,)* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple.decl: AccessMemberWithInvalidBaseTuple = fn_decl @AccessMemberWithInvalidBaseTuple [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple.decl: AccessMemberWithInvalidBaseTuple = fn_decl @AccessMemberWithInvalidBaseTuple [template = constants.%struct.7] { // CHECK:STDOUT: %DeriveFromTuple.ref.loc65: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] -// CHECK:STDOUT: %.loc65: type = ptr_type DeriveFromTuple [template = constants.%.14] +// CHECK:STDOUT: %.loc65_55: type = ptr_type DeriveFromTuple [template = constants.%.14] // CHECK:STDOUT: %p.loc65_37.1: DeriveFromTuple* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc65_37.1 +// CHECK:STDOUT: %int.make_type_32.loc65: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc65_61.1: type = value_of_initializer %int.make_type_32.loc65 [template = i32] +// CHECK:STDOUT: %.loc65_61.2: type = converted %int.make_type_32.loc65, %.loc65_61.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromStruct.decl: type = class_decl @DeriveFromStruct [template = constants.%DeriveFromStruct] {} -// CHECK:STDOUT: %ConvertToBadBaseStruct.decl: ConvertToBadBaseStruct = fn_decl @ConvertToBadBaseStruct [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %ConvertToBadBaseStruct.decl: ConvertToBadBaseStruct = fn_decl @ConvertToBadBaseStruct [template = constants.%struct.8] { // CHECK:STDOUT: %DeriveFromStruct.ref.loc81: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] // CHECK:STDOUT: %.loc81_46: type = ptr_type DeriveFromStruct [template = constants.%.18] // CHECK:STDOUT: %p.loc81_27.1: DeriveFromStruct* = param p // CHECK:STDOUT: @ConvertToBadBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc81_27.1 +// CHECK:STDOUT: %int.make_type_32.loc81_57: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc81_57.1: type = value_of_initializer %int.make_type_32.loc81_57 [template = i32] +// CHECK:STDOUT: %.loc81_57.2: type = converted %int.make_type_32.loc81_57, %.loc81_57.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc81_66: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc81_66.1: type = value_of_initializer %int.make_type_32.loc81_66 [template = i32] +// CHECK:STDOUT: %.loc81_66.2: type = converted %int.make_type_32.loc81_66, %.loc81_66.1 [template = i32] // CHECK:STDOUT: %.loc81_69: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] // CHECK:STDOUT: %.loc81_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] // CHECK:STDOUT: @ConvertToBadBaseStruct.%return: ref {.a: i32, .b: i32}* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct.decl: AccessMemberWithInvalidBaseStruct = fn_decl @AccessMemberWithInvalidBaseStruct [template = constants.%struct.8] { +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct.decl: AccessMemberWithInvalidBaseStruct = fn_decl @AccessMemberWithInvalidBaseStruct [template = constants.%struct.9] { // CHECK:STDOUT: %DeriveFromStruct.ref.loc84: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] -// CHECK:STDOUT: %.loc84: type = ptr_type DeriveFromStruct [template = constants.%.18] +// CHECK:STDOUT: %.loc84_57: type = ptr_type DeriveFromStruct [template = constants.%.18] // CHECK:STDOUT: %p.loc84_38.1: DeriveFromStruct* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc84_38.1 +// CHECK:STDOUT: %int.make_type_32.loc84: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc84_63.1: type = value_of_initializer %int.make_type_32.loc84 [template = i32] +// CHECK:STDOUT: %.loc84_63.2: type = converted %int.make_type_32.loc84, %.loc84_63.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %DeriveFromIncomplete.decl: type = class_decl @DeriveFromIncomplete [template = constants.%DeriveFromIncomplete] {} -// CHECK:STDOUT: %ConvertToBadBaseIncomplete.decl: ConvertToBadBaseIncomplete = fn_decl @ConvertToBadBaseIncomplete [template = constants.%struct.9] { +// CHECK:STDOUT: %ConvertToBadBaseIncomplete.decl: ConvertToBadBaseIncomplete = fn_decl @ConvertToBadBaseIncomplete [template = constants.%struct.10] { // CHECK:STDOUT: %DeriveFromIncomplete.ref.loc103: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] // CHECK:STDOUT: %.loc103_54: type = ptr_type DeriveFromIncomplete [template = constants.%.19] // CHECK:STDOUT: %p.loc103_31.1: DeriveFromIncomplete* = param p @@ -305,15 +343,19 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc103_70: type = ptr_type Incomplete [template = constants.%.20] // CHECK:STDOUT: @ConvertToBadBaseIncomplete.%return: ref Incomplete* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete.decl: AccessMemberWithInvalidBaseIncomplete = fn_decl @AccessMemberWithInvalidBaseIncomplete [template = constants.%struct.10] { +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete.decl: AccessMemberWithInvalidBaseIncomplete = fn_decl @AccessMemberWithInvalidBaseIncomplete [template = constants.%struct.11] { // CHECK:STDOUT: %DeriveFromIncomplete.ref.loc105: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] -// CHECK:STDOUT: %.loc105: type = ptr_type DeriveFromIncomplete [template = constants.%.19] +// CHECK:STDOUT: %.loc105_65: type = ptr_type DeriveFromIncomplete [template = constants.%.19] // CHECK:STDOUT: %p.loc105_42.1: DeriveFromIncomplete* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc105_42.1 +// CHECK:STDOUT: %int.make_type_32.loc105: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc105_71.1: type = value_of_initializer %int.make_type_32.loc105 [template = i32] +// CHECK:STDOUT: %.loc105_71.2: type = converted %int.make_type_32.loc105, %.loc105_71.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromFinal.decl: type = class_decl @DeriveFromFinal [template = constants.%DeriveFromFinal] {} -// CHECK:STDOUT: %ConvertToBadBaseFinal.decl: ConvertToBadBaseFinal = fn_decl @ConvertToBadBaseFinal [template = constants.%struct.11] { +// CHECK:STDOUT: %ConvertToBadBaseFinal.decl: ConvertToBadBaseFinal = fn_decl @ConvertToBadBaseFinal [template = constants.%struct.12] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc116: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc116_44: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc116_26.1: DeriveFromFinal* = param p @@ -322,18 +364,26 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc116_55: type = ptr_type Final [template = constants.%.25] // CHECK:STDOUT: @ConvertToBadBaseFinal.%return: ref Final* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember.decl: AccessMemberWithInvalidBaseFinal_WithMember = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template = constants.%struct.12] { +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember.decl: AccessMemberWithInvalidBaseFinal_WithMember = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template = constants.%struct.13] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc120: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %.loc120: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %.loc120_66: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc120_48.1: DeriveFromFinal* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc120_48.1 +// CHECK:STDOUT: %int.make_type_32.loc120: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc120_72.1: type = value_of_initializer %int.make_type_32.loc120 [template = i32] +// CHECK:STDOUT: %.loc120_72.2: type = converted %int.make_type_32.loc120, %.loc120_72.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember.decl: AccessMemberWithInvalidBaseFinal_NoMember = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template = constants.%struct.13] { +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember.decl: AccessMemberWithInvalidBaseFinal_NoMember = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template = constants.%struct.14] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc124: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %.loc124: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %.loc124_64: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc124_46.1: DeriveFromFinal* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%p: DeriveFromFinal* = bind_name p, %p.loc124_46.1 +// CHECK:STDOUT: %int.make_type_32.loc124: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc124_70.1: type = value_of_initializer %int.make_type_32.loc124 [template = i32] +// CHECK:STDOUT: %.loc124_70.2: type = converted %int.make_type_32.loc124, %.loc124_70.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -344,11 +394,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Final { -// CHECK:STDOUT: %.loc9: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Final -// CHECK:STDOUT: .a = %.loc9 +// CHECK:STDOUT: .a = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromError { @@ -372,11 +425,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromi32 { -// CHECK:STDOUT: %.loc38: = base_decl , element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc38_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc38_16.2: type = converted %int.make_type_32, %.loc38_16.1 [template = i32] +// CHECK:STDOUT: %.loc38_19: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromi32 -// CHECK:STDOUT: .base = %.loc38 +// CHECK:STDOUT: .base = %.loc38_19 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: @@ -393,6 +449,12 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromStruct { +// CHECK:STDOUT: %int.make_type_32.loc74_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc74_21.1: type = value_of_initializer %int.make_type_32.loc74_21 [template = i32] +// CHECK:STDOUT: %.loc74_21.2: type = converted %int.make_type_32.loc74_21, %.loc74_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc74_30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc74_30.1: type = value_of_initializer %int.make_type_32.loc74_30 [template = i32] +// CHECK:STDOUT: %.loc74_30.2: type = converted %int.make_type_32.loc74_30, %.loc74_30.1 [template = i32] // CHECK:STDOUT: %.loc74_33: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] // CHECK:STDOUT: %.loc74_34: = base_decl , element0 [template] // CHECK:STDOUT: @@ -424,6 +486,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseError(%p: DeriveFromError*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromError* = name_ref p, %p @@ -510,7 +574,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromFinal* = name_ref p, %p // CHECK:STDOUT: %.loc121_11: ref DeriveFromFinal = deref %p.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Final.%.loc9 [template = @Final.%.loc9] +// CHECK:STDOUT: %a.ref: = name_ref a, @Final.%.loc9_8 [template = @Final.%.loc9_8] // CHECK:STDOUT: %.loc121_14.1: ref Final = class_element_access %.loc121_11, element0 // CHECK:STDOUT: %.loc121_14.2: ref Final = converted %.loc121_11, %.loc121_14.1 // CHECK:STDOUT: %.loc121_14.3: ref i32 = class_element_access %.loc121_14.2, element0 diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index 3928934614ea..3a575212a59a 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -23,14 +23,16 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: 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 = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = unbound_element_type B, i32 [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type B, i32 [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: i32} [template] // CHECK:STDOUT: %AccessBInA: type = fn_type @AccessBInA [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] -// CHECK:STDOUT: %struct: AccessBInA = struct_value () [template] +// CHECK:STDOUT: %struct.2: AccessBInA = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.7: type = ptr_type {.b: i32} [template] // CHECK:STDOUT: } @@ -44,36 +46,50 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} -// CHECK:STDOUT: %AccessBInA.decl: AccessBInA = fn_decl @AccessBInA [template = constants.%struct] { +// 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: %AccessBInA.decl: AccessBInA = fn_decl @AccessBInA [template = constants.%struct.2] { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.loc15_15.1: A = param a // CHECK:STDOUT: @AccessBInA.%a: A = bind_name a, %a.loc15_15.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_24.2: type = converted %int.make_type_32, %.loc15_24.1 [template = i32] // CHECK:STDOUT: @AccessBInA.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %.loc12: = field_decl b, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .b = %.loc12 +// CHECK:STDOUT: .b = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @AccessBInA(%a: A) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: A = name_ref a, %a // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %b.ref: = name_ref b, @B.%.loc12 [template = @B.%.loc12] +// CHECK:STDOUT: %b.ref: = name_ref b, @B.%.loc12_8 [template = @B.%.loc12_8] // CHECK:STDOUT: %.loc19: i32 = class_element_access , element0 [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index 2231702d8293..bf59f63343a4 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -34,20 +34,22 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A1: type = class_type @A1 [template] -// CHECK:STDOUT: %.1: type = unbound_element_type A1, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: 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 = unbound_element_type A1, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %A2: type = class_type @A2 [template] -// CHECK:STDOUT: %.3: type = unbound_element_type A2, i32 [template] +// CHECK:STDOUT: %.4: type = unbound_element_type A2, i32 [template] // CHECK:STDOUT: %B2: type = class_type @B2 [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.5: type = unbound_element_type B2, A2 [template] -// CHECK:STDOUT: %.6: type = unbound_element_type B2, i32 [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: A2, .b: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type B2 [template] -// CHECK:STDOUT: %.9: type = ptr_type A1 [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.6: type = unbound_element_type B2, A2 [template] +// CHECK:STDOUT: %.7: type = unbound_element_type B2, i32 [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: A2, .b: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type B2 [template] +// CHECK:STDOUT: %.10: type = ptr_type A1 [template] // CHECK:STDOUT: %ConvertUnrelated: type = fn_type @ConvertUnrelated [template] -// CHECK:STDOUT: %.10: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: ConvertUnrelated = struct_value () [template] +// CHECK:STDOUT: %struct.2: ConvertUnrelated = struct_value () [template] // CHECK:STDOUT: %.11: type = struct_type {.base: {.a: i32}*, .b: i32} [template] // CHECK:STDOUT: %.12: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] // CHECK:STDOUT: %.13: type = ptr_type {.base: A2, .b: i32} [template] @@ -55,7 +57,7 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: %.14: type = ptr_type Incomplete [template] // CHECK:STDOUT: %.15: type = ptr_type A2 [template] // CHECK:STDOUT: %ConvertIncomplete: type = fn_type @ConvertIncomplete [template] -// CHECK:STDOUT: %struct.2: ConvertIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.3: ConvertIncomplete = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -70,19 +72,22 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A1.decl: type = class_decl @A1 [template = constants.%A1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A2.decl: type = class_decl @A2 [template = constants.%A2] {} +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B2.decl: type = class_decl @B2 [template = constants.%B2] {} -// CHECK:STDOUT: %ConvertUnrelated.decl: ConvertUnrelated = fn_decl @ConvertUnrelated [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %ConvertUnrelated.decl: ConvertUnrelated = fn_decl @ConvertUnrelated [template = constants.%struct.2] { // CHECK:STDOUT: %B2.ref: type = name_ref B2, %B2.decl [template = constants.%B2] -// CHECK:STDOUT: %.loc24_26: type = ptr_type B2 [template = constants.%.8] +// CHECK:STDOUT: %.loc24_26: type = ptr_type B2 [template = constants.%.9] // CHECK:STDOUT: %p.loc24_21.1: B2* = param p // CHECK:STDOUT: @ConvertUnrelated.%p: B2* = bind_name p, %p.loc24_21.1 // CHECK:STDOUT: %A1.ref: type = name_ref A1, %A1.decl [template = constants.%A1] -// CHECK:STDOUT: %.loc24_34: type = ptr_type A1 [template = constants.%.9] +// CHECK:STDOUT: %.loc24_34: type = ptr_type A1 [template = constants.%.10] // CHECK:STDOUT: @ConvertUnrelated.%return: ref A1* = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} -// CHECK:STDOUT: %ConvertIncomplete.decl: ConvertIncomplete = fn_decl @ConvertIncomplete [template = constants.%struct.2] { +// CHECK:STDOUT: %ConvertIncomplete.decl: ConvertIncomplete = fn_decl @ConvertIncomplete [template = constants.%struct.3] { // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc31_35: type = ptr_type Incomplete [template = constants.%.14] // CHECK:STDOUT: %p.loc31_22.1: Incomplete* = param p @@ -94,35 +99,46 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A1 { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A1 -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A2 { -// CHECK:STDOUT: %.loc12: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A2 -// CHECK:STDOUT: .a = %.loc12 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B2 { // CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2.decl [template = constants.%A2] // CHECK:STDOUT: %.loc16: = base_decl A2, element0 [template] -// CHECK:STDOUT: %.loc17: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B2 // CHECK:STDOUT: .base = %.loc16 -// CHECK:STDOUT: .b = %.loc17 +// CHECK:STDOUT: .b = %.loc17_8 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertUnrelated(%p: B2*) -> A1* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: B2* = name_ref p, %p diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index 0e26a9101cb0..35448264bebe 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -34,10 +34,13 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.j: i32, .k: 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: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = struct_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,19 +50,37 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc13: = field_decl j, element0 [template] -// CHECK:STDOUT: %.loc19: = field_decl k, element1 [template] -// CHECK:STDOUT: %.loc25: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %l: i32 = bind_name l, %.loc25 -// CHECK:STDOUT: %.loc30: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %m: i32 = bind_name m, %.loc30 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_18.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_18.2: type = converted %int.make_type_32.loc13, %.loc13_18.1 [template = i32] +// CHECK:STDOUT: %.loc13_16: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc19_16.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_16.2: type = converted %int.make_type_32.loc19, %.loc19_16.1 [template = i32] +// CHECK:STDOUT: %.loc19_14: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc25_18.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_18.2: type = converted %int.make_type_32.loc25, %.loc25_18.1 [template = i32] +// CHECK:STDOUT: %.loc25_24: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %l: i32 = bind_name l, %.loc25_24 +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] +// CHECK:STDOUT: %.loc30_22: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %m: i32 = bind_name m, %.loc30_22 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc13 -// CHECK:STDOUT: .k = %.loc19 +// CHECK:STDOUT: .j = %.loc13_16 +// CHECK:STDOUT: .k = %.loc19_14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 57723ce5fec5..4084fabbf826 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -144,22 +144,24 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %struct.3: ConvertFromStruct = struct_value () [template] // CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %.4: type = ptr_type Class [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.4: Int32 = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %struct.5: G = struct_value () [template] // CHECK:STDOUT: %MemberAccess: type = fn_type @MemberAccess [template] -// CHECK:STDOUT: %struct.5: MemberAccess = struct_value () [template] +// CHECK:STDOUT: %struct.6: MemberAccess = struct_value () [template] // CHECK:STDOUT: %Copy: type = fn_type @Copy [template] -// CHECK:STDOUT: %struct.6: Copy = struct_value () [template] +// CHECK:STDOUT: %struct.7: Copy = struct_value () [template] // CHECK:STDOUT: %Let: type = fn_type @Let [template] -// CHECK:STDOUT: %struct.7: Let = struct_value () [template] +// CHECK:STDOUT: %struct.8: Let = struct_value () [template] // CHECK:STDOUT: %TakeIncomplete: type = fn_type @TakeIncomplete [template] -// CHECK:STDOUT: %struct.8: TakeIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.9: TakeIncomplete = struct_value () [template] // CHECK:STDOUT: %ReturnIncomplete: type = fn_type @ReturnIncomplete [template] -// CHECK:STDOUT: %struct.9: ReturnIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.10: ReturnIncomplete = struct_value () [template] // CHECK:STDOUT: %CallTakeIncomplete: type = fn_type @CallTakeIncomplete [template] -// CHECK:STDOUT: %struct.10: CallTakeIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.11: CallTakeIncomplete = struct_value () [template] // CHECK:STDOUT: %CallReturnIncomplete: type = fn_type @CallReturnIncomplete [template] -// CHECK:STDOUT: %struct.11: CallReturnIncomplete = struct_value () [template] +// CHECK:STDOUT: %struct.12: CallReturnIncomplete = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -189,21 +191,29 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ConvertFromStruct.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.5] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc47: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %.loc47_14: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc47_6.1: Class* = param p // CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc47_6.1 +// CHECK:STDOUT: %int.make_type_32.loc47: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc47_20.1: type = value_of_initializer %int.make_type_32.loc47 [template = i32] +// CHECK:STDOUT: %.loc47_20.2: type = converted %int.make_type_32.loc47, %.loc47_20.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MemberAccess.decl: MemberAccess = fn_decl @MemberAccess [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %MemberAccess.decl: MemberAccess = fn_decl @MemberAccess [template = constants.%struct.6] { // CHECK:STDOUT: %Class.ref.loc58: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc58: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %.loc58_25: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc58_17.1: Class* = param p // CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc58_17.1 +// CHECK:STDOUT: %int.make_type_32.loc58: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc58_31.1: type = value_of_initializer %int.make_type_32.loc58 [template = i32] +// CHECK:STDOUT: %.loc58_31.2: type = converted %int.make_type_32.loc58, %.loc58_31.1 [template = i32] // CHECK:STDOUT: @MemberAccess.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Copy.decl: Copy = fn_decl @Copy [template = constants.%struct.6] { +// CHECK:STDOUT: %Copy.decl: Copy = fn_decl @Copy [template = constants.%struct.7] { // CHECK:STDOUT: %Class.ref.loc76_12: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc76: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc76_9.1: Class* = param p @@ -211,28 +221,28 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %Class.ref.loc76_23: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Copy.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Let.decl: Let = fn_decl @Let [template = constants.%struct.7] { +// CHECK:STDOUT: %Let.decl: Let = fn_decl @Let [template = constants.%struct.8] { // CHECK:STDOUT: %Class.ref.loc80: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc80: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc80_8.1: Class* = param p // CHECK:STDOUT: @Let.%p: Class* = bind_name p, %p.loc80_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %TakeIncomplete.decl: TakeIncomplete = fn_decl @TakeIncomplete [template = constants.%struct.8] { +// CHECK:STDOUT: %TakeIncomplete.decl: TakeIncomplete = fn_decl @TakeIncomplete [template = constants.%struct.9] { // CHECK:STDOUT: %Class.ref.loc91: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc91_19.1: Class = param c // CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc91_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %ReturnIncomplete.decl: ReturnIncomplete = fn_decl @ReturnIncomplete [template = constants.%struct.9] { +// CHECK:STDOUT: %ReturnIncomplete.decl: ReturnIncomplete = fn_decl @ReturnIncomplete [template = constants.%struct.10] { // CHECK:STDOUT: %Class.ref.loc93: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ReturnIncomplete.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallTakeIncomplete.decl: CallTakeIncomplete = fn_decl @CallTakeIncomplete [template = constants.%struct.10] { +// CHECK:STDOUT: %CallTakeIncomplete.decl: CallTakeIncomplete = fn_decl @CallTakeIncomplete [template = constants.%struct.11] { // CHECK:STDOUT: %Class.ref.loc95: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc95: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc95_23.1: Class* = param p // CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc95_23.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %CallReturnIncomplete.decl: CallReturnIncomplete = fn_decl @CallReturnIncomplete [template = constants.%struct.11] {} +// CHECK:STDOUT: %CallReturnIncomplete.decl: CallReturnIncomplete = fn_decl @CallReturnIncomplete [template = constants.%struct.12] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; @@ -255,6 +265,8 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%p: Class*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p @@ -291,11 +303,11 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallTakeIncomplete(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TakeIncomplete.ref.loc106: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.8] +// CHECK:STDOUT: %TakeIncomplete.ref.loc106: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc106: ref Class = deref %p.ref // CHECK:STDOUT: %TakeIncomplete.call.loc106: init () = call %TakeIncomplete.ref.loc106() [template = ] -// CHECK:STDOUT: %TakeIncomplete.ref.loc118: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.8] +// CHECK:STDOUT: %TakeIncomplete.ref.loc118: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] // CHECK:STDOUT: %.loc118: {} = struct_literal () // CHECK:STDOUT: %TakeIncomplete.call.loc118: init () = call %TakeIncomplete.ref.loc118() [template = ] // CHECK:STDOUT: return @@ -303,7 +315,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallReturnIncomplete() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ReturnIncomplete.ref: ReturnIncomplete = name_ref ReturnIncomplete, file.%ReturnIncomplete.decl [template = constants.%struct.9] +// CHECK:STDOUT: %ReturnIncomplete.ref: ReturnIncomplete = name_ref ReturnIncomplete, file.%ReturnIncomplete.decl [template = constants.%struct.10] // CHECK:STDOUT: %ReturnIncomplete.call: init = call %ReturnIncomplete.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index 765e44d79241..f5c07136c8ed 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -30,11 +30,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] @@ -52,19 +54,29 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.4] diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index ffe3b8dd9187..0ffd5d1f2010 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -26,18 +26,20 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type Class [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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type Class [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] // CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.3: Class = struct_value (%.6, %.7) [template] +// CHECK:STDOUT: %struct.4: Class = struct_value (%.6, %.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -49,25 +51,35 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// 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.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc12_6.1: Class* = param p // CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc12_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%p: Class*); // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -84,12 +96,12 @@ fn F() { // CHECK:STDOUT: %.loc21_33.4: init i32 = initialize_from %.loc21_24 to %.loc21_33.3 [template = constants.%.6] // CHECK:STDOUT: %.loc21_33.5: ref i32 = class_element_access %.loc21_33.2, element1 // CHECK:STDOUT: %.loc21_33.6: init i32 = initialize_from %.loc21_32 to %.loc21_33.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_33.7: init Class = class_init (%.loc21_33.4, %.loc21_33.6), %.loc21_33.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc21_33.7: init Class = class_init (%.loc21_33.4, %.loc21_33.6), %.loc21_33.2 [template = constants.%struct.4] // CHECK:STDOUT: %.loc21_33.8: ref Class = temporary %.loc21_33.2, %.loc21_33.7 // CHECK:STDOUT: %.loc21_35.1: ref Class = converted %.loc21_33.1, %.loc21_33.8 // CHECK:STDOUT: %.loc21_35.2: Class = bind_value %.loc21_35.1 // CHECK:STDOUT: assign %c.var, -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc22: Class* = addr_of %c.ref // CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc22) diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 13526860c2a8..c79a8ca5f376 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -22,12 +22,14 @@ fn T.F() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = fn_type @.1 [template] -// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -37,13 +39,17 @@ fn T.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %T: type = bind_name T, %Class.ref -// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -52,6 +58,8 @@ fn T.F() {} // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() { diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index a6c7d1d0a59b..6fc7d1909920 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -21,13 +21,15 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [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: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,13 +40,21 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.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: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32, %.loc13_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -53,6 +63,8 @@ fn G() -> i32 { // CHECK:STDOUT: .F = %F.decl // 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: %.loc9: i32 = int_literal 1 [template = constants.%.3] diff --git a/toolchain/check/testdata/class/fail_self_type_member.carbon b/toolchain/check/testdata/class/fail_self_type_member.carbon index 8e686ea01b4c..865eb969b641 100644 --- a/toolchain/check/testdata/class/fail_self_type_member.carbon +++ b/toolchain/check/testdata/class/fail_self_type_member.carbon @@ -25,26 +25,33 @@ fn F() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, bool [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: bool} [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Class, bool [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: bool} [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 {.b: bool} [template] // CHECK:STDOUT: %.5: bool = bool_literal true [template] -// CHECK:STDOUT: %struct.2: Class = struct_value (%.5) [template] +// CHECK:STDOUT: %struct.3: Class = struct_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl b, element0 [template] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc8_10.2: type = converted %bool.make_type, %.loc8_10.1 [template = bool] +// CHECK:STDOUT: %.loc8_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .b = %.loc8 +// CHECK:STDOUT: .b = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 0cde60f21136..6bfd0c0a09ff 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -75,21 +75,23 @@ abstract class Abstract { // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = unbound_element_type Access, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.k: i32, .l: i32} [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %struct.4: H = struct_value () [template] // CHECK:STDOUT: %I: type = fn_type @I [template] -// CHECK:STDOUT: %struct.4: I = struct_value () [template] +// CHECK:STDOUT: %struct.5: I = struct_value () [template] // CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] // CHECK:STDOUT: %J: type = fn_type @J [template] -// CHECK:STDOUT: %struct.5: J = struct_value () [template] +// CHECK:STDOUT: %struct.6: J = struct_value () [template] // CHECK:STDOUT: %K: type = fn_type @K [template] -// CHECK:STDOUT: %struct.6: K = struct_value () [template] +// CHECK:STDOUT: %struct.7: K = struct_value () [template] // CHECK:STDOUT: %L: type = fn_type @L [template] -// CHECK:STDOUT: %struct.7: L = struct_value () [template] +// CHECK:STDOUT: %struct.8: L = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -101,6 +103,8 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Access.decl: type = class_decl @Access [template = constants.%Access] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} // CHECK:STDOUT: } @@ -108,20 +112,26 @@ abstract class Abstract { // CHECK:STDOUT: class @Access { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} -// CHECK:STDOUT: %.loc25: = field_decl k, element0 [template] -// CHECK:STDOUT: %.loc31: = field_decl l, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc25_18.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_18.2: type = converted %int.make_type_32.loc25, %.loc25_18.1 [template = i32] +// CHECK:STDOUT: %.loc25_16: = field_decl k, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc31: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc31_20.1: type = value_of_initializer %int.make_type_32.loc31 [template = i32] +// CHECK:STDOUT: %.loc31_20.2: type = converted %int.make_type_32.loc31, %.loc31_20.1 [template = i32] +// CHECK:STDOUT: %.loc31_18: = field_decl l, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Access // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .k = %.loc25 -// CHECK:STDOUT: .l = %.loc31 +// CHECK:STDOUT: .k = %.loc25_16 +// CHECK:STDOUT: .l = %.loc31_18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} -// CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} +// CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.5] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base @@ -130,9 +140,9 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %J.decl: J = fn_decl @J [template = constants.%struct.5] {} -// CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.6] {} -// CHECK:STDOUT: %L.decl: L = fn_decl @L [template = constants.%struct.7] {} +// CHECK:STDOUT: %J.decl: J = fn_decl @J [template = constants.%struct.6] {} +// CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.7] {} +// CHECK:STDOUT: %L.decl: L = fn_decl @L [template = constants.%struct.8] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Abstract @@ -145,6 +155,8 @@ abstract class Abstract { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @H(); // CHECK:STDOUT: // CHECK:STDOUT: fn @I(); diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 443ab0168bb8..6fd9e711bcf2 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -26,13 +26,15 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, 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 = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = struct_type {.field: i32} [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: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,33 +45,47 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.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: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl field, element0 [template] -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_14.2: type = converted %int.make_type_32.loc8, %.loc8_14.1 [template = i32] +// CHECK:STDOUT: %.loc8_12: = field_decl field, element0 [template] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .field = %.loc8 +// CHECK:STDOUT: .field = %.loc8_12 // CHECK:STDOUT: .F = %F.decl // 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: %field.ref: = name_ref field, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8_12 [template = @Class.%.loc8_12] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8_12 [template = @Class.%.loc8_12] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index dbf4d7f5b4c9..87fdb0242390 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -20,11 +20,13 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.n: 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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -36,22 +38,32 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [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: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc11_6.1: Class = param c // CHECK:STDOUT: @G.%c: Class = bind_name c, %c.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32, %.loc11_19.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .n = %.loc8 +// CHECK:STDOUT: .n = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 1496ac4c031b..8ecf3f950a46 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -21,11 +21,13 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: 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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: %Run: type = fn_type @Run [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] @@ -39,45 +41,63 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [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: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {} +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl j, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl k, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc8 -// CHECK:STDOUT: .k = %.loc9 +// CHECK:STDOUT: .j = %.loc8_8 +// CHECK:STDOUT: .k = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref.loc14: ref Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] // CHECK:STDOUT: %.loc14_4: ref i32 = class_element_access %c.ref.loc14, element0 // CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: assign %.loc14_4, %.loc14_9 // CHECK:STDOUT: %c.ref.loc15: ref Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] +// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] // CHECK:STDOUT: %.loc15_4: ref i32 = class_element_access %c.ref.loc15, element1 // CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: assign %.loc15_4, %.loc15_9 +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32.loc16, %.loc16_11.1 [template = i32] // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var // CHECK:STDOUT: %c.ref.loc16: ref Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc16: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %j.ref.loc16: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] // CHECK:STDOUT: %.loc16_18.1: ref i32 = class_element_access %c.ref.loc16, element0 // CHECK:STDOUT: %.loc16_18.2: i32 = bind_value %.loc16_18.1 // CHECK:STDOUT: assign %cj.var, %.loc16_18.2 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] // CHECK:STDOUT: %ck.var: ref i32 = var ck // CHECK:STDOUT: %ck: ref i32 = bind_name ck, %ck.var // CHECK:STDOUT: %c.ref.loc17: ref Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc17: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] +// CHECK:STDOUT: %k.ref.loc17: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] // CHECK:STDOUT: %.loc17_18.1: ref i32 = class_element_access %c.ref.loc17, element1 // CHECK:STDOUT: %.loc17_18.2: i32 = bind_value %.loc17_18.1 // CHECK:STDOUT: assign %ck.var, %.loc17_18.2 diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index ea785a28803b..37da2f757934 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -22,11 +22,13 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: 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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: %Test: type = fn_type @Test [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Test = struct_value () [template] +// CHECK:STDOUT: %struct.2: Test = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] @@ -40,31 +42,43 @@ fn Test() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [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: %Test.decl: Test = fn_decl @Test [template = constants.%struct.2] {} +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl j, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl k, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc8 -// CHECK:STDOUT: .k = %.loc9 +// CHECK:STDOUT: .j = %.loc8_8 +// CHECK:STDOUT: .k = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %cv.var: ref Class = var cv // CHECK:STDOUT: %cv: ref Class = bind_name cv, %cv.var // CHECK:STDOUT: %cv.ref.loc14: ref Class = name_ref cv, %cv -// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] // CHECK:STDOUT: %.loc14_5: ref i32 = class_element_access %cv.ref.loc14, element0 // CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: assign %.loc14_5, %.loc14_10 // CHECK:STDOUT: %cv.ref.loc15: ref Class = name_ref cv, %cv -// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] +// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] // CHECK:STDOUT: %.loc15_5: ref i32 = class_element_access %cv.ref.loc15, element1 // CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: assign %.loc15_5, %.loc15_10 @@ -72,17 +86,23 @@ fn Test() { // CHECK:STDOUT: %cv.ref.loc16: ref Class = name_ref cv, %cv // CHECK:STDOUT: %.loc16: Class = bind_value %cv.ref.loc16 // CHECK:STDOUT: %c: Class = bind_name c, %.loc16 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var // CHECK:STDOUT: %c.ref.loc17: Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc17: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %j.ref.loc17: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] // CHECK:STDOUT: %.loc17_18.1: ref i32 = class_element_access %c.ref.loc17, element0 // CHECK:STDOUT: %.loc17_18.2: i32 = bind_value %.loc17_18.1 // CHECK:STDOUT: assign %cj.var, %.loc17_18.2 +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32.loc18, %.loc18_11.1 [template = i32] // CHECK:STDOUT: %ck.var: ref i32 = var ck // CHECK:STDOUT: %ck: ref i32 = bind_name ck, %ck.var // CHECK:STDOUT: %c.ref.loc18: Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc18: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] +// CHECK:STDOUT: %k.ref.loc18: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] // CHECK:STDOUT: %.loc18_18.1: ref i32 = class_element_access %c.ref.loc18, element1 // CHECK:STDOUT: %.loc18_18.2: i32 = bind_value %.loc18_18.1 // CHECK:STDOUT: assign %ck.var, %.loc18_18.2 diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index e25c11b0c49d..43b0ecd67cd6 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -63,15 +63,17 @@ var a: Class(5, i32*); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] +// 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: %N: i32 = bind_symbolic_name N 1 [symbolic] // CHECK:STDOUT: %Class.1: type = generic_class_type @Class [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Class = struct_value () [template] +// CHECK:STDOUT: %struct.2: Class = struct_value () [template] // CHECK:STDOUT: %Class.2: type = class_type @Class [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: %.4: i32 = int_literal 5 [template] -// CHECK:STDOUT: %Class.3: type = class_type @Class, (file.%.loc6_17, file.%.loc6_20) [template] +// CHECK:STDOUT: %Class.3: type = class_type @Class, (file.%.loc6_17.3, file.%.loc6_20) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: i32 = int_literal 0 [template] // CHECK:STDOUT: %Class.4: type = class_type @Class, (file.%.loc9_13, file.%.loc9_18) [template] @@ -85,19 +87,27 @@ var a: Class(5, i32*); // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc4_13.1: type = param T // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T 0, %T.loc4_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4, %.loc4_27.1 [template = i32] // CHECK:STDOUT: %N.loc4_23.1: i32 = param N // CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N 1, %N.loc4_23.1 [symbolic = constants.%N] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref.loc6: Class = name_ref Class, %Class.decl [template = constants.%struct] -// CHECK:STDOUT: %.loc6_17: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %Class.ref.loc6: Class = name_ref Class, %Class.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_17.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_17.2: type = converted %int.make_type_32.loc6, %.loc6_17.1 [template = i32] +// CHECK:STDOUT: %.loc6_17.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %.loc6_20: i32 = int_literal 5 [template = constants.%.4] -// CHECK:STDOUT: %Class.loc6: type = class_type @Class, (%.loc6_17, %.loc6_20) [template = constants.%Class.3] +// CHECK:STDOUT: %Class.loc6: type = class_type @Class, (%.loc6_17.3, %.loc6_20) [template = constants.%Class.3] // CHECK:STDOUT: %a.var: ref Class = var a // CHECK:STDOUT: %a: ref Class = bind_name a, %a.var -// CHECK:STDOUT: %Class.ref.loc9: Class = name_ref Class, %Class.decl [template = constants.%struct] +// CHECK:STDOUT: %Class.ref.loc9: Class = name_ref Class, %Class.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc9_15: () = tuple_literal () // CHECK:STDOUT: %.loc9_18: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: %.loc9_13: type = converted %.loc9_15, constants.%.1 [template = constants.%.1] @@ -111,14 +121,18 @@ var a: Class(5, i32*); // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_too_few.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] +// 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: %N: i32 = bind_symbolic_name N 1 [symbolic] // CHECK:STDOUT: %Class.1: type = generic_class_type @Class [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Class = struct_value () [template] +// CHECK:STDOUT: %struct.2: Class = struct_value () [template] // CHECK:STDOUT: %Class.2: type = class_type @Class [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] @@ -132,14 +146,22 @@ var a: Class(5, i32*); // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc4_13.1: type = param T // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T 0, %T.loc4_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4, %.loc4_27.1 [template = i32] // CHECK:STDOUT: %N.loc4_23.1: i32 = param N // CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N 1, %N.loc4_23.1 [symbolic = constants.%N] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct] -// CHECK:STDOUT: %.loc13: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32.loc13, %.loc13_17.1 [template = i32] +// CHECK:STDOUT: %.loc13_17.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class.2] // CHECK:STDOUT: %a.var: ref Class = var a // CHECK:STDOUT: %a: ref Class = bind_name a, %a.var @@ -150,14 +172,18 @@ var a: Class(5, i32*); // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_too_many.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] +// 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: %N: i32 = bind_symbolic_name N 1 [symbolic] // CHECK:STDOUT: %Class.1: type = generic_class_type @Class [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Class = struct_value () [template] +// CHECK:STDOUT: %struct.2: Class = struct_value () [template] // CHECK:STDOUT: %Class.2: type = class_type @Class [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] @@ -173,14 +199,22 @@ var a: Class(5, i32*); // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc4_13.1: type = param T // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T 0, %T.loc4_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4, %.loc4_27.1 [template = i32] // CHECK:STDOUT: %N.loc4_23.1: i32 = param N // CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N 1, %N.loc4_23.1 [symbolic = constants.%N] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct] -// CHECK:STDOUT: %.loc13_17: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32.loc13, %.loc13_17.1 [template = i32] +// CHECK:STDOUT: %.loc13_17.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %.loc13_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc13_23: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class.2] @@ -193,14 +227,18 @@ var a: Class(5, i32*); // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_no_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] +// 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: %N: i32 = bind_symbolic_name N 1 [symbolic] // CHECK:STDOUT: %Class.1: type = generic_class_type @Class [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Class = struct_value () [template] +// CHECK:STDOUT: %struct.2: Class = struct_value () [template] // CHECK:STDOUT: %Class.2: type = class_type @Class [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: i32 = int_literal 5 [template] @@ -215,15 +253,23 @@ var a: Class(5, i32*); // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc4_13.1: type = param T // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T 0, %T.loc4_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int.make_type_32.loc4, %.loc4_27.1 [template = i32] // CHECK:STDOUT: %N.loc4_23.1: i32 = param N // CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N 1, %N.loc4_23.1 [symbolic = constants.%N] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct] +// CHECK:STDOUT: %Class.ref: Class = name_ref Class, %Class.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_14: i32 = int_literal 5 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_20: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.2: 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: %.loc12_20.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_20.2: type = converted %int.make_type_32.loc12, %.loc12_20.1 [template = i32] +// CHECK:STDOUT: %.loc12_20.3: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class.2] // CHECK:STDOUT: %a.var: ref Class = var a // CHECK:STDOUT: %a: ref Class = bind_name a, %a.var @@ -234,3 +280,5 @@ var a: Class(5, i32*); // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/fail_todo_use.carbon b/toolchain/check/testdata/class/generic/fail_todo_use.carbon index 11d608997829..9ab5b65f968c 100644 --- a/toolchain/check/testdata/class/generic/fail_todo_use.carbon +++ b/toolchain/check/testdata/class/generic/fail_todo_use.carbon @@ -47,9 +47,11 @@ fn Run() -> i32 { // CHECK:STDOUT: %.4: type = unbound_element_type Class, T [symbolic] // CHECK:STDOUT: %.5: type = struct_type {.k: T} [symbolic] // CHECK:STDOUT: %.6: type = ptr_type {.k: T} [symbolic] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %Run: type = fn_type @Run [template] -// CHECK:STDOUT: %struct.3: Run = struct_value () [template] -// CHECK:STDOUT: %Class.3: type = class_type @Class, (i32) [template] +// CHECK:STDOUT: %struct.4: Run = struct_value () [template] +// CHECK:STDOUT: %Class.3: type = class_type @Class, (@Run.%.loc21_15.2) [template] // CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: type = struct_type {.k: i32} [template] // CHECK:STDOUT: %.9: type = ptr_type Class [template] @@ -66,9 +68,14 @@ fn Run() -> i32 { // CHECK:STDOUT: %T.loc7_13.1: type = param T // CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32, %.loc16_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -101,10 +108,15 @@ fn Run() -> i32 { // CHECK:STDOUT: return %.loc9_12 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: Class = name_ref Class, file.%Class.decl [template = constants.%struct.1] -// CHECK:STDOUT: %Class: type = class_type @Class, (i32) [template = constants.%Class.3] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc21_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_15.2: type = converted %int.make_type_32, %.loc21_15.1 [template = i32] +// CHECK:STDOUT: %Class: type = class_type @Class, (%.loc21_15.2) [template = constants.%Class.3] // CHECK:STDOUT: %v.var: ref Class = var v // CHECK:STDOUT: %v: ref Class = bind_name v, %v.var // CHECK:STDOUT: %.loc21_29: i32 = int_literal 0 [template = constants.%.7] diff --git a/toolchain/check/testdata/class/generic/redeclare.carbon b/toolchain/check/testdata/class/generic/redeclare.carbon index 69b742b8ea2e..bb4799dababa 100644 --- a/toolchain/check/testdata/class/generic/redeclare.carbon +++ b/toolchain/check/testdata/class/generic/redeclare.carbon @@ -150,15 +150,17 @@ class E(U:! type) {} // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// 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: %N.1: i32 = bind_symbolic_name N 0 [symbolic] // CHECK:STDOUT: %B.1: type = generic_class_type @B [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: B = struct_value () [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: %B.2: type = class_type @B [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %N.2: T = bind_symbolic_name N 1 [symbolic] // CHECK:STDOUT: %.2: type = generic_class_type @.1 [template] -// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] // CHECK:STDOUT: %.3: type = class_type @.1 [template] // CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: } @@ -169,11 +171,15 @@ class E(U:! type) {} // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %B.decl: B = class_decl @B [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = class_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_32, %.loc4_13.1 [template = i32] // CHECK:STDOUT: %N.loc4_9.1: i32 = param N // CHECK:STDOUT: %N.loc4_9.2: i32 = bind_symbolic_name N 0, %N.loc4_9.1 [symbolic = constants.%N.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.3] { // CHECK:STDOUT: %T.loc12_9.1: type = param T // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_9.2 [symbolic = constants.%T] @@ -189,6 +195,8 @@ class E(U:! type) {} // CHECK:STDOUT: .Self = constants.%.3 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_count.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -197,9 +205,11 @@ class E(U:! type) {} // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: C = struct_value () [template] // CHECK:STDOUT: %C.2: type = class_type @C [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %U: i32 = bind_symbolic_name U 1 [symbolic] // CHECK:STDOUT: %.2: type = generic_class_type @.1 [template] -// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] // CHECK:STDOUT: %.3: type = class_type @.1 [template] // CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: } @@ -214,9 +224,13 @@ class E(U:! type) {} // CHECK:STDOUT: %T.loc4_9.1: type = param T // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.3] { // CHECK:STDOUT: %T.loc12_9.1: type = param T // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_23.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_23.2: type = converted %int.make_type_32, %.loc12_23.1 [template = i32] // CHECK:STDOUT: %U.loc12_19.1: i32 = param U // CHECK:STDOUT: %U.loc12_19.2: i32 = bind_symbolic_name U 1, %U.loc12_19.1 [symbolic = constants.%U] // CHECK:STDOUT: } @@ -229,6 +243,8 @@ class E(U:! type) {} // CHECK:STDOUT: .Self = constants.%.3 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -237,9 +253,11 @@ class E(U:! type) {} // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: D = struct_value () [template] // CHECK:STDOUT: %D.2: type = class_type @D [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %T.2: i32 = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %.2: type = generic_class_type @.1 [template] -// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] // CHECK:STDOUT: %.3: type = class_type @.1 [template] // CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: } @@ -254,7 +272,11 @@ class E(U:! type) {} // CHECK:STDOUT: %T.loc4_9.1: type = param T // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = constants.%T.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %.decl: = class_decl @.1 [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %T.loc12_9.1: i32 = param T // CHECK:STDOUT: %T.loc12_9.2: i32 = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = constants.%T.2] // CHECK:STDOUT: } @@ -267,6 +289,8 @@ class E(U:! type) {} // CHECK:STDOUT: .Self = constants.%.3 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 75436e63dbef..8cb3a651fd7e 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -51,15 +51,17 @@ fn Run() { // CHECK:STDOUT: %Empty: type = class_type @Empty [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %Field: type = class_type @Field [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Field, i32 [template] -// CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Field, i32 [template] +// CHECK:STDOUT: %.4: type = struct_type {.x: i32} [template] // CHECK:STDOUT: %ForwardDeclared: type = class_type @ForwardDeclared [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type ForwardDeclared [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: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -74,6 +76,7 @@ fn Run() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Empty.decl: type = class_decl @Empty [template = constants.%Empty] {} // CHECK:STDOUT: %Field.decl: type = class_decl @Field [template = constants.%Field] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ForwardDeclared.decl.loc11: type = class_decl @ForwardDeclared [template = constants.%ForwardDeclared] {} // CHECK:STDOUT: %ForwardDeclared.decl.loc13: type = class_decl @ForwardDeclared [template = constants.%ForwardDeclared] {} // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} @@ -85,20 +88,23 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Field { -// CHECK:STDOUT: %.loc8: = field_decl x, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl x, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Field -// CHECK:STDOUT: .x = %.loc8 +// CHECK:STDOUT: .x = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%ForwardDeclared [template = constants.%ForwardDeclared] // CHECK:STDOUT: %self.loc14_8.1: ForwardDeclared = param self // CHECK:STDOUT: %self.loc14_8.2: ForwardDeclared = bind_name self, %self.loc14_8.1 // 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: %Self.ref.loc15: type = name_ref Self, constants.%ForwardDeclared [template = constants.%ForwardDeclared] // CHECK:STDOUT: %.loc15_23: type = ptr_type ForwardDeclared [template = constants.%.5] // CHECK:STDOUT: %self.loc15_13.1: ForwardDeclared* = param self @@ -114,6 +120,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[@ForwardDeclared.%self.loc14_8.2: ForwardDeclared](); // CHECK:STDOUT: // CHECK:STDOUT: fn @G[addr @ForwardDeclared.%self.loc15_13.3: ForwardDeclared*](); @@ -158,19 +166,19 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+2, loaded [template = constants.%Empty] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+5, loaded [template = constants.%Field] -// CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+12, loaded [template = constants.%ForwardDeclared.1] -// CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+31, loaded [template = constants.%Incomplete] +// CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+21, loaded [template = constants.%ForwardDeclared.1] +// CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+39, loaded [template = constants.%Incomplete] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.7: = import_ref ir1, inst+8, loaded [template = imports.%.1] -// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %import_ref.9: G = import_ref ir1, inst+28, loaded [template = constants.%struct.6] -// CHECK:STDOUT: %import_ref.10: F = import_ref ir1, inst+18, loaded [template = constants.%struct.5] -// CHECK:STDOUT: %import_ref.11 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref ir1, inst+28, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref ir1, inst+18, unloaded +// CHECK:STDOUT: %import_ref.7: = import_ref ir1, inst+17, loaded [template = imports.%.1] +// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+22, unloaded +// CHECK:STDOUT: %import_ref.9: G = import_ref ir1, inst+36, loaded [template = constants.%struct.6] +// CHECK:STDOUT: %import_ref.10: F = import_ref ir1, inst+27, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.11 = import_ref ir1, inst+22, unloaded +// CHECK:STDOUT: %import_ref.12 = import_ref ir1, inst+36, unloaded +// CHECK:STDOUT: %import_ref.13 = import_ref ir1, inst+27, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 7809dfa16429..13ec028625d1 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -41,6 +41,8 @@ fn Run() { // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %Unused: type = fn_type @Unused [template] // CHECK:STDOUT: %struct.2: Unused = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = unbound_element_type Base, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.x: i32, .unused: i32} [template] // CHECK:STDOUT: %Child: type = class_type @Child [template] @@ -57,6 +59,8 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %Child.decl: type = class_decl @Child [template = constants.%Child] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -71,15 +75,21 @@ fn Run() { // CHECK:STDOUT: %self.loc6_13.1: Base = param self // CHECK:STDOUT: %self.loc6_13.2: Base = bind_name self, %self.loc6_13.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = field_decl x, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl unused, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl x, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc9_15.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_15.2: type = converted %int.make_type_32.loc9, %.loc9_15.1 [template = i32] +// CHECK:STDOUT: %.loc9_13: = field_decl unused, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .Unused = %Unused.decl -// CHECK:STDOUT: .x = %.loc8 -// CHECK:STDOUT: .unused = %.loc9 +// CHECK:STDOUT: .x = %.loc8_8 +// CHECK:STDOUT: .unused = %.loc9_13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Child { @@ -96,6 +106,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Unused[@Base.%self.loc6_13.2: Base](); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -129,16 +141,16 @@ fn Run() { // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+25, loaded [template = constants.%Child] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+37, loaded [template = constants.%Child] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref.3: F = import_ref ir1, inst+7, loaded [template = constants.%struct.4] // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+3, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+18, loaded [template = imports.%.1] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+26, loaded [template = imports.%.1] // CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+14, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+21, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+33, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+38, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir1, inst+42, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Child { diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 422e90aaf4b4..07f983c1e60b 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -21,16 +21,18 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type Class [template] -// CHECK:STDOUT: %.3: type = unbound_element_type Class, Class* [template] -// CHECK:STDOUT: %.4: type = struct_type {.n: i32, .next: Class*} [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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type Class [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %.5: type = struct_type {.n: i32, .next: Class*} [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type {.n: i32, .next: Class*} [template] // CHECK:STDOUT: %MakeReorder: type = fn_type @MakeReorder [template] -// CHECK:STDOUT: %struct.2: MakeReorder = struct_value () [template] +// CHECK:STDOUT: %struct.3: MakeReorder = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.next: Class*, .n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -43,21 +45,30 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { +// 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: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32.loc12, %.loc12_12.1 [template = i32] // CHECK:STDOUT: %n.loc12_9.1: i32 = param n // CHECK:STDOUT: @Make.%n: i32 = bind_name n, %n.loc12_9.1 // CHECK:STDOUT: %Class.ref.loc12_23: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc12_28: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %next.loc12_17.1: Class* = param next // CHECK:STDOUT: @Make.%next: Class* = bind_name next, %next.loc12_17.1 // CHECK:STDOUT: %Class.ref.loc12_34: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeReorder.decl: MakeReorder = fn_decl @MakeReorder [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %MakeReorder.decl: MakeReorder = fn_decl @MakeReorder [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16, %.loc16_19.1 [template = i32] // CHECK:STDOUT: %n.loc16_16.1: i32 = param n // CHECK:STDOUT: @MakeReorder.%n: i32 = bind_name n, %n.loc16_16.1 // CHECK:STDOUT: %Class.ref.loc16_30: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc16_35: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %next.loc16_24.1: Class* = param next // CHECK:STDOUT: @MakeReorder.%next: Class* = bind_name next, %next.loc16_24.1 // CHECK:STDOUT: %Class.ref.loc16_41: type = name_ref Class, %Class.decl [template = constants.%Class] @@ -66,17 +77,22 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl n, element0 [template] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %.loc9_11: = field_decl next, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .n = %.loc8 +// CHECK:STDOUT: .n = %.loc8_8 // CHECK:STDOUT: .next = %.loc9_11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Make(%n: i32, %next: Class*) -> %return: Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index 48812a2366a7..88b848f64f57 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -79,18 +79,20 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.1: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: C = struct_value (%.5, %.6) [template] // CHECK:STDOUT: %MakeC: type = fn_type @MakeC [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] -// CHECK:STDOUT: %struct.2: MakeC = struct_value () [template] +// CHECK:STDOUT: %struct.3: MakeC = struct_value () [template] // CHECK:STDOUT: %MakeAdaptC: type = fn_type @MakeAdaptC [template] -// CHECK:STDOUT: %struct.3: MakeAdaptC = struct_value () [template] +// CHECK:STDOUT: %struct.4: MakeAdaptC = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -105,17 +107,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// 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: %AdaptC.decl: type = class_decl @AdaptC [template = constants.%AdaptC] {} // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc13_27.1: {.a: i32, .b: i32} = struct_literal (%.loc13_18, %.loc13_26) // CHECK:STDOUT: %.loc13_27.2: ref C = temporary_storage // CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0 -// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.5] // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 -// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_27.8: ref C = temporary %.loc13_27.2, %.loc13_27.7 // CHECK:STDOUT: %.loc13_28.1: ref C = converted %.loc13_27.1, %.loc13_27.8 // CHECK:STDOUT: %.loc13_28.2: C = bind_value %.loc13_28.1 @@ -132,11 +136,11 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.loc17_14.1: C = as_compatible %b.ref // CHECK:STDOUT: %.loc17_14.2: C = converted %b.ref, %.loc17_14.1 // CHECK:STDOUT: %c: C = bind_name c, %.loc17_14.2 -// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.2] { +// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @MakeC.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.3] { +// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.4] { // CHECK:STDOUT: %AdaptC.ref.loc21: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: @MakeAdaptC.%return: ref AdaptC = var // CHECK:STDOUT: } @@ -149,13 +153,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc5: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc5 -// CHECK:STDOUT: .b = %.loc6 +// CHECK:STDOUT: .a = %.loc5_8 +// CHECK:STDOUT: .b = %.loc6_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptC { @@ -166,20 +176,22 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Self = constants.%AdaptC // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @MakeC() -> C; // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeAdaptC() -> AdaptC; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.2] +// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc23_5: ref AdaptC = splice_block file.%d.var {} // CHECK:STDOUT: %MakeC.call: init C = call %MakeC.ref() to %.loc23_5 // CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: %.loc23_25.1: init AdaptC = as_compatible %MakeC.call // CHECK:STDOUT: %.loc23_25.2: init AdaptC = converted %MakeC.call, %.loc23_25.1 // CHECK:STDOUT: assign file.%d.var, %.loc23_25.2 -// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.3] +// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc25_5: ref C = splice_block file.%e.var {} // CHECK:STDOUT: %MakeAdaptC.call: init AdaptC = call %MakeAdaptC.ref() to %.loc25_5 // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] @@ -193,18 +205,20 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.1: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: C = struct_value (%.5, %.6) [template] // CHECK:STDOUT: %MakeC: type = fn_type @MakeC [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] -// CHECK:STDOUT: %struct.2: MakeC = struct_value () [template] +// CHECK:STDOUT: %struct.3: MakeC = struct_value () [template] // CHECK:STDOUT: %MakeAdaptC: type = fn_type @MakeAdaptC [template] -// CHECK:STDOUT: %struct.3: MakeAdaptC = struct_value () [template] +// CHECK:STDOUT: %struct.4: MakeAdaptC = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -219,17 +233,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// 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: %AdaptC.decl: type = class_decl @AdaptC [template = constants.%AdaptC] {} // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc13_27.1: {.a: i32, .b: i32} = struct_literal (%.loc13_18, %.loc13_26) // CHECK:STDOUT: %.loc13_27.2: ref C = temporary_storage // CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0 -// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.5] // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 -// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_27.8: ref C = temporary %.loc13_27.2, %.loc13_27.7 // CHECK:STDOUT: %.loc13_28.1: ref C = converted %.loc13_27.1, %.loc13_27.8 // CHECK:STDOUT: %.loc13_28.2: C = bind_value %.loc13_28.1 @@ -240,11 +256,11 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.ref: AdaptC = name_ref b, %b // CHECK:STDOUT: %c: C = bind_name c, -// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.2] { +// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @MakeC.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.3] { +// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.4] { // CHECK:STDOUT: %AdaptC.ref.loc31: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: @MakeAdaptC.%return: ref AdaptC = var // CHECK:STDOUT: } @@ -257,13 +273,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc5: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc6: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32] +// CHECK:STDOUT: %.loc5_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32] +// CHECK:STDOUT: %.loc6_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc5 -// CHECK:STDOUT: .b = %.loc6 +// CHECK:STDOUT: .a = %.loc5_8 +// CHECK:STDOUT: .b = %.loc6_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptC { @@ -274,17 +296,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Self = constants.%AdaptC // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @MakeC() -> C; // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeAdaptC() -> AdaptC; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.2] +// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc37: ref C = temporary_storage // CHECK:STDOUT: %MakeC.call: init C = call %MakeC.ref() to %.loc37 // CHECK:STDOUT: assign file.%d.var, -// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.3] +// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc42: ref AdaptC = temporary_storage // CHECK:STDOUT: %MakeAdaptC.call: init AdaptC = call %MakeAdaptC.ref() to %.loc42 // CHECK:STDOUT: assign file.%e.var, diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index ad0c377705f9..14445b8b4709 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -17,15 +17,17 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: 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 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct.2: Class = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %struct.3: Class = struct_value (%.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,21 +38,35 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32, %.loc12_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 // 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: %.loc13_17: i32 = int_literal 1 [template = constants.%.4] @@ -62,10 +78,10 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc13_26.4: init i32 = initialize_from %.loc13_17 to %.loc13_26.3 [template = constants.%.4] // CHECK:STDOUT: %.loc13_26.5: ref i32 = class_element_access %.loc13_26.2, element1 // CHECK:STDOUT: %.loc13_26.6: init i32 = initialize_from %.loc13_25 to %.loc13_26.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_26.7: init Class = class_init (%.loc13_26.4, %.loc13_26.6), %.loc13_26.2 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_26.7: init Class = class_init (%.loc13_26.4, %.loc13_26.6), %.loc13_26.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc13_26.8: ref Class = temporary %.loc13_26.2, %.loc13_26.7 // CHECK:STDOUT: %.loc13_28: ref Class = converted %.loc13_26.1, %.loc13_26.8 -// CHECK:STDOUT: %a.ref: = name_ref a, @Class.%.loc8 [template = @Class.%.loc8] +// CHECK:STDOUT: %a.ref: = name_ref a, @Class.%.loc8_8 [template = @Class.%.loc8_8] // CHECK:STDOUT: %.loc13_37.1: ref i32 = class_element_access %.loc13_28, element0 // CHECK:STDOUT: %.loc13_37.2: i32 = bind_value %.loc13_37.1 // CHECK:STDOUT: return %.loc13_37.2 diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index a50479eff9a8..c5c91442f6e0 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -24,17 +24,19 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Inner: type = class_type @Inner [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %MakeInner: type = fn_type @MakeInner [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: MakeInner = struct_value () [template] +// CHECK:STDOUT: %struct.2: MakeInner = struct_value () [template] // CHECK:STDOUT: %Outer: type = class_type @Outer [template] // CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.5: type = unbound_element_type Outer, Inner [template] // CHECK:STDOUT: %.6: type = struct_type {.c: Inner, .d: Inner} [template] // CHECK:STDOUT: %MakeOuter: type = fn_type @MakeOuter [template] -// CHECK:STDOUT: %struct.2: MakeOuter = struct_value () [template] +// CHECK:STDOUT: %struct.3: MakeOuter = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] // CHECK:STDOUT: %.8: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] // CHECK:STDOUT: %.9: type = ptr_type {.c: Inner, .d: Inner} [template] @@ -50,25 +52,33 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Inner.decl: type = class_decl @Inner [template = constants.%Inner] {} -// CHECK:STDOUT: %MakeInner.decl: MakeInner = fn_decl @MakeInner [template = constants.%struct.1] { +// 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: %MakeInner.decl: MakeInner = fn_decl @MakeInner [template = constants.%struct.2] { // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] // CHECK:STDOUT: @MakeInner.%return: ref Inner = var // CHECK:STDOUT: } // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} -// CHECK:STDOUT: %MakeOuter.decl: MakeOuter = fn_decl @MakeOuter [template = constants.%struct.2] { +// CHECK:STDOUT: %MakeOuter.decl: MakeOuter = fn_decl @MakeOuter [template = constants.%struct.3] { // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] // CHECK:STDOUT: @MakeOuter.%return: ref Outer = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { @@ -83,14 +93,16 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: .d = %.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @MakeInner() -> Inner; // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeOuter() -> %return: Outer { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeInner.ref.loc20_16: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.1] +// CHECK:STDOUT: %MakeInner.ref.loc20_16: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc20_45.1: ref Inner = class_element_access %return, element0 // CHECK:STDOUT: %MakeInner.call.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 -// CHECK:STDOUT: %MakeInner.ref.loc20_34: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.1] +// CHECK:STDOUT: %MakeInner.ref.loc20_34: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc20_45.2: ref Inner = class_element_access %return, element1 // CHECK:STDOUT: %MakeInner.call.loc20_43: init Inner = call %MakeInner.ref.loc20_34() to %.loc20_45.2 // CHECK:STDOUT: %.loc20_45.3: {.c: Inner, .d: Inner} = struct_literal (%MakeInner.call.loc20_25, %MakeInner.call.loc20_43) diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index cbd19cd813f8..87b047539667 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -58,35 +58,37 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = ptr_type Class [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: %.3: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.4: type = struct_type {.k: i32} [template] // CHECK:STDOUT: %.5: type = ptr_type {.k: i32} [template] // CHECK:STDOUT: %Call: type = fn_type @Call [template] -// CHECK:STDOUT: %struct.3: Call = struct_value () [template] +// CHECK:STDOUT: %struct.4: Call = struct_value () [template] // CHECK:STDOUT: %CallAlias: type = fn_type @CallAlias [template] -// CHECK:STDOUT: %struct.4: CallAlias = struct_value () [template] +// CHECK:STDOUT: %struct.5: CallAlias = struct_value () [template] // CHECK:STDOUT: %CallOnConstBoundMethod: type = fn_type @CallOnConstBoundMethod [template] -// CHECK:STDOUT: %struct.5: CallOnConstBoundMethod = struct_value () [template] +// CHECK:STDOUT: %struct.6: CallOnConstBoundMethod = struct_value () [template] // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct.6: Class = struct_value (%.6) [template] +// CHECK:STDOUT: %struct.7: Class = struct_value (%.6) [template] // CHECK:STDOUT: %CallWithAddr: type = fn_type @CallWithAddr [template] -// CHECK:STDOUT: %struct.7: CallWithAddr = struct_value () [template] +// CHECK:STDOUT: %struct.8: CallWithAddr = struct_value () [template] // CHECK:STDOUT: %CallFThroughPointer: type = fn_type @CallFThroughPointer [template] -// CHECK:STDOUT: %struct.8: CallFThroughPointer = struct_value () [template] +// CHECK:STDOUT: %struct.9: CallFThroughPointer = struct_value () [template] // CHECK:STDOUT: %CallGThroughPointer: type = fn_type @CallGThroughPointer [template] -// CHECK:STDOUT: %struct.9: CallGThroughPointer = struct_value () [template] +// CHECK:STDOUT: %struct.10: CallGThroughPointer = struct_value () [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %struct.10: Make = struct_value () [template] +// CHECK:STDOUT: %struct.11: Make = struct_value () [template] // CHECK:STDOUT: %CallFOnInitializingExpr: type = fn_type @CallFOnInitializingExpr [template] -// CHECK:STDOUT: %struct.11: CallFOnInitializingExpr = struct_value () [template] +// CHECK:STDOUT: %struct.12: CallFOnInitializingExpr = struct_value () [template] // CHECK:STDOUT: %CallGOnInitializingExpr: type = fn_type @CallGOnInitializingExpr [template] -// CHECK:STDOUT: %struct.12: CallGOnInitializingExpr = struct_value () [template] +// CHECK:STDOUT: %struct.13: CallGOnInitializingExpr = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -105,87 +107,137 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %import_ref.4: 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: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc16_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc16_12.1 +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_29.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_29.2: type = converted %int.make_type_32.loc16, %.loc16_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { // CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc20_9.1: Class = param c // CHECK:STDOUT: @Call.%c: Class = bind_name c, %c.loc20_9.1 +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_22.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_22.2: type = converted %int.make_type_32.loc20, %.loc20_22.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallAlias.decl: CallAlias = fn_decl @CallAlias [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallAlias.decl: CallAlias = fn_decl @CallAlias [template = constants.%struct.5] { // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc26_14.1: Class = param c // CHECK:STDOUT: @CallAlias.%c: Class = bind_name c, %c.loc26_14.1 +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_27.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_27.2: type = converted %int.make_type_32.loc26, %.loc26_27.1 [template = i32] // CHECK:STDOUT: @CallAlias.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallOnConstBoundMethod.decl: CallOnConstBoundMethod = fn_decl @CallOnConstBoundMethod [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallOnConstBoundMethod.decl: CallOnConstBoundMethod = fn_decl @CallOnConstBoundMethod [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_32.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_32.2: type = converted %int.make_type_32.loc30, %.loc30_32.1 [template = i32] // CHECK:STDOUT: @CallOnConstBoundMethod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallWithAddr.decl: CallWithAddr = fn_decl @CallWithAddr [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallWithAddr.decl: CallWithAddr = fn_decl @CallWithAddr [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_22.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_22.2: type = converted %int.make_type_32.loc34, %.loc34_22.1 [template = i32] // CHECK:STDOUT: @CallWithAddr.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallFThroughPointer.decl: CallFThroughPointer = fn_decl @CallFThroughPointer [template = constants.%struct.8] { +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallFThroughPointer.decl: CallFThroughPointer = fn_decl @CallFThroughPointer [template = constants.%struct.9] { // CHECK:STDOUT: %Class.ref.loc39: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc39: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc39_32: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc39_24.1: Class* = param p // CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc39_24.1 +// CHECK:STDOUT: %int.make_type_32.loc39: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc39_38.1: type = value_of_initializer %int.make_type_32.loc39 [template = i32] +// CHECK:STDOUT: %.loc39_38.2: type = converted %int.make_type_32.loc39, %.loc39_38.1 [template = i32] // CHECK:STDOUT: @CallFThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallGThroughPointer.decl: CallGThroughPointer = fn_decl @CallGThroughPointer [template = constants.%struct.9] { +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallGThroughPointer.decl: CallGThroughPointer = fn_decl @CallGThroughPointer [template = constants.%struct.10] { // CHECK:STDOUT: %Class.ref.loc43: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc43: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc43_32: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc43_24.1: Class* = param p // CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 +// CHECK:STDOUT: %int.make_type_32.loc43: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc43_38.1: type = value_of_initializer %int.make_type_32.loc43 [template = i32] +// CHECK:STDOUT: %.loc43_38.2: type = converted %int.make_type_32.loc43, %.loc43_38.1 [template = i32] // CHECK:STDOUT: @CallGThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.10] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.11] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallFOnInitializingExpr.decl: CallFOnInitializingExpr = fn_decl @CallFOnInitializingExpr [template = constants.%struct.11] { +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallFOnInitializingExpr.decl: CallFOnInitializingExpr = fn_decl @CallFOnInitializingExpr [template = constants.%struct.12] { +// CHECK:STDOUT: %int.make_type_32.loc49: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_33.1: type = value_of_initializer %int.make_type_32.loc49 [template = i32] +// CHECK:STDOUT: %.loc49_33.2: type = converted %int.make_type_32.loc49, %.loc49_33.1 [template = i32] // CHECK:STDOUT: @CallFOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallGOnInitializingExpr.decl: CallGOnInitializingExpr = fn_decl @CallGOnInitializingExpr [template = constants.%struct.12] { +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %CallGOnInitializingExpr.decl: CallGOnInitializingExpr = fn_decl @CallGOnInitializingExpr [template = constants.%struct.13] { +// CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_33.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32] +// CHECK:STDOUT: %.loc53_33.2: type = converted %int.make_type_32.loc53, %.loc53_33.1 [template = i32] // CHECK:STDOUT: @CallGOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc8_8.1: Class = param self // CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32.loc8, %.loc8_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // 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: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %self.loc9_13.1: Class* = param self // CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 // CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_31.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_31.2: type = converted %int.make_type_32.loc9, %.loc9_31.1 [template = i32] // CHECK:STDOUT: %return.var.loc9: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.ref: F = name_ref F, %F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %A: F = bind_alias A, %F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13: = field_decl k, element0 [template] +// CHECK:STDOUT: %F.ref: F = name_ref F, %F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %A: F = bind_alias A, %F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .k = %.loc13 +// CHECK:STDOUT: .k = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc13 [template = @Class.%.loc13] +// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] // CHECK:STDOUT: %.loc17_14.1: ref i32 = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc17_14.2: i32 = bind_value %.loc17_14.1 // CHECK:STDOUT: return %.loc17_14.2 @@ -196,7 +248,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: fn @Call(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc23_11: = bound_method %c.ref, %F.ref // CHECK:STDOUT: %F.call: init i32 = call %.loc23_11(%c.ref) // CHECK:STDOUT: %.loc23_15.1: i32 = value_of_initializer %F.call @@ -207,7 +259,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: fn @CallAlias(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c -// CHECK:STDOUT: %A.ref: F = name_ref A, @Class.%A [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: F = name_ref A, @Class.%A [template = constants.%struct.2] // CHECK:STDOUT: %.loc27_11: = bound_method %c.ref, %A.ref // CHECK:STDOUT: %F.call: init i32 = call %.loc27_11(%c.ref) // CHECK:STDOUT: %.loc27_15.1: i32 = value_of_initializer %F.call @@ -223,10 +275,10 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %.loc31_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc31_18.3: ref i32 = class_element_access %.loc31_18.2, element0 // CHECK:STDOUT: %.loc31_18.4: init i32 = initialize_from %.loc31_17 to %.loc31_18.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc31_18.5: init Class = class_init (%.loc31_18.4), %.loc31_18.2 [template = constants.%struct.6] +// CHECK:STDOUT: %.loc31_18.5: init Class = class_init (%.loc31_18.4), %.loc31_18.2 [template = constants.%struct.7] // CHECK:STDOUT: %.loc31_18.6: ref Class = temporary %.loc31_18.2, %.loc31_18.5 // CHECK:STDOUT: %.loc31_20.1: ref Class = converted %.loc31_18.1, %.loc31_18.6 -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc31_29: = bound_method %.loc31_20.1, %F.ref // CHECK:STDOUT: %.loc31_20.2: Class = bind_value %.loc31_20.1 // CHECK:STDOUT: %F.call: init i32 = call %.loc31_29(%.loc31_20.2) @@ -241,7 +293,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc36_11: = bound_method %c.ref, %G.ref // CHECK:STDOUT: %.loc36_10: Class* = addr_of %c.ref // CHECK:STDOUT: %G.call: init i32 = call %.loc36_11(%.loc36_10) @@ -254,7 +306,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc40_11.1: ref Class = deref %p.ref -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc40_14: = bound_method %.loc40_11.1, %F.ref // CHECK:STDOUT: %.loc40_11.2: Class = bind_value %.loc40_11.1 // CHECK:STDOUT: %F.call: init i32 = call %.loc40_14(%.loc40_11.2) @@ -267,7 +319,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc44_11.1: ref Class = deref %p.ref -// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc44_14: = bound_method %.loc44_11.1, %G.ref // CHECK:STDOUT: %.loc44_11.2: Class* = addr_of %.loc44_11.1 // CHECK:STDOUT: %G.call: init i32 = call %.loc44_14(%.loc44_11.2) @@ -280,11 +332,11 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallFOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.10] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.11] // CHECK:STDOUT: %.loc50_14.1: ref Class = temporary_storage // CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc50_14.1 // CHECK:STDOUT: %.loc50_14.2: ref Class = temporary %.loc50_14.1, %Make.call -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc50_16: = bound_method %.loc50_14.2, %F.ref // CHECK:STDOUT: %.loc50_14.3: Class = bind_value %.loc50_14.2 // CHECK:STDOUT: %F.call: init i32 = call %.loc50_16(%.loc50_14.3) @@ -295,11 +347,11 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.10] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.11] // CHECK:STDOUT: %.loc54_14.1: ref Class = temporary_storage // CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc54_14.1 // CHECK:STDOUT: %.loc54_14.2: ref Class = temporary %.loc54_14.1, %Make.call -// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.2, %G.ref // CHECK:STDOUT: %.loc54_14.3: Class* = addr_of %.loc54_14.2 // CHECK:STDOUT: %G.call: init i32 = call %.loc54_16(%.loc54_14.3) diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index a059ea570ac6..070d98d31ab4 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -23,15 +23,17 @@ fn G(o: Outer) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Outer: type = class_type @Outer [template] // CHECK:STDOUT: %Inner: type = class_type @Inner [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.3: type = struct_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: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {.n: i32} [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: %.6: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -44,14 +46,19 @@ fn G(o: Outer) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Outer.ref.loc13: type = name_ref Outer, %Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %oi.loc13_6.1: Inner = param oi // CHECK:STDOUT: @F.%oi: Inner = bind_name oi, %oi.loc13_6.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_26.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_26.2: type = converted %int.make_type_32, %.loc13_26.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // 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: %Outer.ref.loc17: type = name_ref Outer, %Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %o.loc17_6.1: Outer = param o // CHECK:STDOUT: @G.%o: Outer = bind_name o, %o.loc17_6.1 @@ -67,17 +74,22 @@ fn G(o: Outer) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc9: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32, %.loc9_12.1 [template = i32] +// CHECK:STDOUT: %.loc9_10: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner -// CHECK:STDOUT: .n = %.loc9 +// CHECK:STDOUT: .n = %.loc9_10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%oi: Inner) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %oi.ref: Inner = name_ref oi, %oi -// CHECK:STDOUT: %n.ref: = name_ref n, @Inner.%.loc9 [template = @Inner.%.loc9] +// CHECK:STDOUT: %n.ref: = name_ref n, @Inner.%.loc9_10 [template = @Inner.%.loc9_10] // CHECK:STDOUT: %.loc14_12.1: ref i32 = class_element_access %oi.ref, element0 // CHECK:STDOUT: %.loc14_12.2: i32 = bind_value %.loc14_12.1 // CHECK:STDOUT: return %.loc14_12.2 diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index f4861483558b..6de7e9885244 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -23,13 +23,15 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [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: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.6: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %.7: type = ptr_type {.n: i32} [template] @@ -43,61 +45,99 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc13_27: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %self.loc13_17.1: Class* = param self // CHECK:STDOUT: @F.%self.loc13_17: Class* = bind_name self, %self.loc13_17.1 // CHECK:STDOUT: @F.%.loc13: Class* = addr_pattern @F.%self.loc13_17 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_38.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_38.2: type = converted %int.make_type_32.loc13, %.loc13_38.1 [template = i32] // CHECK:STDOUT: %self.loc13_30.1: i32 = param r#self // CHECK:STDOUT: @F.%self.loc13_30: i32 = bind_name r#self, %self.loc13_30.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: 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: %Self.ref.loc17: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc17_12.1: Class = param self // CHECK:STDOUT: @G.%self.loc17_12: Class = bind_name self, %self.loc17_12.1 +// CHECK:STDOUT: %int.make_type_32.loc17_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_32.1: type = value_of_initializer %int.make_type_32.loc17_32 [template = i32] +// CHECK:STDOUT: %.loc17_32.2: type = converted %int.make_type_32.loc17_32, %.loc17_32.1 [template = i32] // CHECK:STDOUT: %self.loc17_24.1: i32 = param r#self // CHECK:STDOUT: @G.%self.loc17_24: i32 = bind_name r#self, %self.loc17_24.1 -// CHECK:STDOUT: %.loc17_49.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc17_49.2: type = converted %.loc17_49.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc17_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc17_46: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_49.1: (type, type) = tuple_literal (%int.make_type_32.loc17_41, %int.make_type_32.loc17_46) +// CHECK:STDOUT: %.loc17_49.2: type = value_of_initializer %int.make_type_32.loc17_41 [template = i32] +// CHECK:STDOUT: %.loc17_49.3: type = converted %int.make_type_32.loc17_41, %.loc17_49.2 [template = i32] +// CHECK:STDOUT: %.loc17_49.4: type = value_of_initializer %int.make_type_32.loc17_46 [template = i32] +// CHECK:STDOUT: %.loc17_49.5: type = converted %int.make_type_32.loc17_46, %.loc17_49.4 [template = i32] +// CHECK:STDOUT: %.loc17_49.6: type = converted %.loc17_49.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc8_23: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %self.loc8_13.1: Class* = param self // CHECK:STDOUT: %self.loc8_13.3: Class* = bind_name self, %self.loc8_13.1 // CHECK:STDOUT: %.loc8_8: Class* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_34.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_34.2: type = converted %int.make_type_32.loc8, %.loc8_34.1 [template = i32] // CHECK:STDOUT: %self.loc8_26.1: i32 = param r#self // CHECK:STDOUT: %self.loc8_26.2: i32 = bind_name r#self, %self.loc8_26.1 // 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: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc9_8.1: Class = param self // CHECK:STDOUT: %self.loc9_8.2: Class = bind_name self, %self.loc9_8.1 +// CHECK:STDOUT: %int.make_type_32.loc9_28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_28.1: type = value_of_initializer %int.make_type_32.loc9_28 [template = i32] +// CHECK:STDOUT: %.loc9_28.2: type = converted %int.make_type_32.loc9_28, %.loc9_28.1 [template = i32] // CHECK:STDOUT: %self.loc9_20.1: i32 = param r#self // CHECK:STDOUT: %self.loc9_20.2: i32 = bind_name r#self, %self.loc9_20.1 -// CHECK:STDOUT: %.loc9_45.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc9_45.2: type = converted %.loc9_45.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc9_37: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc9_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_45.1: (type, type) = tuple_literal (%int.make_type_32.loc9_37, %int.make_type_32.loc9_42) +// CHECK:STDOUT: %.loc9_45.2: type = value_of_initializer %int.make_type_32.loc9_37 [template = i32] +// CHECK:STDOUT: %.loc9_45.3: type = converted %int.make_type_32.loc9_37, %.loc9_45.2 [template = i32] +// CHECK:STDOUT: %.loc9_45.4: type = value_of_initializer %int.make_type_32.loc9_42 [template = i32] +// CHECK:STDOUT: %.loc9_45.5: type = converted %int.make_type_32.loc9_42, %.loc9_45.4 [template = i32] +// CHECK:STDOUT: %.loc9_45.6: type = converted %.loc9_45.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %return.var: ref (i32, i32) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] +// CHECK:STDOUT: %.loc10_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .n = %.loc10 +// CHECK:STDOUT: .n = %.loc10_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[addr %self.loc13_17: Class*](%self.loc13_30: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref.loc14_5: Class* = name_ref self, %self.loc13_17 // CHECK:STDOUT: %.loc14_4: ref Class = deref %self.ref.loc14_5 -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10 [template = @Class.%.loc10] +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10_8 [template = @Class.%.loc10_8] // CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 // CHECK:STDOUT: %self.ref.loc14_15: i32 = name_ref r#self, %self.loc13_30 // CHECK:STDOUT: assign %.loc14_10, %self.ref.loc14_15 @@ -107,7 +147,7 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: fn @G[%self.loc17_12: Class](%self.loc17_24: i32) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref.loc18_11: Class = name_ref self, %self.loc17_12 -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10 [template = @Class.%.loc10] +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10_8 [template = @Class.%.loc10_8] // CHECK:STDOUT: %.loc18_15.1: ref i32 = class_element_access %self.ref.loc18_11, element0 // CHECK:STDOUT: %.loc18_15.2: i32 = bind_value %.loc18_15.1 // CHECK:STDOUT: %self.ref.loc18_19: i32 = name_ref r#self, %self.loc17_24 diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index 085e5219bf8d..c22f0dc8dd3a 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -16,9 +16,11 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: } @@ -31,20 +33,28 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl.loc7: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %Class.decl.loc9: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc13_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc13_12.1 +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc13_27.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc13_27.2: type = converted %bool.make_type, %.loc13_27.1 [template = bool] // CHECK:STDOUT: %b.loc13_24.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc13_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc10_8.1: Class = param self // CHECK:STDOUT: %self.loc10_8.2: Class = bind_name self, %self.loc10_8.1 +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc10_23.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc10_23.2: type = converted %bool.make_type, %.loc10_23.1 [template = bool] // CHECK:STDOUT: %b.loc10_20.1: bool = param b // CHECK:STDOUT: %b.loc10_20.2: bool = bind_name b, %b.loc10_20.1 // CHECK:STDOUT: } @@ -54,6 +64,8 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class](%b: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 383adea0544b..a5db0494c656 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -18,11 +18,13 @@ fn Class.F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [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: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -33,16 +35,28 @@ fn Class.F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_17.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_17.2: type = converted %int.make_type_32, %.loc12_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // 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: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc9: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -52,12 +66,14 @@ fn Class.F() -> i32 { // CHECK:STDOUT: .G = %G.decl // 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: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %G.ref.loc13: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref.loc13: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call.loc13: init i32 = call %G.ref.loc13() -// CHECK:STDOUT: %G.ref.loc14: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref.loc14: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call.loc14: init i32 = call %G.ref.loc14() // CHECK:STDOUT: %.loc14_13.1: i32 = value_of_initializer %G.call.loc14 // CHECK:STDOUT: %.loc14_13.2: i32 = converted %G.call.loc14, %.loc14_13.1 diff --git a/toolchain/check/testdata/class/reorder.carbon b/toolchain/check/testdata/class/reorder.carbon index 3cf34149f0eb..5a20a64ee05c 100644 --- a/toolchain/check/testdata/class/reorder.carbon +++ b/toolchain/check/testdata/class/reorder.carbon @@ -18,11 +18,13 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } @@ -34,13 +36,21 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} +// 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: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,10 +60,12 @@ class Class { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc9_21.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc9_21.2: i32 = converted %F.call, %.loc9_21.1 diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index 53609ccad923..c3f54c5c6bd7 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -51,35 +51,37 @@ class A { // CHECK:STDOUT: %BF: type = fn_type @BF [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: BF = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = unbound_element_type B, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.b: i32} [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %DF: type = fn_type @DF [template] -// CHECK:STDOUT: %struct.3: DF = struct_value () [template] +// CHECK:STDOUT: %struct.4: DF = struct_value () [template] // CHECK:STDOUT: %.4: type = unbound_element_type D, i32 [template] // CHECK:STDOUT: %.5: type = struct_type {.d: i32} [template] // CHECK:STDOUT: %CF: type = fn_type @CF [template] -// CHECK:STDOUT: %struct.4: CF = struct_value () [template] +// CHECK:STDOUT: %struct.5: CF = struct_value () [template] // CHECK:STDOUT: %.6: type = unbound_element_type C, i32 [template] // CHECK:STDOUT: %.7: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %AF: type = fn_type @AF [template] -// CHECK:STDOUT: %struct.5: AF = struct_value () [template] +// CHECK:STDOUT: %struct.6: AF = struct_value () [template] // CHECK:STDOUT: %.8: type = unbound_element_type A, i32 [template] // CHECK:STDOUT: %.9: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.10: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.11: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct.6: A = struct_value (%.11) [template] +// CHECK:STDOUT: %struct.7: A = struct_value (%.11) [template] // CHECK:STDOUT: %.12: type = ptr_type {.b: i32} [template] // CHECK:STDOUT: %.13: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.7: B = struct_value (%.13) [template] +// CHECK:STDOUT: %struct.8: B = struct_value (%.13) [template] // CHECK:STDOUT: %.14: type = ptr_type {.c: i32} [template] // CHECK:STDOUT: %.15: i32 = int_literal 3 [template] -// CHECK:STDOUT: %struct.8: C = struct_value (%.15) [template] +// CHECK:STDOUT: %struct.9: C = struct_value (%.15) [template] // CHECK:STDOUT: %.16: type = ptr_type {.d: i32} [template] // CHECK:STDOUT: %.17: i32 = int_literal 4 [template] -// CHECK:STDOUT: %struct.9: D = struct_value (%.17) [template] +// CHECK:STDOUT: %struct.10: D = struct_value (%.17) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -89,60 +91,78 @@ class A { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} +// 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: class @A { // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %AF.decl: AF = fn_decl @AF [template = constants.%struct.5] {} -// CHECK:STDOUT: %.loc42: = field_decl a, element0 [template] +// CHECK:STDOUT: %AF.decl: AF = fn_decl @AF [template = constants.%struct.6] {} +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc42_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc42_10.2: type = converted %int.make_type_32, %.loc42_10.1 [template = i32] +// CHECK:STDOUT: %.loc42_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .AF = %AF.decl -// CHECK:STDOUT: .a = %.loc42 +// CHECK:STDOUT: .a = %.loc42_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %BF.decl: BF = fn_decl @BF [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc12: = field_decl b, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32, %.loc12_12.1 [template = i32] +// CHECK:STDOUT: %.loc12_10: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .BF = %BF.decl -// CHECK:STDOUT: .b = %.loc12 +// CHECK:STDOUT: .b = %.loc12_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.3] {} -// CHECK:STDOUT: %CF.decl: CF = fn_decl @CF [template = constants.%struct.4] {} -// CHECK:STDOUT: %.loc38: = field_decl c, element0 [template] +// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.4] {} +// CHECK:STDOUT: %CF.decl: CF = fn_decl @CF [template = constants.%struct.5] {} +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc38_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc38_12.2: type = converted %int.make_type_32, %.loc38_12.1 [template = i32] +// CHECK:STDOUT: %.loc38_10: = field_decl c, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .CF = %CF.decl -// CHECK:STDOUT: .c = %.loc38 +// CHECK:STDOUT: .c = %.loc38_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} -// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.3] {} -// CHECK:STDOUT: %.loc20: = field_decl d, element0 [template] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} +// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.4] {} +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc20_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc20_14.2: type = converted %int.make_type_32, %.loc20_14.1 [template = i32] +// CHECK:STDOUT: %.loc20_12: = field_decl d, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .DF = %DF.decl -// CHECK:STDOUT: .d = %.loc20 +// CHECK:STDOUT: .d = %.loc20_12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @BF(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @DF() { @@ -154,8 +174,8 @@ class A { // CHECK:STDOUT: %.loc25_25.1: {.a: i32} = struct_literal (%.loc25_24) // CHECK:STDOUT: %.loc25_25.2: ref i32 = class_element_access %a.var, element0 // CHECK:STDOUT: %.loc25_25.3: init i32 = initialize_from %.loc25_24 to %.loc25_25.2 [template = constants.%.11] -// CHECK:STDOUT: %.loc25_25.4: init A = class_init (%.loc25_25.3), %a.var [template = constants.%struct.6] -// CHECK:STDOUT: %.loc25_26: init A = converted %.loc25_25.1, %.loc25_25.4 [template = constants.%struct.6] +// CHECK:STDOUT: %.loc25_25.4: init A = class_init (%.loc25_25.3), %a.var [template = constants.%struct.7] +// CHECK:STDOUT: %.loc25_26: init A = converted %.loc25_25.1, %.loc25_25.4 [template = constants.%struct.7] // CHECK:STDOUT: assign %a.var, %.loc25_26 // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [template = constants.%B] // CHECK:STDOUT: %b.var: ref B = var b @@ -164,8 +184,8 @@ class A { // CHECK:STDOUT: %.loc26_25.1: {.b: i32} = struct_literal (%.loc26_24) // CHECK:STDOUT: %.loc26_25.2: ref i32 = class_element_access %b.var, element0 // CHECK:STDOUT: %.loc26_25.3: init i32 = initialize_from %.loc26_24 to %.loc26_25.2 [template = constants.%.13] -// CHECK:STDOUT: %.loc26_25.4: init B = class_init (%.loc26_25.3), %b.var [template = constants.%struct.7] -// CHECK:STDOUT: %.loc26_26: init B = converted %.loc26_25.1, %.loc26_25.4 [template = constants.%struct.7] +// CHECK:STDOUT: %.loc26_25.4: init B = class_init (%.loc26_25.3), %b.var [template = constants.%struct.8] +// CHECK:STDOUT: %.loc26_26: init B = converted %.loc26_25.1, %.loc26_25.4 [template = constants.%struct.8] // CHECK:STDOUT: assign %b.var, %.loc26_26 // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c @@ -174,8 +194,8 @@ class A { // CHECK:STDOUT: %.loc27_25.1: {.c: i32} = struct_literal (%.loc27_24) // CHECK:STDOUT: %.loc27_25.2: ref i32 = class_element_access %c.var, element0 // CHECK:STDOUT: %.loc27_25.3: init i32 = initialize_from %.loc27_24 to %.loc27_25.2 [template = constants.%.15] -// CHECK:STDOUT: %.loc27_25.4: init C = class_init (%.loc27_25.3), %c.var [template = constants.%struct.8] -// CHECK:STDOUT: %.loc27_26: init C = converted %.loc27_25.1, %.loc27_25.4 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc27_25.4: init C = class_init (%.loc27_25.3), %c.var [template = constants.%struct.9] +// CHECK:STDOUT: %.loc27_26: init C = converted %.loc27_25.1, %.loc27_25.4 [template = constants.%struct.9] // CHECK:STDOUT: assign %c.var, %.loc27_26 // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [template = constants.%D] // CHECK:STDOUT: %d.var: ref D = var d @@ -184,16 +204,16 @@ class A { // CHECK:STDOUT: %.loc28_25.1: {.d: i32} = struct_literal (%.loc28_24) // CHECK:STDOUT: %.loc28_25.2: ref i32 = class_element_access %d.var, element0 // CHECK:STDOUT: %.loc28_25.3: init i32 = initialize_from %.loc28_24 to %.loc28_25.2 [template = constants.%.17] -// CHECK:STDOUT: %.loc28_25.4: init D = class_init (%.loc28_25.3), %d.var [template = constants.%struct.9] -// CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%struct.9] +// CHECK:STDOUT: %.loc28_25.4: init D = class_init (%.loc28_25.3), %d.var [template = constants.%struct.10] +// CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%struct.10] // CHECK:STDOUT: assign %d.var, %.loc28_26 -// CHECK:STDOUT: %AF.ref: AF = name_ref AF, @A.%AF.decl [template = constants.%struct.5] +// CHECK:STDOUT: %AF.ref: AF = name_ref AF, @A.%AF.decl [template = constants.%struct.6] // CHECK:STDOUT: %AF.call: init () = call %AF.ref() // CHECK:STDOUT: %BF.ref: BF = name_ref BF, @B.%BF.decl [template = constants.%struct.1] // CHECK:STDOUT: %BF.call: init () = call %BF.ref() -// CHECK:STDOUT: %CF.ref: CF = name_ref CF, @C.%CF.decl [template = constants.%struct.4] +// CHECK:STDOUT: %CF.ref: CF = name_ref CF, @C.%CF.decl [template = constants.%struct.5] // CHECK:STDOUT: %CF.call: init () = call %CF.ref() -// CHECK:STDOUT: %DF.ref: DF = name_ref DF, @D.%DF.decl [template = constants.%struct.3] +// CHECK:STDOUT: %DF.ref: DF = name_ref DF, @D.%DF.decl [template = constants.%struct.4] // CHECK:STDOUT: %DF.call: init () = call %DF.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index 0feccff7eaee..a868d5d0e9c3 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -27,18 +27,20 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [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: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: %Run: type = fn_type @Run [template] -// CHECK:STDOUT: %struct.4: Run = struct_value () [template] +// CHECK:STDOUT: %struct.5: Run = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,17 +52,31 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { +// 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.2 [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32, %.loc17_11.1 [template = i32] // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.5] {} +// 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: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // 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: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -70,6 +86,8 @@ fn Run() { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.3] @@ -78,7 +96,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 @@ -93,15 +111,21 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_10.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_10.2: type = converted %int.make_type_32.loc22, %.loc22_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F.ref.loc22: F = name_ref F, file.%F.decl [template = constants.%struct.3] +// CHECK:STDOUT: %F.ref.loc22: F = name_ref F, file.%F.decl [template = constants.%struct.4] // CHECK:STDOUT: %F.call.loc22: init i32 = call %F.ref.loc22() // CHECK:STDOUT: assign %a.var, %F.call.loc22 +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_10.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_10.2: type = converted %int.make_type_32.loc23, %.loc23_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref.loc23: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc23: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call.loc23: init i32 = call %F.ref.loc23() // CHECK:STDOUT: assign %b.var, %F.call.loc23 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index 2b485c8c3ce9..d7b9b81db99a 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -23,12 +23,14 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = ptr_type Class [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: %.3: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.4: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %.5: type = ptr_type {.n: i32} [template] @@ -41,50 +43,72 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %import_ref.4: 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: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc14_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc14_12.1 +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_29.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_29.2: type = converted %int.make_type_32.loc14, %.loc14_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.5: 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: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc18_27: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %self.loc18_17.1: Class* = param self // CHECK:STDOUT: @G.%self: Class* = bind_name self, %self.loc18_17.1 // CHECK:STDOUT: @G.%.loc18: Class* = addr_pattern @G.%self +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_35.2: type = converted %int.make_type_32.loc18, %.loc18_35.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc8_8.1: Class = param self // CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32.loc8, %.loc8_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // 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: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %self.loc9_13.1: Class* = param self // CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 // CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_31.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_31.2: type = converted %int.make_type_32.loc9, %.loc9_31.1 [template = i32] // CHECK:STDOUT: %return.var.loc9: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32.loc11, %.loc11_10.1 [template = i32] +// CHECK:STDOUT: %.loc11_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .n = %.loc11 +// CHECK:STDOUT: .n = %.loc11_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11 [template = @Class.%.loc11] +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11_8 [template = @Class.%.loc11_8] // CHECK:STDOUT: %.loc15_14.1: ref i32 = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc15_14.2: i32 = bind_value %.loc15_14.1 // CHECK:STDOUT: return %.loc15_14.2 @@ -94,7 +118,7 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class* = name_ref self, %self // CHECK:STDOUT: %.loc19_11: ref Class = deref %self.ref -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11 [template = @Class.%.loc11] +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11_8 [template = @Class.%.loc11_8] // CHECK:STDOUT: %.loc19_17.1: ref i32 = class_element_access %.loc19_11, element0 // CHECK:STDOUT: %.loc19_17.2: i32 = bind_value %.loc19_17.1 // CHECK:STDOUT: return %.loc19_17.2 diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 25210fc05509..69c800ff79e5 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -32,22 +32,24 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: 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 = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, Base [template] // CHECK:STDOUT: %SelfBase: type = fn_type @SelfBase [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: SelfBase = struct_value () [template] +// CHECK:STDOUT: %struct.2: SelfBase = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type Base [template] // CHECK:STDOUT: %AddrSelfBase: type = fn_type @AddrSelfBase [template] -// CHECK:STDOUT: %struct.2: AddrSelfBase = struct_value () [template] +// CHECK:STDOUT: %struct.3: AddrSelfBase = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.base: Base} [template] // CHECK:STDOUT: %.8: i32 = int_literal 1 [template] // CHECK:STDOUT: %.9: type = ptr_type Derived [template] // CHECK:STDOUT: %Call: type = fn_type @Call [template] -// CHECK:STDOUT: %struct.3: Call = struct_value () [template] +// CHECK:STDOUT: %struct.4: Call = struct_value () [template] // CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*} [template] // CHECK:STDOUT: %.11: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: } @@ -61,47 +63,63 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [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: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.2] { // CHECK:STDOUT: %Base.ref.loc18: type = name_ref Base, %Base.decl [template = constants.%Base] // CHECK:STDOUT: %self.loc18_21.1: Base = param self // CHECK:STDOUT: @SelfBase.%self: Base = bind_name self, %self.loc18_21.1 +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_38.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_38.2: type = converted %int.make_type_32.loc18, %.loc18_38.1 [template = i32] // CHECK:STDOUT: @SelfBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.2] { +// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.3] { // CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, %Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc22_40: type = ptr_type Base [template = constants.%.6] // CHECK:STDOUT: %self.loc22_30.1: Base* = param self // CHECK:STDOUT: @AddrSelfBase.%self: Base* = bind_name self, %self.loc22_30.1 // CHECK:STDOUT: @AddrSelfBase.%.loc22: Base* = addr_pattern @AddrSelfBase.%self // CHECK:STDOUT: } -// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc26: type = ptr_type Derived [template = constants.%.9] +// CHECK:STDOUT: %.loc26_19: type = ptr_type Derived [template = constants.%.9] // CHECK:STDOUT: %p.loc26_9.1: Derived* = param p // CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc26_9.1 +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_25.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_25.2: type = converted %int.make_type_32.loc26, %.loc26_25.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc8_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref.loc12: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] -// CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.1] { +// CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.2] { // CHECK:STDOUT: %Base.ref.loc14: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %self.loc14_15.1: Base = param self // CHECK:STDOUT: %self.loc14_15.2: Base = bind_name self, %self.loc14_15.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_32.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_32.2: type = converted %int.make_type_32, %.loc14_32.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.2] { +// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.3] { // CHECK:STDOUT: %Base.ref.loc15: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc15_34: type = ptr_type Base [template = constants.%.6] // CHECK:STDOUT: %self.loc15_24.1: Base* = param self @@ -117,10 +135,12 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @SelfBase[%self: Base]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base = name_ref self, %self -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8 [template = @Base.%.loc8] +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] // CHECK:STDOUT: %.loc19_14.1: ref i32 = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc19_14.2: i32 = bind_value %.loc19_14.1 // CHECK:STDOUT: return %.loc19_14.2 @@ -130,7 +150,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc23_4: ref Base = deref %self.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8 [template = @Base.%.loc8] +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] // CHECK:STDOUT: %.loc23_10: ref i32 = class_element_access %.loc23_4, element0 // CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.8] // CHECK:STDOUT: assign %.loc23_10, %.loc23_15 @@ -141,7 +161,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref.loc27: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc27_4.1: ref Derived = deref %p.ref.loc27 -// CHECK:STDOUT: %AddrSelfBase.ref: AddrSelfBase = name_ref AddrSelfBase, @Derived.%AddrSelfBase.decl [template = constants.%struct.2] +// CHECK:STDOUT: %AddrSelfBase.ref: AddrSelfBase = name_ref AddrSelfBase, @Derived.%AddrSelfBase.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc27_7: = bound_method %.loc27_4.1, %AddrSelfBase.ref // CHECK:STDOUT: %.loc27_4.2: Derived* = addr_of %.loc27_4.1 // CHECK:STDOUT: %.loc27_20.1: ref Derived = deref %.loc27_4.2 @@ -151,7 +171,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %AddrSelfBase.call: init () = call %.loc27_7(%.loc27_20.4) // CHECK:STDOUT: %p.ref.loc28: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc28_11: ref Derived = deref %p.ref.loc28 -// CHECK:STDOUT: %SelfBase.ref: SelfBase = name_ref SelfBase, @Derived.%SelfBase.decl [template = constants.%struct.1] +// CHECK:STDOUT: %SelfBase.ref: SelfBase = name_ref SelfBase, @Derived.%SelfBase.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc28_14: = bound_method %.loc28_11, %SelfBase.ref // CHECK:STDOUT: %.loc28_23.1: ref Base = class_element_access %.loc28_11, element0 // CHECK:STDOUT: %.loc28_23.2: ref Base = converted %.loc28_11, %.loc28_23.1 diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 8453a6fef961..507ea360fc93 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -22,11 +22,13 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %Make: type = fn_type @Make [template] -// CHECK:STDOUT: %struct.2: Make = struct_value () [template] +// CHECK:STDOUT: %struct.3: Make = struct_value () [template] // CHECK:STDOUT: %.2: type = ptr_type Class [template] // CHECK:STDOUT: %.3: type = unbound_element_type Class, Class* [template] // CHECK:STDOUT: %.4: type = struct_type {.p: Class*} [template] @@ -40,22 +42,30 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc17_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc17_12.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_29.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_29.2: type = converted %int.make_type_32, %.loc17_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc8_8.1: Class = param self // CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32, %.loc8_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %return.var.loc9: ref Class = var // CHECK:STDOUT: } @@ -70,6 +80,8 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: .p = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self @@ -77,7 +89,7 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: %.loc18_16.1: ref Class* = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc18_16.2: Class* = bind_value %.loc18_16.1 // CHECK:STDOUT: %.loc18_11.1: ref Class = deref %.loc18_16.2 -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc18_19: = bound_method %.loc18_11.1, %F.ref // CHECK:STDOUT: %.loc18_11.2: Class = bind_value %.loc18_11.1 // CHECK:STDOUT: %F.call: init i32 = call %.loc18_19(%.loc18_11.2) diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index d0b034c63ab6..027878c5017f 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -17,12 +17,14 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [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: %.3: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -34,13 +36,21 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.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: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32, %.loc11_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -49,6 +59,8 @@ fn Run() -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { @@ -57,7 +69,7 @@ fn Run() -> i32 { // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 diff --git a/toolchain/check/testdata/const/basic.carbon b/toolchain/check/testdata/const/basic.carbon index 2ce4165cc237..dc217edeb343 100644 --- a/toolchain/check/testdata/const/basic.carbon +++ b/toolchain/check/testdata/const/basic.carbon @@ -15,16 +15,18 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type const 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 = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type const i32* [template] // CHECK:STDOUT: %A: type = fn_type @A [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type i32 [template] // CHECK:STDOUT: %.6: type = const_type i32* [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,28 +36,46 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_9: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_18: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_19: type = ptr_type const i32* [template = constants.%.3] +// 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: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_15 [template = i32] +// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_15, %.loc7_9.1 [template = i32] +// CHECK:STDOUT: %.loc7_9.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_18: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_19: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: %p.loc7_6.1: const i32** = param p // CHECK:STDOUT: @A.%p: const i32** = bind_name p, %p.loc7_6.1 -// CHECK:STDOUT: %.loc7_25: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc7_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_31 [template = i32] +// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_31, %.loc7_25.1 [template = i32] +// CHECK:STDOUT: %.loc7_25.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: @A.%return: ref const i32** = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_16, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %.loc11_19.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.6] // CHECK:STDOUT: %p.loc11_6.1: const (i32*) = param p // CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc11_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_36.1: type = value_of_initializer %int.make_type_32.loc11_33 [template = i32] +// CHECK:STDOUT: %.loc11_36.2: type = converted %int.make_type_32.loc11_33, %.loc11_36.1 [template = i32] +// CHECK:STDOUT: %.loc11_36.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.6] // CHECK:STDOUT: @B.%return: ref const (i32*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A(%p: const i32**) -> const i32** { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 2c091c480686..2ca06769cf0a 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -15,12 +15,14 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: --- collapse.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type const 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 = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type const i32* [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,20 +31,30 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc11_9: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_18: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_19: type = ptr_type const i32* [template = constants.%.3] +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc11_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_15 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_15, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_9.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_18: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_19: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: %p.loc11_6.1: const i32** = param p // CHECK:STDOUT: @F.%p: const i32** = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25: type = const_type const i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_43: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_38: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_38 [template = i32] +// CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_38, %.loc11_32.1 [template = i32] +// CHECK:STDOUT: %.loc11_32.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_25: type = const_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_43: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: @F.%return: ref const i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const i32**) -> const i32** { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index f91af50a4d76..fb079d7034a3 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -18,14 +18,16 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: --- fail_collapse.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type const i32* [template] -// CHECK:STDOUT: %.4: type = ptr_type i32 [template] -// CHECK:STDOUT: %.5: type = ptr_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 = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type const i32* [template] +// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type i32* [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] -// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,19 +36,29 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] { -// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_9: type = const_type const i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_26: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27: type = ptr_type const i32* [template = constants.%.3] +// 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: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11_22, %.loc11_16.1 [template = i32] +// CHECK:STDOUT: %.loc11_16.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9: type = const_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: %p.loc11_6.1: const i32** = param p // CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_37: type = ptr_type i32* [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc11_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_36.1: type = value_of_initializer %int.make_type_32.loc11_33 [template = i32] +// CHECK:STDOUT: %.loc11_36.2: type = converted %int.make_type_32.loc11_33, %.loc11_36.1 [template = i32] +// CHECK:STDOUT: %.loc11_36.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_37: type = ptr_type i32* [template = constants.%.6] // CHECK:STDOUT: @G.%return: ref i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%p: const i32**) -> i32** { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 98a2fc4c4017..0193bb03efcc 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -25,10 +25,12 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_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 = const_type i32 [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type const i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -40,24 +42,38 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: .a_ptr_ref = %a_ptr_ref // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc4: type = const_type i32 [template = constants.%.1] +// 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.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] +// CHECK:STDOUT: %.loc4_11.3: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_12.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_12.2: type = converted %int.make_type_32.loc6, %.loc6_12.1 [template = i32] +// CHECK:STDOUT: %.loc6_12.3: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: %a_ref.var: ref const i32 = var a_ref // CHECK:STDOUT: %a_ref: ref const i32 = bind_name a_ref, %a_ref.var -// CHECK:STDOUT: %.loc7_16: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.3: 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_16.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7, %.loc7_16.1 [template = i32] +// CHECK:STDOUT: %.loc7_16.3: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: %.loc7_25: type = ptr_type const i32 [template = constants.%.3] // CHECK:STDOUT: %a_ptr_ref.var: ref const i32* = var a_ptr_ref // CHECK:STDOUT: %a_ptr_ref: ref const i32* = bind_name a_ptr_ref, %a_ptr_ref.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> const i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init const i32 = call %F.ref() // CHECK:STDOUT: assign file.%a_ref.var, %F.call // CHECK:STDOUT: %a_ref.ref: ref const i32 = name_ref a_ref, file.%a_ref @@ -69,8 +85,11 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const 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: type = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -82,20 +101,30 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .a_ptr = %a_ptr // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+5, unloaded -// CHECK:STDOUT: %import_ref.2: ref const i32 = import_ref ir0, inst+11, loaded -// CHECK:STDOUT: %import_ref.3: ref const i32* = import_ref ir0, inst+19, loaded +// CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+14, unloaded +// CHECK:STDOUT: %import_ref.2: ref const i32 = import_ref ir0, inst+23, loaded +// CHECK:STDOUT: %import_ref.3: ref const i32* = import_ref ir0, inst+35, loaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc6_8: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_17: type = ptr_type const 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.loc6: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %.loc6_8.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_17: type = ptr_type const i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref const i32* = var a // CHECK:STDOUT: %a: ref const i32* = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_12: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_21: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7, %.loc7_12.1 [template = i32] +// CHECK:STDOUT: %.loc7_12.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_21: type = ptr_type const i32 [template = constants.%.3] // CHECK:STDOUT: %a_ptr.var: ref const i32* = var a_ptr // CHECK:STDOUT: %a_ptr: ref const i32* = bind_name a_ptr, %a_ptr.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: %a_ref.ref: ref const i32 = name_ref a_ref, file.%import_ref.2 diff --git a/toolchain/check/testdata/eval/aggregate.carbon b/toolchain/check/testdata/eval/aggregate.carbon index 4dc304e483db..2fca16d6f4b2 100644 --- a/toolchain/check/testdata/eval/aggregate.carbon +++ b/toolchain/check/testdata/eval/aggregate.carbon @@ -15,34 +15,37 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: --- aggregate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: type = struct_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.9: type = struct_type {.c: i32, .b: i32, .a: i32} [template] -// CHECK:STDOUT: %.10: type = struct_type {.b: i32, .a: i32, .c: i32} [template] -// CHECK:STDOUT: %.11: type = ptr_type {.b: i32, .a: i32, .c: i32} [template] -// CHECK:STDOUT: %struct.1: {.b: i32, .a: i32, .c: i32} = struct_value (%.5, %.4, %.8) [template] -// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32, .c: i32} = struct_value (%.4, %.5, %.8) [template] -// CHECK:STDOUT: %.12: type = array_type %.4, i32 [template] -// CHECK:STDOUT: %.13: type = ptr_type [i32; 1] [template] -// CHECK:STDOUT: %.14: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.15: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.16: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.17: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.18: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.19: type = tuple_type (i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.20: type = ptr_type (i32, i32, i32, i32) [template] -// CHECK:STDOUT: %tuple.2: (i32, i32, i32, i32) = tuple_value (%.16, %.17, %.4, %.18) [template] -// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.14) [template] -// CHECK:STDOUT: %.21: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.22: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.8, %.4) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.10: type = struct_type {.c: i32, .b: i32, .a: i32} [template] +// CHECK:STDOUT: %.11: type = struct_type {.b: i32, .a: i32, .c: i32} [template] +// CHECK:STDOUT: %.12: type = ptr_type {.b: i32, .a: i32, .c: i32} [template] +// CHECK:STDOUT: %struct.2: {.b: i32, .a: i32, .c: i32} = struct_value (%.6, %.5, %.9) [template] +// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32, .c: i32} = struct_value (%.5, %.6, %.9) [template] +// CHECK:STDOUT: %.13: type = array_type %.5, i32 [template] +// CHECK:STDOUT: %.14: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %.15: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.16: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.17: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.18: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.19: i32 = int_literal 9 [template] +// CHECK:STDOUT: %.20: type = tuple_type (i32, i32, i32, i32) [template] +// CHECK:STDOUT: %.21: type = ptr_type (i32, i32, i32, i32) [template] +// CHECK:STDOUT: %tuple.2: (i32, i32, i32, i32) = tuple_value (%.17, %.18, %.5, %.19) [template] +// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.15) [template] +// CHECK:STDOUT: %.22: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.23: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %struct.4: {.a: i32, .b: i32} = struct_value (%.9, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,88 +57,146 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: .struct_access = %struct_access // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_26.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_26.2: type = converted %.loc7_26.1, constants.%.2 [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_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_26.1: (type, type) = tuple_literal (%int.make_type_32.loc7_18, %int.make_type_32.loc7_23) +// CHECK:STDOUT: %.loc7_26.2: type = value_of_initializer %int.make_type_32.loc7_18 [template = i32] +// CHECK:STDOUT: %.loc7_26.3: type = converted %int.make_type_32.loc7_18, %.loc7_26.2 [template = i32] +// CHECK:STDOUT: %.loc7_26.4: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] +// CHECK:STDOUT: %.loc7_26.5: type = converted %int.make_type_32.loc7_23, %.loc7_26.4 [template = i32] +// CHECK:STDOUT: %.loc7_26.6: type = converted %.loc7_26.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %tuple_copy.var: ref (i32, i32) = var tuple_copy // CHECK:STDOUT: %tuple_copy: ref (i32, i32) = bind_name tuple_copy, %tuple_copy.var -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %int.make_type_32.loc9_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_32.loc9_23 [template = i32] +// CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_32.loc9_23, %.loc9_23.1 [template = i32] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc9_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_32.1: type = value_of_initializer %int.make_type_32.loc9_32 [template = i32] +// CHECK:STDOUT: %.loc9_32.2: type = converted %int.make_type_32.loc9_32, %.loc9_32.1 [template = i32] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc9_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_41.1: type = value_of_initializer %int.make_type_32.loc9_41 [template = i32] +// CHECK:STDOUT: %.loc9_41.2: type = converted %int.make_type_32.loc9_41, %.loc9_41.1 [template = i32] +// CHECK:STDOUT: %.loc9_44: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.7] // CHECK:STDOUT: %struct_copy.var: ref {.a: i32, .b: i32, .c: i32} = var struct_copy // CHECK:STDOUT: %struct_copy: ref {.a: i32, .b: i32, .c: i32} = bind_name struct_copy, %struct_copy.var -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_25: type = array_type %.loc11_24, i32 [template = constants.%.12] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: 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_24: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %.loc11_25: type = array_type %.loc11_24, i32 [template = constants.%.13] // CHECK:STDOUT: %tuple_index.var: ref [i32; 1] = var tuple_index // CHECK:STDOUT: %tuple_index: ref [i32; 1] = bind_name tuple_index, %tuple_index.var -// CHECK:STDOUT: %.loc13_26: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_27: type = array_type %.loc13_26, i32 [template = constants.%.12] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_26: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_21.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] +// CHECK:STDOUT: %.loc13_27: type = array_type %.loc13_26, i32 [template = constants.%.13] // CHECK:STDOUT: %struct_access.var: ref [i32; 1] = var struct_access // CHECK:STDOUT: %struct_access: ref [i32; 1] = bind_name struct_access, %struct_access.var +// CHECK:STDOUT: %import_ref.14: 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 @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_31: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_34: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_31: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_34: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc7_35.1: (i32, i32) = tuple_literal (%.loc7_31, %.loc7_34) -// CHECK:STDOUT: %.loc7_49.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_49.2: type = converted %.loc7_49.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc7_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc7_46: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_49.1: (type, type) = tuple_literal (%int.make_type_32.loc7_41, %int.make_type_32.loc7_46) +// CHECK:STDOUT: %.loc7_49.2: type = value_of_initializer %int.make_type_32.loc7_41 [template = i32] +// CHECK:STDOUT: %.loc7_49.3: type = converted %int.make_type_32.loc7_41, %.loc7_49.2 [template = i32] +// CHECK:STDOUT: %.loc7_49.4: type = value_of_initializer %int.make_type_32.loc7_46 [template = i32] +// CHECK:STDOUT: %.loc7_49.5: type = converted %int.make_type_32.loc7_46, %.loc7_49.4 [template = i32] +// CHECK:STDOUT: %.loc7_49.6: type = converted %.loc7_49.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %.loc7_35.2: ref i32 = tuple_access file.%tuple_copy.var, element0 -// CHECK:STDOUT: %.loc7_35.3: init i32 = initialize_from %.loc7_31 to %.loc7_35.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_35.3: init i32 = initialize_from %.loc7_31 to %.loc7_35.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_35.4: ref i32 = tuple_access file.%tuple_copy.var, element1 -// CHECK:STDOUT: %.loc7_35.5: init i32 = initialize_from %.loc7_34 to %.loc7_35.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_35.5: init i32 = initialize_from %.loc7_34 to %.loc7_35.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_35.6: init (i32, i32) = tuple_init (%.loc7_35.3, %.loc7_35.5) to file.%tuple_copy.var [template = constants.%tuple.1] // CHECK:STDOUT: %.loc7_50: init (i32, i32) = converted %.loc7_35.1, %.loc7_35.6 [template = constants.%tuple.1] // CHECK:STDOUT: assign file.%tuple_copy.var, %.loc7_50 -// CHECK:STDOUT: %.loc9_54: i32 = int_literal 3 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_62: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_70: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_54: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc9_62: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_70: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc9_71: {.c: i32, .b: i32, .a: i32} = struct_literal (%.loc9_54, %.loc9_62, %.loc9_70) -// CHECK:STDOUT: %.loc9_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.10] -// CHECK:STDOUT: %struct.loc9: {.b: i32, .a: i32, .c: i32} = struct_value (%.loc9_62, %.loc9_70, %.loc9_54) [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_73.1: {.b: i32, .a: i32, .c: i32} = converted %.loc9_71, %struct.loc9 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_73.2: i32 = struct_access %.loc9_73.1, element1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc9_81: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_81.1: type = value_of_initializer %int.make_type_32.loc9_81 [template = i32] +// CHECK:STDOUT: %.loc9_81.2: type = converted %int.make_type_32.loc9_81, %.loc9_81.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc9_90: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_90.1: type = value_of_initializer %int.make_type_32.loc9_90 [template = i32] +// CHECK:STDOUT: %.loc9_90.2: type = converted %int.make_type_32.loc9_90, %.loc9_90.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc9_99: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_99.1: type = value_of_initializer %int.make_type_32.loc9_99 [template = i32] +// CHECK:STDOUT: %.loc9_99.2: type = converted %int.make_type_32.loc9_99, %.loc9_99.1 [template = i32] +// CHECK:STDOUT: %.loc9_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.11] +// CHECK:STDOUT: %struct.loc9: {.b: i32, .a: i32, .c: i32} = struct_value (%.loc9_62, %.loc9_70, %.loc9_54) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_73.1: {.b: i32, .a: i32, .c: i32} = converted %.loc9_71, %struct.loc9 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_73.2: i32 = struct_access %.loc9_73.1, element1 [template = constants.%.5] // CHECK:STDOUT: %.loc9_73.3: ref i32 = struct_access file.%struct_copy.var, element1 -// CHECK:STDOUT: %.loc9_73.4: init i32 = initialize_from %.loc9_73.2 to %.loc9_73.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_73.5: i32 = struct_access %.loc9_73.1, element0 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_73.4: init i32 = initialize_from %.loc9_73.2 to %.loc9_73.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_73.5: i32 = struct_access %.loc9_73.1, element0 [template = constants.%.6] // CHECK:STDOUT: %.loc9_73.6: ref i32 = struct_access file.%struct_copy.var, element0 -// CHECK:STDOUT: %.loc9_73.7: init i32 = initialize_from %.loc9_73.5 to %.loc9_73.6 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_73.8: i32 = struct_access %.loc9_73.1, element2 [template = constants.%.8] +// CHECK:STDOUT: %.loc9_73.7: init i32 = initialize_from %.loc9_73.5 to %.loc9_73.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_73.8: i32 = struct_access %.loc9_73.1, element2 [template = constants.%.9] // CHECK:STDOUT: %.loc9_73.9: ref i32 = struct_access file.%struct_copy.var, element2 -// CHECK:STDOUT: %.loc9_73.10: init i32 = initialize_from %.loc9_73.8 to %.loc9_73.9 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_73.11: init {.a: i32, .b: i32, .c: i32} = struct_init (%.loc9_73.4, %.loc9_73.7, %.loc9_73.10) to file.%struct_copy.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_103: init {.a: i32, .b: i32, .c: i32} = converted %.loc9_73.1, %.loc9_73.11 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_73.10: init i32 = initialize_from %.loc9_73.8 to %.loc9_73.9 [template = constants.%.9] +// CHECK:STDOUT: %.loc9_73.11: init {.a: i32, .b: i32, .c: i32} = struct_init (%.loc9_73.4, %.loc9_73.7, %.loc9_73.10) to file.%struct_copy.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_103: init {.a: i32, .b: i32, .c: i32} = converted %.loc9_73.1, %.loc9_73.11 [template = constants.%struct.3] // CHECK:STDOUT: assign file.%struct_copy.var, %.loc9_103 -// CHECK:STDOUT: %.loc11_30: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc11_30: i32 = int_literal 0 [template = constants.%.15] // CHECK:STDOUT: %.loc11_32.1: (i32,) = tuple_literal (%.loc11_30) -// CHECK:STDOUT: %.loc11_44: i32 = int_literal 5 [template = constants.%.16] -// CHECK:STDOUT: %.loc11_47: i32 = int_literal 7 [template = constants.%.17] -// CHECK:STDOUT: %.loc11_50: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_53: i32 = int_literal 9 [template = constants.%.18] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_44: i32 = int_literal 5 [template = constants.%.17] +// CHECK:STDOUT: %.loc11_47: i32 = int_literal 7 [template = constants.%.18] +// CHECK:STDOUT: %.loc11_50: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_53: i32 = int_literal 9 [template = constants.%.19] // CHECK:STDOUT: %.loc11_54.1: (i32, i32, i32, i32) = tuple_literal (%.loc11_44, %.loc11_47, %.loc11_50, %.loc11_53) -// CHECK:STDOUT: %.loc11_56: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_56: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %tuple: (i32, i32, i32, i32) = tuple_value (%.loc11_44, %.loc11_47, %.loc11_50, %.loc11_53) [template = constants.%tuple.2] // CHECK:STDOUT: %.loc11_54.2: (i32, i32, i32, i32) = converted %.loc11_54.1, %tuple [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc11_57: i32 = tuple_index %.loc11_54.2, %.loc11_56 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_58: type = array_type %.loc11_57, i32 [template = constants.%.12] +// CHECK:STDOUT: %.loc11_57: i32 = tuple_index %.loc11_54.2, %.loc11_56 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_38.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_38.2: type = converted %int.make_type_32.loc11, %.loc11_38.1 [template = i32] +// CHECK:STDOUT: %.loc11_58: type = array_type %.loc11_57, i32 [template = constants.%.13] // CHECK:STDOUT: %.loc11_5: ref [i32; 1] = splice_block file.%tuple_index.var {} -// CHECK:STDOUT: %.loc11_32.2: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc11_32.2: i32 = int_literal 0 [template = constants.%.15] // CHECK:STDOUT: %.loc11_32.3: ref i32 = array_index %.loc11_5, %.loc11_32.2 -// CHECK:STDOUT: %.loc11_32.4: init i32 = initialize_from %.loc11_30 to %.loc11_32.3 [template = constants.%.14] +// CHECK:STDOUT: %.loc11_32.4: init i32 = initialize_from %.loc11_30 to %.loc11_32.3 [template = constants.%.15] // CHECK:STDOUT: %.loc11_32.5: init [i32; 1] = array_init (%.loc11_32.4) to %.loc11_5 [template = constants.%array] // CHECK:STDOUT: %.loc11_34: init [i32; 1] = converted %.loc11_32.1, %.loc11_32.5 [template = constants.%array] // CHECK:STDOUT: assign file.%tuple_index.var, %.loc11_34 -// CHECK:STDOUT: %.loc13_32: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc13_32: i32 = int_literal 0 [template = constants.%.15] // CHECK:STDOUT: %.loc13_34.1: (i32,) = tuple_literal (%.loc13_32) -// CHECK:STDOUT: %.loc13_51: i32 = int_literal 3 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_59: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_51: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_59: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc13_60.1: {.a: i32, .b: i32} = struct_literal (%.loc13_51, %.loc13_59) -// CHECK:STDOUT: %struct.loc13: {.a: i32, .b: i32} = struct_value (%.loc13_51, %.loc13_59) [template = constants.%struct.3] -// CHECK:STDOUT: %.loc13_60.2: {.a: i32, .b: i32} = converted %.loc13_60.1, %struct.loc13 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc13_61: i32 = struct_access %.loc13_60.2, element1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_63: type = array_type %.loc13_61, i32 [template = constants.%.12] +// CHECK:STDOUT: %struct.loc13: {.a: i32, .b: i32} = struct_value (%.loc13_51, %.loc13_59) [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_60.2: {.a: i32, .b: i32} = converted %.loc13_60.1, %struct.loc13 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_61: i32 = struct_access %.loc13_60.2, element1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_40.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_40.2: type = converted %int.make_type_32.loc13, %.loc13_40.1 [template = i32] +// CHECK:STDOUT: %.loc13_63: type = array_type %.loc13_61, i32 [template = constants.%.13] // CHECK:STDOUT: %.loc13_5: ref [i32; 1] = splice_block file.%struct_access.var {} -// CHECK:STDOUT: %.loc13_34.2: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc13_34.2: i32 = int_literal 0 [template = constants.%.15] // CHECK:STDOUT: %.loc13_34.3: ref i32 = array_index %.loc13_5, %.loc13_34.2 -// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_32 to %.loc13_34.3 [template = constants.%.14] +// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_32 to %.loc13_34.3 [template = constants.%.15] // CHECK:STDOUT: %.loc13_34.5: init [i32; 1] = array_init (%.loc13_34.4) to %.loc13_5 [template = constants.%array] // CHECK:STDOUT: %.loc13_36: init [i32; 1] = converted %.loc13_34.1, %.loc13_34.5 [template = constants.%array] // CHECK:STDOUT: assign file.%struct_access.var, %.loc13_36 diff --git a/toolchain/check/testdata/eval/fail_aggregate.carbon b/toolchain/check/testdata/eval/fail_aggregate.carbon index a0710e827042..b47b3f185d1a 100644 --- a/toolchain/check/testdata/eval/fail_aggregate.carbon +++ b/toolchain/check/testdata/eval/fail_aggregate.carbon @@ -14,21 +14,24 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: --- fail_aggregate.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 0 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.9: type = tuple_type (i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.11: type = array_type %.10, i32 [template] -// CHECK:STDOUT: %.12: type = ptr_type [i32; 4] [template] -// CHECK:STDOUT: %.13: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 3 [template] -// CHECK:STDOUT: %array: [i32; 4] = tuple_value (%.6, %.7, %.1, %.8) [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 0 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 9 [template] +// CHECK:STDOUT: %.10: type = tuple_type (i32, i32, i32, i32) [template] +// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.12: type = array_type %.11, i32 [template] +// CHECK:STDOUT: %.13: type = ptr_type [i32; 4] [template] +// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.15: i32 = int_literal 3 [template] +// CHECK:STDOUT: %array: [i32; 4] = tuple_value (%.7, %.8, %.2, %.9) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -37,39 +40,51 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: .array_index = %array_index // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc12_24: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_25: type = array_type %.loc12_24, 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: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_24: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32, %.loc12_19.1 [template = i32] +// CHECK:STDOUT: %.loc12_25: type = array_type %.loc12_24, i32 [template = constants.%.3] // CHECK:STDOUT: %array_index.var: ref [i32; 1] = var array_index // CHECK:STDOUT: %array_index: ref [i32; 1] = bind_name array_index, %array_index.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // 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: %.loc12_30: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_30: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc12_32: (i32,) = tuple_literal (%.loc12_30) -// CHECK:STDOUT: %.loc12_45: i32 = int_literal 5 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_48: i32 = int_literal 7 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_51: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_54: i32 = int_literal 9 [template = constants.%.8] +// CHECK:STDOUT: %int.make_type_32.loc12_38: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_45: i32 = int_literal 5 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_48: i32 = int_literal 7 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_51: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_54: i32 = int_literal 9 [template = constants.%.9] // CHECK:STDOUT: %.loc12_55.1: (i32, i32, i32, i32) = tuple_literal (%.loc12_45, %.loc12_48, %.loc12_51, %.loc12_54) -// CHECK:STDOUT: %.loc12_66: i32 = int_literal 4 [template = constants.%.10] -// CHECK:STDOUT: %.loc12_67: type = array_type %.loc12_66, i32 [template = constants.%.11] +// CHECK:STDOUT: %int.make_type_32.loc12_61: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_66: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: %.loc12_61.1: type = value_of_initializer %int.make_type_32.loc12_61 [template = i32] +// CHECK:STDOUT: %.loc12_61.2: type = converted %int.make_type_32.loc12_61, %.loc12_61.1 [template = i32] +// CHECK:STDOUT: %.loc12_67: type = array_type %.loc12_66, i32 [template = constants.%.12] // CHECK:STDOUT: %.loc12_55.2: ref [i32; 4] = temporary_storage -// CHECK:STDOUT: %.loc12_55.3: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_55.3: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc12_55.4: ref i32 = array_index %.loc12_55.2, %.loc12_55.3 -// CHECK:STDOUT: %.loc12_55.5: init i32 = initialize_from %.loc12_45 to %.loc12_55.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_55.6: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_55.5: init i32 = initialize_from %.loc12_45 to %.loc12_55.4 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_55.6: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc12_55.7: ref i32 = array_index %.loc12_55.2, %.loc12_55.6 -// CHECK:STDOUT: %.loc12_55.8: init i32 = initialize_from %.loc12_48 to %.loc12_55.7 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_55.9: i32 = int_literal 2 [template = constants.%.13] +// CHECK:STDOUT: %.loc12_55.8: init i32 = initialize_from %.loc12_48 to %.loc12_55.7 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_55.9: i32 = int_literal 2 [template = constants.%.14] // CHECK:STDOUT: %.loc12_55.10: ref i32 = array_index %.loc12_55.2, %.loc12_55.9 -// CHECK:STDOUT: %.loc12_55.11: init i32 = initialize_from %.loc12_51 to %.loc12_55.10 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_55.12: i32 = int_literal 3 [template = constants.%.14] +// CHECK:STDOUT: %.loc12_55.11: init i32 = initialize_from %.loc12_51 to %.loc12_55.10 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_55.12: i32 = int_literal 3 [template = constants.%.15] // CHECK:STDOUT: %.loc12_55.13: ref i32 = array_index %.loc12_55.2, %.loc12_55.12 -// CHECK:STDOUT: %.loc12_55.14: init i32 = initialize_from %.loc12_54 to %.loc12_55.13 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_55.14: init i32 = initialize_from %.loc12_54 to %.loc12_55.13 [template = constants.%.9] // CHECK:STDOUT: %.loc12_55.15: init [i32; 4] = array_init (%.loc12_55.5, %.loc12_55.8, %.loc12_55.11, %.loc12_55.14) to %.loc12_55.2 [template = constants.%array] // CHECK:STDOUT: %.loc12_57.1: init [i32; 4] = converted %.loc12_55.1, %.loc12_55.15 [template = constants.%array] -// CHECK:STDOUT: %.loc12_70: i32 = int_literal 2 [template = constants.%.13] +// CHECK:STDOUT: %.loc12_70: i32 = int_literal 2 [template = constants.%.14] // CHECK:STDOUT: %.loc12_57.2: ref [i32; 4] = temporary %.loc12_55.2, %.loc12_57.1 // CHECK:STDOUT: %.loc12_71.1: ref i32 = array_index %.loc12_57.2, %.loc12_70 // CHECK:STDOUT: %.loc12_71.2: i32 = bind_value %.loc12_71.1 diff --git a/toolchain/check/testdata/eval/fail_symbolic.carbon b/toolchain/check/testdata/eval/fail_symbolic.carbon index bd42f417aa12..3fe12630c50b 100644 --- a/toolchain/check/testdata/eval/fail_symbolic.carbon +++ b/toolchain/check/testdata/eval/fail_symbolic.carbon @@ -15,10 +15,12 @@ fn G(N:! i32) { // CHECK:STDOUT: --- fail_symbolic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// 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: %N: i32 = bind_symbolic_name N 0 [symbolic] // 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.2: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,16 +29,26 @@ fn G(N:! i32) { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %N.loc8_6.1: i32 = param N // CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N 0, %N.loc8_6.1 [symbolic = constants.%N] // CHECK:STDOUT: } +// 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 @G(%N: i32) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %N.ref: i32 = name_ref N, %N [symbolic = constants.%N] -// CHECK:STDOUT: %.loc12: type = array_type %N.ref, i32 [template = ] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32, %.loc12_11.1 [template = i32] +// CHECK:STDOUT: %.loc12_17: type = array_type %N.ref, i32 [template = ] // CHECK:STDOUT: %k.var: ref = var k // CHECK:STDOUT: %k: ref = bind_name k, %k.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index 0de81dc8dc7d..b7bbdf94aa49 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -19,16 +19,18 @@ fn H() -> i32 { // CHECK:STDOUT: --- in_place_tuple_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (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: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %struct.4: H = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -40,39 +42,69 @@ fn H() -> i32 { // CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_20.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.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: %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: %.loc7_20.1: (type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17) +// CHECK:STDOUT: %.loc7_20.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] +// CHECK:STDOUT: %.loc7_20.3: type = converted %int.make_type_32.loc7_12, %.loc7_20.2 [template = i32] +// CHECK:STDOUT: %.loc7_20.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] +// CHECK:STDOUT: %.loc7_20.5: type = converted %int.make_type_32.loc7_17, %.loc7_20.4 [template = i32] +// CHECK:STDOUT: %.loc7_20.6: type = converted %.loc7_20.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32, i32) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc9_20.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc9_20.2: type = converted %.loc9_20.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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.loc9_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc9_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_20.1: (type, type) = tuple_literal (%int.make_type_32.loc9_12, %int.make_type_32.loc9_17) +// CHECK:STDOUT: %.loc9_20.2: type = value_of_initializer %int.make_type_32.loc9_12 [template = i32] +// CHECK:STDOUT: %.loc9_20.3: type = converted %int.make_type_32.loc9_12, %.loc9_20.2 [template = i32] +// CHECK:STDOUT: %.loc9_20.4: type = value_of_initializer %int.make_type_32.loc9_17 [template = i32] +// CHECK:STDOUT: %.loc9_20.5: type = converted %int.make_type_32.loc9_17, %.loc9_20.4 [template = i32] +// CHECK:STDOUT: %.loc9_20.6: type = converted %.loc9_20.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] { +// 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: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] // CHECK:STDOUT: @H.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_19.2: type = converted %.loc10_19.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_19.1: (type, type) = tuple_literal (%int.make_type_32.loc10_11, %int.make_type_32.loc10_16) +// CHECK:STDOUT: %.loc10_19.2: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] +// CHECK:STDOUT: %.loc10_19.3: type = converted %int.make_type_32.loc10_11, %.loc10_19.2 [template = i32] +// CHECK:STDOUT: %.loc10_19.4: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] +// CHECK:STDOUT: %.loc10_19.5: type = converted %int.make_type_32.loc10_16, %.loc10_19.4 [template = i32] +// CHECK:STDOUT: %.loc10_19.6: type = converted %.loc10_19.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref (i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc10: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_7: ref (i32, i32) = splice_block %v.var {} // CHECK:STDOUT: %F.call.loc10: init (i32, i32) = call %F.ref.loc10() to %.loc10_7 // CHECK:STDOUT: assign %v.var, %F.call.loc10 // CHECK:STDOUT: %v.ref: ref (i32, i32) = name_ref v, %v -// CHECK:STDOUT: %F.ref.loc11: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc11: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc11: ref (i32, i32) = splice_block %v.ref {} // CHECK:STDOUT: %F.call.loc11: init (i32, i32) = call %F.ref.loc11() to %.loc11 // CHECK:STDOUT: assign %v.ref, %F.call.loc11 -// CHECK:STDOUT: %F.ref.loc12: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc12: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc9: ref (i32, i32) = splice_block %return {} // CHECK:STDOUT: %F.call.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 // CHECK:STDOUT: return %F.call.loc12 to %return @@ -80,7 +112,7 @@ fn H() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc16_11.1: ref (i32, i32) = temporary_storage // CHECK:STDOUT: %G.call: init (i32, i32) = call %G.ref() to %.loc16_11.1 // CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 [template = constants.%.5] diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index fea1eeb81df1..0e0c9346eb5c 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -11,9 +11,11 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: --- call.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] @@ -28,21 +30,39 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: .arr = %arr // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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 // 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_20: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.4] +// 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_25: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // 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: diff --git a/toolchain/check/testdata/function/builtin/definition.carbon b/toolchain/check/testdata/function/builtin/definition.carbon index 2285333d459e..b745bdf3ac1f 100644 --- a/toolchain/check/testdata/function/builtin/definition.carbon +++ b/toolchain/check/testdata/function/builtin/definition.carbon @@ -9,9 +9,11 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: --- definition.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: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,14 +22,28 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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 // CHECK:STDOUT: } // 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: diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index 45b0d0caf5e8..9854caca52ac 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -36,13 +36,15 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: --- fail_redefined.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,50 +55,124 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: .C = %C.decl.loc27 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.1] { +// 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: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] // CHECK:STDOUT: %n.loc7_6.1: i32 = param n // CHECK:STDOUT: %n.loc7_6.2: i32 = bind_name n, %n.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] +// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] // CHECK:STDOUT: %m.loc7_14.1: i32 = param m // CHECK:STDOUT: %m.loc7_14.2: i32 = bind_name m, %m.loc7_14.1 +// CHECK:STDOUT: %int.make_type_32.loc7_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_25 [template = i32] +// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_25, %.loc7_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.1] { +// 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: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc15_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15_9 [template = i32] +// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15_9, %.loc15_9.1 [template = i32] // CHECK:STDOUT: %n.loc15_6.1: i32 = param n // CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc15_6.1 +// CHECK:STDOUT: %int.make_type_32.loc15_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_17.1: type = value_of_initializer %int.make_type_32.loc15_17 [template = i32] +// CHECK:STDOUT: %.loc15_17.2: type = converted %int.make_type_32.loc15_17, %.loc15_17.1 [template = i32] // CHECK:STDOUT: %m.loc15_14.1: i32 = param m // CHECK:STDOUT: @A.%m: i32 = bind_name m, %m.loc15_14.1 +// CHECK:STDOUT: %int.make_type_32.loc15_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_25.1: type = value_of_initializer %int.make_type_32.loc15_25 [template = i32] +// CHECK:STDOUT: %.loc15_25.2: type = converted %int.make_type_32.loc15_25, %.loc15_25.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc17_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_9.1: type = value_of_initializer %int.make_type_32.loc17_9 [template = i32] +// CHECK:STDOUT: %.loc17_9.2: type = converted %int.make_type_32.loc17_9, %.loc17_9.1 [template = i32] // CHECK:STDOUT: %n.loc17_6.1: i32 = param n // CHECK:STDOUT: %n.loc17_6.2: i32 = bind_name n, %n.loc17_6.1 +// CHECK:STDOUT: %int.make_type_32.loc17_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_17.1: type = value_of_initializer %int.make_type_32.loc17_17 [template = i32] +// CHECK:STDOUT: %.loc17_17.2: type = converted %int.make_type_32.loc17_17, %.loc17_17.1 [template = i32] // CHECK:STDOUT: %m.loc17_14.1: i32 = param m // CHECK:STDOUT: %m.loc17_14.2: i32 = bind_name m, %m.loc17_14.1 +// CHECK:STDOUT: %int.make_type_32.loc17_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_25.1: type = value_of_initializer %int.make_type_32.loc17_25 [template = i32] +// CHECK:STDOUT: %.loc17_25.2: type = converted %int.make_type_32.loc17_25, %.loc17_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc17: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc25_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_9.1: type = value_of_initializer %int.make_type_32.loc25_9 [template = i32] +// CHECK:STDOUT: %.loc25_9.2: type = converted %int.make_type_32.loc25_9, %.loc25_9.1 [template = i32] // CHECK:STDOUT: %n.loc25_6.1: i32 = param n // CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc25_6.1 +// CHECK:STDOUT: %int.make_type_32.loc25_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_17.1: type = value_of_initializer %int.make_type_32.loc25_17 [template = i32] +// CHECK:STDOUT: %.loc25_17.2: type = converted %int.make_type_32.loc25_17, %.loc25_17.1 [template = i32] // CHECK:STDOUT: %m.loc25_14.1: i32 = param m // CHECK:STDOUT: @B.%m: i32 = bind_name m, %m.loc25_14.1 +// CHECK:STDOUT: %int.make_type_32.loc25_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_25.1: type = value_of_initializer %int.make_type_32.loc25_25 [template = i32] +// CHECK:STDOUT: %.loc25_25.2: type = converted %int.make_type_32.loc25_25, %.loc25_25.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc27: C = fn_decl @C [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %C.decl.loc27: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc27_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_9.1: type = value_of_initializer %int.make_type_32.loc27_9 [template = i32] +// CHECK:STDOUT: %.loc27_9.2: type = converted %int.make_type_32.loc27_9, %.loc27_9.1 [template = i32] // CHECK:STDOUT: %n.loc27_6.1: i32 = param n // CHECK:STDOUT: %n.loc27_6.2: i32 = bind_name n, %n.loc27_6.1 +// CHECK:STDOUT: %int.make_type_32.loc27_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_17.1: type = value_of_initializer %int.make_type_32.loc27_17 [template = i32] +// CHECK:STDOUT: %.loc27_17.2: type = converted %int.make_type_32.loc27_17, %.loc27_17.1 [template = i32] // CHECK:STDOUT: %m.loc27_14.1: i32 = param m // CHECK:STDOUT: %m.loc27_14.2: i32 = bind_name m, %m.loc27_14.1 +// CHECK:STDOUT: %int.make_type_32.loc27_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_25.1: type = value_of_initializer %int.make_type_32.loc27_25 [template = i32] +// CHECK:STDOUT: %.loc27_25.2: type = converted %int.make_type_32.loc27_25, %.loc27_25.1 [template = i32] // CHECK:STDOUT: %return.var.loc27: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc34: C = fn_decl @C [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %C.decl.loc34: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc34_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_9.1: type = value_of_initializer %int.make_type_32.loc34_9 [template = i32] +// CHECK:STDOUT: %.loc34_9.2: type = converted %int.make_type_32.loc34_9, %.loc34_9.1 [template = i32] // CHECK:STDOUT: %n.loc34_6.1: i32 = param n // CHECK:STDOUT: @C.%n: i32 = bind_name n, %n.loc34_6.1 +// CHECK:STDOUT: %int.make_type_32.loc34_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_17.1: type = value_of_initializer %int.make_type_32.loc34_17 [template = i32] +// CHECK:STDOUT: %.loc34_17.2: type = converted %int.make_type_32.loc34_17, %.loc34_17.1 [template = i32] // CHECK:STDOUT: %m.loc34_14.1: i32 = param m // CHECK:STDOUT: @C.%m: i32 = bind_name m, %m.loc34_14.1 +// CHECK:STDOUT: %int.make_type_32.loc34_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_25.1: type = value_of_initializer %int.make_type_32.loc34_25 [template = i32] +// CHECK:STDOUT: %.loc34_25.2: type = converted %int.make_type_32.loc34_25, %.loc34_25.1 [template = i32] // CHECK:STDOUT: @C.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A(%n: i32, %m: i32) -> i32 = "int.sadd" { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index 3305c009e729..5c251e8f9383 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -24,11 +24,13 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] -// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.3) [template] // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.7: = bound_method %.6, %struct.2 [template] +// CHECK:STDOUT: %.7: = bound_method %.6, %struct.3 [template] // CHECK:STDOUT: %.8: i32 = int_literal 2 [template] // CHECK:STDOUT: %.9: i32 = int_literal 3 [template] // CHECK:STDOUT: %.10: type = array_type %.9, i32 [template] @@ -43,16 +45,27 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_6.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_6.2: type = converted %int.make_type_32.loc11, %.loc11_6.1 [template = i32] // CHECK:STDOUT: %I.ref.loc11: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } +// 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: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] // CHECK:STDOUT: %.loc15_16: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8_40 [template = constants.%.4] -// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] // CHECK:STDOUT: %.loc15_17: = bound_method %.loc15_16, %.1 [template = constants.%.7] // CHECK:STDOUT: %.loc15_24: i32 = int_literal 2 [template = constants.%.8] // CHECK:STDOUT: %int.sadd: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.9] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] // CHECK:STDOUT: %.loc15_26: type = array_type %int.sadd, i32 [template = constants.%.10] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var @@ -85,11 +98,20 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc12_14: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_14.1: type = value_of_initializer %int.make_type_32.loc12_14 [template = i32] +// CHECK:STDOUT: %.loc12_14.2: type = converted %int.make_type_32.loc12_14, %.loc12_14.1 [template = i32] // CHECK:STDOUT: %self.loc12_8.1: i32 = param self // CHECK:STDOUT: %self.loc12_8.2: i32 = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %int.make_type_32.loc12_26: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_26.1: type = value_of_initializer %int.make_type_32.loc12_26 [template = i32] +// CHECK:STDOUT: %.loc12_26.2: type = converted %int.make_type_32.loc12_26, %.loc12_26.1 [template = i32] // CHECK:STDOUT: %other.loc12_19.1: i32 = param other // CHECK:STDOUT: %other.loc12_19.2: i32 = bind_name other, %other.loc12_19.1 +// CHECK:STDOUT: %int.make_type_32.loc12_34: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_34.1: type = value_of_initializer %int.make_type_32.loc12_34 [template = i32] +// CHECK:STDOUT: %.loc12_34.2: type = converted %int.make_type_32.loc12_34, %.loc12_34.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] @@ -101,5 +123,7 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1[@I.%self.loc8_8.2: Self](@I.%other.loc8_20.2: Self) -> Self; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.2[@impl.%self.loc12_8.2: i32](@impl.%other.loc12_19.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon index 05773a4335ef..c17d3676f90d 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon @@ -84,24 +84,26 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: --- user.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = interface_type @Add [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 = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Op = struct_value () [template] -// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %struct.2: Op = struct_value () [template] -// CHECK:STDOUT: %.3: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness (%struct.2) [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: %.6: type = assoc_entity_type @Add, Op [template] -// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.6 [template] -// CHECK:STDOUT: %.8: = bound_method %.4, %struct.1 [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %.8: = bound_method %.4, %struct.2 [template] // CHECK:STDOUT: %.9: i32 = int_literal 3 [template] // CHECK:STDOUT: %.10: type = array_type %.9, i32 [template] // CHECK:STDOUT: %.11: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: %.12: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.13: = bound_method %.9, %struct.1 [template] +// CHECK:STDOUT: %.13: = bound_method %.9, %struct.2 [template] // CHECK:STDOUT: %.14: i32 = int_literal 7 [template] // CHECK:STDOUT: %.15: type = tuple_type (i32, i32, i32) [template] // CHECK:STDOUT: %.16: i32 = int_literal 0 [template] @@ -114,36 +116,44 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: .arr = %arr // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+6, loaded [template = constants.%.1] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+8, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+28, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.4: Op = import_ref ir1, inst+24, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+6, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+8, unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+28, loaded [template = constants.%.7] +// CHECK:STDOUT: %import_ref.5: Op = import_ref ir1, inst+24, loaded [template = constants.%struct.3] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_6.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_6.2: type = converted %int.make_type_32.loc6, %.loc6_6.1 [template = i32] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.1] +// CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.2 [template = constants.%.2] // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_20: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %import_ref.5: type = import_ref ir1, inst+6, loaded [template = constants.%.1] -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+24, unloaded -// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: type = import_ref ir1, inst+6, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+24, unloaded +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_18: = bound_method %.loc10_16, %.1 [template = constants.%.8] // CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_18(%.loc10_16, %.loc10_20) [template = constants.%.9] +// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10, %.loc10_11.1 [template = i32] // CHECK:STDOUT: %.loc10_21: type = array_type %int.sadd, i32 [template = constants.%.10] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var -// CHECK:STDOUT: %import_ref.7: type = import_ref ir1, inst+6, loaded [template = constants.%.1] +// CHECK:STDOUT: %import_ref.9: type = import_ref ir1, inst+6, loaded [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = file.%import_ref.2 -// CHECK:STDOUT: .Op = file.%import_ref.3 -// CHECK:STDOUT: witness = (file.%import_ref.4) +// CHECK:STDOUT: .Self = file.%import_ref.3 +// CHECK:STDOUT: .Op = file.%import_ref.4 +// CHECK:STDOUT: witness = (file.%import_ref.5) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Add { -// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc7_15: type = name_ref Self, i32 [template = i32] // CHECK:STDOUT: %self.loc7_9.1: i32 = param self // CHECK:STDOUT: %self.loc7_9.2: i32 = bind_name self, %self.loc7_9.1 @@ -160,6 +170,8 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@impl.%self.loc7_9.2: i32](@impl.%other.loc7_21.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; @@ -170,7 +182,7 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %.loc10_29: i32 = int_literal 4 [template = constants.%.12] // CHECK:STDOUT: %.loc10_32: i32 = int_literal 3 [template = constants.%.9] // CHECK:STDOUT: %.loc10_36: i32 = int_literal 4 [template = constants.%.12] -// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_34: = bound_method %.loc10_32, %.1 [template = constants.%.13] // CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_34(%.loc10_32, %.loc10_36) [template = constants.%.14] // CHECK:STDOUT: %.loc10_37.1: (i32, i32, i32) = tuple_literal (%.loc10_26, %.loc10_29, %int.sadd) diff --git a/toolchain/check/testdata/function/builtin/import.carbon b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon similarity index 63% rename from toolchain/check/testdata/function/builtin/import.carbon rename to toolchain/check/testdata/function/builtin/no_prelude/import.carbon index d307eb769290..f4d2ff1eb628 100644 --- a/toolchain/check/testdata/function/builtin/import.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon @@ -8,6 +8,7 @@ package Core library "test"; +fn Int32() -> type = "int.make_type_32"; fn TestAdd(a: i32, b: i32) -> i32 = "int.sadd"; // --- use.carbon @@ -19,32 +20,51 @@ var arr: [i32; Core.TestAdd(1, 2)] = (1, 2, 3); // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TestAdd: type = fn_type @TestAdd [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: TestAdd = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TestAdd: type = fn_type @TestAdd [template] +// CHECK:STDOUT: %struct.2: TestAdd = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Int32 = %Int32.decl // CHECK:STDOUT: .TestAdd = %TestAdd.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %TestAdd.decl: TestAdd = fn_decl @TestAdd [template = constants.%struct] { -// CHECK:STDOUT: %a.loc4_12.1: i32 = param a -// CHECK:STDOUT: @TestAdd.%a: i32 = bind_name a, %a.loc4_12.1 -// CHECK:STDOUT: %b.loc4_20.1: i32 = param b -// CHECK:STDOUT: @TestAdd.%b: i32 = bind_name b, %b.loc4_20.1 +// CHECK:STDOUT: %Int32.decl: Int32 = fn_decl @Int32 [template = constants.%struct.1] { +// CHECK:STDOUT: @Int32.%return: ref type = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %TestAdd.decl: TestAdd = fn_decl @TestAdd [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc5_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_15.1: type = value_of_initializer %int.make_type_32.loc5_15 [template = i32] +// CHECK:STDOUT: %.loc5_15.2: type = converted %int.make_type_32.loc5_15, %.loc5_15.1 [template = i32] +// CHECK:STDOUT: %a.loc5_12.1: i32 = param a +// CHECK:STDOUT: @TestAdd.%a: i32 = bind_name a, %a.loc5_12.1 +// CHECK:STDOUT: %int.make_type_32.loc5_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_23.1: type = value_of_initializer %int.make_type_32.loc5_23 [template = i32] +// CHECK:STDOUT: %.loc5_23.2: type = converted %int.make_type_32.loc5_23, %.loc5_23.1 [template = i32] +// CHECK:STDOUT: %b.loc5_20.1: i32 = param b +// CHECK:STDOUT: @TestAdd.%b: i32 = bind_name b, %b.loc5_20.1 +// CHECK:STDOUT: %int.make_type_32.loc5_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_31.1: type = value_of_initializer %int.make_type_32.loc5_31 [template = i32] +// CHECK:STDOUT: %.loc5_31.2: type = converted %int.make_type_32.loc5_31, %.loc5_31.1 [template = i32] // CHECK:STDOUT: @TestAdd.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestAdd(%a: i32, %b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: --- use.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %TestAdd: type = fn_type @TestAdd [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: TestAdd = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %TestAdd: type = fn_type @TestAdd [template] +// CHECK:STDOUT: %struct.2: TestAdd = 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] @@ -61,17 +81,23 @@ var arr: [i32; Core.TestAdd(1, 2)] = (1, 2, 3); // CHECK:STDOUT: .arr = %arr // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %import_ref: TestAdd = import_ref ir2, inst+6, loaded [template = constants.%struct] -// CHECK:STDOUT: %TestAdd.ref: TestAdd = name_ref TestAdd, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: TestAdd = import_ref ir1, inst+20, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %TestAdd.ref: TestAdd = name_ref TestAdd, %import_ref.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc4_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc4_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.sadd: init i32 = call %TestAdd.ref(%.loc4_29, %.loc4_32) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] // CHECK:STDOUT: %.loc4_34: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestAdd(%a: i32, %b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 28466c7e6ad7..9a638edcc4f9 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -16,7 +16,9 @@ fn Run() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = ptr_type String [template] // CHECK:STDOUT: %.3: String = string_literal "hello" [template] // CHECK:STDOUT: } @@ -27,15 +29,21 @@ fn Run() { // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc11: String = string_literal "hello" [template = constants.%.3] +// CHECK:STDOUT: %.loc11_16: String = string_literal "hello" [template = constants.%.3] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 93bcd7408305..9b6c2d7d8caa 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -66,12 +66,14 @@ fn Main() { // CHECK:STDOUT: %Run0: type = fn_type @Run0 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: Run0 = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %Run1: type = fn_type @Run1 [template] -// CHECK:STDOUT: %struct.2: Run1 = struct_value () [template] +// CHECK:STDOUT: %struct.3: Run1 = struct_value () [template] // CHECK:STDOUT: %Run2: type = fn_type @Run2 [template] -// CHECK:STDOUT: %struct.3: Run2 = struct_value () [template] +// CHECK:STDOUT: %struct.4: Run2 = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.4: Main = struct_value () [template] +// CHECK:STDOUT: %struct.5: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -86,17 +88,29 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Run0.decl: Run0 = fn_decl @Run0 [template = constants.%struct.1] {} -// CHECK:STDOUT: %Run1.decl: Run1 = fn_decl @Run1 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Run1.decl: Run1 = fn_decl @Run1 [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_12.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_12.2: type = converted %int.make_type_32.loc8, %.loc8_12.1 [template = i32] // CHECK:STDOUT: %a.loc8_9.1: i32 = param a // CHECK:STDOUT: @Run1.%a: i32 = bind_name a, %a.loc8_9.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Run2.decl: Run2 = fn_decl @Run2 [template = constants.%struct.3] { +// 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: %Run2.decl: Run2 = fn_decl @Run2 [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc9_12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32.loc9_12 [template = i32] +// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32.loc9_12, %.loc9_12.1 [template = i32] // CHECK:STDOUT: %a.loc9_9.1: i32 = param a // CHECK:STDOUT: @Run2.%a: i32 = bind_name a, %a.loc9_9.1 +// CHECK:STDOUT: %int.make_type_32.loc9_20: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_20.1: type = value_of_initializer %int.make_type_32.loc9_20 [template = i32] +// CHECK:STDOUT: %.loc9_20.2: type = converted %int.make_type_32.loc9_20, %.loc9_20.1 [template = i32] // CHECK:STDOUT: %b.loc9_17.1: i32 = param b // CHECK:STDOUT: @Run2.%b: i32 = bind_name b, %b.loc9_17.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.4] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run0() { @@ -104,6 +118,8 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Run1(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -123,15 +139,15 @@ fn Main() { // CHECK:STDOUT: %.loc27_8: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc27_11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Run0.call.loc27: init () = call %Run0.ref.loc27() [template = ] -// CHECK:STDOUT: %Run1.ref.loc36: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Run1.ref.loc36: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] // CHECK:STDOUT: %Run1.call.loc36: init () = call %Run1.ref.loc36() [template = ] -// CHECK:STDOUT: %Run1.ref.loc44: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Run1.ref.loc44: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc44_8: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc44_11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Run1.call.loc44: init () = call %Run1.ref.loc44() [template = ] -// CHECK:STDOUT: %Run2.ref.loc53: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Run2.ref.loc53: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] // CHECK:STDOUT: %Run2.call.loc53: init () = call %Run2.ref.loc53() [template = ] -// CHECK:STDOUT: %Run2.ref.loc60: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Run2.ref.loc60: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc60: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %Run2.call.loc60: init () = call %Run2.ref.loc60() [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 845537ad9bf5..d7a35f4362ca 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -19,11 +19,13 @@ fn F() { // CHECK:STDOUT: --- fail_param_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.2: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -34,13 +36,19 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// 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: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -48,7 +56,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc16: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: %G.call: init () = call %G.ref() [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index d1b1a32ec0d9..53e0ffe32b5e 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -16,12 +16,17 @@ fn Run() { // CHECK:STDOUT: --- fail_return_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] // CHECK:STDOUT: %Foo: type = fn_type @Foo [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 1 [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 1 [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: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.4: Int32 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,25 +36,38 @@ fn Run() { // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] // CHECK:STDOUT: @Foo.%return: ref f64 = var // 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.4] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: f64 = float_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc7: f64 = float_literal 1 [template = constants.%.3] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32, %.loc13_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %Foo.call: init f64 = call %Foo.ref() // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 5bede83e8db3..aff76a612a44 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -15,11 +15,13 @@ fn Main() { // CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Echo: type = fn_type @Echo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Echo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Echo: type = fn_type @Echo [template] +// CHECK:STDOUT: %struct.2: Echo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -30,14 +32,25 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { +// 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: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] +// 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: %a.loc7_9.1: i32 = param a // CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1 +// CHECK:STDOUT: %int.make_type_32.loc7_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %int.make_type_32.loc7_20 [template = i32] +// CHECK:STDOUT: %.loc7_20.2: type = converted %int.make_type_32.loc7_20, %.loc7_20.1 [template = i32] // CHECK:STDOUT: @Echo.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} +// CHECK:STDOUT: %import_ref.3: 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 @Echo(%a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a @@ -46,11 +59,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12) +// CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12_21) // CHECK:STDOUT: assign %b.var, %Echo.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index 89f99bef88a2..79ce4549f5ec 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -15,11 +15,13 @@ fn Main() { // CHECK:STDOUT: --- more_param_ir.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] @@ -35,15 +37,26 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// 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: %Foo.decl: Foo = fn_decl @Foo [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: @Foo.%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: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} +// CHECK:STDOUT: %import_ref.3: 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 @Foo(%a: i32, %b: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -51,8 +64,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_15.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_15.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_15.1: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc10_15.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_15.3: type = converted %int.make_type_32, %.loc10_15.2 [template = i32] +// CHECK:STDOUT: %.loc10_15.4: type = converted %.loc10_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var // CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.4] @@ -60,7 +76,7 @@ fn Main() { // CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var [template = constants.%tuple] // CHECK:STDOUT: %.loc10_23: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 [template = constants.%tuple] // CHECK:STDOUT: assign %x.var, %.loc10_23 -// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x // CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9 diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index 9990434a0c41..b8312447e93f 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -13,11 +13,13 @@ fn Main() { // CHECK:STDOUT: --- params_one.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -28,13 +30,19 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -42,7 +50,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 0432976def61..2d793f2477c0 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -14,11 +14,13 @@ fn Main() { // CHECK:STDOUT: --- params_one_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -29,13 +31,19 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -43,10 +51,10 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10) -// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index 991ec5e59ca6..c87192ddeb1a 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -13,11 +13,13 @@ fn Main() { // CHECK:STDOUT: --- params_two.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } @@ -29,15 +31,25 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// 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: %Foo.decl: Foo = fn_decl @Foo [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: @Foo.%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: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -45,7 +57,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10_7, %.loc10_10) diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index bf04c4e239cd..c89c01582c2c 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -14,11 +14,13 @@ fn Main() { // CHECK:STDOUT: --- params_two_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } @@ -30,15 +32,25 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { +// 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: %Foo.decl: Foo = fn_decl @Foo [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: @Foo.%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: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return @@ -46,11 +58,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) -// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) diff --git a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon index 6da21485a715..77d7dd01ece9 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -12,9 +12,11 @@ fn F(n: i32, a: [i32; n]*); // CHECK:STDOUT: --- fail_param_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,15 +25,23 @@ fn F(n: i32, a: [i32; n]*); // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] +// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32.loc10_9, %.loc10_9.1 [template = i32] // CHECK:STDOUT: %n.loc10_6.1: i32 = param n // CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc10_6.1 +// CHECK:STDOUT: %int.make_type_32.loc10_18: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %n.ref: i32 = name_ref n, @F.%n -// CHECK:STDOUT: %.loc10: type = ptr_type [template = ] +// CHECK:STDOUT: %.loc10_25: type = ptr_type [template = ] // CHECK:STDOUT: %a.loc10_14.1: = param a // CHECK:STDOUT: @F.%a: = bind_name a, %a.loc10_14.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%n: i32, %a: ); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index f93df2a21838..a890cc774665 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -15,9 +15,11 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: --- fail_param_redecl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,13 +28,23 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc13_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_32.loc13_9 [template = i32] +// CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_32.loc13_9, %.loc13_9.1 [template = i32] // CHECK:STDOUT: %n.loc13_6.1: i32 = param n // CHECK:STDOUT: @F.%n.loc13_6: i32 = bind_name n, %n.loc13_6.1 +// CHECK:STDOUT: %int.make_type_32.loc13_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32.loc13_17 [template = i32] +// CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32.loc13_17, %.loc13_17.1 [template = i32] // CHECK:STDOUT: %n.loc13_14.1: i32 = param n // CHECK:STDOUT: @F.%n.loc13_14: i32 = bind_name n, %n.loc13_14.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%n.loc13_6: i32, %n.loc13_14: i32); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index ba2355d3b3b4..ad9ebf71c475 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -369,17 +369,19 @@ import library "extern_api"; // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -393,28 +395,46 @@ import library "extern_api"; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// 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: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_9.1: type = value_of_initializer %int.make_type_32.loc5_9 [template = i32] +// CHECK:STDOUT: %.loc5_9.2: type = converted %int.make_type_32.loc5_9, %.loc5_9.1 [template = i32] // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 +// CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_17.1: type = value_of_initializer %int.make_type_32.loc5_17 [template = i32] +// CHECK:STDOUT: %.loc5_17.2: type = converted %int.make_type_32.loc5_17, %.loc5_17.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] +// 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: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (%int.make_type_32.loc6_10) +// CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32] +// CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_32.loc6_10, %.loc6_14.2 [template = i32] +// CHECK:STDOUT: %.loc6_14.4: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 +// CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int.make_type_32.loc6_25 [template = i32] +// CHECK:STDOUT: %.loc6_25.2: type = converted %int.make_type_32.loc6_25, %.loc6_25.1 [template = i32] // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {} // CHECK:STDOUT: %NS: = namespace [template] { // CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32}; @@ -429,17 +449,19 @@ import library "extern_api"; // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -453,28 +475,46 @@ import library "extern_api"; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// 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: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_16.1: type = value_of_initializer %int.make_type_32.loc5_16 [template = i32] +// CHECK:STDOUT: %.loc5_16.2: type = converted %int.make_type_32.loc5_16, %.loc5_16.1 [template = i32] // CHECK:STDOUT: %b.loc5_13.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_13.1 +// CHECK:STDOUT: %int.make_type_32.loc5_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_24.1: type = value_of_initializer %int.make_type_32.loc5_24 [template = i32] +// CHECK:STDOUT: %.loc5_24.2: type = converted %int.make_type_32.loc5_24, %.loc5_24.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc6_21.2: type = converted %.loc6_21.1, constants.%.3 [template = constants.%.3] +// 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: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (%int.make_type_32.loc6_17) +// CHECK:STDOUT: %.loc6_21.2: type = value_of_initializer %int.make_type_32.loc6_17 [template = i32] +// CHECK:STDOUT: %.loc6_21.3: type = converted %int.make_type_32.loc6_17, %.loc6_21.2 [template = i32] +// CHECK:STDOUT: %.loc6_21.4: type = converted %.loc6_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc6_13.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_13.1 +// CHECK:STDOUT: %int.make_type_32.loc6_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_32.1: type = value_of_initializer %int.make_type_32.loc6_32 [template = i32] +// CHECK:STDOUT: %.loc6_32.2: type = converted %int.make_type_32.loc6_32, %.loc6_32.1 [template = i32] // CHECK:STDOUT: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {} // CHECK:STDOUT: %NS: = namespace [template] { // CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: extern fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32}; @@ -489,18 +529,20 @@ import library "extern_api"; // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -518,22 +560,30 @@ import library "extern_api"; // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc8: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.3] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc9_9.1: () = tuple_literal () @@ -548,6 +598,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32}; @@ -561,22 +613,22 @@ import library "extern_api"; // CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc8_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc8_21: (i32,) = converted %.loc8_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc8_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -588,17 +640,19 @@ import library "extern_api"; // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template] // CHECK:STDOUT: } @@ -618,38 +672,62 @@ import library "extern_api"; // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] +// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32] // CHECK:STDOUT: %b.loc7_13.1: i32 = param b // CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1 +// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.2() [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: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (%int.make_type_32.loc8_17) +// CHECK:STDOUT: %.loc8_21.2: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32] +// CHECK:STDOUT: %.loc8_21.3: type = converted %int.make_type_32.loc8_17, %.loc8_21.2 [template = i32] +// CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc8_13.1: (i32,) = param c // CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1 +// CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_32.1: type = value_of_initializer %int.make_type_32.loc8_32 [template = i32] +// CHECK:STDOUT: %.loc8_32.2: type = converted %int.make_type_32.loc8_32, %.loc8_32.1 [template = i32] // CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %return.var.loc8: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} -// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b.loc13: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.4] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %.loc14_16: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc15_9.1: () = tuple_literal () @@ -664,6 +742,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: extern fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32}; @@ -677,22 +757,22 @@ import library "extern_api"; // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -704,17 +784,19 @@ import library "extern_api"; // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template] // CHECK:STDOUT: } @@ -734,38 +816,62 @@ import library "extern_api"; // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] +// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32] // CHECK:STDOUT: %b.loc7_13.1: i32 = param b // CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1 +// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.2() [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: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (%int.make_type_32.loc8_17) +// CHECK:STDOUT: %.loc8_21.2: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32] +// CHECK:STDOUT: %.loc8_21.3: type = converted %int.make_type_32.loc8_17, %.loc8_21.2 [template = i32] +// CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc8_13.1: (i32,) = param c // CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1 +// CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_32.1: type = value_of_initializer %int.make_type_32.loc8_32 [template = i32] +// CHECK:STDOUT: %.loc8_32.2: type = converted %int.make_type_32.loc8_32, %.loc8_32.1 [template = i32] // CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %return.var.loc8: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} -// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b.loc13: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.4] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %.loc14_16: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc15_9.1: () = tuple_literal () @@ -780,6 +886,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: extern fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32}; @@ -793,22 +901,22 @@ import library "extern_api"; // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -820,18 +928,20 @@ import library "extern_api"; // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -849,27 +959,35 @@ import library "extern_api"; // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6] // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc72_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc73: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc73_8.1: type = value_of_initializer %int.make_type_32.loc73 [template = i32] +// CHECK:STDOUT: %.loc73_8.2: type = converted %int.make_type_32.loc73, %.loc73_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc74: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc74: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc74_13.1: type = value_of_initializer %int.make_type_32.loc74 [template = i32] +// CHECK:STDOUT: %.loc74_13.2: type = converted %int.make_type_32.loc74, %.loc74_13.1 [template = i32] +// CHECK:STDOUT: %.loc74_16: type = struct_type {.c: i32} [template = constants.%.3] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc75_9.1: () = tuple_literal () @@ -884,6 +1002,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32}; @@ -897,22 +1017,22 @@ import library "extern_api"; // CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -924,18 +1044,20 @@ import library "extern_api"; // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -953,27 +1075,35 @@ import library "extern_api"; // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6] // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc72_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc73: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc73_8.1: type = value_of_initializer %int.make_type_32.loc73 [template = i32] +// CHECK:STDOUT: %.loc73_8.2: type = converted %int.make_type_32.loc73, %.loc73_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc74: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc74: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc74_13.1: type = value_of_initializer %int.make_type_32.loc74 [template = i32] +// CHECK:STDOUT: %.loc74_13.2: type = converted %int.make_type_32.loc74, %.loc74_13.1 [template = i32] +// CHECK:STDOUT: %.loc74_16: type = struct_type {.c: i32} [template = constants.%.3] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc75_9.1: () = tuple_literal () @@ -988,6 +1118,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: extern fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32}; @@ -1001,22 +1133,22 @@ import library "extern_api"; // CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -1041,14 +1173,14 @@ import library "extern_api"; // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] @@ -1073,8 +1205,10 @@ import library "extern_api"; // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = fn_type @.1 [template] -// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1088,26 +1222,32 @@ import library "extern_api"; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32] // CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -1137,14 +1277,14 @@ import library "extern_api"; // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] @@ -1175,14 +1315,14 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1198,14 +1338,14 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1221,19 +1361,19 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+49, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/param_same_name.carbon b/toolchain/check/testdata/function/declaration/param_same_name.carbon index 1a7abd660302..63cace84bc24 100644 --- a/toolchain/check/testdata/function/declaration/param_same_name.carbon +++ b/toolchain/check/testdata/function/declaration/param_same_name.carbon @@ -11,11 +11,13 @@ fn G(a: i32); // CHECK:STDOUT: --- param_same_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [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: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,16 +27,26 @@ fn G(a: i32); // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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.loc7: init type = call constants.%struct.1() [template = i32] +// 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: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: 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.loc9: init type = call constants.%struct.1() [template = i32] +// 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: %a.loc9_6.1: i32 = param a // CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a: i32); diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index fbfefce52c44..e1f231cd024b 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -96,16 +96,18 @@ fn D() {} // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: type = tuple_type (type) [template] // CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 0 [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -118,20 +120,36 @@ fn D() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// 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: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_9.1: type = value_of_initializer %int.make_type_32.loc5_9 [template = i32] +// CHECK:STDOUT: %.loc5_9.2: type = converted %int.make_type_32.loc5_9, %.loc5_9.1 [template = i32] // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 +// CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc5_17.1: type = value_of_initializer %int.make_type_32.loc5_17 [template = i32] +// CHECK:STDOUT: %.loc5_17.2: type = converted %int.make_type_32.loc5_17, %.loc5_17.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] +// 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: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (%int.make_type_32.loc6_10) +// CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32] +// CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_32.loc6_10, %.loc6_14.2 [template = i32] +// CHECK:STDOUT: %.loc6_14.4: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 +// CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int.make_type_32.loc6_25 [template = i32] +// CHECK:STDOUT: %.loc6_25.2: type = converted %int.make_type_32.loc6_25, %.loc6_25.1 [template = i32] // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -139,6 +157,8 @@ fn D() {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b @@ -183,13 +203,15 @@ fn D() {} // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -205,23 +227,33 @@ fn D() {} // CHECK:STDOUT: .c = %c // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+10, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+26, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+38, unloaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+22, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+46, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+58, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc8: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.3] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32}; @@ -231,11 +263,11 @@ fn D() {} // CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc8_23) [template = constants.%tuple] @@ -251,8 +283,10 @@ fn D() {} // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -264,14 +298,22 @@ fn D() {} // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+10, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+38, unloaded +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+22, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+58, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc27_9: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc27_9.1: type = value_of_initializer %int.make_type_32.loc27_9 [template = i32] +// CHECK:STDOUT: %.loc27_9.2: type = converted %int.make_type_32.loc27_9, %.loc27_9.1 [template = i32] // CHECK:STDOUT: %b.loc27_6.1: i32 = param b // CHECK:STDOUT: %b.loc27_6.2: i32 = bind_name b, %b.loc27_6.1 +// CHECK:STDOUT: %int.make_type_32.loc27_17: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc27_17.1: type = value_of_initializer %int.make_type_32.loc27_17 [template = i32] +// CHECK:STDOUT: %.loc27_17.2: type = converted %int.make_type_32.loc27_17, %.loc27_17.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -281,6 +323,8 @@ fn D() {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B(%b: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: --- redecl_then_def.carbon @@ -324,9 +368,9 @@ fn D() {} // CHECK:STDOUT: .D = %D.decl.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+10, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+26, unloaded -// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+38, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+22, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+46, unloaded +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+58, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl.loc6: D = fn_decl @D [template = constants.%struct] {} // CHECK:STDOUT: %D.decl.loc13: D = fn_decl @D [template = constants.%struct] {} diff --git a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon index 3b483724fcd3..9a8377f37afa 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon @@ -25,12 +25,9 @@ fn G(x: ()); fn G() {} fn H(x: ()); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:6: ERROR: Redeclaration differs at parameter 1. +// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:9: ERROR: Name `Core` not found. // CHECK:STDERR: fn H(x: bool) {} -// CHECK:STDERR: ^ -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:6: Previous declaration's corresponding parameter here. -// CHECK:STDERR: fn H(x: ()); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ // CHECK:STDERR: fn H(x: bool) {} @@ -125,30 +122,30 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: %x.loc27_6.1: () = param x // CHECK:STDOUT: @H.%x: () = bind_name x, %x.loc27_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc35: = fn_decl @.3 [template = constants.%struct.6] { -// CHECK:STDOUT: %x.loc35_6.1: bool = param x -// CHECK:STDOUT: @.3.%x: bool = bind_name x, %x.loc35_6.1 +// CHECK:STDOUT: %.decl.loc32: = fn_decl @.3 [template = constants.%struct.6] { +// CHECK:STDOUT: %x.loc32_6.1: = param x +// CHECK:STDOUT: @.3.%x: = bind_name x, %x.loc32_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.7] {} -// CHECK:STDOUT: %.decl.loc45: = fn_decl @.4 [template = constants.%struct.8] { -// CHECK:STDOUT: %.loc45_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc45_12.2: type = converted %.loc45_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.decl.loc42: = fn_decl @.4 [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc42_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc42_12.2: type = converted %.loc42_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @.4.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %J.decl: J = fn_decl @J [template = constants.%struct.9] { -// CHECK:STDOUT: %.loc47_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc47_12.2: type = converted %.loc47_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc44_12.2: type = converted %.loc44_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @J.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc55: = fn_decl @.5 [template = constants.%struct.10] {} +// CHECK:STDOUT: %.decl.loc52: = fn_decl @.5 [template = constants.%struct.10] {} // CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.11] { -// CHECK:STDOUT: %.loc57_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc57_12.2: type = converted %.loc57_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc54_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc54_12.2: type = converted %.loc54_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @K.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc64: = fn_decl @.6 [template = constants.%struct.12] { -// CHECK:STDOUT: %.loc64_12.1: {} = struct_literal () -// CHECK:STDOUT: %.loc64_12.2: type = converted %.loc64_12.1, constants.%.7 [template = constants.%.7] +// CHECK:STDOUT: %.decl.loc61: = fn_decl @.6 [template = constants.%struct.12] { +// CHECK:STDOUT: %.loc61_12.1: {} = struct_literal () +// CHECK:STDOUT: %.loc61_12.2: type = converted %.loc61_12.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: @.6.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -169,7 +166,7 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @H(%x: ()); // CHECK:STDOUT: -// CHECK:STDOUT: fn @.3(%x: bool) { +// CHECK:STDOUT: fn @.3(%x: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -178,10 +175,10 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.4() -> () { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc45_24: () = tuple_literal () +// CHECK:STDOUT: %.loc42_24: () = tuple_literal () // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc45_25: () = converted %.loc45_24, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc45_25 +// CHECK:STDOUT: %.loc42_25: () = converted %.loc42_24, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc42_25 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @J() -> (); @@ -195,9 +192,9 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.6() -> {} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc64_24: {} = struct_literal () +// CHECK:STDOUT: %.loc61_24: {} = struct_literal () // CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct.13] -// CHECK:STDOUT: %.loc64_25: {} = converted %.loc64_24, %struct [template = constants.%struct.13] -// CHECK:STDOUT: return %.loc64_25 +// CHECK:STDOUT: %.loc61_25: {} = converted %.loc61_24, %struct [template = constants.%struct.13] +// CHECK:STDOUT: return %.loc61_25 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/params_one.carbon b/toolchain/check/testdata/function/definition/params_one.carbon index 42088f85afb0..c9594cf129dd 100644 --- a/toolchain/check/testdata/function/definition/params_one.carbon +++ b/toolchain/check/testdata/function/definition/params_one.carbon @@ -9,9 +9,11 @@ fn Foo(a: i32) {} // CHECK:STDOUT: --- params_one.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,12 +22,18 @@ fn Foo(a: i32) {} // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/definition/params_one_comma.carbon b/toolchain/check/testdata/function/definition/params_one_comma.carbon index e70ca5190785..14d61c381277 100644 --- a/toolchain/check/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_one_comma.carbon @@ -9,9 +9,11 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: --- params_one_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,12 +22,18 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/definition/params_two.carbon b/toolchain/check/testdata/function/definition/params_two.carbon index 9ebba23b6b83..547c738366da 100644 --- a/toolchain/check/testdata/function/definition/params_two.carbon +++ b/toolchain/check/testdata/function/definition/params_two.carbon @@ -9,9 +9,11 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: --- params_two.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,14 +22,24 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [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: %Foo.decl: Foo = fn_decl @Foo [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: @Foo.%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: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/definition/params_two_comma.carbon b/toolchain/check/testdata/function/definition/params_two_comma.carbon index 665936884e26..7322d103e799 100644 --- a/toolchain/check/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_two_comma.carbon @@ -9,9 +9,11 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: --- params_two_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,14 +22,24 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [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: %Foo.decl: Foo = fn_decl @Foo [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: @Foo.%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: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon index e39d4c45b040..3f8778bd42be 100644 --- a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon +++ b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon @@ -12,10 +12,12 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: --- fail_todo_param_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// 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: %N: i32 = bind_symbolic_name N 0 [symbolic] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,10 +26,18 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc10_10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10_10, %.loc10_10.1 [template = i32] // CHECK:STDOUT: %N.loc10_6.1: i32 = param N // CHECK:STDOUT: @F.%N: i32 = bind_symbolic_name N 0, %N.loc10_6.1 [symbolic = constants.%N] +// CHECK:STDOUT: %int.make_type_32.loc10_19: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %N.ref: i32 = name_ref N, @F.%N [symbolic = constants.%N] +// CHECK:STDOUT: %.loc10_19.1: type = value_of_initializer %int.make_type_32.loc10_19 [template = i32] +// CHECK:STDOUT: %.loc10_19.2: type = converted %int.make_type_32.loc10_19, %.loc10_19.1 [template = i32] // CHECK:STDOUT: %.loc10_25: type = array_type %N.ref, i32 [template = ] // CHECK:STDOUT: %.loc10_26: type = ptr_type [template = ] // CHECK:STDOUT: %a.loc10_15.1: = param a @@ -35,5 +45,7 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%N: i32, %a: ); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/decl.carbon b/toolchain/check/testdata/global/decl.carbon index 0f33fd875bf6..e4d29ca63d18 100644 --- a/toolchain/check/testdata/global/decl.carbon +++ b/toolchain/check/testdata/global/decl.carbon @@ -7,13 +7,25 @@ var a: i32; // CHECK:STDOUT: --- decl.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: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %.loc6_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32, %.loc6_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/simple_init.carbon b/toolchain/check/testdata/global/simple_init.carbon index 96664a8ac354..aa0985340f72 100644 --- a/toolchain/check/testdata/global/simple_init.carbon +++ b/toolchain/check/testdata/global/simple_init.carbon @@ -8,7 +8,10 @@ var a: i32 = 0; // CHECK:STDOUT: --- simple_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: 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: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -17,13 +20,19 @@ var a: i32 = 0; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %.loc6_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32, %.loc6_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = 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: %.loc6: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc6: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%a.var, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index 0e56875e75d7..fe2d3508dc86 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -13,9 +13,11 @@ var a: i32 = test_a(); // CHECK:STDOUT: --- simple_with_fun.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %test_a: type = fn_type @test_a [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: test_a = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %test_a: type = fn_type @test_a [template] +// CHECK:STDOUT: %struct.2: test_a = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -26,13 +28,23 @@ var a: i32 = test_a(); // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %test_a.decl: test_a = fn_decl @test_a [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %test_a.decl: test_a = fn_decl @test_a [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7, %.loc7_16.1 [template = i32] // CHECK:STDOUT: @test_a.%return: ref i32 = var // CHECK:STDOUT: } +// 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: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @test_a() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] @@ -41,7 +53,7 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %test_a.ref: test_a = name_ref test_a, file.%test_a.decl [template = constants.%struct] +// CHECK:STDOUT: %test_a.ref: test_a = name_ref test_a, file.%test_a.decl [template = constants.%struct.2] // CHECK:STDOUT: %test_a.call: init i32 = call %test_a.ref() // CHECK:STDOUT: assign file.%a.var, %test_a.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index 565fa2d88d2e..fbe11e274269 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -27,8 +27,10 @@ fn If(b: bool) { // CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %H: type = fn_type @H [template] // CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %If: type = fn_type @If [template] -// CHECK:STDOUT: %struct.4: If = struct_value () [template] +// CHECK:STDOUT: %struct.5: If = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,7 +45,11 @@ fn If(b: bool) { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} -// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.5] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_10.2: type = converted %bool.make_type, %.loc11_10.1 [template = bool] // CHECK:STDOUT: %b.loc11_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc11_7.1 // CHECK:STDOUT: } @@ -64,6 +70,8 @@ fn If(b: bool) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @If(%b: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index bc8b64eac798..6b88f42058f1 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -38,15 +38,19 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: --- fail_reachable_fallthrough.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %If1: type = fn_type @If1 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: If1 = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %If1: type = fn_type @If1 [template] +// CHECK:STDOUT: %struct.3: If1 = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %If2: type = fn_type @If2 [template] -// CHECK:STDOUT: %struct.2: If2 = struct_value () [template] +// CHECK:STDOUT: %struct.4: If2 = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %If3: type = fn_type @If3 [template] -// CHECK:STDOUT: %struct.3: If3 = struct_value () [template] +// CHECK:STDOUT: %struct.5: If3 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -57,23 +61,51 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: .If3 = %If3.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %If1.decl: If1 = fn_decl @If1 [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %If1.decl: If1 = fn_decl @If1 [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc7_8.1 +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_20.2: type = converted %int.make_type_32.loc7, %.loc7_20.1 [template = i32] // CHECK:STDOUT: @If1.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %If2.decl: If2 = fn_decl @If2 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %If2.decl: If2 = fn_decl @If2 [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_11.2: type = converted %bool.make_type.loc18, %.loc18_11.1 [template = bool] // CHECK:STDOUT: %b.loc18_8.1: bool = param b // CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc18_8.1 +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_32.loc18, %.loc18_20.1 [template = i32] // CHECK:STDOUT: @If2.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %If3.decl: If3 = fn_decl @If3 [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %If3.decl: If3 = fn_decl @If3 [template = constants.%struct.5] { +// CHECK:STDOUT: %bool.make_type.loc29: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc29_11.1: type = value_of_initializer %bool.make_type.loc29 [template = bool] +// CHECK:STDOUT: %.loc29_11.2: type = converted %bool.make_type.loc29, %.loc29_11.1 [template = bool] // CHECK:STDOUT: %b.loc29_8.1: bool = param b // CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc29_8.1 +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc29_20.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_20.2: type = converted %int.make_type_32.loc29, %.loc29_20.1 [template = i32] // CHECK:STDOUT: @If3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @If1(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index d084bf098416..82d40843c13e 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -18,9 +18,13 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: --- fail_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %VarScope: type = fn_type @VarScope [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: VarScope = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %VarScope: type = fn_type @VarScope [template] +// CHECK:STDOUT: %struct.3: VarScope = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -30,23 +34,39 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: .VarScope = %VarScope.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %VarScope.decl: VarScope = fn_decl @VarScope [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %VarScope.decl: VarScope = fn_decl @VarScope [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_16.2: type = converted %bool.make_type, %.loc7_16.1 [template = bool] // CHECK:STDOUT: %b.loc7_13.1: bool = param b // CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc7_13.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32, %.loc7_25.1 [template = i32] // CHECK:STDOUT: @VarScope.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @VarScope(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32, %.loc9_12.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc9 +// CHECK:STDOUT: %.loc9_18: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc9_18 // CHECK:STDOUT: %n.ref.loc10: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc10: i32 = bind_value %n.ref.loc10 // CHECK:STDOUT: return %.loc10 diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index fd05461e9063..07e18020abca 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -22,8 +22,10 @@ fn If(b: bool) { // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.3: Bool = struct_value () [template] // CHECK:STDOUT: %If: type = fn_type @If [template] -// CHECK:STDOUT: %struct.3: If = struct_value () [template] +// CHECK:STDOUT: %struct.4: If = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,7 +38,11 @@ fn If(b: bool) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} -// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc10_10.2: type = converted %bool.make_type, %.loc10_10.1 [template = bool] // CHECK:STDOUT: %b.loc10_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc10_7.1 // CHECK:STDOUT: } @@ -52,6 +58,8 @@ fn If(b: bool) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @If(%b: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index a29c670905a7..715eb15b7a13 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -16,9 +16,13 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: --- unreachable_fallthrough.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %If: type = fn_type @If [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: If = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %If: type = fn_type @If [template] +// CHECK:STDOUT: %struct.3: If = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } @@ -29,13 +33,25 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: .If = %If.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_10.2: type = converted %bool.make_type, %.loc7_10.1 [template = bool] // CHECK:STDOUT: %b.loc7_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc7_7.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] // CHECK:STDOUT: @If.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @If(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index 68c05f08fb2d..629621d35dcc 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -12,9 +12,13 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = 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] @@ -29,20 +33,44 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type, %.loc7_9.1 [template = bool] // CHECK:STDOUT: %b.loc7_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc7_18: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32.loc7_18 [template = i32] +// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32.loc7_18, %.loc7_18.1 [template = i32] // CHECK:STDOUT: %n.loc7_15.1: i32 = param n // CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc7_15.1 +// CHECK:STDOUT: %int.make_type_32.loc7_26: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_26.1: type = value_of_initializer %int.make_type_32.loc7_26 [template = i32] +// CHECK:STDOUT: %.loc7_26.2: type = converted %int.make_type_32.loc7_26, %.loc7_26.1 [template = i32] // CHECK:STDOUT: %m.loc7_23.1: i32 = param m // CHECK:STDOUT: @F.%m: i32 = bind_name m, %m.loc7_23.1 +// CHECK:STDOUT: %int.make_type_32.loc7_34: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %int.make_type_32.loc7_34 [template = i32] +// CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_32.loc7_34, %.loc7_34.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] // CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32, %.loc8_11.1 [template = i32] // CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref [i32; 1] = var x // CHECK:STDOUT: %x: ref [i32; 1] = bind_name x, %x.var diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index fe07e8fe2986..4771f85292bc 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -30,24 +30,26 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: --- constant_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.4: bool = bool_literal true [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %struct.5: G = struct_value () [template] // CHECK:STDOUT: %.5: bool = bool_literal false [template] // CHECK:STDOUT: %Constant: type = fn_type @Constant [template] -// CHECK:STDOUT: %struct.5: Constant = struct_value () [template] +// CHECK:STDOUT: %struct.6: Constant = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type i32 [template] // CHECK:STDOUT: %PartiallyConstant: type = fn_type @PartiallyConstant [template] -// CHECK:STDOUT: %struct.6: PartiallyConstant = struct_value () [template] +// CHECK:STDOUT: %struct.7: PartiallyConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -61,28 +63,60 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: .PartiallyConstant = %PartiallyConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8, %.loc8_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// 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.4] { +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10, %.loc10_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { +// 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.5] { +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14, %.loc14_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_18.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_18.2: type = converted %int.make_type_32.loc18, %.loc18_18.1 [template = i32] // CHECK:STDOUT: @Constant.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PartiallyConstant.decl: PartiallyConstant = fn_decl @PartiallyConstant [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PartiallyConstant.decl: PartiallyConstant = fn_decl @PartiallyConstant [template = constants.%struct.7] { // CHECK:STDOUT: %t.loc24_22.1: type = param t // CHECK:STDOUT: @PartiallyConstant.%t: type = bind_name t, %t.loc24_22.1 +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_34.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_34.2: type = converted %int.make_type_32.loc24, %.loc24_34.1 [template = i32] // CHECK:STDOUT: @PartiallyConstant.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: 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 @A() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] @@ -101,14 +135,14 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: if %.loc11_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc11_24.2: i32 = converted %A.call, %.loc11_24.1 // CHECK:STDOUT: br !if.expr.result(%.loc11_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_27.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc11_27.2: i32 = converted %B.call, %.loc11_27.1 @@ -125,14 +159,14 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: if %.loc15_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc15_25.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc15_25.2: i32 = converted %A.call, %.loc15_25.1 // CHECK:STDOUT: br !if.expr.result(%.loc15_25.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc15_28.2: i32 = converted %B.call, %.loc15_28.1 @@ -149,11 +183,17 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: if %.loc19_13 br !if.expr.then.loc19 else br !if.expr.else.loc19 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc19: -// CHECK:STDOUT: br !if.expr.result.loc19(i32) +// CHECK:STDOUT: %int.make_type_32.loc19_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_23.1: type = value_of_initializer %int.make_type_32.loc19_23 [template = i32] +// CHECK:STDOUT: %.loc19_23.2: type = converted %int.make_type_32.loc19_23, %.loc19_23.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_23.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc19: -// CHECK:STDOUT: %.loc19_35: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_35) +// CHECK:STDOUT: %int.make_type_32.loc19_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_35.1: type = value_of_initializer %int.make_type_32.loc19_32 [template = i32] +// CHECK:STDOUT: %.loc19_35.2: type = converted %int.make_type_32.loc19_32, %.loc19_35.1 [template = i32] +// CHECK:STDOUT: %.loc19_35.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_35.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc19: // CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = i32] @@ -165,11 +205,17 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: if %.loc20_13 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc20: -// CHECK:STDOUT: br !if.expr.result.loc20(i32) +// CHECK:STDOUT: %int.make_type_32.loc20_24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_24.1: type = value_of_initializer %int.make_type_32.loc20_24 [template = i32] +// CHECK:STDOUT: %.loc20_24.2: type = converted %int.make_type_32.loc20_24, %.loc20_24.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc20: -// CHECK:STDOUT: %.loc20_36: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_36) +// CHECK:STDOUT: %int.make_type_32.loc20_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_36.1: type = value_of_initializer %int.make_type_32.loc20_33 [template = i32] +// CHECK:STDOUT: %.loc20_36.2: type = converted %int.make_type_32.loc20_33, %.loc20_36.1 [template = i32] +// CHECK:STDOUT: %.loc20_36.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_36.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc20: // CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = constants.%.6] @@ -191,7 +237,10 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: if %.loc25_13 br !if.expr.then.loc25 else br !if.expr.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc25: -// CHECK:STDOUT: br !if.expr.result.loc25(i32) +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_23.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_23.2: type = converted %int.make_type_32.loc25, %.loc25_23.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc25(%.loc25_23.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc25: // CHECK:STDOUT: %t.ref.loc25: type = name_ref t, %t @@ -211,8 +260,11 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: br !if.expr.result.loc26(%t.ref.loc26) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc26: -// CHECK:STDOUT: %.loc26_34: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc26(%.loc26_34) +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_34.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_34.2: type = converted %int.make_type_32.loc26, %.loc26_34.1 [template = i32] +// CHECK:STDOUT: %.loc26_34.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc26(%.loc26_34.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc26: // CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result.loc26 [template = constants.%.6] diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 6c38b2086714..418df3e03683 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -14,15 +14,19 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- control_flow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.4: Bool = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,19 +37,37 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8, %.loc8_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.4() [template = bool] +// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc10_9.2: type = converted %bool.make_type, %.loc10_9.1 [template = bool] // CHECK:STDOUT: %b.loc10_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc10_6.1 +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_18.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_18.2: type = converted %int.make_type_32.loc10, %.loc10_18.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] @@ -58,20 +80,22 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_21.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc11_21.2: i32 = converted %A.call, %.loc11_21.1 // CHECK:STDOUT: br !if.expr.result(%.loc11_21.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc11_24.2: i32 = converted %B.call, %.loc11_24.1 diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 8d8c678cc783..e629f97ab756 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -36,26 +36,38 @@ class C { // CHECK:STDOUT: --- fail_not_in_function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [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: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.5: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.2: Float = struct_value () [template] +// CHECK:STDOUT: %.6: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc19: i32 = block_arg [template = constants.%.2] +// CHECK:STDOUT: %.loc19: i32 = block_arg [template = constants.%.3] // CHECK:STDOUT: %x: i32 = bind_name x, %.loc19 // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc33: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc33: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc33 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .n = +// CHECK:STDOUT: .n = // 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: diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index ed08ccafbd3d..cf96549b4859 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -38,9 +38,13 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: --- fail_non_constant_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %ConditionIsNonConstant: type = fn_type @ConditionIsNonConstant [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: ConditionIsNonConstant = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %ConditionIsNonConstant: type = fn_type @ConditionIsNonConstant [template] +// CHECK:STDOUT: %struct.2: ConditionIsNonConstant = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,22 +54,36 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: .ConditionIsNonConstant = %ConditionIsNonConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ConditionIsNonConstant.decl: ConditionIsNonConstant = fn_decl @ConditionIsNonConstant [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %ConditionIsNonConstant.decl: ConditionIsNonConstant = fn_decl @ConditionIsNonConstant [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_30.2: type = converted %bool.make_type, %.loc4_30.1 [template = bool] // CHECK:STDOUT: %b.loc4_27.1: bool = param b // CHECK:STDOUT: @ConditionIsNonConstant.%b: bool = bind_name b, %b.loc4_27.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @ConditionIsNonConstant(%b: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: br !if.expr.result(i32) +// CHECK:STDOUT: %int.make_type_32.loc12_20: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc12_20.1: type = value_of_initializer %int.make_type_32.loc12_20 [template = i32] +// CHECK:STDOUT: %.loc12_20.2: type = converted %int.make_type_32.loc12_20, %.loc12_20.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result(%.loc12_20.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: br !if.expr.result(i32) +// CHECK:STDOUT: %int.make_type_32.loc12_29: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc12_24.1: type = value_of_initializer %int.make_type_32.loc12_29 [template = i32] +// CHECK:STDOUT: %.loc12_24.2: type = converted %int.make_type_32.loc12_29, %.loc12_24.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result(%.loc12_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc12_10: type = block_arg !if.expr.result @@ -76,13 +94,17 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_non_constant_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %ChosenBranchIsNonConstant: type = fn_type @ChosenBranchIsNonConstant [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: ChosenBranchIsNonConstant = struct_value () [template] +// CHECK:STDOUT: %struct.1: ChosenBranchIsNonConstant = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %.4: bool = bool_literal false [template] // CHECK:STDOUT: } @@ -93,10 +115,12 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: .ChosenBranchIsNonConstant = %ChosenBranchIsNonConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ChosenBranchIsNonConstant.decl: ChosenBranchIsNonConstant = fn_decl @ChosenBranchIsNonConstant [template = constants.%struct] { +// CHECK:STDOUT: %ChosenBranchIsNonConstant.decl: ChosenBranchIsNonConstant = fn_decl @ChosenBranchIsNonConstant [template = constants.%struct.1] { // CHECK:STDOUT: %t.loc4_30.1: type = param t // CHECK:STDOUT: @ChosenBranchIsNonConstant.%t: type = bind_name t, %t.loc4_30.1 // CHECK:STDOUT: } +// 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: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ChosenBranchIsNonConstant(%t: type) { @@ -109,7 +133,10 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: br !if.expr.result.loc9(%t.ref.loc9) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: br !if.expr.result.loc9(i32) +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_25.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_25.2: type = converted %int.make_type_32.loc9, %.loc9_25.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_25.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result.loc9 @@ -121,7 +148,10 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: if %.loc13_13 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: -// CHECK:STDOUT: br !if.expr.result.loc13(i32) +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_24.2: type = converted %int.make_type_32.loc13, %.loc13_24.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc13(%.loc13_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc13: // CHECK:STDOUT: %t.ref.loc13: type = name_ref t, %t @@ -136,3 +166,5 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index 7d019fcf6e6c..da5d4a03c7e0 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -11,9 +11,13 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = 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] @@ -26,17 +30,37 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type.loc7_9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type.loc7_9 [template = bool] +// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type.loc7_9, %.loc7_9.1 [template = bool] // CHECK:STDOUT: %a.loc7_6.1: bool = param a // CHECK:STDOUT: @F.%a: bool = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %bool.make_type.loc7_18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %bool.make_type.loc7_18 [template = bool] +// CHECK:STDOUT: %.loc7_18.2: type = converted %bool.make_type.loc7_18, %.loc7_18.1 [template = bool] // CHECK:STDOUT: %b.loc7_15.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_15.1 +// CHECK:STDOUT: %bool.make_type.loc7_27: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %bool.make_type.loc7_27 [template = bool] +// CHECK:STDOUT: %.loc7_27.2: type = converted %bool.make_type.loc7_27, %.loc7_27.1 [template = bool] // CHECK:STDOUT: %c.loc7_24.1: bool = param c // CHECK:STDOUT: @F.%c: bool = bind_name c, %c.loc7_24.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_36.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_36.2: type = converted %int.make_type_32, %.loc7_36.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: bool, %b: bool, %c: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: bool = name_ref a, %a diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 760e753d0585..9a861b0ffabe 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -14,16 +14,20 @@ fn F(cond: bool) { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: 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 = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.3: Bool = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %struct.5: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,22 +37,46 @@ fn F(cond: bool) { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// 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: %G.decl: G = fn_decl @G [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: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_23.1: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] +// CHECK:STDOUT: %.loc7_23.2: type = converted %int.make_type_32.loc7_23, %.loc7_23.1 [template = i32] +// CHECK:STDOUT: %.loc7_26: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %s.loc7_6.1: {.a: i32, .b: i32} = param s // CHECK:STDOUT: @G.%s: {.a: i32, .b: i32} = bind_name s, %s.loc7_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc9_12.2: type = converted %bool.make_type, %.loc9_12.1 [template = bool] // CHECK:STDOUT: %cond.loc9_6.1: bool = param cond // CHECK:STDOUT: @F.%cond: bool = bind_name cond, %cond.loc9_6.1 // CHECK:STDOUT: } +// 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: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(%s: {.a: i32, .b: i32}); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%cond: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc10_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] +// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_32.loc10_15, %.loc10_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_24.1: type = value_of_initializer %int.make_type_32.loc10_24 [template = i32] +// CHECK:STDOUT: %.loc10_24.2: type = converted %int.make_type_32.loc10_24, %.loc10_24.1 [template = i32] +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %a.var: ref {.a: i32, .b: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32, .b: i32} = bind_name a, %a.var // CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.4] @@ -58,10 +86,10 @@ fn F(cond: bool) { // CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_46.4: ref i32 = struct_access %a.var, element1 // CHECK:STDOUT: %.loc10_46.5: init i32 = initialize_from %.loc10_45 to %.loc10_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc10_47: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var [template = constants.%struct.5] +// CHECK:STDOUT: %.loc10_47: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 [template = constants.%struct.5] // CHECK:STDOUT: assign %a.var, %.loc10_47 -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %cond.ref: bool = name_ref cond, %cond // CHECK:STDOUT: if %cond.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index fb3bf940b915..dd898a8494cf 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -44,20 +44,22 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Simple, G [template] // CHECK:STDOUT: %.6: = assoc_entity element1, @Simple.%G.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] -// CHECK:STDOUT: %struct.4: G = struct_value () [template] -// CHECK:STDOUT: %.7: = interface_witness (%struct.3, %struct.4) [template] +// CHECK:STDOUT: %struct.5: G = struct_value () [template] +// CHECK:STDOUT: %.7: = interface_witness (%struct.4, %struct.5) [template] // CHECK:STDOUT: %NonInstanceCall: type = fn_type @NonInstanceCall [template] -// CHECK:STDOUT: %struct.5: NonInstanceCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: NonInstanceCall = struct_value () [template] // CHECK:STDOUT: %InstanceCall: type = fn_type @InstanceCall [template] -// CHECK:STDOUT: %struct.6: InstanceCall = struct_value () [template] +// CHECK:STDOUT: %struct.7: InstanceCall = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type i32 [template] // CHECK:STDOUT: %NonInstanceCallIndirect: type = fn_type @NonInstanceCallIndirect [template] -// CHECK:STDOUT: %struct.7: NonInstanceCallIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.8: NonInstanceCallIndirect = struct_value () [template] // CHECK:STDOUT: %InstanceCallIndirect: type = fn_type @InstanceCallIndirect [template] -// CHECK:STDOUT: %struct.8: InstanceCallIndirect = struct_value () [template] +// CHECK:STDOUT: %struct.9: InstanceCallIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -71,24 +73,45 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_6.2: type = converted %int.make_type_32.loc12, %.loc12_6.1 [template = i32] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %NonInstanceCall.decl: NonInstanceCall = fn_decl @NonInstanceCall [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %NonInstanceCall.decl: NonInstanceCall = fn_decl @NonInstanceCall [template = constants.%struct.6] { +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc17_23.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_23.2: type = converted %int.make_type_32.loc17, %.loc17_23.1 [template = i32] // CHECK:STDOUT: %n.loc17_20.1: i32 = param n // CHECK:STDOUT: @NonInstanceCall.%n: i32 = bind_name n, %n.loc17_20.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.7] { +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc21_20.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_20.2: type = converted %int.make_type_32.loc21, %.loc21_20.1 [template = i32] // CHECK:STDOUT: %n.loc21_17.1: i32 = param n // CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc21_17.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %NonInstanceCallIndirect.decl: NonInstanceCallIndirect = fn_decl @NonInstanceCallIndirect [template = constants.%struct.7] { -// CHECK:STDOUT: %.loc25: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %NonInstanceCallIndirect.decl: NonInstanceCallIndirect = fn_decl @NonInstanceCallIndirect [template = constants.%struct.8] { +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc25_34.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_34.2: type = converted %int.make_type_32.loc25, %.loc25_34.1 [template = i32] +// CHECK:STDOUT: %.loc25_34.3: type = ptr_type i32 [template = constants.%.8] // CHECK:STDOUT: %p.loc25_28.1: i32* = param p // CHECK:STDOUT: @NonInstanceCallIndirect.%p: i32* = bind_name p, %p.loc25_28.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCallIndirect.decl: InstanceCallIndirect = fn_decl @InstanceCallIndirect [template = constants.%struct.8] { -// CHECK:STDOUT: %.loc29: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %InstanceCallIndirect.decl: InstanceCallIndirect = fn_decl @InstanceCallIndirect [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc29_31.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_31.2: type = converted %int.make_type_32.loc29, %.loc29_31.1 [template = i32] +// CHECK:STDOUT: %.loc29_31.3: type = ptr_type i32 [template = constants.%.8] // CHECK:STDOUT: %p.loc29_25.1: i32* = param p // CHECK:STDOUT: @InstanceCallIndirect.%p: i32* = bind_name p, %p.loc29_25.1 // CHECK:STDOUT: } @@ -115,8 +138,11 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.4] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc14_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_14.2: type = converted %int.make_type_32, %.loc14_14.1 [template = i32] // CHECK:STDOUT: %self.loc14_8.1: i32 = param self // CHECK:STDOUT: %self.loc14_8.2: i32 = bind_name self, %self.loc14_8.1 // CHECK:STDOUT: } @@ -132,6 +158,8 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G.1[@Simple.%self.loc9_8.2: Self](); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(); // CHECK:STDOUT: // CHECK:STDOUT: fn @G.2[@impl.%self.loc14_8.2: i32](); @@ -141,7 +169,7 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] -// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.4] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -151,7 +179,7 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] -// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.4] +// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.5] // CHECK:STDOUT: %.loc22: = bound_method %n.ref, %.1 // CHECK:STDOUT: %G.call: init () = call %.loc22(%n.ref) // CHECK:STDOUT: return @@ -163,7 +191,7 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] // CHECK:STDOUT: %.loc26: ref i32 = deref %p.ref -// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.4] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -174,7 +202,7 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] // CHECK:STDOUT: %.loc30_4.1: ref i32 = deref %p.ref -// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.4] +// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.5] // CHECK:STDOUT: %.loc30_4.2: = bound_method %.loc30_4.1, %.1 // CHECK:STDOUT: %.loc30_4.3: i32 = bind_value %.loc30_4.1 // CHECK:STDOUT: %G.call: init () = call %.loc30_4.2(%.loc30_4.3) diff --git a/toolchain/check/testdata/impl/declaration.carbon b/toolchain/check/testdata/impl/declaration.carbon index a765ad113253..31a12f9331b2 100644 --- a/toolchain/check/testdata/impl/declaration.carbon +++ b/toolchain/check/testdata/impl/declaration.carbon @@ -13,6 +13,9 @@ impl i32 as I; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,7 +25,11 @@ impl i32 as I; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32, %.loc9_6.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -37,3 +44,5 @@ impl i32 as I; // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/empty.carbon b/toolchain/check/testdata/impl/empty.carbon index 94700f2fb8a7..40b722ec8c79 100644 --- a/toolchain/check/testdata/impl/empty.carbon +++ b/toolchain/check/testdata/impl/empty.carbon @@ -15,7 +15,10 @@ impl i32 as Empty { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Empty [template] // CHECK:STDOUT: %Self: Empty = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: = interface_witness () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,7 +28,11 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_6.2: type = converted %int.make_type_32, %.loc10_6.1 [template = i32] // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -39,9 +46,11 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Empty { -// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.2] +// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_call_invalid.carbon b/toolchain/check/testdata/impl/fail_call_invalid.carbon index f838e190cc2f..5cc2cd833612 100644 --- a/toolchain/check/testdata/impl/fail_call_invalid.carbon +++ b/toolchain/check/testdata/impl/fail_call_invalid.carbon @@ -29,10 +29,12 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %struct.1: G = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, G [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%G.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] -// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %InstanceCall: type = fn_type @InstanceCall [template] -// CHECK:STDOUT: %struct.3: InstanceCall = struct_value () [template] +// CHECK:STDOUT: %struct.4: InstanceCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,10 +45,18 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_6.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_6.2: type = converted %int.make_type_32.loc11, %.loc11_6.1 [template = i32] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_32.loc18, %.loc18_20.1 [template = i32] // CHECK:STDOUT: %n.loc18_17.1: i32 = param n // CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc18_17.1 // CHECK:STDOUT: } @@ -70,7 +80,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { -// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.2] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Undeclared.ref: = name_ref Undeclared, [template = ] // CHECK:STDOUT: %self.loc15_8.1: = param self // CHECK:STDOUT: %self.loc15_8.2: = bind_name self, %self.loc15_8.1 @@ -84,6 +94,8 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G.1[@Simple.%self.loc8_8.2: Self](); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G.2[@impl.%self.loc15_8.2: ](); // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCall(%n: i32) { diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index 5523257cd02b..078321d24ac6 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -16,7 +16,10 @@ extend impl i32 as I {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: = interface_witness () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,7 +29,11 @@ extend impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -40,9 +47,11 @@ extend impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { -// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.2] +// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index c70a8c7636d2..3b8d4ee89470 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -41,8 +41,11 @@ class E { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.2: = interface_witness () [template] -// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness () [template] +// CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %E: type = class_type @E [template] // CHECK:STDOUT: } @@ -58,6 +61,7 @@ class E { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %E.decl: type = class_decl @E [template = constants.%E] {} // CHECK:STDOUT: } @@ -71,7 +75,7 @@ class E { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: i32 as I { -// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.2] +// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = %.1 @@ -80,7 +84,7 @@ class E { // CHECK:STDOUT: impl @impl.2: D as I; // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.3: E as I { -// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.2] +// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = %.1 @@ -88,6 +92,9 @@ class E { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: impl_decl @impl.1 { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32, %.loc14_15.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -118,3 +125,5 @@ class E { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index 8900ddd14b18..f35a43c7148a 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -15,7 +15,10 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = struct_type {} [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 = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,15 +28,22 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as i32; // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl {} +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32, %.loc11_18.1 [template = i32] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon index 2fc59f308fa3..7bd5cdc8b04b 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon @@ -18,6 +18,9 @@ impl bool as I {} // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = assoc_entity_type @I, type [template] // CHECK:STDOUT: %.3: = assoc_entity element0, @I.%T [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,7 +30,11 @@ impl bool as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc12_6.2: type = converted %bool.make_type, %.loc12_6.1 [template = bool] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -48,3 +55,5 @@ impl bool as I {} // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index 00f6b2a70c93..eb2aab9beb7b 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -227,51 +227,55 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %struct.2: PossiblyF = struct_value () [template] // CHECK:STDOUT: %FAlias: type = class_type @FAlias [template] // CHECK:STDOUT: %FExtraParam: type = class_type @FExtraParam [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.3: Bool = struct_value () [template] // CHECK:STDOUT: %F.3: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [template] // CHECK:STDOUT: %F.4: type = fn_type @F.3 [template] -// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [template] // CHECK:STDOUT: %F.5: type = fn_type @F.4 [template] -// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %struct.6: F = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @J [template] // CHECK:STDOUT: %Self.2: J = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %F.6: type = fn_type @F.5 [template] -// CHECK:STDOUT: %struct.6: F = struct_value () [template] +// CHECK:STDOUT: %struct.7: F = struct_value () [template] // CHECK:STDOUT: %.7: type = assoc_entity_type @J, F [template] // CHECK:STDOUT: %.8: = assoc_entity element0, @J.%F.decl [template] // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [template] // CHECK:STDOUT: %F.7: type = fn_type @F.6 [template] -// CHECK:STDOUT: %struct.7: F = struct_value () [template] +// CHECK:STDOUT: %struct.8: F = struct_value () [template] // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [template] // CHECK:STDOUT: %F.8: type = fn_type @F.7 [template] -// CHECK:STDOUT: %struct.8: F = struct_value () [template] +// CHECK:STDOUT: %struct.9: F = struct_value () [template] // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [template] // CHECK:STDOUT: %F.9: type = fn_type @F.8 [template] -// CHECK:STDOUT: %struct.9: F = struct_value () [template] +// CHECK:STDOUT: %struct.10: F = struct_value () [template] // CHECK:STDOUT: %FDifferentParamType: type = class_type @FDifferentParamType [template] // CHECK:STDOUT: %F.10: type = fn_type @F.9 [template] -// CHECK:STDOUT: %struct.10: F = struct_value () [template] +// CHECK:STDOUT: %struct.11: F = struct_value () [template] // CHECK:STDOUT: %FDifferentImplicitParamType: type = class_type @FDifferentImplicitParamType [template] // CHECK:STDOUT: %F.11: type = fn_type @F.10 [template] -// CHECK:STDOUT: %struct.11: F = struct_value () [template] +// CHECK:STDOUT: %struct.12: F = struct_value () [template] // CHECK:STDOUT: %FDifferentReturnType: type = class_type @FDifferentReturnType [template] // CHECK:STDOUT: %F.12: type = fn_type @F.11 [template] -// CHECK:STDOUT: %struct.12: F = struct_value () [template] +// CHECK:STDOUT: %struct.13: F = struct_value () [template] // CHECK:STDOUT: %FDifferentParamName: type = class_type @FDifferentParamName [template] // CHECK:STDOUT: %F.13: type = fn_type @F.12 [template] -// CHECK:STDOUT: %struct.13: F = struct_value () [template] +// CHECK:STDOUT: %struct.14: F = struct_value () [template] // CHECK:STDOUT: %.9: type = interface_type @SelfNested [template] // CHECK:STDOUT: %Self.3: SelfNested = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.10: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.15: Int32 = struct_value () [template] // CHECK:STDOUT: %.11: type = struct_type {.x: Self, .y: i32} [symbolic] // CHECK:STDOUT: %.12: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.13: type = tuple_type (Self*, {.x: Self, .y: i32}) [symbolic] // CHECK:STDOUT: %.14: i32 = int_literal 4 [template] // CHECK:STDOUT: %.15: type = array_type %.14, Self [symbolic] // CHECK:STDOUT: %F.14: type = fn_type @F.13 [template] -// CHECK:STDOUT: %struct.14: F = struct_value () [template] +// CHECK:STDOUT: %struct.16: F = struct_value () [template] // CHECK:STDOUT: %.16: type = assoc_entity_type @SelfNested, F [template] // CHECK:STDOUT: %.17: = assoc_entity element0, @SelfNested.%F.decl [template] // CHECK:STDOUT: %SelfNestedBadParam: type = class_type @SelfNestedBadParam [template] @@ -280,7 +284,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.20: type = tuple_type (SelfNestedBadParam*, {.x: i32, .y: i32}) [template] // CHECK:STDOUT: %.21: type = array_type %.14, SelfNestedBadParam [template] // CHECK:STDOUT: %F.15: type = fn_type @F.14 [template] -// CHECK:STDOUT: %struct.15: F = struct_value () [template] +// CHECK:STDOUT: %struct.17: F = struct_value () [template] // CHECK:STDOUT: %.22: type = struct_type {.x: SelfNestedBadParam, .y: i32} [template] // CHECK:STDOUT: %.23: type = tuple_type (SelfNestedBadParam*, {.x: SelfNestedBadParam, .y: i32}) [template] // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [template] @@ -288,7 +292,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.25: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template] // CHECK:STDOUT: %.26: type = tuple_type (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) [template] // CHECK:STDOUT: %F.16: type = fn_type @F.15 [template] -// CHECK:STDOUT: %struct.16: F = struct_value () [template] +// CHECK:STDOUT: %struct.18: F = struct_value () [template] // CHECK:STDOUT: %.27: type = array_type %.14, SelfNestedBadReturnType [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -322,19 +326,43 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %PossiblyF.decl: PossiblyF = fn_decl @PossiblyF [template = constants.%struct.2] {} // CHECK:STDOUT: %FAlias.decl: type = class_decl @FAlias [template = constants.%FAlias] {} // CHECK:STDOUT: %FExtraParam.decl: type = class_decl @FExtraParam [template = constants.%FExtraParam] {} +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FExtraImplicitParam.decl: type = class_decl @FExtraImplicitParam [template = constants.%FExtraImplicitParam] {} // CHECK:STDOUT: %FExtraReturnType.decl: type = class_decl @FExtraReturnType [template = constants.%FExtraReturnType] {} +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.6] {} +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FMissingParam.decl: type = class_decl @FMissingParam [template = constants.%FMissingParam] {} +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FMissingImplicitParam.decl: type = class_decl @FMissingImplicitParam [template = constants.%FMissingImplicitParam] {} +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FMissingReturnType.decl: type = class_decl @FMissingReturnType [template = constants.%FMissingReturnType] {} +// CHECK:STDOUT: %import_ref.10: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.11: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FDifferentParamType.decl: type = class_decl @FDifferentParamType [template = constants.%FDifferentParamType] {} +// CHECK:STDOUT: %import_ref.12: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.13: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FDifferentImplicitParamType.decl: type = class_decl @FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] {} +// CHECK:STDOUT: %import_ref.14: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.15: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FDifferentReturnType.decl: type = class_decl @FDifferentReturnType [template = constants.%FDifferentReturnType] {} +// CHECK:STDOUT: %import_ref.16: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.17: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %FDifferentParamName.decl: type = class_decl @FDifferentParamName [template = constants.%FDifferentParamName] {} +// CHECK:STDOUT: %import_ref.18: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.19: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.20: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%.9] {} +// CHECK:STDOUT: %import_ref.21: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.15] // CHECK:STDOUT: %SelfNestedBadParam.decl: type = class_decl @SelfNestedBadParam [template = constants.%SelfNestedBadParam] {} +// CHECK:STDOUT: %import_ref.22: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.15] +// CHECK:STDOUT: %import_ref.23: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.15] // CHECK:STDOUT: %SelfNestedBadReturnType.decl: type = class_decl @SelfNestedBadReturnType [template = constants.%SelfNestedBadReturnType] {} +// CHECK:STDOUT: %import_ref.24: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.15] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -350,24 +378,33 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: interface @J { // CHECK:STDOUT: %Self: J = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.6] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.7] { +// CHECK:STDOUT: %bool.make_type.loc89_26: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc89_26.1: type = value_of_initializer %bool.make_type.loc89_26 [template = bool] +// CHECK:STDOUT: %.loc89_26.2: type = converted %bool.make_type.loc89_26, %.loc89_26.1 [template = bool] // CHECK:STDOUT: %self.loc89_20.1: bool = param self // CHECK:STDOUT: %self.loc89_20.2: bool = bind_name self, %self.loc89_20.1 +// CHECK:STDOUT: %bool.make_type.loc89_35: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc89_35.1: type = value_of_initializer %bool.make_type.loc89_35 [template = bool] +// CHECK:STDOUT: %.loc89_35.2: type = converted %bool.make_type.loc89_35, %.loc89_35.1 [template = bool] // CHECK:STDOUT: %b.loc89_32.1: bool = param b // CHECK:STDOUT: %b.loc89_32.2: bool = bind_name b, %b.loc89_32.1 +// CHECK:STDOUT: %bool.make_type.loc89_44: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc89_44.1: type = value_of_initializer %bool.make_type.loc89_44 [template = bool] +// CHECK:STDOUT: %.loc89_44.2: type = converted %bool.make_type.loc89_44, %.loc89_44.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc89: = assoc_entity element0, %F.decl [template = constants.%.8] +// CHECK:STDOUT: %.loc89_48: = assoc_entity element0, %F.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc89 +// CHECK:STDOUT: .F = %.loc89_48 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SelfNested { // CHECK:STDOUT: %Self: SelfNested = bind_symbolic_name Self 0 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %F.decl: F = fn_decl @F.13 [template = constants.%struct.14] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.13 [template = constants.%struct.16] { // CHECK:STDOUT: %Self.ref.loc184_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_16.1: type = facet_type_access %Self.ref.loc184_12 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_16.2: type = converted %Self.ref.loc184_12, %.loc184_16.1 [symbolic = constants.%Self.3] @@ -375,6 +412,9 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref.loc184_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_24.1: type = facet_type_access %Self.ref.loc184_24 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_24.2: type = converted %Self.ref.loc184_24, %.loc184_24.1 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc184_34.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc184_34.2: type = converted %int.make_type_32, %.loc184_34.1 [template = i32] // CHECK:STDOUT: %.loc184_37: type = struct_type {.x: Self, .y: i32} [symbolic = constants.%.11] // CHECK:STDOUT: %.loc184_38.1: (type, type) = tuple_literal (%.loc184_16.3, %.loc184_37) // CHECK:STDOUT: %.loc184_38.2: type = converted %.loc184_38.1, constants.%.13 [symbolic = constants.%.13] @@ -422,7 +462,10 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.4: FExtraParam as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc58_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc58_13.2: type = converted %bool.make_type, %.loc58_13.1 [template = bool] // CHECK:STDOUT: %b.loc58_10.1: bool = param b // CHECK:STDOUT: %b.loc58_10.2: bool = bind_name b, %b.loc58_10.1 // CHECK:STDOUT: } @@ -434,7 +477,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.5: FExtraImplicitParam as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.5] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [template = constants.%FExtraImplicitParam] // CHECK:STDOUT: %self.loc71_10.1: FExtraImplicitParam = param self // CHECK:STDOUT: %self.loc71_10.2: FExtraImplicitParam = bind_name self, %self.loc71_10.1 @@ -447,7 +490,10 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.6: FExtraReturnType as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.5] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.6] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc85_15.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc85_15.2: type = converted %bool.make_type, %.loc85_15.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -458,9 +504,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.7: FMissingParam as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.7] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.8] { +// CHECK:STDOUT: %bool.make_type.loc100_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc100_16.1: type = value_of_initializer %bool.make_type.loc100_16 [template = bool] +// CHECK:STDOUT: %.loc100_16.2: type = converted %bool.make_type.loc100_16, %.loc100_16.1 [template = bool] // CHECK:STDOUT: %self.loc100_10.1: bool = param self // CHECK:STDOUT: %self.loc100_10.2: bool = bind_name self, %self.loc100_10.1 +// CHECK:STDOUT: %bool.make_type.loc100_27: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc100_27.1: type = value_of_initializer %bool.make_type.loc100_27 [template = bool] +// CHECK:STDOUT: %.loc100_27.2: type = converted %bool.make_type.loc100_27, %.loc100_27.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -471,9 +523,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.8: FMissingImplicitParam as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.7 [template = constants.%struct.8] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.7 [template = constants.%struct.9] { +// CHECK:STDOUT: %bool.make_type.loc113_13: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc113_13.1: type = value_of_initializer %bool.make_type.loc113_13 [template = bool] +// CHECK:STDOUT: %.loc113_13.2: type = converted %bool.make_type.loc113_13, %.loc113_13.1 [template = bool] // CHECK:STDOUT: %b.loc113_10.1: bool = param b // CHECK:STDOUT: %b.loc113_10.2: bool = bind_name b, %b.loc113_10.1 +// CHECK:STDOUT: %bool.make_type.loc113_22: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc113_22.1: type = value_of_initializer %bool.make_type.loc113_22 [template = bool] +// CHECK:STDOUT: %.loc113_22.2: type = converted %bool.make_type.loc113_22, %.loc113_22.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -484,9 +542,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.9: FMissingReturnType as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.8 [template = constants.%struct.9] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.8 [template = constants.%struct.10] { +// CHECK:STDOUT: %bool.make_type.loc126_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc126_16.1: type = value_of_initializer %bool.make_type.loc126_16 [template = bool] +// CHECK:STDOUT: %.loc126_16.2: type = converted %bool.make_type.loc126_16, %.loc126_16.1 [template = bool] // CHECK:STDOUT: %self.loc126_10.1: bool = param self // CHECK:STDOUT: %self.loc126_10.2: bool = bind_name self, %self.loc126_10.1 +// CHECK:STDOUT: %bool.make_type.loc126_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc126_25.1: type = value_of_initializer %bool.make_type.loc126_25 [template = bool] +// CHECK:STDOUT: %.loc126_25.2: type = converted %bool.make_type.loc126_25, %.loc126_25.1 [template = bool] // CHECK:STDOUT: %b.loc126_22.1: bool = param b // CHECK:STDOUT: %b.loc126_22.2: bool = bind_name b, %b.loc126_22.1 // CHECK:STDOUT: } @@ -498,12 +562,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.10: FDifferentParamType as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.9 [template = constants.%struct.10] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.9 [template = constants.%struct.11] { +// CHECK:STDOUT: %bool.make_type.loc139_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc139_16.1: type = value_of_initializer %bool.make_type.loc139_16 [template = bool] +// CHECK:STDOUT: %.loc139_16.2: type = converted %bool.make_type.loc139_16, %.loc139_16.1 [template = bool] // CHECK:STDOUT: %self.loc139_10.1: bool = param self // CHECK:STDOUT: %self.loc139_10.2: bool = bind_name self, %self.loc139_10.1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [template = constants.%FDifferentParamType] // CHECK:STDOUT: %b.loc139_22.1: FDifferentParamType = param b // CHECK:STDOUT: %b.loc139_22.2: FDifferentParamType = bind_name b, %b.loc139_22.1 +// CHECK:STDOUT: %bool.make_type.loc139_34: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc139_34.1: type = value_of_initializer %bool.make_type.loc139_34 [template = bool] +// CHECK:STDOUT: %.loc139_34.2: type = converted %bool.make_type.loc139_34, %.loc139_34.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -514,12 +584,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.11: FDifferentImplicitParamType as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.10 [template = constants.%struct.11] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.10 [template = constants.%struct.12] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %self.loc152_10.1: FDifferentImplicitParamType = param self // CHECK:STDOUT: %self.loc152_10.2: FDifferentImplicitParamType = bind_name self, %self.loc152_10.1 +// CHECK:STDOUT: %bool.make_type.loc152_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc152_25.1: type = value_of_initializer %bool.make_type.loc152_25 [template = bool] +// CHECK:STDOUT: %.loc152_25.2: type = converted %bool.make_type.loc152_25, %.loc152_25.1 [template = bool] // CHECK:STDOUT: %b.loc152_22.1: bool = param b // CHECK:STDOUT: %b.loc152_22.2: bool = bind_name b, %b.loc152_22.1 +// CHECK:STDOUT: %bool.make_type.loc152_34: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc152_34.1: type = value_of_initializer %bool.make_type.loc152_34 [template = bool] +// CHECK:STDOUT: %.loc152_34.2: type = converted %bool.make_type.loc152_34, %.loc152_34.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -530,9 +606,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.12: FDifferentReturnType as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.11 [template = constants.%struct.12] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.11 [template = constants.%struct.13] { +// CHECK:STDOUT: %bool.make_type.loc165_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc165_16.1: type = value_of_initializer %bool.make_type.loc165_16 [template = bool] +// CHECK:STDOUT: %.loc165_16.2: type = converted %bool.make_type.loc165_16, %.loc165_16.1 [template = bool] // CHECK:STDOUT: %self.loc165_10.1: bool = param self // CHECK:STDOUT: %self.loc165_10.2: bool = bind_name self, %self.loc165_10.1 +// CHECK:STDOUT: %bool.make_type.loc165_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc165_25.1: type = value_of_initializer %bool.make_type.loc165_25 [template = bool] +// CHECK:STDOUT: %.loc165_25.2: type = converted %bool.make_type.loc165_25, %.loc165_25.1 [template = bool] // CHECK:STDOUT: %b.loc165_22.1: bool = param b // CHECK:STDOUT: %b.loc165_22.2: bool = bind_name b, %b.loc165_22.1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [template = constants.%FDifferentReturnType] @@ -546,11 +628,20 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.13: FDifferentParamName as J { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.12 [template = constants.%struct.13] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.12 [template = constants.%struct.14] { +// CHECK:STDOUT: %bool.make_type.loc179_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc179_16.1: type = value_of_initializer %bool.make_type.loc179_16 [template = bool] +// CHECK:STDOUT: %.loc179_16.2: type = converted %bool.make_type.loc179_16, %.loc179_16.1 [template = bool] // CHECK:STDOUT: %self.loc179_10.1: bool = param self // CHECK:STDOUT: %self.loc179_10.2: bool = bind_name self, %self.loc179_10.1 +// CHECK:STDOUT: %bool.make_type.loc179_29: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc179_29.1: type = value_of_initializer %bool.make_type.loc179_29 [template = bool] +// CHECK:STDOUT: %.loc179_29.2: type = converted %bool.make_type.loc179_29, %.loc179_29.1 [template = bool] // CHECK:STDOUT: %not_b.loc179_22.1: bool = param not_b // CHECK:STDOUT: %not_b.loc179_22.2: bool = bind_name not_b, %not_b.loc179_22.1 +// CHECK:STDOUT: %bool.make_type.loc179_38: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc179_38.1: type = value_of_initializer %bool.make_type.loc179_38 [template = bool] +// CHECK:STDOUT: %.loc179_38.2: type = converted %bool.make_type.loc179_38, %.loc179_38.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -561,9 +652,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.14: SelfNestedBadParam as SelfNested { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.14 [template = constants.%struct.15] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.14 [template = constants.%struct.17] { // CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] // CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.18] +// CHECK:STDOUT: %int.make_type_32.loc196_40: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc196_40.1: type = value_of_initializer %int.make_type_32.loc196_40 [template = i32] +// CHECK:STDOUT: %.loc196_40.2: type = converted %int.make_type_32.loc196_40, %.loc196_40.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc196_49: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc196_49.1: type = value_of_initializer %int.make_type_32.loc196_49 [template = i32] +// CHECK:STDOUT: %.loc196_49.2: type = converted %int.make_type_32.loc196_49, %.loc196_49.1 [template = i32] // CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19] // CHECK:STDOUT: %.loc196_53.1: (type, type) = tuple_literal (%.loc196_32, %.loc196_52) // CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.20 [template = constants.%.20] @@ -582,10 +679,13 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.15: SelfNestedBadReturnType as SelfNested { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.15 [template = constants.%struct.16] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.15 [template = constants.%struct.18] { // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.24] // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc208_74.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc208_74.2: type = converted %int.make_type_32, %.loc208_74.1 [template = i32] // CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.25] // CHECK:STDOUT: %.loc208_78.1: (type, type) = tuple_literal (%.loc208_37, %.loc208_77) // CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.26 [template = constants.%.26] @@ -744,6 +844,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: fn @PossiblyF(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(@impl.4.%b.loc58_10.2: bool); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.3[@impl.5.%self.loc71_10.2: FExtraImplicitParam](); @@ -766,6 +868,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.12[@impl.13.%self.loc179_10.2: bool](@impl.13.%not_b.loc179_22.2: bool) -> bool; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc184_8.2: (Self*, {.x: Self, .y: i32})) -> [Self; 4]; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.14(@impl.14.%x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index 6b86a0276053..bb28450faccc 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -16,7 +16,10 @@ impl i32 as false {} // CHECK:STDOUT: --- fail_impl_bad_interface.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal false [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: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,8 +27,12 @@ impl i32 as false {} // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %.loc14: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_6.2: type = converted %int.make_type_32, %.loc14_6.1 [template = i32] +// CHECK:STDOUT: %.loc14_13: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -34,3 +41,5 @@ impl i32 as false {} // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index ca15d4f9b2cb..18f4b076c04c 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -21,7 +21,10 @@ impl i32 as I {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: = interface_witness () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,10 +34,18 @@ impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32.loc9, %.loc9_6.1 [template = i32] // CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_6.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_6.2: type = converted %int.make_type_32.loc17, %.loc17_6.1 [template = i32] // CHECK:STDOUT: %I.ref.loc17: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -49,6 +60,8 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = +// CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon b/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon index c707c0599433..074dc9966e73 100644 --- a/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon @@ -18,6 +18,9 @@ impl bool as I where .T = bool {} // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = assoc_entity_type @I, type [template] // CHECK:STDOUT: %.3: = assoc_entity element0, @I.%T [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,7 +30,11 @@ impl bool as I where .T = bool {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc12_6.2: type = converted %bool.make_type, %.loc12_6.1 [template = bool] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -45,3 +52,5 @@ impl bool as I where .T = bool {} // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: bool as I; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index d83191660f71..bf6c274b1134 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -36,11 +36,13 @@ impl C as I { // CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] -// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] // CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.6: = interface_witness (%struct.3) [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,7 +55,11 @@ impl C as I { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32, %.loc15_11.1 [template = i32] // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl { @@ -74,7 +80,7 @@ impl C as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] {} // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -94,6 +100,8 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index aa7ba9f5b12d..600e02817a70 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -118,20 +118,20 @@ fn G(c: Impl.C) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Impl: = namespace [template] {} -// CHECK:STDOUT: %import_ref.1 = import_ref ir7, inst+14, unloaded -// CHECK:STDOUT: %import_ref.2: = import_ref ir7, inst+11, loaded [template = constants.%.6] -// CHECK:STDOUT: %import_ref.3 = import_ref ir7, inst+4, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir7, inst+6, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir7, inst+22, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.6: type = import_ref ir7, inst+13, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.1 = import_ref ir8, inst+14, unloaded +// CHECK:STDOUT: %import_ref.2: = import_ref ir8, inst+11, loaded [template = constants.%.6] +// CHECK:STDOUT: %import_ref.3 = import_ref ir8, inst+4, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir8, inst+6, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir8, inst+22, loaded [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: type = import_ref ir8, inst+13, loaded [template = constants.%C] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: %Impl.ref: = name_ref Impl, %Impl [template = %Impl] // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.6 [template = constants.%C] // CHECK:STDOUT: %c.loc4_6.1: C = param c // CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc4_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.7: type = import_ref ir7, inst+2, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.8 = import_ref ir7, inst+6, unloaded +// CHECK:STDOUT: %import_ref.7: type = import_ref ir8, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.8 = import_ref ir8, inst+6, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { diff --git a/toolchain/check/testdata/impl/lookup/instance_method.carbon b/toolchain/check/testdata/impl/lookup/instance_method.carbon index 6e978015204e..96c325099786 100644 --- a/toolchain/check/testdata/impl/lookup/instance_method.carbon +++ b/toolchain/check/testdata/impl/lookup/instance_method.carbon @@ -26,17 +26,19 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] -// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.3) [template] // CHECK:STDOUT: %.6: type = struct_type {} [template] // CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,23 +52,32 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl.loc7: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %C.decl.loc13: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] { +// 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.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl.loc7 [template = constants.%C] // CHECK:STDOUT: %c.loc19_6.1: C = param c // CHECK:STDOUT: @F.3.%c: C = bind_name c, %c.loc19_6.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_15.2: type = converted %int.make_type_32, %.loc19_15.1 [template = i32] // CHECK:STDOUT: @F.3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: I = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_14.2: type = converted %Self.ref, %.loc10_14.1 [symbolic = constants.%Self] // CHECK:STDOUT: %self.loc10_8.1: Self = param self // CHECK:STDOUT: %self.loc10_8.2: Self = bind_name self, %self.loc10_8.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32, %.loc10_25.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc10_28: = assoc_entity element0, %F.decl [template = constants.%.4] @@ -78,10 +89,13 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { -// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %self.loc15_10.1: C = param self // CHECK:STDOUT: %self.loc15_10.2: C = bind_name self, %self.loc15_10.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_27.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_27.2: type = converted %int.make_type_32, %.loc15_27.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] @@ -101,6 +115,8 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F.1[@I.%self.loc10_8.2: Self]() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2[@impl.%self.loc15_10.2: C]() -> i32; @@ -109,7 +125,7 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc10_28 [template = constants.%.4] -// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] // CHECK:STDOUT: %.loc20_11: = bound_method %c.ref, %.1 // CHECK:STDOUT: %F.call: init i32 = call %.loc20_11(%c.ref) // CHECK:STDOUT: %.loc20_15.1: i32 = value_of_initializer %F.call diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index bcee75975a30..2c8a7b2506ef 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -19,9 +19,12 @@ impl i32 as I {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] // CHECK:STDOUT: %X: type = class_type @X [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: = interface_witness () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %.4: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -32,11 +35,20 @@ impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32.loc9, %.loc9_6.1 [template = i32] // CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32.loc15, %.loc15_6.1 [template = i32] // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -50,7 +62,7 @@ impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { -// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness () [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = %.1 @@ -58,6 +70,9 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: class @X { // CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -65,3 +80,5 @@ impl i32 as I {} // CHECK:STDOUT: .Self = constants.%X // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/array_element_access.carbon b/toolchain/check/testdata/index/array_element_access.carbon index c1d367273d19..cd09c369d418 100644 --- a/toolchain/check/testdata/index/array_element_access.carbon +++ b/toolchain/check/testdata/index/array_element_access.carbon @@ -12,15 +12,18 @@ var d: i32 = a[b]; // CHECK:STDOUT: --- array_element_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 2] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 24 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %array: [i32; 2] = tuple_value (%.4, %.5) [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 2 [template] +// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 2] [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 24 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] +// CHECK:STDOUT: %array: [i32; 2] = tuple_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -32,36 +35,54 @@ var d: i32 = a[b]; // CHECK:STDOUT: .d = %d // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2 [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] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2 [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; 2] = var a // CHECK:STDOUT: %a: ref [i32; 2] = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.2: 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_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: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = 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: %.loc7_20: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24 [template = constants.%.6] // CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_20, %.loc7_24) -// CHECK:STDOUT: %.loc7_26.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc7_26.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc7_26.3: ref i32 = array_index file.%a.var, %.loc7_26.2 -// CHECK:STDOUT: %.loc7_26.4: init i32 = initialize_from %.loc7_20 to %.loc7_26.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26.5: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc7_26.4: init i32 = initialize_from %.loc7_20 to %.loc7_26.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26.5: i32 = int_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc7_26.6: ref i32 = array_index file.%a.var, %.loc7_26.5 -// CHECK:STDOUT: %.loc7_26.7: init i32 = initialize_from %.loc7_24 to %.loc7_26.6 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26.7: init i32 = initialize_from %.loc7_24 to %.loc7_26.6 [template = constants.%.6] // CHECK:STDOUT: %.loc7_26.8: init [i32; 2] = array_init (%.loc7_26.4, %.loc7_26.7) to file.%a.var [template = constants.%array] // CHECK:STDOUT: %.loc7_27: init [i32; 2] = converted %.loc7_26.1, %.loc7_26.8 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc7_27 -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.9] // CHECK:STDOUT: assign file.%b.var, %.loc8 // CHECK:STDOUT: %a.ref.loc9: ref [i32; 2] = name_ref a, file.%a -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc9_17.1: ref i32 = array_index %a.ref.loc9, %.loc9_16 // CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 // CHECK:STDOUT: assign file.%c.var, %.loc9_17.2 diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index ded25d0b63ab..1510cb3f6819 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -27,23 +27,25 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: --- expr_category.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: %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: 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, %.1) [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.2) [template] // CHECK:STDOUT: %.9: type = ptr_type i32 [template] // CHECK:STDOUT: %.10: i32 = int_literal 4 [template] // CHECK:STDOUT: %ValueBinding: type = fn_type @ValueBinding [template] -// CHECK:STDOUT: %struct.3: ValueBinding = struct_value () [template] +// CHECK:STDOUT: %struct.4: ValueBinding = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,36 +56,56 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: .ValueBinding = %ValueBinding.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: 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 [template = i32] +// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7, %.loc7_12.1 [template = i32] +// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref [i32; 3] = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.3] // CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b // CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %ValueBinding.decl: ValueBinding = fn_decl @ValueBinding [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc17_26: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %ValueBinding.decl: ValueBinding = fn_decl @ValueBinding [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_26: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] +// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.3] // CHECK:STDOUT: %b.loc17_17.1: [i32; 3] = param b // CHECK:STDOUT: @ValueBinding.%b: [i32; 3] = bind_name b, %b.loc17_17.1 // CHECK:STDOUT: } +// 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; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10, %.loc10_11.1 [template = i32] +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_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 // CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc10_29.1: (i32, i32, i32) = tuple_literal (%.loc10_22, %.loc10_25, %.loc10_28) // CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc10_29.3: ref i32 = array_index %a.var, %.loc10_29.2 @@ -93,11 +115,14 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc10_29.7: init i32 = initialize_from %.loc10_25 to %.loc10_29.6 [template = constants.%.6] // CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc10_29.9: ref i32 = array_index %a.var, %.loc10_29.8 -// CHECK:STDOUT: %.loc10_29.10: init i32 = initialize_from %.loc10_28 to %.loc10_29.9 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_29.10: init i32 = initialize_from %.loc10_28 to %.loc10_29.9 [template = constants.%.2] // CHECK:STDOUT: %.loc10_29.11: init [i32; 3] = array_init (%.loc10_29.4, %.loc10_29.7, %.loc10_29.10) to %a.var [template = constants.%array] // CHECK:STDOUT: %.loc10_30: init [i32; 3] = converted %.loc10_29.1, %.loc10_29.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc10_30 -// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_14.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_14.2: type = converted %int.make_type_32.loc13, %.loc13_14.1 [template = i32] +// CHECK:STDOUT: %.loc13_14.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: %pa.var: ref i32* = var pa // CHECK:STDOUT: %pa: ref i32* = bind_name pa, %pa.var // CHECK:STDOUT: %a.ref.loc13: ref [i32; 3] = name_ref a, %a @@ -115,13 +140,16 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @ValueBinding(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32] +// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_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 // CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc18_29.1: (i32, i32, i32) = tuple_literal (%.loc18_22, %.loc18_25, %.loc18_28) // CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc18_29.3: ref i32 = array_index %a.var, %.loc18_29.2 @@ -131,7 +159,7 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc18_29.7: init i32 = initialize_from %.loc18_25 to %.loc18_29.6 [template = constants.%.6] // CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc18_29.9: ref i32 = array_index %a.var, %.loc18_29.8 -// CHECK:STDOUT: %.loc18_29.10: init i32 = initialize_from %.loc18_28 to %.loc18_29.9 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_29.10: init i32 = initialize_from %.loc18_28 to %.loc18_29.9 [template = constants.%.2] // CHECK:STDOUT: %.loc18_29.11: init [i32; 3] = array_init (%.loc18_29.4, %.loc18_29.7, %.loc18_29.10) to %a.var [template = constants.%array] // CHECK:STDOUT: %.loc18_30: init [i32; 3] = converted %.loc18_29.1, %.loc18_29.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc18_30 @@ -143,7 +171,7 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc23_6.1: ref [i32; 3] = value_as_ref %b.ref // CHECK:STDOUT: %.loc23_6.2: ref i32 = array_index %.loc23_6.1, %.loc23_5 // CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 -// 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: %.loc24_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call: init [i32; 3] = call %F.ref() to %.loc24_4.1 // CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.8] diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index 4da7d721c70b..b90a47d4a0ad 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -20,14 +20,17 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: --- fail_array_large_index.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 12 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.4) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 2147483647 [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 12 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.5) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,33 +41,47 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: .c = %c // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [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.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; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var +// 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_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var +// 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_8.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_8.2: type = converted %int.make_type_32.loc18, %.loc18_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.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 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] // CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc7_24 // CHECK:STDOUT: %a.ref.loc13: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc13_17.1: ref i32 = array_index %a.ref.loc13, %.loc13_16 [template = ] // CHECK:STDOUT: %.loc13_17.2: i32 = bind_value %.loc13_17.1 // CHECK:STDOUT: assign file.%b.var, %.loc13_17.2 // CHECK:STDOUT: %a.ref.loc18: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 2147483647 [template = constants.%.7] +// CHECK:STDOUT: %.loc18_16: i32 = int_literal 2147483647 [template = constants.%.8] // CHECK:STDOUT: %.loc18_27.1: ref i32 = array_index %a.ref.loc18, %.loc18_16 [template = ] // CHECK:STDOUT: %.loc18_27.2: i32 = bind_value %.loc18_27.1 // CHECK:STDOUT: assign file.%c.var, %.loc18_27.2 diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index 329a7be12543..bebbecc4f20b 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -13,14 +13,17 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: --- fail_array_non_int_indexing.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 12 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.4) [template] -// CHECK:STDOUT: %.7: f64 = float_literal 2.6000000000000001 [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 12 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.5) [template] +// CHECK:STDOUT: %.8: f64 = float_literal 2.6000000000000001 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -30,26 +33,36 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [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.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; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.2: 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_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 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] // CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc7_24 // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.8] // CHECK:STDOUT: %.loc11_19.1: ref i32 = array_index %a.ref, // CHECK:STDOUT: %.loc11_19.2: i32 = bind_value %.loc11_19.1 // CHECK:STDOUT: assign file.%b.var, %.loc11_19.2 diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index e21b5af6039b..e6f011f2a9b7 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -13,13 +13,16 @@ var b: i32 = a[1]; // CHECK:STDOUT: --- fail_array_out_of_bound_access.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 12 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.4) [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 12 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,26 +32,36 @@ var b: i32 = a[1]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [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.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; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.2: 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_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 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] // CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] // CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc7_24 // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_16: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc11_17.1: ref i32 = array_index %a.ref, %.loc11_16 [template = ] // CHECK:STDOUT: %.loc11_17.2: i32 = bind_value %.loc11_17.1 // CHECK:STDOUT: assign file.%b.var, %.loc11_17.2 diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index a1df13589434..db2f106aa679 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -35,13 +35,15 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: --- fail_expr_category.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: %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: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: %.5: type = ptr_type i32 [template] // CHECK:STDOUT: %.6: i32 = int_literal 0 [template] @@ -55,24 +57,39 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: 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 [template = i32] +// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7, %.loc7_12.1 [template = i32] +// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref [i32; 3] = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.3] // CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b // CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: 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; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] +// CHECK:STDOUT: %.loc15_14.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pb.var: ref i32* = var pb // CHECK:STDOUT: %pb: ref i32* = bind_name pb, %pb.var // CHECK:STDOUT: %b.ref.loc15: [i32; 3] = name_ref b, %b @@ -89,10 +106,13 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %.loc20_6.3: i32 = bind_value %.loc20_6.2 // CHECK:STDOUT: %.loc20_10: i32 = int_literal 4 [template = constants.%.7] // CHECK:STDOUT: assign %.loc20_6.3, %.loc20_10 -// CHECK:STDOUT: %.loc28_14: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc28_14.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_14.2: type = converted %int.make_type_32.loc28, %.loc28_14.1 [template = i32] +// CHECK:STDOUT: %.loc28_14.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pf.var: ref i32* = var pf // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var -// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc28_20.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call.loc28: init [i32; 3] = call %F.ref.loc28() to %.loc28_20.1 // CHECK:STDOUT: %.loc28_23: i32 = int_literal 0 [template = constants.%.6] @@ -101,7 +121,7 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %.loc28_24.2: i32 = bind_value %.loc28_24.1 // CHECK:STDOUT: %.loc28_18: i32* = addr_of [template = ] // CHECK:STDOUT: assign %pf.var, %.loc28_18 -// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc32_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call.loc32: init [i32; 3] = call %F.ref.loc32() to %.loc32_4.1 // CHECK:STDOUT: %.loc32_7: i32 = int_literal 0 [template = constants.%.6] diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 779d95feae1e..83fc32df3289 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -32,15 +32,17 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: --- fail_invalid_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [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 0 [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,36 +57,62 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %N: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: 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: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_8.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_8.2: type = converted %int.make_type_32.loc19, %.loc19_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_8.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_8.2: type = converted %int.make_type_32.loc25, %.loc25_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_8.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_8.2: type = converted %int.make_type_32.loc30, %.loc30_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var +// 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(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [template = file.%N] -// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%a.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: %.loc19: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: %.loc25_20: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc25_28: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc25_29.1: {.a: i32, .b: i32} = struct_literal (%.loc25_20, %.loc25_28) -// CHECK:STDOUT: %.loc25_31: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc25_20, %.loc25_28) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc25_29.2: {.a: i32, .b: i32} = converted %.loc25_29.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc25_31: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc25_20, %.loc25_28) [template = constants.%struct.3] +// CHECK:STDOUT: %.loc25_29.2: {.a: i32, .b: i32} = converted %.loc25_29.1, %struct [template = constants.%struct.3] // CHECK:STDOUT: assign file.%c.var, +// CHECK:STDOUT: %int.make_type_32.loc30_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_19.1: type = value_of_initializer %int.make_type_32.loc30_19 [template = i32] +// CHECK:STDOUT: %.loc30_19.2: type = converted %int.make_type_32.loc30_19, %.loc30_19.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc30_28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_28.1: type = value_of_initializer %int.make_type_32.loc30_28 [template = i32] +// CHECK:STDOUT: %.loc30_28.2: type = converted %int.make_type_32.loc30_28, %.loc30_28.1 [template = i32] // CHECK:STDOUT: %.loc30_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.5] -// CHECK:STDOUT: %.loc30_33: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_33: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index 08414c0d2e54..59a103b0aa81 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -16,7 +16,9 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Main = 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 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -26,16 +28,22 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index fa54e3bd3543..eb8f467ec147 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -13,20 +13,22 @@ var b: i32 = a[-10]; // CHECK:STDOUT: --- fail_negative_indexing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 6 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 10 [template] -// CHECK:STDOUT: %.7: type = interface_type @Negate [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 6 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.8: type = interface_type @Negate [template] // CHECK:STDOUT: %Self: Negate = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Op: type = fn_type @Op [template] -// CHECK:STDOUT: %.8: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] // CHECK:STDOUT: %.9: type = assoc_entity_type @Negate, Op [template] -// CHECK:STDOUT: %.10: = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %.10: = assoc_entity element0, file.%import_ref.8 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,42 +38,56 @@ var b: i32 = a[-10]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.2 [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_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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: %import_ref.1: type = import_ref ir4, inst+67, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.2 = import_ref ir4, inst+69, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+84, loaded [template = constants.%.10] -// CHECK:STDOUT: %import_ref.4 = import_ref ir4, inst+80, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+80, unloaded +// CHECK:STDOUT: %import_ref.4: type = import_ref ir4, inst+67, loaded [template = constants.%.8] +// CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+69, unloaded +// CHECK:STDOUT: %import_ref.6: = import_ref ir4, inst+84, loaded [template = constants.%.10] +// CHECK:STDOUT: %import_ref.7 = import_ref ir4, inst+80, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir4, inst+80, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Negate { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = file.%import_ref.2 -// CHECK:STDOUT: .Op = file.%import_ref.3 -// CHECK:STDOUT: witness = (file.%import_ref.4) +// CHECK:STDOUT: .Self = file.%import_ref.5 +// CHECK:STDOUT: .Op = file.%import_ref.6 +// CHECK:STDOUT: witness = (file.%import_ref.7) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Op[%self: Self]() -> Self; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_17: i32 = int_literal 10 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_17: i32 = int_literal 10 [template = constants.%.7] // CHECK:STDOUT: %.loc11_19: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon index 6f2e18a9327f..4f3052ec5b97 100644 --- a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon +++ b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon @@ -14,13 +14,16 @@ var c: i32 = a[b]; // CHECK:STDOUT: --- fail_non_deterministic_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 3 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: 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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,29 +34,47 @@ var c: i32 = a[b]; // CHECK:STDOUT: .c = %c // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.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: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_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: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.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_22: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3 [template = constants.%.6] // CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) // CHECK:STDOUT: %.loc7_26.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_26.3: init i32 = initialize_from %.loc7_22 to %.loc7_26.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_26.3: init i32 = initialize_from %.loc7_22 to %.loc7_26.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_26.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_26.5: init i32 = initialize_from %.loc7_25 to %.loc7_26.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26.5: init i32 = initialize_from %.loc7_25 to %.loc7_26.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_26.6: init (i32, i32) = tuple_init (%.loc7_26.3, %.loc7_26.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_27: init (i32, i32) = converted %.loc7_26.1, %.loc7_26.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_27 -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: assign file.%b.var, %.loc8 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a // CHECK:STDOUT: %b.ref: ref i32 = name_ref b, file.%b diff --git a/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon b/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon index 4272e5ac7dd5..f4852c88cb4a 100644 --- a/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon +++ b/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon @@ -13,15 +13,18 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: --- fail_out_of_bound_not_literal.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 34 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.7: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.6) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 34 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.index: i32} [template] +// CHECK:STDOUT: %struct.2: {.index: i32} = struct_value (%.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,32 +34,46 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.2 [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_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.6] // CHECK:STDOUT: %.loc7_28.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_28.6: init (i32, i32) = tuple_init (%.loc7_28.3, %.loc7_28.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_29: init (i32, i32) = converted %.loc7_28.1, %.loc7_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_29 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_26: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 2 [template = constants.%.7] // 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.%.6] +// 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.%.7] // CHECK:STDOUT: %.loc11_34: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_tuple_index_error.carbon b/toolchain/check/testdata/index/fail_tuple_index_error.carbon index a04864ef3ab2..ba093ed53778 100644 --- a/toolchain/check/testdata/index/fail_tuple_index_error.carbon +++ b/toolchain/check/testdata/index/fail_tuple_index_error.carbon @@ -13,12 +13,15 @@ var b: i32 = a[oops]; // CHECK:STDOUT: --- fail_tuple_index_error.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 6 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 6 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,23 +31,37 @@ var b: i32 = a[oops]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.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: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_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_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_28 diff --git a/toolchain/check/testdata/index/fail_tuple_large_index.carbon b/toolchain/check/testdata/index/fail_tuple_large_index.carbon index 31872ae99f5b..4f56985939bc 100644 --- a/toolchain/check/testdata/index/fail_tuple_large_index.carbon +++ b/toolchain/check/testdata/index/fail_tuple_large_index.carbon @@ -19,12 +19,15 @@ var d: i32 = b[0x7FFF_FFFF]; // CHECK:STDOUT: --- fail_tuple_large_index.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 12 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2147483647 [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2147483647 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,23 +39,41 @@ var d: i32 = b[0x7FFF_FFFF]; // CHECK:STDOUT: .d = %d // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.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: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] +// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_13.2: type = converted %.loc8_13.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) +// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] +// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref (i32,) = var b // CHECK:STDOUT: %b: ref (i32,) = bind_name b, %b.var +// CHECK:STDOUT: %import_ref.3: 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_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = 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: %.loc7_18: i32 = int_literal 12 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 [template = constants.%.4] // CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_22: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 [template = constants.%tuple] @@ -64,11 +85,11 @@ var d: i32 = b[0x7FFF_FFFF]; // CHECK:STDOUT: %.loc8_18: init (i32,) = converted %a.ref, %.loc8_17.3 // CHECK:STDOUT: assign file.%b.var, %.loc8_18 // CHECK:STDOUT: %b.ref.loc13: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc13_17: ref = tuple_index %b.ref.loc13, // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: %b.ref.loc17: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc17_16: i32 = int_literal 2147483647 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_16: i32 = int_literal 2147483647 [template = constants.%.6] // CHECK:STDOUT: %.loc17_27: ref = tuple_index %b.ref.loc17, // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon index 2d0646ea2181..af80e48d91c8 100644 --- a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon @@ -13,13 +13,16 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: --- fail_tuple_non_int_indexing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 6 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: f64 = float_literal 2.6000000000000001 [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 6 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: f64 = float_literal 2.6000000000000001 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,28 +32,42 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.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: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_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_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.7] // CHECK:STDOUT: %.loc11_19: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon index e445212f5096..e3d5df2c58c2 100644 --- a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon @@ -13,13 +13,16 @@ var b: i32 = a[2]; // CHECK:STDOUT: --- fail_tuple_out_of_bound_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 6 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 6 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,28 +32,42 @@ var b: i32 = a[2]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.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: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_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_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc11_17: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/index_not_literal.carbon b/toolchain/check/testdata/index/index_not_literal.carbon index bbead6134562..94bef88bd47d 100644 --- a/toolchain/check/testdata/index/index_not_literal.carbon +++ b/toolchain/check/testdata/index/index_not_literal.carbon @@ -10,15 +10,18 @@ var b: i32 = a[{.index = 1}.index]; // CHECK:STDOUT: --- index_not_literal.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 34 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.7: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.6) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 34 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.8: type = struct_type {.index: i32} [template] +// CHECK:STDOUT: %struct.2: {.index: i32} = struct_value (%.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,32 +31,46 @@ var b: i32 = a[{.index = 1}.index]; // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.2 [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_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.3: 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_22: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.6] // CHECK:STDOUT: %.loc7_28.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.6] // CHECK:STDOUT: %.loc7_28.6: init (i32, i32) = tuple_init (%.loc7_28.3, %.loc7_28.5) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_29: init (i32, i32) = converted %.loc7_28.1, %.loc7_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc7_29 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_26: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_26: i32 = int_literal 1 [template = constants.%.7] // 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.%.6] +// 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.%.7] // CHECK:STDOUT: %.loc8_34.1: ref i32 = tuple_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 diff --git a/toolchain/check/testdata/index/tuple_element_access.carbon b/toolchain/check/testdata/index/tuple_element_access.carbon index 55edbb92c132..8586a7a23811 100644 --- a/toolchain/check/testdata/index/tuple_element_access.carbon +++ b/toolchain/check/testdata/index/tuple_element_access.carbon @@ -11,11 +11,14 @@ var c: i32 = b[0]; // CHECK:STDOUT: --- tuple_element_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 12 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.4: 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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 12 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,21 +29,35 @@ var c: i32 = b[0]; // CHECK:STDOUT: .c = %c // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.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: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] +// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_13.2: type = converted %.loc8_13.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) +// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] +// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref (i32,) = var b // CHECK:STDOUT: %b: ref (i32,) = bind_name b, %b.var +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.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_18: i32 = int_literal 12 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 [template = constants.%.4] // CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to file.%a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_22: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 [template = constants.%tuple] @@ -52,7 +69,7 @@ var c: i32 = b[0]; // CHECK:STDOUT: %.loc8_18: init (i32,) = converted %a.ref, %.loc8_17.3 // CHECK:STDOUT: assign file.%b.var, %.loc8_18 // CHECK:STDOUT: %b.ref: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.1: ref i32 = tuple_index %b.ref, %.loc9_16 // CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 // CHECK:STDOUT: assign file.%c.var, %.loc9_17.2 diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index 3b9dc112168c..fbbe78f68e87 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -13,15 +13,17 @@ fn Run() -> i32 { // CHECK:STDOUT: --- tuple_return_value_access.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: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,16 +33,26 @@ fn Run() -> i32 { // CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (%int.make_type_32.loc7) +// CHECK:STDOUT: %.loc7_16.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_16.3: type = converted %int.make_type_32.loc7, %.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 // CHECK:STDOUT: } -// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // 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] @@ -52,7 +64,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> 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: %F.call: init (i32,) = call %F.ref() // CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc10_11.1: ref (i32,) = temporary_storage diff --git a/toolchain/check/testdata/interface/assoc_const.carbon b/toolchain/check/testdata/interface/assoc_const.carbon index 606d2528296c..2e99e8d2f9c9 100644 --- a/toolchain/check/testdata/interface/assoc_const.carbon +++ b/toolchain/check/testdata/interface/assoc_const.carbon @@ -16,8 +16,11 @@ interface I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = assoc_entity_type @I, type [template] // CHECK:STDOUT: %.3: = assoc_entity element0, @I.%T [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type @I, i32 [template] -// CHECK:STDOUT: %.5: = assoc_entity element1, @I.%N [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @I, i32 [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @I.%N [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,19 +30,25 @@ interface I { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] // CHECK:STDOUT: %.loc8: = assoc_entity element0, %T [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32, %.loc9_11.1 [template = i32] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc9: = assoc_entity element1, %N [template = constants.%.5] +// CHECK:STDOUT: %.loc9_14: = assoc_entity element1, %N [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .T = %.loc8 -// CHECK:STDOUT: .N = %.loc9 +// CHECK:STDOUT: .N = %.loc9_14 // CHECK:STDOUT: witness = (%T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon index cbec0761c8b2..4cf4bb58d9a8 100644 --- a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +++ b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon @@ -21,13 +21,16 @@ interface I { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type @I, type [template] -// CHECK:STDOUT: %.5: = assoc_entity element0, @I.%T [template] -// CHECK:STDOUT: %.6: i32 = int_literal 42 [template] -// CHECK:STDOUT: %.7: type = assoc_entity_type @I, i32 [template] -// CHECK:STDOUT: %.8: = assoc_entity element1, @I.%N [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @I, type [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, @I.%T [template] +// CHECK:STDOUT: %.7: i32 = int_literal 42 [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @I, i32 [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, @I.%N [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -37,22 +40,36 @@ interface I { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc12_35: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc12_36.1: type = converted %.loc12_35, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_35: (type, type) = tuple_literal (%int.make_type_32.loc12_27, %int.make_type_32.loc12_32) +// CHECK:STDOUT: %.loc12_36.1: type = value_of_initializer %int.make_type_32.loc12_27 [template = i32] +// CHECK:STDOUT: %.loc12_36.2: type = converted %int.make_type_32.loc12_27, %.loc12_36.1 [template = i32] +// CHECK:STDOUT: %.loc12_36.3: type = value_of_initializer %int.make_type_32.loc12_32 [template = i32] +// CHECK:STDOUT: %.loc12_36.4: type = converted %int.make_type_32.loc12_32, %.loc12_36.3 [template = i32] +// CHECK:STDOUT: %.loc12_36.5: type = converted %.loc12_35, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc12_36.2: = assoc_entity element0, %T [template = constants.%.5] -// CHECK:STDOUT: %.loc16_25: i32 = int_literal 42 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_36.6: = assoc_entity element0, %T [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16, %.loc16_19.1 [template = i32] +// CHECK:STDOUT: %.loc16_25: i32 = int_literal 42 [template = constants.%.7] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc16_27: = assoc_entity element1, %N [template = constants.%.8] +// CHECK:STDOUT: %.loc16_27: = assoc_entity element1, %N [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc12_36.2 +// CHECK:STDOUT: .T = %.loc12_36.6 // CHECK:STDOUT: .N = %.loc16_27 // CHECK:STDOUT: witness = (%T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon index 289c9897ef98..092bd166b1c2 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon @@ -27,8 +27,10 @@ interface Interface { // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = 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: %.5: type = assoc_entity_type @Interface, G [template] // CHECK:STDOUT: %.6: = assoc_entity element1, @Interface.%G.decl [template] // CHECK:STDOUT: } @@ -40,25 +42,37 @@ interface Interface { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.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: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] -// 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: %int.make_type_32.loc17_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc17_19.1: type = value_of_initializer %int.make_type_32.loc17_19 [template = i32] +// CHECK:STDOUT: %.loc17_19.2: type = converted %int.make_type_32.loc17_19, %.loc17_19.1 [template = i32] // CHECK:STDOUT: %a.loc17_16.1: i32 = param a // CHECK:STDOUT: %a.loc17_16.2: i32 = bind_name a, %a.loc17_16.1 +// CHECK:STDOUT: %int.make_type_32.loc17_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc17_27.1: type = value_of_initializer %int.make_type_32.loc17_27 [template = i32] +// CHECK:STDOUT: %.loc17_27.2: type = converted %int.make_type_32.loc17_27, %.loc17_27.1 [template = i32] // CHECK:STDOUT: %b.loc17_24.1: i32 = param b // CHECK:STDOUT: %b.loc17_24.2: i32 = bind_name b, %b.loc17_24.1 +// CHECK:STDOUT: %int.make_type_32.loc17_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc17_35.1: type = value_of_initializer %int.make_type_32.loc17_35 [template = i32] +// CHECK:STDOUT: %.loc17_35.2: type = converted %int.make_type_32.loc17_35, %.loc17_35.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc17_39: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc12 -// CHECK:STDOUT: .G = %.loc17 +// CHECK:STDOUT: .G = %.loc17_39 // CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -67,5 +81,7 @@ interface Interface { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(@Interface.%a.loc17_16.2: i32, @Interface.%b.loc17_24.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon index 36d56d8b2976..7e225887328f 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon @@ -45,14 +45,16 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = 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: %.5: type = assoc_entity_type @Interface, G [template] // CHECK:STDOUT: %.6: = assoc_entity element1, @Interface.%G.decl [template] // CHECK:STDOUT: %.7: type = fn_type @.1 [template] -// CHECK:STDOUT: %struct.3: = struct_value () [template] -// CHECK:STDOUT: %.8: type = fn_type @.2 [template] // CHECK:STDOUT: %struct.4: = struct_value () [template] +// CHECK:STDOUT: %.8: type = fn_type @.2 [template] +// CHECK:STDOUT: %struct.5: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +64,27 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %.decl.loc28: = fn_decl @.1 [template = constants.%struct.3] {} -// CHECK:STDOUT: %.decl.loc36: = fn_decl @.2 [template = constants.%struct.4] { +// 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: %.decl.loc28: = fn_decl @.1 [template = constants.%struct.4] {} +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %.decl.loc36: = fn_decl @.2 [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc36_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc36_19.1: type = value_of_initializer %int.make_type_32.loc36_19 [template = i32] +// CHECK:STDOUT: %.loc36_19.2: type = converted %int.make_type_32.loc36_19, %.loc36_19.1 [template = i32] // CHECK:STDOUT: %a.loc36_16.1: i32 = param a // CHECK:STDOUT: @.2.%a: i32 = bind_name a, %a.loc36_16.1 +// CHECK:STDOUT: %int.make_type_32.loc36_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc36_27.1: type = value_of_initializer %int.make_type_32.loc36_27 [template = i32] +// CHECK:STDOUT: %.loc36_27.2: type = converted %int.make_type_32.loc36_27, %.loc36_27.1 [template = i32] // CHECK:STDOUT: %b.loc36_24.1: i32 = param b // CHECK:STDOUT: @.2.%b: i32 = bind_name b, %b.loc36_24.1 +// CHECK:STDOUT: %int.make_type_32.loc36_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc36_35.1: type = value_of_initializer %int.make_type_32.loc36_35 [template = i32] +// CHECK:STDOUT: %.loc36_35.2: type = converted %int.make_type_32.loc36_35, %.loc36_35.1 [template = i32] // CHECK:STDOUT: @.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -76,24 +93,35 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] -// 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: %int.make_type_32.loc18_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_19.1: type = value_of_initializer %int.make_type_32.loc18_19 [template = i32] +// CHECK:STDOUT: %.loc18_19.2: type = converted %int.make_type_32.loc18_19, %.loc18_19.1 [template = i32] // CHECK:STDOUT: %a.loc18_16.1: i32 = param a // CHECK:STDOUT: %a.loc18_16.2: i32 = bind_name a, %a.loc18_16.1 +// CHECK:STDOUT: %int.make_type_32.loc18_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_27.1: type = value_of_initializer %int.make_type_32.loc18_27 [template = i32] +// CHECK:STDOUT: %.loc18_27.2: type = converted %int.make_type_32.loc18_27, %.loc18_27.1 [template = i32] // CHECK:STDOUT: %b.loc18_24.1: i32 = param b // CHECK:STDOUT: %b.loc18_24.2: i32 = bind_name b, %b.loc18_24.1 +// CHECK:STDOUT: %int.make_type_32.loc18_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %int.make_type_32.loc18_35 [template = i32] +// CHECK:STDOUT: %.loc18_35.2: type = converted %int.make_type_32.loc18_35, %.loc18_35.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc18_38: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc12 -// CHECK:STDOUT: .G = %.loc18 +// CHECK:STDOUT: .G = %.loc18_38 // CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(@Interface.%a.loc18_16.2: i32, @Interface.%b.loc18_24.2: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() { diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon index cfb3d3ed0c7f..9956ffb2108b 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon @@ -5,9 +5,13 @@ // AUTOUPDATE interface I { - // CHECK:STDERR: fail_assoc_const_not_constant.carbon:[[@LINE+3]]:7: ERROR: Pattern in associated constant declaration must be a single `:!` binding. + // CHECK:STDERR: fail_assoc_const_not_constant.carbon:[[@LINE+7]]:7: ERROR: Pattern in associated constant declaration must be a single `:!` binding. // CHECK:STDERR: let a: i32; // CHECK:STDERR: ^ + // CHECK:STDERR: + // CHECK:STDERR: fail_assoc_const_not_constant.carbon:[[@LINE+3]]:10: ERROR: Name `Core` not found. + // CHECK:STDERR: let a: i32; + // CHECK:STDERR: ^~~ let a: i32; } @@ -31,10 +35,10 @@ alias UseOther = I.other; // CHECK:STDOUT: .UseOther = %UseOther // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} -// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %I.ref.loc19: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] // CHECK:STDOUT: %UseA: = bind_alias UseA, [template = ] -// CHECK:STDOUT: %I.ref.loc18: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %I.ref.loc22: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: %other.ref: = name_ref other, [template = ] // CHECK:STDOUT: %UseOther: = bind_alias UseOther, [template = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/todo_define_not_default.carbon b/toolchain/check/testdata/interface/todo_define_not_default.carbon index 5743f6e129f4..5c01a9dac32b 100644 --- a/toolchain/check/testdata/interface/todo_define_not_default.carbon +++ b/toolchain/check/testdata/interface/todo_define_not_default.carbon @@ -25,8 +25,10 @@ interface I { // CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = 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: %.5: type = assoc_entity_type @I, G [template] // CHECK:STDOUT: %.6: = assoc_entity element1, @I.%G.decl [template] // CHECK:STDOUT: %.7: type = tuple_type (type, type) [template] @@ -45,24 +47,48 @@ interface I { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.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: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc9: = assoc_entity element0, %F.decl [template = constants.%.4] -// 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: %int.make_type_32.loc10_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] +// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10_11, %.loc10_11.1 [template = i32] // CHECK:STDOUT: %a.loc10_8.1: i32 = param a // CHECK:STDOUT: %a.loc10_8.2: i32 = bind_name a, %a.loc10_8.1 +// CHECK:STDOUT: %int.make_type_32.loc10_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc10_19.1: type = value_of_initializer %int.make_type_32.loc10_19 [template = i32] +// CHECK:STDOUT: %.loc10_19.2: type = converted %int.make_type_32.loc10_19, %.loc10_19.1 [template = i32] // CHECK:STDOUT: %b.loc10_16.1: i32 = param b // CHECK:STDOUT: %b.loc10_16.2: i32 = bind_name b, %b.loc10_16.1 +// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] +// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_32.loc10_27, %.loc10_27.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = assoc_entity element1, %G.decl [template = constants.%.6] -// CHECK:STDOUT: %.loc14_27: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc14_28.1: type = converted %.loc14_27, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_31: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc14_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_27: (type, type) = tuple_literal (%int.make_type_32.loc14_19, %int.make_type_32.loc14_24) +// CHECK:STDOUT: %.loc14_28.1: type = value_of_initializer %int.make_type_32.loc14_19 [template = i32] +// CHECK:STDOUT: %.loc14_28.2: type = converted %int.make_type_32.loc14_19, %.loc14_28.1 [template = i32] +// CHECK:STDOUT: %.loc14_28.3: type = value_of_initializer %int.make_type_32.loc14_24 [template = i32] +// CHECK:STDOUT: %.loc14_28.4: type = converted %int.make_type_32.loc14_24, %.loc14_28.3 [template = i32] +// CHECK:STDOUT: %.loc14_28.5: type = converted %.loc14_27, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc14_28.2: = assoc_entity element2, %T [template = constants.%.10] +// CHECK:STDOUT: %.loc14_28.6: = assoc_entity element2, %T [template = constants.%.10] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] // CHECK:STDOUT: %.loc15_17: i32 = int_literal 42 [template = constants.%.11] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] // CHECK:STDOUT: %.loc15_19: = assoc_entity element3, %N [template = constants.%.13] @@ -70,8 +96,8 @@ interface I { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc9 -// CHECK:STDOUT: .G = %.loc10 -// CHECK:STDOUT: .T = %.loc14_28.2 +// CHECK:STDOUT: .G = %.loc10_31 +// CHECK:STDOUT: .T = %.loc14_28.6 // CHECK:STDOUT: .N = %.loc15_19 // CHECK:STDOUT: witness = (%F.decl, %G.decl, %T, %N) // CHECK:STDOUT: } @@ -81,5 +107,7 @@ interface I { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G(@I.%a.loc10_8.2: i32, @I.%b.loc10_16.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index 53d80488520b..a9b1042d88b0 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -11,8 +11,10 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: } @@ -23,7 +25,9 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [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: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -32,6 +36,9 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: if %.loc7_14 br !if.then.loc7_18 else br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_18: +// CHECK:STDOUT: %int.make_type_32.loc7_29: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int.make_type_32.loc7_29 [template = i32] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int.make_type_32.loc7_29, %.loc7_29.1 [template = i32] // CHECK:STDOUT: %n.var.loc7_26: ref i32 = var n // CHECK:STDOUT: %n.loc7_26: ref i32 = bind_name n, %n.var.loc7_26 // CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.3] @@ -43,6 +50,9 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: if %.loc7_44 br !if.then.loc7_48 else br !if.else.loc7_48 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_48: +// CHECK:STDOUT: %int.make_type_32.loc7_59: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_59.1: type = value_of_initializer %int.make_type_32.loc7_59 [template = i32] +// CHECK:STDOUT: %.loc7_59.2: type = converted %int.make_type_32.loc7_59, %.loc7_59.1 [template = i32] // CHECK:STDOUT: %n.var.loc7_56: ref i32 = var n // CHECK:STDOUT: %n.loc7_56: ref i32 = bind_name n, %n.var.loc7_56 // CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.4] @@ -53,3 +63,5 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 4c6cbca65e93..103f50e4c16e 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -14,9 +14,11 @@ fn F() -> i32 { // CHECK:STDOUT: --- convert.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = 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] @@ -32,15 +34,36 @@ fn F() -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// 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: %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: %import_ref.7: 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: %.loc8_24.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc8_24.2: type = converted %.loc8_24.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc8_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc8_11, %int.make_type_32.loc8_16, %int.make_type_32.loc8_21) +// CHECK:STDOUT: %.loc8_24.2: type = value_of_initializer %int.make_type_32.loc8_11 [template = i32] +// CHECK:STDOUT: %.loc8_24.3: type = converted %int.make_type_32.loc8_11, %.loc8_24.2 [template = i32] +// CHECK:STDOUT: %.loc8_24.4: type = value_of_initializer %int.make_type_32.loc8_16 [template = i32] +// CHECK:STDOUT: %.loc8_24.5: type = converted %int.make_type_32.loc8_16, %.loc8_24.4 [template = i32] +// CHECK:STDOUT: %.loc8_24.6: type = value_of_initializer %int.make_type_32.loc8_21 [template = i32] +// CHECK:STDOUT: %.loc8_24.7: type = converted %int.make_type_32.loc8_21, %.loc8_24.6 [template = i32] +// CHECK:STDOUT: %.loc8_24.8: type = converted %.loc8_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref (i32, i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32, i32) = bind_name v, %v.var // CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.5] @@ -56,8 +79,17 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc8_36.8: init (i32, i32, i32) = tuple_init (%.loc8_36.3, %.loc8_36.5, %.loc8_36.7) to %v.var [template = constants.%tuple] // CHECK:STDOUT: %.loc8_37: init (i32, i32, i32) = converted %.loc8_36.1, %.loc8_36.8 [template = constants.%tuple] // CHECK:STDOUT: assign %v.var, %.loc8_37 -// CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.1() [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.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.ref: ref (i32, i32, i32) = name_ref v, %v // CHECK:STDOUT: %.loc10_28.1: ref i32 = tuple_access %v.ref, element0 // CHECK:STDOUT: %.loc10_28.2: i32 = bind_value %.loc10_28.1 diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index f6e219f9bcc6..60c3cfa8537e 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -20,7 +20,9 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: F = 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 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } @@ -31,15 +33,25 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8 -// CHECK:STDOUT: %.loc15: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %a.loc15: i32 = bind_name a, %.loc15 +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_16 +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32.loc15, %.loc15_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_16: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %a.loc15: i32 = bind_name a, %.loc15_16 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index a9011173571e..f13be8236172 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -21,9 +21,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- fail_generic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %.2: i32 = int_literal 5 [template] // CHECK:STDOUT: } @@ -34,16 +36,30 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_9.1: type = value_of_initializer %int.make_type_32.loc8_9 [template = i32] +// CHECK:STDOUT: %.loc8_9.2: type = converted %int.make_type_32.loc8_9, %.loc8_9.1 [template = i32] // CHECK:STDOUT: %a.loc8_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc8_6.1 +// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_17.1: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32] +// CHECK:STDOUT: %.loc8_17.2: type = converted %int.make_type_32.loc8_17, %.loc8_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: 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(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32, %.loc9_21.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc9_21.2 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %.loc14: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %x: T = bind_name x, diff --git a/toolchain/check/testdata/let/fail_generic_import.carbon b/toolchain/check/testdata/let/fail_generic_import.carbon index a3dd5f67baca..e7624897da17 100644 --- a/toolchain/check/testdata/let/fail_generic_import.carbon +++ b/toolchain/check/testdata/let/fail_generic_import.carbon @@ -23,6 +23,9 @@ let a: T = 0; // CHECK:STDOUT: --- implicit.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: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -31,9 +34,15 @@ let a: T = 0; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] +// 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: %.loc4_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32, %.loc4_19.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc4_19.2 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index 969d537696ae..ec27ce7b369e 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -20,9 +20,11 @@ fn F() { // CHECK:STDOUT: --- fail_missing_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,12 +33,22 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %.loc11_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32, %.loc11_8.1 [template = i32] // CHECK:STDOUT: %n: i32 = bind_name n, -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// 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() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index a836291fbefa..8ef11ac65c6a 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -82,7 +82,10 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: --- fail_modifiers.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 { @@ -90,21 +93,55 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %b: i32 = bind_name b, %.loc11 -// CHECK:STDOUT: %.loc17: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %c: i32 = bind_name c, %.loc17 -// CHECK:STDOUT: %.loc23: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %d: i32 = bind_name d, %.loc23 -// CHECK:STDOUT: %.loc29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %e: i32 = bind_name e, %.loc29 -// CHECK:STDOUT: %.loc42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %f: i32 = bind_name f, %.loc42 -// CHECK:STDOUT: %.loc55: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %g: i32 = bind_name g, %.loc55 -// CHECK:STDOUT: %.loc68: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %h: i32 = bind_name h, %.loc68 -// CHECK:STDOUT: %.loc80: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %i: i32 = bind_name i, %.loc80 +// 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_18.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32.loc11, %.loc11_18.1 [template = i32] +// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %b: i32 = bind_name b, %.loc11_24 +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_16.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_16.2: type = converted %int.make_type_32.loc17, %.loc17_16.1 [template = i32] +// CHECK:STDOUT: %.loc17_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %c: i32 = bind_name c, %.loc17_22 +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc23_14.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_14.2: type = converted %int.make_type_32.loc23, %.loc23_14.1 [template = i32] +// CHECK:STDOUT: %.loc23_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %d: i32 = bind_name d, %.loc23_20 +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc29_16.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_16.2: type = converted %int.make_type_32.loc29, %.loc29_16.1 [template = i32] +// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %e: i32 = bind_name e, %.loc29_22 +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc42: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc42_22.1: type = value_of_initializer %int.make_type_32.loc42 [template = i32] +// CHECK:STDOUT: %.loc42_22.2: type = converted %int.make_type_32.loc42, %.loc42_22.1 [template = i32] +// CHECK:STDOUT: %.loc42_28: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %f: i32 = bind_name f, %.loc42_28 +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc55: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc55_24.1: type = value_of_initializer %int.make_type_32.loc55 [template = i32] +// CHECK:STDOUT: %.loc55_24.2: type = converted %int.make_type_32.loc55, %.loc55_24.1 [template = i32] +// CHECK:STDOUT: %.loc55_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %g: i32 = bind_name g, %.loc55_30 +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc68: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc68_26.1: type = value_of_initializer %int.make_type_32.loc68 [template = i32] +// CHECK:STDOUT: %.loc68_26.2: type = converted %int.make_type_32.loc68, %.loc68_26.1 [template = i32] +// CHECK:STDOUT: %.loc68_32: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %h: i32 = bind_name h, %.loc68_32 +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc80: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc80_28.1: type = value_of_initializer %int.make_type_32.loc80 [template = i32] +// CHECK:STDOUT: %.loc80_28.2: type = converted %int.make_type_32.loc80, %.loc80_28.1 [template = i32] +// CHECK:STDOUT: %.loc80_34: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %i: i32 = bind_name i, %.loc80_34 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_todo_modifiers.carbon b/toolchain/check/testdata/let/fail_todo_modifiers.carbon index 1f510c804d99..3b4d34f091b8 100644 --- a/toolchain/check/testdata/let/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_todo_modifiers.carbon @@ -12,7 +12,10 @@ private let a: i32 = 1; // CHECK:STDOUT: --- fail_todo_modifiers.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 { @@ -20,7 +23,13 @@ private let a: i32 = 1; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %a: i32 = bind_name a, %.loc10 +// 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_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_32, %.loc10_16.1 [template = i32] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a: i32 = bind_name a, %.loc10_22 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index 39312d04f48b..f45d811d6a2c 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -16,7 +16,9 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,13 +27,19 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index e462c2d3e1be..be5b26667c05 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -15,7 +15,9 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %.2: type = ptr_type T [symbolic] // CHECK:STDOUT: } @@ -26,12 +28,16 @@ fn F() { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32, %.loc8_21.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc8_21.2 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %.loc9: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p @@ -47,3 +53,5 @@ fn F() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/generic_import.carbon b/toolchain/check/testdata/let/generic_import.carbon index 5abd2d4274ed..046be977d3e9 100644 --- a/toolchain/check/testdata/let/generic_import.carbon +++ b/toolchain/check/testdata/let/generic_import.carbon @@ -20,6 +20,9 @@ var b: T = *a; // CHECK:STDOUT: --- implicit.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: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -28,9 +31,15 @@ var b: T = *a; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] +// 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: %.loc4_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32, %.loc4_19.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc4_19.2 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index 8f9c0af13e79..e7bcabeaa8e5 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -11,10 +11,12 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: --- global.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.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,13 +25,23 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %n: i32 = bind_name n, %.loc7 -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// 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_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_14 +// CHECK:STDOUT: %import_ref.2: 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.loc9: init type = call constants.%struct.1() [template = i32] +// 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: @F.%return: ref i32 = var // CHECK:STDOUT: } // 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: %n.ref: i32 = name_ref n, file.%n diff --git a/toolchain/check/testdata/let/import.carbon b/toolchain/check/testdata/let/import.carbon index 06feef8755d1..60a69f011b6c 100644 --- a/toolchain/check/testdata/let/import.carbon +++ b/toolchain/check/testdata/let/import.carbon @@ -19,7 +19,10 @@ let b:! bool = a; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %a: bool = bind_symbolic_name a 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -28,25 +31,40 @@ let b:! bool = a; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %a: bool = bind_symbolic_name a 0, %.loc4 [symbolic = constants.%a] +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc4_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_9.2: type = converted %bool.make_type, %.loc4_9.1 [template = bool] +// CHECK:STDOUT: %.loc4_16: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %a: bool = bind_symbolic_name a 0, %.loc4_16 [symbolic = constants.%a] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] // CHECK:STDOUT: %a: bool = bind_symbolic_name a 0 [symbolic] // CHECK:STDOUT: %b: bool = bind_symbolic_name b 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .a = %import_ref +// CHECK:STDOUT: .a = %import_ref.1 // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: bool = import_ref ir0, inst+2, loaded [symbolic = constants.%a] +// CHECK:STDOUT: %import_ref.1: bool = import_ref ir0, inst+11, loaded [symbolic = constants.%a] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %a.ref: bool = name_ref a, %import_ref [symbolic = constants.%a] +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc4_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_9.2: type = converted %bool.make_type, %.loc4_9.1 [template = bool] +// CHECK:STDOUT: %a.ref: bool = name_ref a, %import_ref.1 [symbolic = constants.%a] // CHECK:STDOUT: %b: bool = bind_symbolic_name b 0, %a.ref [symbolic = constants.%b] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index 9b85a61a3a34..349e194fa389 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -12,9 +12,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- local.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,15 +25,29 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] +// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: 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(%a: i32) -> i32 { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b: i32 = bind_name b, %a.ref // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index 8a755b372af8..f76a98996541 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -13,9 +13,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- shadowed_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -25,17 +27,31 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a.loc7: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] +// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: 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(%a.loc7: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_16 // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a.loc8 // CHECK:STDOUT: return %a.ref // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index 086a858e3b3e..7f14c75c8911 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -32,9 +32,11 @@ var a: i32 = NS.A(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -44,18 +46,28 @@ var a: i32 = NS.A(); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+2, loaded -// CHECK:STDOUT: %NS: = namespace %import_ref, [template] { +// CHECK:STDOUT: %import_ref.1: = import_ref ir0, inst+2, loaded +// CHECK:STDOUT: %NS: = namespace %import_ref.1, [template] { // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_14.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_14.2: type = converted %int.make_type_32.loc4, %.loc4_14.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2] @@ -65,7 +77,7 @@ var a: i32 = NS.A(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index 262b0e274c55..523c46e67c7d 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -19,14 +19,16 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: --- alias.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.3: D = struct_value () [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,20 +46,34 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: } // CHECK:STDOUT: %NS.ref.loc9: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, %NS [template = %NS] -// CHECK:STDOUT: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.1] -// CHECK:STDOUT: %C: A = bind_alias C, %A.decl [template = constants.%struct.1] -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.3] { +// CHECK:STDOUT: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.2] +// CHECK:STDOUT: %C: A = bind_alias C, %A.decl [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] // CHECK:STDOUT: @D.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] @@ -67,7 +83,7 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ns.ref: = name_ref ns, file.%ns [template = file.%NS] -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc13_30.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc13_30.2: i32 = converted %A.call, %.loc13_30.1 @@ -76,7 +92,7 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: A = name_ref C, file.%C [template = constants.%struct.1] +// CHECK:STDOUT: %C.ref: A = name_ref C, file.%C [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %C.ref() // CHECK:STDOUT: %.loc17_27.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc17_27.2: i32 = converted %A.call, %.loc17_27.1 diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index a57ec8265e62..af3b3fc330cb 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -20,9 +20,11 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: --- fail_decl_in_alias.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = fn_type @.1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct: = struct_value () [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 = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -36,11 +38,17 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %NS: = namespace [template] {} // CHECK:STDOUT: %NS.ref: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] -// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_14.2: type = converted %int.make_type_32, %.loc18_14.1 [template = i32] // CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.3] diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index dfc932f510d1..3d4182be8563 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -31,8 +31,10 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: %struct.1: A = struct_value () [template] // CHECK:STDOUT: %A.2: type = fn_type @A.2 [template] // CHECK:STDOUT: %struct.2: A = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.3: B = struct_value () [template] +// CHECK:STDOUT: %struct.4: B = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -53,15 +55,22 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: %M: = namespace [template] { // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32, %.loc14_15.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1(); // CHECK:STDOUT: // CHECK:STDOUT: fn @A.2(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl.loc10 [template = constants.%struct.2] @@ -70,10 +79,13 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: if %.loc17 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc18_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_12.2: type = converted %int.make_type_32, %.loc18_12.1 [template = i32] // CHECK:STDOUT: %A.var: ref i32 = var A // CHECK:STDOUT: %A: ref i32 = bind_name A, %A.var -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %A.var, %.loc18 +// CHECK:STDOUT: %.loc18_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %A.var, %.loc18_18 // CHECK:STDOUT: %A.ref.loc21: ref i32 = name_ref A, %A // CHECK:STDOUT: %.loc21: i32 = bind_value %A.ref.loc21 // CHECK:STDOUT: return %.loc21 diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index c326411591bb..35b4feb109ee 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -25,20 +25,22 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: --- and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [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: %And: type = fn_type @And [template] -// CHECK:STDOUT: %struct.3: And = struct_value () [template] +// CHECK:STDOUT: %struct.4: And = struct_value () [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: %Constant: type = fn_type @Constant [template] -// CHECK:STDOUT: %struct.4: Constant = struct_value () [template] +// CHECK:STDOUT: %struct.5: Constant = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] -// CHECK:STDOUT: %struct.5: PartialConstant = struct_value () [template] +// CHECK:STDOUT: %struct.6: PartialConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -51,22 +53,45 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] +// CHECK:STDOUT: %.loc10_13.2: type = converted %bool.make_type.loc10, %.loc10_13.1 [template = bool] // CHECK:STDOUT: @And.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.4] {} -// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.5] { +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] {} +// CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.6] { +// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] +// CHECK:STDOUT: %.loc21_23.2: type = converted %bool.make_type.loc21, %.loc21_23.1 [template = bool] // CHECK:STDOUT: %x.loc21_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] @@ -81,7 +106,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @And() -> bool { // 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: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 @@ -89,7 +114,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc11_14.2 br !and.rhs else br !and.result(%.loc11_14.3) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.4: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc11_14.5: bool = converted %G.call, %.loc11_14.4 @@ -115,7 +140,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc15_18.2 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: br !if.expr.result.loc15(bool) +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_32.2: type = converted %bool.make_type.loc15, %.loc15_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_32.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_43: () = tuple_literal () @@ -141,7 +169,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc16_18.2 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: br !if.expr.result.loc16(bool) +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc16_33.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_33.2: type = converted %bool.make_type.loc16, %.loc16_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_33.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_44: () = tuple_literal () @@ -169,7 +200,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc17_19.2 br !if.expr.then.loc17 else br !if.expr.else.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc17: -// CHECK:STDOUT: br !if.expr.result.loc17(bool) +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc17_33.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_33.2: type = converted %bool.make_type.loc17, %.loc17_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_33.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc17: // CHECK:STDOUT: %.loc17_44: () = tuple_literal () @@ -197,7 +231,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc18_19.2 br !if.expr.then.loc18 else br !if.expr.else.loc18 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc18: -// CHECK:STDOUT: br !if.expr.result.loc18(bool) +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc18_34.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_34.2: type = converted %bool.make_type.loc18, %.loc18_34.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_34.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc18: // CHECK:STDOUT: %.loc18_45: () = tuple_literal () @@ -230,7 +267,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc22_19.2 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: br !if.expr.result(bool) +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_30.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc22_30.2: type = converted %bool.make_type, %.loc22_30.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result(%.loc22_30.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %.loc22_41: () = tuple_literal () diff --git a/toolchain/check/testdata/operators/builtin/assignment.carbon b/toolchain/check/testdata/operators/builtin/assignment.carbon index bf17f4dac25f..a0ceb769613f 100644 --- a/toolchain/check/testdata/operators/builtin/assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/assignment.carbon @@ -28,6 +28,8 @@ fn Main() { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: Main = 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 12 [template] // CHECK:STDOUT: %.3: i32 = int_literal 9 [template] // CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] @@ -41,7 +43,7 @@ fn Main() { // CHECK:STDOUT: %.11: i32 = int_literal 4 [template] // CHECK:STDOUT: %.12: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.13: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.7, %.8) [template] +// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.7, %.8) [template] // CHECK:STDOUT: %.14: type = ptr_type i32 [template] // CHECK:STDOUT: %.15: i32 = int_literal 5 [template] // CHECK:STDOUT: %.16: bool = bool_literal true [template] @@ -55,19 +57,34 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [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: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 12 [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc8 +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc8_16 // CHECK:STDOUT: %a.ref.loc9: ref i32 = name_ref a, %a // CHECK:STDOUT: %.loc9: i32 = int_literal 9 [template = constants.%.3] // CHECK:STDOUT: assign %a.ref.loc9, %.loc9 -// CHECK:STDOUT: %.loc11_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: (type, type) = tuple_literal (%int.make_type_32.loc11_11, %int.make_type_32.loc11_16) +// CHECK:STDOUT: %.loc11_19.2: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_19.3: type = converted %int.make_type_32.loc11_11, %.loc11_19.2 [template = i32] +// CHECK:STDOUT: %.loc11_19.4: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] +// CHECK:STDOUT: %.loc11_19.5: type = converted %int.make_type_32.loc11_16, %.loc11_19.4 [template = i32] +// CHECK:STDOUT: %.loc11_19.6: type = converted %.loc11_19.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %b.var: ref (i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32) = bind_name b, %b.var // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.7] @@ -90,6 +107,12 @@ fn Main() { // CHECK:STDOUT: %.loc13_6: ref i32 = tuple_index %b.ref.loc13, %.loc13_5 // CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: assign %.loc13_6, %.loc13_10 +// CHECK:STDOUT: %int.make_type_32.loc15_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %int.make_type_32.loc15_15 [template = i32] +// CHECK:STDOUT: %.loc15_15.2: type = converted %int.make_type_32.loc15_15, %.loc15_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %int.make_type_32.loc15_24 [template = i32] +// CHECK:STDOUT: %.loc15_24.2: type = converted %int.make_type_32.loc15_24, %.loc15_24.1 [template = i32] // CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.12] // CHECK:STDOUT: %c.var: ref {.a: i32, .b: i32} = var c // CHECK:STDOUT: %c: ref {.a: i32, .b: i32} = bind_name c, %c.var @@ -100,8 +123,8 @@ fn Main() { // CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 [template = constants.%.7] // CHECK:STDOUT: %.loc15_46.4: ref i32 = struct_access %c.var, element1 // CHECK:STDOUT: %.loc15_46.5: init i32 = initialize_from %.loc15_45 to %.loc15_46.4 [template = constants.%.8] -// CHECK:STDOUT: %.loc15_46.6: init {.a: i32, .b: i32} = struct_init (%.loc15_46.3, %.loc15_46.5) to %c.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc15_47: init {.a: i32, .b: i32} = converted %.loc15_46.1, %.loc15_46.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_46.6: init {.a: i32, .b: i32} = struct_init (%.loc15_46.3, %.loc15_46.5) to %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_47: init {.a: i32, .b: i32} = converted %.loc15_46.1, %.loc15_46.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %c.var, %.loc15_47 // CHECK:STDOUT: %c.ref.loc16: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc16_4: ref i32 = struct_access %c.ref.loc16, element0 @@ -111,7 +134,10 @@ fn Main() { // CHECK:STDOUT: %.loc17_4: ref i32 = struct_access %c.ref.loc17, element1 // CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 [template = constants.%.14] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_13.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_13.2: type = converted %int.make_type_32.loc19, %.loc19_13.1 [template = i32] +// CHECK:STDOUT: %.loc19_13.3: type = ptr_type i32 [template = constants.%.14] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %a.ref.loc19: ref i32 = name_ref a, %a @@ -143,3 +169,5 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index 026c2fbdd04d..264910c69c46 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -40,35 +40,55 @@ var or_: F(true or true); // CHECK:STDOUT: --- fail_and_or_not_in_function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] -// CHECK:STDOUT: %.2: bool = bool_literal true [template] -// CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.4: Float = struct_value () [template] +// CHECK:STDOUT: %.3: bool = bool_literal true [template] +// CHECK:STDOUT: %.4: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.2] -// CHECK:STDOUT: %F.call: init type = call (%.loc38_17) +// CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.3] +// CHECK:STDOUT: %F.call: init type = call (%.loc38_17) // CHECK:STDOUT: %.loc38_24.1: type = value_of_initializer %F.call // CHECK:STDOUT: %.loc38_24.2: type = converted %F.call, %.loc38_24.1 // CHECK:STDOUT: %or_.var: ref = var or_ // CHECK:STDOUT: %or_: ref = bind_name or_, %or_.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> type { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: br !if.expr.result(i32) +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc9_20.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_20.2: type = converted %int.make_type_32, %.loc9_20.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result(%.loc9_20.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: br !if.expr.result(f64) +// CHECK:STDOUT: %.loc9_29: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.4(%.loc9_29) [template = f64] +// CHECK:STDOUT: %.loc9_24.1: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc9_24.2: type = converted %float.make_type, %.loc9_24.1 [template = f64] +// CHECK:STDOUT: br !if.expr.result(%.loc9_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc9: type = block_arg !if.expr.result -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result +// CHECK:STDOUT: return %.loc9_10 // 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: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index c47c9729a417..7335baa0c221 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -42,9 +42,11 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: --- fail_non_constant_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: PartialConstant = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] +// CHECK:STDOUT: %struct.2: PartialConstant = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: } @@ -55,12 +57,20 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc4_23.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_23.2: type = converted %bool.make_type, %.loc4_23.1 [template = bool] // CHECK:STDOUT: %x.loc4_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc4_20.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc9_13: bool = bool_literal true [template = constants.%.2] @@ -76,7 +86,10 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: if %.loc9_18.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: br !if.expr.result.loc9(bool) +// CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc9_29.1: type = value_of_initializer %bool.make_type.loc9 [template = bool] +// CHECK:STDOUT: %.loc9_29.2: type = converted %bool.make_type.loc9, %.loc9_29.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_29.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc9: // CHECK:STDOUT: %.loc9_40: () = tuple_literal () @@ -101,7 +114,10 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: if %.loc14_19.3 br !if.expr.then.loc14 else br !if.expr.else.loc14 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc14: -// CHECK:STDOUT: br !if.expr.result.loc14(bool) +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_29.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_29.2: type = converted %bool.make_type.loc14, %.loc14_29.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_29.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc14: // CHECK:STDOUT: %.loc14_40: () = tuple_literal () @@ -118,9 +134,11 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: --- fail_despite_known_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %KnownValueButNonConstantCondition: type = fn_type @KnownValueButNonConstantCondition [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: KnownValueButNonConstantCondition = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %KnownValueButNonConstantCondition: type = fn_type @KnownValueButNonConstantCondition [template] +// CHECK:STDOUT: %struct.2: KnownValueButNonConstantCondition = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal false [template] // CHECK:STDOUT: %.3: bool = bool_literal true [template] // CHECK:STDOUT: } @@ -131,12 +149,20 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: .KnownValueButNonConstantCondition = %KnownValueButNonConstantCondition.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %KnownValueButNonConstantCondition.decl: KnownValueButNonConstantCondition = fn_decl @KnownValueButNonConstantCondition [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %KnownValueButNonConstantCondition.decl: KnownValueButNonConstantCondition = fn_decl @KnownValueButNonConstantCondition [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc4_41.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_41.2: type = converted %bool.make_type, %.loc4_41.1 [template = bool] // CHECK:STDOUT: %x.loc4_38.1: bool = param x // CHECK:STDOUT: @KnownValueButNonConstantCondition.%x: bool = bind_name x, %x.loc4_38.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @KnownValueButNonConstantCondition(%x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref.loc11: bool = name_ref x, %x @@ -152,7 +178,10 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: if %.loc11_15.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: br !if.expr.result.loc11(bool) +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_30.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_30.2: type = converted %bool.make_type.loc11, %.loc11_30.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc11(%.loc11_30.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc11: // CHECK:STDOUT: %.loc11_41: () = tuple_literal () @@ -177,7 +206,10 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: if %.loc15_15.3 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: br !if.expr.result.loc15(bool) +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_28.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_28.2: type = converted %bool.make_type.loc15, %.loc15_28.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_28.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_39: () = tuple_literal () diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 52477ea5c485..34437c304976 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -55,11 +55,13 @@ fn Main() { // CHECK:STDOUT: --- fail_assignment_to_non_assignable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] @@ -72,8 +74,8 @@ fn Main() { // CHECK:STDOUT: %.9: type = ptr_type i32 [template] // CHECK:STDOUT: %.10: type = struct_type {.x: i32, .y: i32} [template] // CHECK:STDOUT: %.11: type = ptr_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %struct.3: {.x: i32, .y: i32} = struct_value (%.5, %.6) [template] -// CHECK:STDOUT: %struct.4: {.x: i32, .y: i32} = struct_value (%.2, %.3) [template] +// CHECK:STDOUT: %struct.4: {.x: i32, .y: i32} = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %struct.5: {.x: i32, .y: i32} = struct_value (%.2, %.3) [template] // CHECK:STDOUT: %.12: bool = bool_literal true [template] // CHECK:STDOUT: %.13: i32 = int_literal 10 [template] // CHECK:STDOUT: } @@ -85,12 +87,22 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} +// 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: %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: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -98,7 +110,7 @@ fn Main() { // CHECK:STDOUT: %.loc14_3: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc14_7: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: assign %.loc14_3, %.loc14_7 -// 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: %.loc19: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %F.call, %.loc19 @@ -117,10 +129,13 @@ fn Main() { // CHECK:STDOUT: assign %.loc24_8.1, %.loc24_10 // CHECK:STDOUT: %tuple.loc24: (i32, i32) = tuple_value (%.loc24_4, %.loc24_7) [template = constants.%tuple.2] // CHECK:STDOUT: %.loc24_8.2: (i32, i32) = converted %.loc24_8.1, %tuple.loc24 [template = constants.%tuple.2] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_10.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_10.2: type = converted %int.make_type_32.loc25, %.loc25_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc25: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: assign %n.var, %.loc25 +// CHECK:STDOUT: %.loc25_16: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: assign %n.var, %.loc25_16 // CHECK:STDOUT: %n.ref.loc30_4: ref i32 = name_ref n, %n // CHECK:STDOUT: %n.ref.loc30_7: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc30_8.1: (i32, i32) = tuple_literal (%n.ref.loc30_4, %n.ref.loc30_7) @@ -138,8 +153,12 @@ fn Main() { // CHECK:STDOUT: %.loc30_7: i32 = bind_value %n.ref.loc30_7 // CHECK:STDOUT: %tuple.loc30: (i32, i32) = tuple_value (%.loc30_4, %.loc30_7) // CHECK:STDOUT: %.loc30_8.2: (i32, i32) = converted %.loc30_8.1, %tuple.loc30 -// CHECK:STDOUT: %.loc35: type = ptr_type i32 [template = constants.%.9] -// CHECK:STDOUT: assign i32, %.loc35 +// CHECK:STDOUT: %int.make_type_32.loc35_3: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc35_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc35_12.1: type = value_of_initializer %int.make_type_32.loc35_9 [template = i32] +// CHECK:STDOUT: %.loc35_12.2: type = converted %int.make_type_32.loc35_9, %.loc35_12.1 [template = i32] +// CHECK:STDOUT: %.loc35_12.3: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: assign %int.make_type_32.loc35_3, %.loc35_12.3 // CHECK:STDOUT: %.loc40_9: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc40_17: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc40_18.1: {.x: i32, .y: i32} = struct_literal (%.loc40_9, %.loc40_17) @@ -150,11 +169,11 @@ fn Main() { // CHECK:STDOUT: %.loc40_37.3: init i32 = initialize_from %.loc40_28 to %.loc40_37.2 [template = constants.%.5] // CHECK:STDOUT: %.loc40_37.4: i32 = struct_access %.loc40_18.1, element1 // CHECK:STDOUT: %.loc40_37.5: init i32 = initialize_from %.loc40_36 to %.loc40_37.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc40_37.6: init {.x: i32, .y: i32} = struct_init (%.loc40_37.3, %.loc40_37.5) to %.loc40_18.1 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc40_20: init {.x: i32, .y: i32} = converted %.loc40_37.1, %.loc40_37.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc40_37.6: init {.x: i32, .y: i32} = struct_init (%.loc40_37.3, %.loc40_37.5) to %.loc40_18.1 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc40_20: init {.x: i32, .y: i32} = converted %.loc40_37.1, %.loc40_37.6 [template = constants.%struct.4] // CHECK:STDOUT: assign %.loc40_18.1, %.loc40_20 -// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc40_9, %.loc40_17) [template = constants.%struct.4] -// CHECK:STDOUT: %.loc40_18.2: {.x: i32, .y: i32} = converted %.loc40_18.1, %struct [template = constants.%struct.4] +// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc40_9, %.loc40_17) [template = constants.%struct.5] +// CHECK:STDOUT: %.loc40_18.2: {.x: i32, .y: i32} = converted %.loc40_18.1, %struct [template = constants.%struct.5] // CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.12] // CHECK:STDOUT: if %.loc45_7 br !if.expr.then.loc45 else br !if.expr.else.loc45 // CHECK:STDOUT: @@ -170,6 +189,9 @@ fn Main() { // CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 [template = constants.%.2] // CHECK:STDOUT: %.loc45_29: i32 = int_literal 3 [template = constants.%.5] // CHECK:STDOUT: assign %.loc45_4, %.loc45_29 +// CHECK:STDOUT: %int.make_type_32.loc48: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc48_10.1: type = value_of_initializer %int.make_type_32.loc48 [template = i32] +// CHECK:STDOUT: %.loc48_10.2: type = converted %int.make_type_32.loc48, %.loc48_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %.loc52_7: bool = bool_literal true [template = constants.%.12] diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index 4b479494e15d..b24a6c12fb5b 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -22,12 +22,14 @@ fn Main() { // CHECK:STDOUT: --- fail_redundant_compound_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: Main = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -38,12 +40,19 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [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: i32 = int_literal 0 [template = constants.%.2] @@ -52,10 +61,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32, %.loc10_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc10: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: assign %a.var, %.loc10 +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: assign %a.var, %.loc10_16 // CHECK:STDOUT: %a.ref.loc15_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc15_7: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc15_10: ref i32 = name_ref a, %a @@ -63,7 +75,7 @@ fn Main() { // CHECK:STDOUT: assign %a.ref.loc15_3, %.loc15 // CHECK:STDOUT: %a.ref.loc19_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc19_7: ref i32 = name_ref a, %a -// 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: assign %a.ref.loc19_3, %F.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 06ff09a68736..ca65acdd5805 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -16,7 +16,9 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.2: Bool = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -26,11 +28,15 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.2() [template = bool] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_10.2: type = converted %bool.make_type, %.loc11_10.1 [template = bool] // CHECK:STDOUT: %x.var: ref bool = var x // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var // CHECK:STDOUT: %.loc11_21: i32 = int_literal 12 [template = constants.%.2] @@ -39,3 +45,5 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index b61b10a6f6da..ef4855e1d3ca 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -17,7 +17,9 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Main = 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: f64 = float_literal 5.6000000000000005 [template] // CHECK:STDOUT: } @@ -28,18 +30,24 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc8 +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc8_16 // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, %a // CHECK:STDOUT: %.loc12: f64 = float_literal 5.6000000000000005 [template = constants.%.3] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index 2b8d82264af4..ddfae358fa38 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -20,17 +20,19 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch_once.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: %.3: f64 = float_literal 3.4000000000000004 [template] // CHECK:STDOUT: %.4: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Op: type = fn_type @Op [template] -// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Add, Op [template] -// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -39,24 +41,30 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: type = import_ref ir4, inst+1, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2 = import_ref ir4, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+24, loaded [template = constants.%.6] -// CHECK:STDOUT: %import_ref.4 = import_ref ir4, inst+19, unloaded +// CHECK:STDOUT: %import_ref.2: type = import_ref ir4, inst+1, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.3 = import_ref ir4, inst+3, unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref ir4, inst+24, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+19, unloaded -// CHECK:STDOUT: %import_ref.6: type = import_ref ir4, inst+1, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.6 = import_ref ir4, inst+19, unloaded +// CHECK:STDOUT: %import_ref.7: type = import_ref ir4, inst+1, loaded [template = constants.%.4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = file.%import_ref.2 -// CHECK:STDOUT: .Op = file.%import_ref.3 -// CHECK:STDOUT: witness = (file.%import_ref.4) +// CHECK:STDOUT: .Self = file.%import_ref.3 +// CHECK:STDOUT: .Op = file.%import_ref.4 +// CHECK:STDOUT: witness = (file.%import_ref.5) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc17_10: i32 = int_literal 12 [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index 3318ecd5469a..6e9894ff11f8 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -14,17 +14,19 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_unimplemented_op.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: %.3: i32 = int_literal 34 [template] // CHECK:STDOUT: %.4: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Op: type = fn_type @Op [template] -// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Add, Op [template] -// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,23 +35,29 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: type = import_ref ir4, inst+1, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2 = import_ref ir4, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+24, loaded [template = constants.%.6] -// CHECK:STDOUT: %import_ref.4 = import_ref ir4, inst+19, unloaded +// CHECK:STDOUT: %import_ref.2: type = import_ref ir4, inst+1, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.3 = import_ref ir4, inst+3, unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref ir4, inst+24, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+19, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir4, inst+19, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = file.%import_ref.2 -// CHECK:STDOUT: .Op = file.%import_ref.3 -// CHECK:STDOUT: witness = (file.%import_ref.4) +// CHECK:STDOUT: .Self = file.%import_ref.3 +// CHECK:STDOUT: .Op = file.%import_ref.4 +// CHECK:STDOUT: witness = (file.%import_ref.5) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11_10: i32 = int_literal 12 [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index d1168183411a..7c7d45a839e6 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -25,20 +25,22 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: --- or.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [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: %Or: type = fn_type @Or [template] -// CHECK:STDOUT: %struct.3: Or = struct_value () [template] +// CHECK:STDOUT: %struct.4: Or = struct_value () [template] // CHECK:STDOUT: %Constant: type = fn_type @Constant [template] -// CHECK:STDOUT: %struct.4: Constant = struct_value () [template] +// CHECK:STDOUT: %struct.5: Constant = struct_value () [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] -// CHECK:STDOUT: %struct.5: PartialConstant = struct_value () [template] +// CHECK:STDOUT: %struct.6: PartialConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -51,22 +53,45 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc10_12.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] +// CHECK:STDOUT: %.loc10_12.2: type = converted %bool.make_type.loc10, %.loc10_12.1 [template = bool] // CHECK:STDOUT: @Or.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.4] {} -// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.5] { +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] {} +// CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.6] { +// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] +// CHECK:STDOUT: %.loc21_23.2: type = converted %bool.make_type.loc21, %.loc21_23.1 [template = bool] // CHECK:STDOUT: %x.loc21_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] @@ -81,7 +106,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Or() -> bool { // 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: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 @@ -90,7 +115,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc11_14.3 br !or.rhs else br !or.result(%.loc11_14.4) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.5: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc11_14.6: bool = converted %G.call, %.loc11_14.5 @@ -117,7 +142,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc15_18.3 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: br !if.expr.result.loc15(bool) +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_31.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_31.2: type = converted %bool.make_type.loc15, %.loc15_31.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_31.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_42: () = tuple_literal () @@ -144,7 +172,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc16_18.3 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: br !if.expr.result.loc16(bool) +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc16_32.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_32.2: type = converted %bool.make_type.loc16, %.loc16_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_32.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_43: () = tuple_literal () @@ -171,7 +202,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc17_19.3 br !if.expr.then.loc17 else br !if.expr.else.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc17: -// CHECK:STDOUT: br !if.expr.result.loc17(bool) +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc17_32.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_32.2: type = converted %bool.make_type.loc17, %.loc17_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_32.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc17: // CHECK:STDOUT: %.loc17_43: () = tuple_literal () @@ -198,7 +232,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc18_19.3 br !if.expr.then.loc18 else br !if.expr.else.loc18 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc18: -// CHECK:STDOUT: br !if.expr.result.loc18(bool) +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc18_33.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_33.2: type = converted %bool.make_type.loc18, %.loc18_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_33.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc18: // CHECK:STDOUT: %.loc18_44: () = tuple_literal () @@ -232,7 +269,10 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: if %.loc22_18.3 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: br !if.expr.result(bool) +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_28.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc22_28.2: type = converted %bool.make_type, %.loc22_28.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result(%.loc22_28.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %.loc22_39: () = tuple_literal () diff --git a/toolchain/check/testdata/operators/builtin/unary_op.carbon b/toolchain/check/testdata/operators/builtin/unary_op.carbon index e042a8401a43..585eb5bf9632 100644 --- a/toolchain/check/testdata/operators/builtin/unary_op.carbon +++ b/toolchain/check/testdata/operators/builtin/unary_op.carbon @@ -19,13 +19,15 @@ fn Constant() { // CHECK:STDOUT: --- unary_op.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Not: type = fn_type @Not [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Not = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Not: type = fn_type @Not [template] +// CHECK:STDOUT: %struct.2: Not = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: %Constant: type = fn_type @Constant [template] -// CHECK:STDOUT: %struct.2: Constant = struct_value () [template] +// CHECK:STDOUT: %struct.3: Constant = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -36,20 +38,40 @@ fn Constant() { // CHECK:STDOUT: .Constant = %Constant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Not.decl: Not = fn_decl @Not [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Not.decl: Not = fn_decl @Not [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type.loc7_11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7_11 [template = bool] +// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7_11, %.loc7_11.1 [template = bool] // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc7_8.1 +// CHECK:STDOUT: %bool.make_type.loc7_20: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %bool.make_type.loc7_20 [template = bool] +// CHECK:STDOUT: %.loc7_20.2: type = converted %bool.make_type.loc7_20, %.loc7_20.1 [template = bool] // CHECK:STDOUT: @Not.%return: ref bool = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_15.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_15.2: type = converted %bool.make_type.loc11, %.loc11_15.1 [template = bool] // CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.3] // CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 +// CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_16.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_16.2: type = converted %bool.make_type.loc12, %.loc12_16.1 [template = bool] // CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.2] // CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 -// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.2] {} +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.3] {} +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Not(%b: bool) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b @@ -64,7 +86,10 @@ fn Constant() { // CHECK:STDOUT: if %.loc15_13 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: br !if.expr.result.loc15(bool) +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_27.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_27.2: type = converted %bool.make_type.loc15, %.loc15_27.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_27.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_38: () = tuple_literal () @@ -84,7 +109,10 @@ fn Constant() { // CHECK:STDOUT: if %.loc16_13 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: br !if.expr.result.loc16(bool) +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc16_28.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_28.2: type = converted %bool.make_type.loc16, %.loc16_28.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_28.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_39: () = tuple_literal () diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index 8c532285e429..b8158d17ba59 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -82,25 +82,27 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Equal = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %struct.2: Equal = struct_value () [template] // CHECK:STDOUT: %NotEqual.1: type = fn_type @NotEqual.1 [template] -// CHECK:STDOUT: %struct.2: NotEqual = struct_value () [template] +// CHECK:STDOUT: %struct.3: NotEqual = struct_value () [template] // CHECK:STDOUT: %Equal.2: type = fn_type @Equal.2 [template] -// CHECK:STDOUT: %struct.3: Equal = struct_value () [template] +// CHECK:STDOUT: %struct.4: Equal = struct_value () [template] // CHECK:STDOUT: %NotEqual.2: type = fn_type @NotEqual.2 [template] -// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] -// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2) [template] +// CHECK:STDOUT: %struct.5: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.2, %struct.3) [template] // CHECK:STDOUT: %TestEqual: type = fn_type @TestEqual [template] -// CHECK:STDOUT: %struct.5: TestEqual = struct_value () [template] +// CHECK:STDOUT: %struct.6: TestEqual = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, Equal [template] -// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.11 [template] // CHECK:STDOUT: %TestNotEqual: type = fn_type @TestNotEqual [template] -// CHECK:STDOUT: %struct.6: TestNotEqual = struct_value () [template] +// CHECK:STDOUT: %struct.7: TestNotEqual = struct_value () [template] // CHECK:STDOUT: %.8: type = assoc_entity_type @Eq, NotEqual [template] -// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.10 [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.14 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -112,39 +114,49 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2 = import_ref ir6, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+21, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+38, loaded [template = constants.%.9] -// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir6, inst+16, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir6, inst+34, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2 = import_ref ir6, inst+4, unloaded +// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+29, loaded [template = constants.%.7] +// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+49, loaded [template = constants.%.9] +// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir6, inst+25, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir6, inst+45, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc11_17: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc11_14.1: C = param a // CHECK:STDOUT: @TestEqual.%a: C = bind_name a, %a.loc11_14.1 // CHECK:STDOUT: %C.ref.loc11_23: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc11_20.1: C = param b // CHECK:STDOUT: @TestEqual.%b: C = bind_name b, %b.loc11_20.1 +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_29.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_29.2: type = converted %bool.make_type.loc11, %.loc11_29.1 [template = bool] // CHECK:STDOUT: @TestEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.7: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.8 = import_ref ir6, inst+16, unloaded -// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.10: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.11 = import_ref ir6, inst+25, unloaded +// CHECK:STDOUT: %import_ref.12: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc15_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc15_17.1: C = param a // CHECK:STDOUT: @TestNotEqual.%a: C = bind_name a, %a.loc15_17.1 // CHECK:STDOUT: %C.ref.loc15_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc15_23.1: C = param b // CHECK:STDOUT: @TestNotEqual.%b: C = bind_name b, %b.loc15_23.1 +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_32.2: type = converted %bool.make_type.loc15, %.loc15_32.1 [template = bool] // CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.9: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.10 = import_ref ir6, inst+34, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.14 = import_ref ir6, inst+45, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { @@ -156,22 +168,28 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Eq { -// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc7_18: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc7_12.1: C = param self // CHECK:STDOUT: %self.loc7_12.2: C = bind_name self, %self.loc7_12.1 // CHECK:STDOUT: %C.ref.loc7_28: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc7_21.1: C = param other // CHECK:STDOUT: %other.loc7_21.2: C = bind_name other, %other.loc7_21.1 +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_34.2: type = converted %bool.make_type.loc7, %.loc7_34.1 [template = bool] // CHECK:STDOUT: %return.var.loc7: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc8_15.1: C = param self // CHECK:STDOUT: %self.loc8_15.2: C = bind_name self, %self.loc8_15.1 // CHECK:STDOUT: %C.ref.loc8_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc8_24.1: C = param other // CHECK:STDOUT: %other.loc8_24.2: C = bind_name other, %other.loc8_24.1 +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_37.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_37.2: type = converted %bool.make_type.loc8, %.loc8_37.1 [template = bool] // CHECK:STDOUT: %return.var.loc8: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Equal.decl, %NotEqual.decl) [template = constants.%.4] @@ -187,6 +205,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Equal.1[@impl.%self.loc7_12.2: C](@impl.%other.loc7_21.2: C) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @NotEqual.1[@impl.%self.loc8_15.2: C](@impl.%other.loc8_24.2: C) -> bool; @@ -199,7 +219,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %Equal.call: init bool = call %.loc12_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc12_16.1: bool = value_of_initializer %Equal.call @@ -211,7 +231,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: NotEqual = interface_witness_access @impl.%.1, element1 [template = constants.%struct.2] +// CHECK:STDOUT: %.1: NotEqual = interface_witness_access @impl.%.1, element1 [template = constants.%struct.3] // CHECK:STDOUT: %.loc16_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %NotEqual.call: init bool = call %.loc16_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc16_16.1: bool = value_of_initializer %NotEqual.call @@ -224,22 +244,24 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %TestEqual: type = fn_type @TestEqual [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TestEqual = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %TestEqual: type = fn_type @TestEqual [template] +// CHECK:STDOUT: %struct.2: TestEqual = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Equal: type = fn_type @Equal [template] -// CHECK:STDOUT: %struct.2: Equal = struct_value () [template] +// CHECK:STDOUT: %struct.3: Equal = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Eq, Equal [template] -// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.7 [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.8 [template] // CHECK:STDOUT: %TestNotEqual: type = fn_type @TestNotEqual [template] -// CHECK:STDOUT: %struct.3: TestNotEqual = struct_value () [template] +// CHECK:STDOUT: %struct.4: TestNotEqual = struct_value () [template] // CHECK:STDOUT: %NotEqual: type = fn_type @NotEqual [template] -// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] +// CHECK:STDOUT: %struct.5: NotEqual = struct_value () [template] // CHECK:STDOUT: %.7: type = assoc_entity_type @Eq, NotEqual [template] -// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.9 [template] +// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.11 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -251,41 +273,49 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.2] { // CHECK:STDOUT: %D.ref.loc6_17: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc6_14.1: D = param a // CHECK:STDOUT: @TestEqual.%a: D = bind_name a, %a.loc6_14.1 // CHECK:STDOUT: %D.ref.loc6_23: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc6_20.1: D = param b // CHECK:STDOUT: @TestEqual.%b: D = bind_name b, %b.loc6_20.1 +// CHECK:STDOUT: %bool.make_type.loc6: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %bool.make_type.loc6 [template = bool] +// CHECK:STDOUT: %.loc6_29.2: type = converted %bool.make_type.loc6, %.loc6_29.1 [template = bool] // CHECK:STDOUT: @TestEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+1, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2 = import_ref ir6, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+21, loaded [template = constants.%.6] -// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+38, loaded [template = constants.%.8] -// CHECK:STDOUT: %import_ref.5 = import_ref ir6, inst+16, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref ir6, inst+34, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref ir6, inst+16, unloaded -// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.2: type = import_ref ir6, inst+2, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.3 = import_ref ir6, inst+4, unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+29, loaded [template = constants.%.6] +// CHECK:STDOUT: %import_ref.5: = import_ref ir6, inst+49, loaded [template = constants.%.8] +// CHECK:STDOUT: %import_ref.6 = import_ref ir6, inst+25, unloaded +// CHECK:STDOUT: %import_ref.7 = import_ref ir6, inst+45, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir6, inst+25, unloaded +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.4] { // CHECK:STDOUT: %D.ref.loc14_20: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc14_17.1: D = param a // CHECK:STDOUT: @TestNotEqual.%a: D = bind_name a, %a.loc14_17.1 // CHECK:STDOUT: %D.ref.loc14_26: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc14_23.1: D = param b // CHECK:STDOUT: @TestNotEqual.%b: D = bind_name b, %b.loc14_23.1 +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_32.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_32.2: type = converted %bool.make_type.loc14, %.loc14_32.1 [template = bool] // CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.8: type = import_ref ir6, inst+1, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.9 = import_ref ir6, inst+34, unloaded +// CHECK:STDOUT: %import_ref.10: type = import_ref ir6, inst+2, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.11 = import_ref ir6, inst+45, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = file.%import_ref.2 -// CHECK:STDOUT: .Equal = file.%import_ref.3 -// CHECK:STDOUT: .NotEqual = file.%import_ref.4 -// CHECK:STDOUT: witness = (file.%import_ref.5, file.%import_ref.6) +// CHECK:STDOUT: .Self = file.%import_ref.3 +// CHECK:STDOUT: .Equal = file.%import_ref.4 +// CHECK:STDOUT: .NotEqual = file.%import_ref.5 +// CHECK:STDOUT: witness = (file.%import_ref.6, file.%import_ref.7) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { @@ -293,6 +323,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestEqual(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a @@ -319,25 +351,27 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.2: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Equal = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %struct.2: Equal = struct_value () [template] // CHECK:STDOUT: %NotEqual.1: type = fn_type @NotEqual.1 [template] -// CHECK:STDOUT: %struct.2: NotEqual = struct_value () [template] +// CHECK:STDOUT: %struct.3: NotEqual = struct_value () [template] // CHECK:STDOUT: %Equal.2: type = fn_type @Equal.2 [template] -// CHECK:STDOUT: %struct.3: Equal = struct_value () [template] +// CHECK:STDOUT: %struct.4: Equal = struct_value () [template] // CHECK:STDOUT: %NotEqual.2: type = fn_type @NotEqual.2 [template] -// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] -// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2) [template] +// CHECK:STDOUT: %struct.5: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.2, %struct.3) [template] // CHECK:STDOUT: %TestRhsBad: type = fn_type @TestRhsBad [template] -// CHECK:STDOUT: %struct.5: TestRhsBad = struct_value () [template] +// CHECK:STDOUT: %struct.6: TestRhsBad = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, Equal [template] -// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.11 [template] // CHECK:STDOUT: %TestLhsBad: type = fn_type @TestLhsBad [template] -// CHECK:STDOUT: %struct.6: TestLhsBad = struct_value () [template] +// CHECK:STDOUT: %struct.7: TestLhsBad = struct_value () [template] // CHECK:STDOUT: %.8: type = assoc_entity_type @Eq, NotEqual [template] -// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.10 [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.14 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -351,39 +385,49 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2 = import_ref ir6, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+21, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+38, loaded [template = constants.%.9] -// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir6, inst+16, loaded [template = constants.%struct.3] -// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir6, inst+34, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2 = import_ref ir6, inst+4, unloaded +// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+29, loaded [template = constants.%.7] +// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+49, loaded [template = constants.%.9] +// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir6, inst+25, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir6, inst+45, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestRhsBad.decl: TestRhsBad = fn_decl @TestRhsBad [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestRhsBad.decl: TestRhsBad = fn_decl @TestRhsBad [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc12_15.1: C = param a // CHECK:STDOUT: @TestRhsBad.%a: C = bind_name a, %a.loc12_15.1 // CHECK:STDOUT: %D.ref.loc12: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc12_21.1: D = param b // CHECK:STDOUT: @TestRhsBad.%b: D = bind_name b, %b.loc12_21.1 +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_30.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_30.2: type = converted %bool.make_type.loc12, %.loc12_30.1 [template = bool] // CHECK:STDOUT: @TestRhsBad.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.7: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.8 = import_ref ir6, inst+16, unloaded -// CHECK:STDOUT: %TestLhsBad.decl: TestLhsBad = fn_decl @TestLhsBad [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.10: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.11 = import_ref ir6, inst+25, unloaded +// CHECK:STDOUT: %import_ref.12: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestLhsBad.decl: TestLhsBad = fn_decl @TestLhsBad [template = constants.%struct.7] { // CHECK:STDOUT: %D.ref.loc23: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc23_15.1: D = param a // CHECK:STDOUT: @TestLhsBad.%a: D = bind_name a, %a.loc23_15.1 // CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc23_21.1: C = param b // CHECK:STDOUT: @TestLhsBad.%b: C = bind_name b, %b.loc23_21.1 +// CHECK:STDOUT: %bool.make_type.loc23: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc23_30.1: type = value_of_initializer %bool.make_type.loc23 [template = bool] +// CHECK:STDOUT: %.loc23_30.2: type = converted %bool.make_type.loc23, %.loc23_30.1 [template = bool] // CHECK:STDOUT: @TestLhsBad.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.9: type = import_ref ir6, inst+1, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.10 = import_ref ir6, inst+34, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref ir6, inst+2, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.14 = import_ref ir6, inst+45, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { @@ -395,22 +439,28 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Eq { -// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc8_18: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc8_12.1: C = param self // CHECK:STDOUT: %self.loc8_12.2: C = bind_name self, %self.loc8_12.1 // CHECK:STDOUT: %C.ref.loc8_28: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc8_21.1: C = param other // CHECK:STDOUT: %other.loc8_21.2: C = bind_name other, %other.loc8_21.1 +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_34.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_34.2: type = converted %bool.make_type.loc8, %.loc8_34.1 [template = bool] // CHECK:STDOUT: %return.var.loc8: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc9_21: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_15.1: C = param self // CHECK:STDOUT: %self.loc9_15.2: C = bind_name self, %self.loc9_15.1 // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc9_24.1: C = param other // CHECK:STDOUT: %other.loc9_24.2: C = bind_name other, %other.loc9_24.1 +// CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc9_37.1: type = value_of_initializer %bool.make_type.loc9 [template = bool] +// CHECK:STDOUT: %.loc9_37.2: type = converted %bool.make_type.loc9, %.loc9_37.1 [template = bool] // CHECK:STDOUT: %return.var.loc9: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Equal.decl, %NotEqual.decl) [template = constants.%.4] @@ -431,6 +481,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Equal.1[@impl.%self.loc8_12.2: C](@impl.%other.loc8_21.2: C) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @NotEqual.1[@impl.%self.loc9_15.2: C](@impl.%other.loc9_24.2: C) -> bool; @@ -443,7 +495,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b -// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc20_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %Equal.call: init bool = call %.loc20_12() [template = ] // CHECK:STDOUT: %.loc20_16.1: bool = value_of_initializer %Equal.call [template = ] diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index 4b17c114634f..0becfa1c218a 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -77,41 +77,43 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Ordered [template] // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %Less.1: type = fn_type @Less.1 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Less.1: type = fn_type @Less.1 [template] +// CHECK:STDOUT: %struct.2: Less = struct_value () [template] // CHECK:STDOUT: %LessOrEquivalent.1: type = fn_type @LessOrEquivalent.1 [template] -// CHECK:STDOUT: %struct.2: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %struct.3: LessOrEquivalent = struct_value () [template] // CHECK:STDOUT: %Greater.1: type = fn_type @Greater.1 [template] -// CHECK:STDOUT: %struct.3: Greater = struct_value () [template] +// CHECK:STDOUT: %struct.4: Greater = struct_value () [template] // CHECK:STDOUT: %GreaterOrEquivalent.1: type = fn_type @GreaterOrEquivalent.1 [template] -// CHECK:STDOUT: %struct.4: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %struct.5: GreaterOrEquivalent = struct_value () [template] // CHECK:STDOUT: %Less.2: type = fn_type @Less.2 [template] -// CHECK:STDOUT: %struct.5: Less = struct_value () [template] +// CHECK:STDOUT: %struct.6: Less = struct_value () [template] // CHECK:STDOUT: %LessOrEquivalent.2: type = fn_type @LessOrEquivalent.2 [template] -// CHECK:STDOUT: %struct.6: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %struct.7: LessOrEquivalent = struct_value () [template] // CHECK:STDOUT: %Greater.2: type = fn_type @Greater.2 [template] -// CHECK:STDOUT: %struct.7: Greater = struct_value () [template] +// CHECK:STDOUT: %struct.8: Greater = struct_value () [template] // CHECK:STDOUT: %GreaterOrEquivalent.2: type = fn_type @GreaterOrEquivalent.2 [template] -// CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template] -// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2, %struct.3, %struct.4) [template] +// CHECK:STDOUT: %struct.9: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.2, %struct.3, %struct.4, %struct.5) [template] // CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template] -// CHECK:STDOUT: %struct.9: TestLess = struct_value () [template] +// CHECK:STDOUT: %struct.10: TestLess = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: type = assoc_entity_type @Ordered, Less [template] -// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.17 [template] // CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template] -// CHECK:STDOUT: %struct.10: TestLessEqual = struct_value () [template] +// CHECK:STDOUT: %struct.11: TestLessEqual = struct_value () [template] // CHECK:STDOUT: %.8: type = assoc_entity_type @Ordered, LessOrEquivalent [template] -// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.14 [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.20 [template] // CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template] -// CHECK:STDOUT: %struct.11: TestGreater = struct_value () [template] +// CHECK:STDOUT: %struct.12: TestGreater = struct_value () [template] // CHECK:STDOUT: %.10: type = assoc_entity_type @Ordered, Greater [template] -// CHECK:STDOUT: %.11: = assoc_entity element2, file.%import_ref.16 [template] +// CHECK:STDOUT: %.11: = assoc_entity element2, file.%import_ref.23 [template] // CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template] -// CHECK:STDOUT: %struct.12: TestGreaterEqual = struct_value () [template] +// CHECK:STDOUT: %struct.13: TestGreaterEqual = struct_value () [template] // CHECK:STDOUT: %.12: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template] -// CHECK:STDOUT: %.13: = assoc_entity element3, file.%import_ref.18 [template] +// CHECK:STDOUT: %.13: = assoc_entity element3, file.%import_ref.26 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -125,112 +127,144 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+40, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: = import_ref ir6, inst+59, loaded [template = constants.%.7] -// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+93, loaded [template = constants.%.11] -// CHECK:STDOUT: %import_ref.4 = import_ref ir6, inst+42, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir6, inst+76, loaded [template = constants.%.9] -// CHECK:STDOUT: %import_ref.6: = import_ref ir6, inst+110, loaded [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7: Less = import_ref ir6, inst+55, loaded [template = constants.%struct.5] -// CHECK:STDOUT: %import_ref.8: LessOrEquivalent = import_ref ir6, inst+72, loaded [template = constants.%struct.6] -// CHECK:STDOUT: %import_ref.9: Greater = import_ref ir6, inst+89, loaded [template = constants.%struct.7] -// CHECK:STDOUT: %import_ref.10: GreaterOrEquivalent = import_ref ir6, inst+106, loaded [template = constants.%struct.8] +// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+51, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: = import_ref ir6, inst+93, loaded [template = constants.%.9] +// CHECK:STDOUT: %import_ref.3 = import_ref ir6, inst+53, unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref ir6, inst+133, loaded [template = constants.%.13] +// CHECK:STDOUT: %import_ref.5: = import_ref ir6, inst+73, loaded [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: = import_ref ir6, inst+113, loaded [template = constants.%.11] +// CHECK:STDOUT: %import_ref.7: Less = import_ref ir6, inst+69, loaded [template = constants.%struct.6] +// CHECK:STDOUT: %import_ref.8: LessOrEquivalent = import_ref ir6, inst+89, loaded [template = constants.%struct.7] +// CHECK:STDOUT: %import_ref.9: Greater = import_ref ir6, inst+109, loaded [template = constants.%struct.8] +// CHECK:STDOUT: %import_ref.10: GreaterOrEquivalent = import_ref ir6, inst+129, loaded [template = constants.%struct.9] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Ordered.ref: type = name_ref Ordered, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.9] { +// CHECK:STDOUT: %import_ref.11: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.15: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.10] { // CHECK:STDOUT: %C.ref.loc13_16: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc13_13.1: C = param a // CHECK:STDOUT: @TestLess.%a: C = bind_name a, %a.loc13_13.1 // CHECK:STDOUT: %C.ref.loc13_22: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc13_19.1: C = param b // CHECK:STDOUT: @TestLess.%b: C = bind_name b, %b.loc13_19.1 +// CHECK:STDOUT: %bool.make_type.loc13: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc13_28.1: type = value_of_initializer %bool.make_type.loc13 [template = bool] +// CHECK:STDOUT: %.loc13_28.2: type = converted %bool.make_type.loc13, %.loc13_28.1 [template = bool] // CHECK:STDOUT: @TestLess.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir6, inst+40, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.12 = import_ref ir6, inst+55, unloaded -// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.10] { +// CHECK:STDOUT: %import_ref.16: type = import_ref ir6, inst+51, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.17 = import_ref ir6, inst+69, unloaded +// CHECK:STDOUT: %import_ref.18: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.11] { // CHECK:STDOUT: %C.ref.loc17_21: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_18.1: C = param a // CHECK:STDOUT: @TestLessEqual.%a: C = bind_name a, %a.loc17_18.1 // CHECK:STDOUT: %C.ref.loc17_27: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc17_24.1: C = param b // CHECK:STDOUT: @TestLessEqual.%b: C = bind_name b, %b.loc17_24.1 +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc17_33.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_33.2: type = converted %bool.make_type.loc17, %.loc17_33.1 [template = bool] // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.13: type = import_ref ir6, inst+40, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.14 = import_ref ir6, inst+72, unloaded -// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.11] { +// CHECK:STDOUT: %import_ref.19: type = import_ref ir6, inst+51, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.20 = import_ref ir6, inst+89, unloaded +// CHECK:STDOUT: %import_ref.21: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.12] { // CHECK:STDOUT: %C.ref.loc21_19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc21_16.1: C = param a // CHECK:STDOUT: @TestGreater.%a: C = bind_name a, %a.loc21_16.1 // CHECK:STDOUT: %C.ref.loc21_25: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestGreater.%b: C = bind_name b, %b.loc21_22.1 +// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc21_31.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] +// CHECK:STDOUT: %.loc21_31.2: type = converted %bool.make_type.loc21, %.loc21_31.1 [template = bool] // CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.15: type = import_ref ir6, inst+40, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.16 = import_ref ir6, inst+89, unloaded -// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.12] { +// CHECK:STDOUT: %import_ref.22: type = import_ref ir6, inst+51, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.23 = import_ref ir6, inst+109, unloaded +// CHECK:STDOUT: %import_ref.24: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.13] { // CHECK:STDOUT: %C.ref.loc25_24: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc25_21.1: C = param a // CHECK:STDOUT: @TestGreaterEqual.%a: C = bind_name a, %a.loc25_21.1 // CHECK:STDOUT: %C.ref.loc25_30: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc25_27.1: C = param b // CHECK:STDOUT: @TestGreaterEqual.%b: C = bind_name b, %b.loc25_27.1 +// CHECK:STDOUT: %bool.make_type.loc25: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc25_36.1: type = value_of_initializer %bool.make_type.loc25 [template = bool] +// CHECK:STDOUT: %.loc25_36.2: type = converted %bool.make_type.loc25, %.loc25_36.1 [template = bool] // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.17: type = import_ref ir6, inst+40, loaded [template = constants.%.2] -// CHECK:STDOUT: %import_ref.18 = import_ref ir6, inst+106, unloaded +// CHECK:STDOUT: %import_ref.25: type = import_ref ir6, inst+51, loaded [template = constants.%.2] +// CHECK:STDOUT: %import_ref.26 = import_ref ir6, inst+129, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Ordered { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Less = file.%import_ref.2 -// CHECK:STDOUT: .Greater = file.%import_ref.3 -// CHECK:STDOUT: .Self = file.%import_ref.4 -// CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.5 -// CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.6 +// CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.2 +// CHECK:STDOUT: .Self = file.%import_ref.3 +// CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.4 +// CHECK:STDOUT: .Less = file.%import_ref.5 +// CHECK:STDOUT: .Greater = file.%import_ref.6 // CHECK:STDOUT: witness = (file.%import_ref.7, file.%import_ref.8, file.%import_ref.9, file.%import_ref.10) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Ordered { -// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less.1 [template = constants.%struct.1] { +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc7_17: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc7_11.1: C = param self // CHECK:STDOUT: %self.loc7_11.2: C = bind_name self, %self.loc7_11.1 // CHECK:STDOUT: %C.ref.loc7_27: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc7_20.1: C = param other // CHECK:STDOUT: %other.loc7_20.2: C = bind_name other, %other.loc7_20.1 +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_33.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_33.2: type = converted %bool.make_type.loc7, %.loc7_33.1 [template = bool] // CHECK:STDOUT: %return.var.loc7: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent.1 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc8_29: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc8_23.1: C = param self // CHECK:STDOUT: %self.loc8_23.2: C = bind_name self, %self.loc8_23.1 // CHECK:STDOUT: %C.ref.loc8_39: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc8_32.1: C = param other // CHECK:STDOUT: %other.loc8_32.2: C = bind_name other, %other.loc8_32.1 +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_45.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_45.2: type = converted %bool.make_type.loc8, %.loc8_45.1 [template = bool] // CHECK:STDOUT: %return.var.loc8: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater.1 [template = constants.%struct.3] { +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater.1 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc9_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_14.1: C = param self // CHECK:STDOUT: %self.loc9_14.2: C = bind_name self, %self.loc9_14.1 // CHECK:STDOUT: %C.ref.loc9_30: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc9_23.1: C = param other // CHECK:STDOUT: %other.loc9_23.2: C = bind_name other, %other.loc9_23.1 +// CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc9_36.1: type = value_of_initializer %bool.make_type.loc9 [template = bool] +// CHECK:STDOUT: %.loc9_36.2: type = converted %bool.make_type.loc9, %.loc9_36.1 [template = bool] // CHECK:STDOUT: %return.var.loc9: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent.1 [template = constants.%struct.4] { +// CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent.1 [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc10_32: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc10_26.1: C = param self // CHECK:STDOUT: %self.loc10_26.2: C = bind_name self, %self.loc10_26.1 // CHECK:STDOUT: %C.ref.loc10_42: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %other.loc10_35.1: C = param other // CHECK:STDOUT: %other.loc10_35.2: C = bind_name other, %other.loc10_35.1 +// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc10_48.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] +// CHECK:STDOUT: %.loc10_48.2: type = converted %bool.make_type.loc10, %.loc10_48.1 [template = bool] // CHECK:STDOUT: %return.var.loc10: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl) [template = constants.%.4] @@ -248,6 +282,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Less.1[@impl.%self.loc7_11.2: C](@impl.%other.loc7_20.2: C) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @LessOrEquivalent.1[@impl.%self.loc8_23.2: C](@impl.%other.loc8_32.2: C) -> bool; @@ -268,7 +304,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: Less = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.1: Less = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc14_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %Less.call: init bool = call %.loc14_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc14_15.1: bool = value_of_initializer %Less.call @@ -280,7 +316,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: LessOrEquivalent = interface_witness_access @impl.%.1, element1 [template = constants.%struct.2] +// CHECK:STDOUT: %.1: LessOrEquivalent = interface_witness_access @impl.%.1, element1 [template = constants.%struct.3] // CHECK:STDOUT: %.loc18_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %LessOrEquivalent.call: init bool = call %.loc18_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc18_16.1: bool = value_of_initializer %LessOrEquivalent.call @@ -292,7 +328,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: Greater = interface_witness_access @impl.%.1, element2 [template = constants.%struct.3] +// CHECK:STDOUT: %.1: Greater = interface_witness_access @impl.%.1, element2 [template = constants.%struct.4] // CHECK:STDOUT: %.loc22_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %Greater.call: init bool = call %.loc22_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc22_15.1: bool = value_of_initializer %Greater.call @@ -304,7 +340,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: GreaterOrEquivalent = interface_witness_access @impl.%.1, element3 [template = constants.%struct.4] +// CHECK:STDOUT: %.1: GreaterOrEquivalent = interface_witness_access @impl.%.1, element3 [template = constants.%struct.5] // CHECK:STDOUT: %.loc26_12: = bound_method %a.ref, %.1 // CHECK:STDOUT: %GreaterOrEquivalent.call: init bool = call %.loc26_12(%a.ref, %b.ref) // CHECK:STDOUT: %.loc26_16.1: bool = value_of_initializer %GreaterOrEquivalent.call @@ -317,34 +353,36 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: TestLess = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template] +// CHECK:STDOUT: %struct.2: TestLess = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = interface_type @Ordered [template] // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %Less: type = fn_type @Less [template] -// CHECK:STDOUT: %struct.2: Less = struct_value () [template] +// CHECK:STDOUT: %struct.3: Less = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, Less [template] -// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.11 [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template] -// CHECK:STDOUT: %struct.3: TestLessEqual = struct_value () [template] +// CHECK:STDOUT: %struct.4: TestLessEqual = struct_value () [template] // CHECK:STDOUT: %LessOrEquivalent: type = fn_type @LessOrEquivalent [template] -// CHECK:STDOUT: %struct.4: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %struct.5: LessOrEquivalent = struct_value () [template] // CHECK:STDOUT: %.7: type = assoc_entity_type @Ordered, LessOrEquivalent [template] -// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.13 [template] +// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.15 [template] // CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template] -// CHECK:STDOUT: %struct.5: TestGreater = struct_value () [template] +// CHECK:STDOUT: %struct.6: TestGreater = struct_value () [template] // CHECK:STDOUT: %Greater: type = fn_type @Greater [template] -// CHECK:STDOUT: %struct.6: Greater = struct_value () [template] +// CHECK:STDOUT: %struct.7: Greater = struct_value () [template] // CHECK:STDOUT: %.9: type = assoc_entity_type @Ordered, Greater [template] -// CHECK:STDOUT: %.10: = assoc_entity element2, file.%import_ref.15 [template] +// CHECK:STDOUT: %.10: = assoc_entity element2, file.%import_ref.18 [template] // CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template] -// CHECK:STDOUT: %struct.7: TestGreaterEqual = struct_value () [template] +// CHECK:STDOUT: %struct.8: TestGreaterEqual = struct_value () [template] // CHECK:STDOUT: %GreaterOrEquivalent: type = fn_type @GreaterOrEquivalent [template] -// CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %struct.9: GreaterOrEquivalent = struct_value () [template] // CHECK:STDOUT: %.11: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template] -// CHECK:STDOUT: %.12: = assoc_entity element3, file.%import_ref.17 [template] +// CHECK:STDOUT: %.12: = assoc_entity element3, file.%import_ref.21 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -358,69 +396,85 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.2] { // CHECK:STDOUT: %D.ref.loc6_16: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc6_13.1: D = param a // CHECK:STDOUT: @TestLess.%a: D = bind_name a, %a.loc6_13.1 // CHECK:STDOUT: %D.ref.loc6_22: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc6_19.1: D = param b // CHECK:STDOUT: @TestLess.%b: D = bind_name b, %b.loc6_19.1 +// CHECK:STDOUT: %bool.make_type.loc6: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc6_28.1: type = value_of_initializer %bool.make_type.loc6 [template = bool] +// CHECK:STDOUT: %.loc6_28.2: type = converted %bool.make_type.loc6, %.loc6_28.1 [template = bool] // CHECK:STDOUT: @TestLess.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: type = import_ref ir6, inst+40, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2: = import_ref ir6, inst+59, loaded [template = constants.%.6] -// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+93, loaded [template = constants.%.10] -// CHECK:STDOUT: %import_ref.4 = import_ref ir6, inst+42, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir6, inst+76, loaded [template = constants.%.8] -// CHECK:STDOUT: %import_ref.6: = import_ref ir6, inst+110, loaded [template = constants.%.12] -// CHECK:STDOUT: %import_ref.7 = import_ref ir6, inst+55, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir6, inst+72, unloaded +// CHECK:STDOUT: %import_ref.2: type = import_ref ir6, inst+51, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.3: = import_ref ir6, inst+93, loaded [template = constants.%.8] +// CHECK:STDOUT: %import_ref.4 = import_ref ir6, inst+53, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir6, inst+133, loaded [template = constants.%.12] +// CHECK:STDOUT: %import_ref.6: = import_ref ir6, inst+73, loaded [template = constants.%.6] +// CHECK:STDOUT: %import_ref.7: = import_ref ir6, inst+113, loaded [template = constants.%.10] +// CHECK:STDOUT: %import_ref.8 = import_ref ir6, inst+69, unloaded // CHECK:STDOUT: %import_ref.9 = import_ref ir6, inst+89, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir6, inst+106, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir6, inst+55, unloaded -// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.10 = import_ref ir6, inst+109, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir6, inst+129, unloaded +// CHECK:STDOUT: %import_ref.12 = import_ref ir6, inst+69, unloaded +// CHECK:STDOUT: %import_ref.13: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.4] { // CHECK:STDOUT: %D.ref.loc14_21: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc14_18.1: D = param a // CHECK:STDOUT: @TestLessEqual.%a: D = bind_name a, %a.loc14_18.1 // CHECK:STDOUT: %D.ref.loc14_27: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc14_24.1: D = param b // CHECK:STDOUT: @TestLessEqual.%b: D = bind_name b, %b.loc14_24.1 +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_33.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_33.2: type = converted %bool.make_type.loc14, %.loc14_33.1 [template = bool] // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.12: type = import_ref ir6, inst+40, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.13 = import_ref ir6, inst+72, unloaded -// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.14: type = import_ref ir6, inst+51, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.15 = import_ref ir6, inst+89, unloaded +// CHECK:STDOUT: %import_ref.16: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.6] { // CHECK:STDOUT: %D.ref.loc22_19: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc22_16.1: D = param a // CHECK:STDOUT: @TestGreater.%a: D = bind_name a, %a.loc22_16.1 // CHECK:STDOUT: %D.ref.loc22_25: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc22_22.1: D = param b // CHECK:STDOUT: @TestGreater.%b: D = bind_name b, %b.loc22_22.1 +// CHECK:STDOUT: %bool.make_type.loc22: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_31.1: type = value_of_initializer %bool.make_type.loc22 [template = bool] +// CHECK:STDOUT: %.loc22_31.2: type = converted %bool.make_type.loc22, %.loc22_31.1 [template = bool] // CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.14: type = import_ref ir6, inst+40, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.15 = import_ref ir6, inst+89, unloaded -// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.17: type = import_ref ir6, inst+51, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.18 = import_ref ir6, inst+109, unloaded +// CHECK:STDOUT: %import_ref.19: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.8] { // CHECK:STDOUT: %D.ref.loc30_24: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc30_21.1: D = param a // CHECK:STDOUT: @TestGreaterEqual.%a: D = bind_name a, %a.loc30_21.1 // CHECK:STDOUT: %D.ref.loc30_30: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc30_27.1: D = param b // CHECK:STDOUT: @TestGreaterEqual.%b: D = bind_name b, %b.loc30_27.1 +// CHECK:STDOUT: %bool.make_type.loc30: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc30_36.1: type = value_of_initializer %bool.make_type.loc30 [template = bool] +// CHECK:STDOUT: %.loc30_36.2: type = converted %bool.make_type.loc30, %.loc30_36.1 [template = bool] // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.16: type = import_ref ir6, inst+40, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.17 = import_ref ir6, inst+106, unloaded +// CHECK:STDOUT: %import_ref.20: type = import_ref ir6, inst+51, loaded [template = constants.%.4] +// CHECK:STDOUT: %import_ref.21 = import_ref ir6, inst+129, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Ordered { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Less = file.%import_ref.2 -// CHECK:STDOUT: .Greater = file.%import_ref.3 +// CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.3 // CHECK:STDOUT: .Self = file.%import_ref.4 -// CHECK:STDOUT: .LessOrEquivalent = file.%import_ref.5 -// CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.6 -// CHECK:STDOUT: witness = (file.%import_ref.7, file.%import_ref.8, file.%import_ref.9, file.%import_ref.10) +// CHECK:STDOUT: .GreaterOrEquivalent = file.%import_ref.5 +// CHECK:STDOUT: .Less = file.%import_ref.6 +// CHECK:STDOUT: .Greater = file.%import_ref.7 +// CHECK:STDOUT: witness = (file.%import_ref.8, file.%import_ref.9, file.%import_ref.10, file.%import_ref.11) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { @@ -428,6 +482,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestLess(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index d97c3bb2a2b1..f783d8e0b222 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -16,7 +16,9 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,11 +27,15 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] @@ -38,3 +44,5 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index 30643b56b785..76bc6860bc95 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -40,7 +40,10 @@ fn Main() { // CHECK:STDOUT: --- global.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: 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: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,15 +53,25 @@ fn Main() { // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc4_8.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_8.2: type = converted %int.make_type_32.loc4, %.loc4_8.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_8.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_8.2: type = converted %int.make_type_32.loc5, %.loc5_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.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: %.loc4: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%x.var, %.loc4 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, file.%x @@ -70,10 +83,12 @@ fn Main() { // CHECK:STDOUT: --- inside_fn.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [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 0 [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -84,29 +99,43 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %.loc4_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_8.2: type = converted %int.make_type_32, %.loc4_8.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} +// 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: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_10.2: type = converted %int.make_type_32.loc7, %.loc7_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: assign %x.var, %.loc7 +// CHECK:STDOUT: %.loc7_16: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: assign %x.var, %.loc7_16 +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, file.%x -// CHECK:STDOUT: %.loc9: i32 = bind_value %x.ref -// CHECK:STDOUT: assign %y.var, %.loc9 +// CHECK:STDOUT: %.loc9_23: i32 = bind_value %x.ref +// CHECK:STDOUT: assign %y.var, %.loc9_23 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%x.var, %.loc4 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index f7a19f7c4b75..5ceedba5b16b 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -56,16 +56,28 @@ import library "var"; // CHECK:STDOUT: // CHECK:STDOUT: --- var.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: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Foo = %Foo // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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: %.loc4_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_10.2: type = converted %int.make_type_32, %.loc4_10.1 [template = i32] // CHECK:STDOUT: %Foo.var: ref i32 = var Foo // CHECK:STDOUT: %Foo: ref i32 = bind_name Foo, %Foo.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -74,7 +86,7 @@ import library "var"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+3, unloaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+12, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/fail_import_type_error.carbon b/toolchain/check/testdata/packages/fail_import_type_error.carbon index 192db1cc86e9..3785689dd2a9 100644 --- a/toolchain/check/testdata/packages/fail_import_type_error.carbon +++ b/toolchain/check/testdata/packages/fail_import_type_error.carbon @@ -69,6 +69,12 @@ var d: i32 = d_ref; // CHECK:STDOUT: // CHECK:STDOUT: --- implicit.impl.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: package: = namespace [template] { // CHECK:STDOUT: .a_ref = %import_ref.1 @@ -86,16 +92,34 @@ var d: i32 = d_ref; // CHECK:STDOUT: %import_ref.3: ref = import_ref ir0, inst+13, loaded // CHECK:STDOUT: %import_ref.4: ref = import_ref ir0, inst+17, loaded // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var +// CHECK:STDOUT: %import_ref.7: 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_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: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = 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: %a_ref.ref: ref = name_ref a_ref, file.%import_ref.1 diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index 2f75608f4528..84ad7f0a14e8 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -12,9 +12,11 @@ fn F() -> i32 { // CHECK:STDOUT: --- address_of_deref.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: } @@ -25,17 +27,27 @@ fn F() -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// 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: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc8 +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc8_16 // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc9_13: i32* = addr_of %n.ref // CHECK:STDOUT: %.loc9_12: ref i32 = deref %.loc9_13 diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index b5633a919937..6bb5dcfb368b 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -22,11 +22,13 @@ fn F() { // CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] // CHECK:STDOUT: %.6: type = ptr_type i32 [template] // CHECK:STDOUT: %.7: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template] @@ -42,10 +44,26 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc8_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_15.1: type = value_of_initializer %int.make_type_32.loc8_15 [template = i32] +// CHECK:STDOUT: %.loc8_15.2: type = converted %int.make_type_32.loc8_15, %.loc8_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc8_24.1: type = value_of_initializer %int.make_type_32.loc8_24 [template = i32] +// CHECK:STDOUT: %.loc8_24.2: type = converted %int.make_type_32.loc8_24, %.loc8_24.1 [template = i32] // CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s // CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var @@ -56,9 +74,15 @@ fn F() { // CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.4] // CHECK:STDOUT: %.loc8_46.4: ref i32 = struct_access %s.var, element1 // CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %s.var, %.loc8_47 +// CHECK:STDOUT: %int.make_type_32.loc10_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] +// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_32.loc10_15, %.loc10_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc10_24.1: type = value_of_initializer %int.make_type_32.loc10_24 [template = i32] +// CHECK:STDOUT: %.loc10_24.2: type = converted %int.make_type_32.loc10_24, %.loc10_24.1 [template = i32] // CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.3] // CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p @@ -66,22 +90,34 @@ fn F() { // CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10 // CHECK:STDOUT: assign %p.var, %.loc10_32 -// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %.loc11_13.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %q.var: ref i32* = var q // CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var // CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0 // CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19 // CHECK:STDOUT: assign %q.var, %.loc11_17 -// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] +// CHECK:STDOUT: %.loc12_13.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %r.var: ref i32* = var r // CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var // CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc12_19: ref i32 = struct_access %s.ref.loc12, element1 // CHECK:STDOUT: %.loc12_17: i32* = addr_of %.loc12_19 // CHECK:STDOUT: assign %r.var, %.loc12_17 -// CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (%int.make_type_32.loc14_11, %int.make_type_32.loc14_16) +// CHECK:STDOUT: %.loc14_19.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_19.3: type = converted %int.make_type_32.loc14_11, %.loc14_19.2 [template = i32] +// CHECK:STDOUT: %.loc14_19.4: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_19.5: type = converted %int.make_type_32.loc14_16, %.loc14_19.4 [template = i32] +// CHECK:STDOUT: %.loc14_19.6: type = converted %.loc14_19.1, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %t.var: ref (i32, i32) = var t // CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var // CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.4] @@ -94,7 +130,10 @@ fn F() { // CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var [template = constants.%tuple] // CHECK:STDOUT: %.loc14_29: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign %t.var, %.loc14_29 -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] +// CHECK:STDOUT: %.loc15_14.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t0.var: ref i32* = var t0 // CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var // CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t @@ -102,7 +141,10 @@ fn F() { // CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21 // CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22 // CHECK:STDOUT: assign %t0.var, %.loc15_18 -// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc16_14.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_14.2: type = converted %int.make_type_32.loc16, %.loc16_14.1 [template = i32] +// CHECK:STDOUT: %.loc16_14.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t1.var: ref i32* = var t1 // CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var // CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t @@ -113,3 +155,5 @@ fn F() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 689cef76e8f4..429689a92665 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -14,9 +14,11 @@ fn F() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: } @@ -27,18 +29,32 @@ fn F() -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// 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: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc8 -// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc8_16 +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] +// CHECK:STDOUT: %.loc9_13.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 1bce4c6f3d7c..3a85a2ce14cb 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -98,14 +98,16 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: --- fail_address_of_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.2: H = struct_value () [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] // CHECK:STDOUT: %AddressOfLiteral: type = fn_type @AddressOfLiteral [template] -// CHECK:STDOUT: %struct.3: AddressOfLiteral = struct_value () [template] +// CHECK:STDOUT: %struct.4: AddressOfLiteral = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: type = ptr_type i32 [template] // CHECK:STDOUT: %.5: bool = bool_literal true [template] @@ -121,20 +123,20 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %.15: i32 = int_literal 5 [template] // CHECK:STDOUT: %.16: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %AddressOfOperator: type = fn_type @AddressOfOperator [template] -// CHECK:STDOUT: %struct.4: AddressOfOperator = struct_value () [template] +// CHECK:STDOUT: %struct.5: AddressOfOperator = struct_value () [template] // CHECK:STDOUT: %.17: bool = bool_literal false [template] // CHECK:STDOUT: %AddressOfCall: type = fn_type @AddressOfCall [template] -// CHECK:STDOUT: %struct.5: AddressOfCall = struct_value () [template] +// CHECK:STDOUT: %struct.6: AddressOfCall = struct_value () [template] // CHECK:STDOUT: %AddressOfType: type = fn_type @AddressOfType [template] -// CHECK:STDOUT: %struct.6: AddressOfType = struct_value () [template] +// CHECK:STDOUT: %struct.7: AddressOfType = struct_value () [template] // CHECK:STDOUT: %.18: type = ptr_type type [template] // CHECK:STDOUT: %.19: type = const_type i32 [template] // CHECK:STDOUT: %.20: type = ptr_type const i32 [template] // CHECK:STDOUT: %AddressOfTupleElementValue: type = fn_type @AddressOfTupleElementValue [template] -// CHECK:STDOUT: %struct.7: AddressOfTupleElementValue = struct_value () [template] +// CHECK:STDOUT: %struct.8: AddressOfTupleElementValue = struct_value () [template] // CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.11, %.12) [template] // CHECK:STDOUT: %AddressOfParam: type = fn_type @AddressOfParam [template] -// CHECK:STDOUT: %struct.8: AddressOfParam = struct_value () [template] +// CHECK:STDOUT: %struct.9: AddressOfParam = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -150,24 +152,41 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: .AddressOfParam = %AddressOfParam.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// 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.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_16.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_16.2: type = converted %int.make_type_32.loc9, %.loc9_16.1 [template = i32] +// CHECK:STDOUT: %.loc9_19: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: @H.%return: ref {.a: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AddressOfLiteral.decl: AddressOfLiteral = fn_decl @AddressOfLiteral [template = constants.%struct.3] {} -// CHECK:STDOUT: %AddressOfOperator.decl: AddressOfOperator = fn_decl @AddressOfOperator [template = constants.%struct.4] {} -// CHECK:STDOUT: %AddressOfCall.decl: AddressOfCall = fn_decl @AddressOfCall [template = constants.%struct.5] {} -// CHECK:STDOUT: %AddressOfType.decl: AddressOfType = fn_decl @AddressOfType [template = constants.%struct.6] {} -// CHECK:STDOUT: %AddressOfTupleElementValue.decl: AddressOfTupleElementValue = fn_decl @AddressOfTupleElementValue [template = constants.%struct.7] {} -// CHECK:STDOUT: %AddressOfParam.decl: AddressOfParam = fn_decl @AddressOfParam [template = constants.%struct.8] { +// CHECK:STDOUT: %AddressOfLiteral.decl: AddressOfLiteral = fn_decl @AddressOfLiteral [template = constants.%struct.4] {} +// CHECK:STDOUT: %AddressOfOperator.decl: AddressOfOperator = fn_decl @AddressOfOperator [template = constants.%struct.5] {} +// CHECK:STDOUT: %AddressOfCall.decl: AddressOfCall = fn_decl @AddressOfCall [template = constants.%struct.6] {} +// CHECK:STDOUT: %AddressOfType.decl: AddressOfType = fn_decl @AddressOfType [template = constants.%struct.7] {} +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AddressOfTupleElementValue.decl: AddressOfTupleElementValue = fn_decl @AddressOfTupleElementValue [template = constants.%struct.8] {} +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %AddressOfParam.decl: AddressOfParam = fn_decl @AddressOfParam [template = constants.%struct.9] { +// CHECK:STDOUT: %int.make_type_32.loc91: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc91_26.1: type = value_of_initializer %int.make_type_32.loc91 [template = i32] +// CHECK:STDOUT: %.loc91_26.2: type = converted %int.make_type_32.loc91, %.loc91_26.1 [template = i32] // CHECK:STDOUT: %param.loc91_19.1: i32 = param param // CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc91_19.1 // CHECK:STDOUT: } +// 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 @G() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> {.a: i32}; @@ -205,7 +224,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: !and.result: // CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.17] // CHECK:STDOUT: %.loc49_3: bool* = addr_of [template = ] -// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.2] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.3] // CHECK:STDOUT: %H.call: init {.a: i32} = call %H.ref() // CHECK:STDOUT: %.loc54_5.1: ref {.a: i32} = temporary_storage // CHECK:STDOUT: %.loc54_5.2: ref {.a: i32} = temporary %.loc54_5.1, %H.call @@ -219,7 +238,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfCall() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init i32 = call %G.ref() // CHECK:STDOUT: %.loc67: i32* = addr_of [template = ] // CHECK:STDOUT: return @@ -227,8 +246,12 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32.loc75: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc75: type* = addr_of [template = ] -// CHECK:STDOUT: %.loc80_5: type = const_type i32 [template = constants.%.19] +// CHECK:STDOUT: %int.make_type_32.loc80: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc80_5.1: type = value_of_initializer %int.make_type_32.loc80 [template = i32] +// CHECK:STDOUT: %.loc80_5.2: type = converted %int.make_type_32.loc80, %.loc80_5.1 [template = i32] +// CHECK:STDOUT: %.loc80_5.3: type = const_type i32 [template = constants.%.19] // CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.20] // CHECK:STDOUT: %.loc80_3: type* = addr_of [template = ] // CHECK:STDOUT: return @@ -249,7 +272,10 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfParam(%param: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc95_22: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc95_22.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc95_22.2: type = converted %int.make_type_32, %.loc95_22.1 [template = i32] +// CHECK:STDOUT: %.loc95_22.3: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr // CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param diff --git a/toolchain/check/testdata/pointer/fail_deref_error.carbon b/toolchain/check/testdata/pointer/fail_deref_error.carbon index b1a591f9299b..2d9577ee0a9a 100644 --- a/toolchain/check/testdata/pointer/fail_deref_error.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_error.carbon @@ -16,16 +16,32 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: --- fail_deref_error.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: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// 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_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: %undeclared.ref.loc11: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc11: ref = deref +// CHECK:STDOUT: %.loc11_14: ref = deref // CHECK:STDOUT: %n: i32 = bind_name n, +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15, %.loc15_9.1 [template = i32] // CHECK:STDOUT: %undeclared.ref.loc15: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc15: ref = deref +// CHECK:STDOUT: %.loc15_25: ref = deref // CHECK:STDOUT: %n2: i32 = bind_name n2, // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index 1880e124af45..41afdb2b680e 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -39,12 +39,14 @@ fn Deref(n: i32) { // CHECK:STDOUT: --- fail_deref_not_pointer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Deref: type = fn_type @Deref [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Deref = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Deref: type = fn_type @Deref [template] +// CHECK:STDOUT: %struct.2: Deref = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %struct.2: {} = struct_value () [template] +// CHECK:STDOUT: %struct.3: {} = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,12 +55,18 @@ fn Deref(n: i32) { // CHECK:STDOUT: .Deref = %Deref.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Deref.decl: Deref = fn_decl @Deref [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Deref.decl: Deref = fn_decl @Deref [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32, %.loc7_13.1 [template = i32] // CHECK:STDOUT: %n.loc7_10.1: i32 = param n // CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc7_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref.loc12: i32 = name_ref n, %n @@ -74,12 +82,12 @@ fn Deref(n: i32) { // CHECK:STDOUT: %.loc27_4.2: () = converted %.loc27_4.1, %tuple.loc27 [template = constants.%tuple] // CHECK:STDOUT: %.loc27_5: ref = deref %.loc27_4.2 // CHECK:STDOUT: %.loc32_5.1: {} = struct_literal () -// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct.2] -// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct.2] +// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct.3] +// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct.3] // CHECK:STDOUT: %.loc32_3: ref = deref %.loc32_5.2 // CHECK:STDOUT: %.loc36_4.1: {} = struct_literal () -// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct.2] -// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct.2] +// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct.3] +// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct.3] // CHECK:STDOUT: %.loc36_5: ref = deref %.loc36_4.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_type.carbon b/toolchain/check/testdata/pointer/fail_deref_type.carbon index a8da68a1e2ca..71eee1ac7cdb 100644 --- a/toolchain/check/testdata/pointer/fail_deref_type.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_type.carbon @@ -19,6 +19,12 @@ var p2: i32->foo; // CHECK:STDOUT: --- fail_deref_type.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: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -26,11 +32,21 @@ var p2: i32->foo; // CHECK:STDOUT: .p2 = %p2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc14: ref = deref i32 +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14, %.loc14_9.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: ref = deref %.loc14_9.2 // CHECK:STDOUT: %p.var: ref = var p // CHECK:STDOUT: %p: ref = bind_name p, %p.var -// CHECK:STDOUT: %.loc18: ref = deref i32 +// CHECK:STDOUT: %import_ref.2: 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_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_12: ref = deref %.loc18_9.2 // CHECK:STDOUT: %p2.var: ref = var p2 // CHECK:STDOUT: %p2: ref = bind_name p2, %p2.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/import.carbon b/toolchain/check/testdata/pointer/import.carbon index 5bc9ef7b5034..bf440b95f9fe 100644 --- a/toolchain/check/testdata/pointer/import.carbon +++ b/toolchain/check/testdata/pointer/import.carbon @@ -20,8 +20,11 @@ var a: i32* = a_ref; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type 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 0 [template] +// CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,16 +34,26 @@ var a: i32* = a_ref; // CHECK:STDOUT: .a_ref = %a_ref // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_32.loc4, %.loc4_13.1 [template = i32] // CHECK:STDOUT: %a_orig.var: ref i32 = var a_orig // CHECK:STDOUT: %a_orig: ref i32 = bind_name a_orig, %a_orig.var -// CHECK:STDOUT: %.loc5: type = ptr_type i32 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_15.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] +// CHECK:STDOUT: %.loc5_15.2: type = converted %int.make_type_32.loc5, %.loc5_15.1 [template = i32] +// CHECK:STDOUT: %.loc5_15.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %a_ref.var: ref i32* = var a_ref // CHECK:STDOUT: %a_ref: ref i32* = bind_name a_ref, %a_ref.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: %.loc4: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%a_orig.var, %.loc4 // CHECK:STDOUT: %a_orig.ref: ref i32 = name_ref a_orig, file.%a_orig // CHECK:STDOUT: %.loc5: i32* = addr_of %a_orig.ref @@ -51,7 +64,10 @@ var a: i32* = a_ref; // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type 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: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -61,14 +77,20 @@ var a: i32* = a_ref; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+3, unloaded -// CHECK:STDOUT: %import_ref.2: ref i32* = import_ref ir0, inst+10, loaded +// CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+12, unloaded +// CHECK:STDOUT: %import_ref.2: ref i32* = import_ref ir0, inst+23, loaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4: type = ptr_type i32 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.3: 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: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] +// CHECK:STDOUT: %.loc4_11.3: type = ptr_type i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref i32* = var a // CHECK:STDOUT: %a: ref i32* = 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: %a_ref.ref: ref i32* = name_ref a_ref, file.%import_ref.2 diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index faf65da60ec7..8714aecdd593 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -12,14 +12,16 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: --- nested_const.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] -// CHECK:STDOUT: %.3: type = const_type const i32* [template] -// CHECK:STDOUT: %.4: type = ptr_type const (const i32*) [template] -// CHECK:STDOUT: %.5: type = const_type const (const 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 = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.4: type = const_type const i32* [template] +// CHECK:STDOUT: %.5: type = ptr_type const (const i32*) [template] +// CHECK:STDOUT: %.6: type = const_type const (const i32*)* [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,19 +30,29 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc8_23: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_32: type = ptr_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_16: type = const_type const i32* [template = constants.%.3] -// CHECK:STDOUT: %.loc8_34: type = ptr_type const (const i32*) [template = constants.%.4] -// CHECK:STDOUT: %.loc8_9: type = const_type const (const i32*)* [template = constants.%.5] +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_23.1: type = value_of_initializer %int.make_type_32.loc8_29 [template = i32] +// CHECK:STDOUT: %.loc8_23.2: type = converted %int.make_type_32.loc8_29, %.loc8_23.1 [template = i32] +// CHECK:STDOUT: %.loc8_23.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_32: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_16: type = const_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %.loc8_34: type = ptr_type const (const i32*) [template = constants.%.5] +// CHECK:STDOUT: %.loc8_9: type = const_type const (const i32*)* [template = constants.%.6] // CHECK:STDOUT: %p.loc8_6.1: const (const (const i32*)*) = param p // CHECK:STDOUT: @F.%p: const (const (const i32*)*) = bind_name p, %p.loc8_6.1 -// CHECK:STDOUT: %.loc8_41: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc8_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_41.1: type = value_of_initializer %int.make_type_32.loc8_47 [template = i32] +// CHECK:STDOUT: %.loc8_41.2: type = converted %int.make_type_32.loc8_47, %.loc8_41.1 [template = i32] +// CHECK:STDOUT: %.loc8_41.3: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: const (const (const i32*)*) = name_ref p, %p diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index fcd3686daee2..5d71653dc076 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -15,14 +15,16 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_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 = ptr_type i32 [template] // CHECK:STDOUT: %Ptr: type = fn_type @Ptr [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Ptr = struct_value () [template] +// CHECK:STDOUT: %struct.2: Ptr = struct_value () [template] // CHECK:STDOUT: %.3: type = const_type i32 [template] // CHECK:STDOUT: %.4: type = ptr_type const i32 [template] // CHECK:STDOUT: %ConstPtr: type = fn_type @ConstPtr [template] -// CHECK:STDOUT: %struct.2: ConstPtr = struct_value () [template] +// CHECK:STDOUT: %struct.3: ConstPtr = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -32,24 +34,42 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: .ConstPtr = %ConstPtr.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Ptr.decl: Ptr = fn_decl @Ptr [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_14: type = ptr_type i32 [template = constants.%.1] +// 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: %Ptr.decl: Ptr = fn_decl @Ptr [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32.loc7_11, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc7_14.3: type = ptr_type i32 [template = constants.%.2] // CHECK:STDOUT: %p.loc7_8.1: i32* = param p // CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc7_8.1 -// CHECK:STDOUT: %.loc7_23: type = ptr_type i32 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc7_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_23.1: type = value_of_initializer %int.make_type_32.loc7_20 [template = i32] +// CHECK:STDOUT: %.loc7_23.2: type = converted %int.make_type_32.loc7_20, %.loc7_23.1 [template = i32] +// CHECK:STDOUT: %.loc7_23.3: type = ptr_type i32 [template = constants.%.2] // CHECK:STDOUT: @Ptr.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConstPtr.decl: ConstPtr = fn_decl @ConstPtr [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %ConstPtr.decl: ConstPtr = fn_decl @ConstPtr [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11_22, %.loc11_16.1 [template = i32] +// CHECK:STDOUT: %.loc11_16.3: type = const_type i32 [template = constants.%.3] // CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.4] // CHECK:STDOUT: %p.loc11_13.1: const i32* = param p // CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc11_13.1 -// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_38: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_38 [template = i32] +// CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_38, %.loc11_32.1 [template = i32] +// CHECK:STDOUT: %.loc11_32.3: type = const_type i32 [template = constants.%.3] // CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.4] // CHECK:STDOUT: @ConstPtr.%return: ref const i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Ptr(%p: i32*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index 4170d55b0fa5..47b4fb674f57 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -14,7 +14,9 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Main = 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 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -24,7 +26,8 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -32,3 +35,5 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index 5e6182559069..67e64b63ce94 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -19,9 +19,13 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- code_after_return_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] @@ -35,13 +39,26 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type, %.loc7_9.1 [template = bool] // CHECK:STDOUT: %b.loc7_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32, %.loc7_18.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index cab4d335d1dc..74a69b3a2ccb 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -18,8 +18,10 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: %ReturnType: type = fn_type @ReturnType [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %struct.1: ReturnType = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] // CHECK:STDOUT: %Six: type = fn_type @Six [template] -// CHECK:STDOUT: %struct.2: Six = struct_value () [template] +// CHECK:STDOUT: %struct.3: Six = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -33,7 +35,8 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: %ReturnType.decl: ReturnType = fn_decl @ReturnType [template = constants.%struct.1] { // CHECK:STDOUT: @ReturnType.%return: ref type = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.3] { // CHECK:STDOUT: %ReturnType.ref: ReturnType = name_ref ReturnType, %ReturnType.decl [template = constants.%struct.1] // CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() // CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %ReturnType.call @@ -44,9 +47,14 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnType() -> type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: return i32 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_37.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_37.2: type = converted %int.make_type_32, %.loc9_37.1 [template = i32] +// CHECK:STDOUT: return %.loc9_37.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc13: i32 = int_literal 6 [template = constants.%.2] diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index fb248b281b0b..85a096b902bc 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -29,17 +29,21 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: --- fail_let_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Six = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %struct.2: Six = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: %y: type = bind_symbolic_name y 0 [symbolic] // CHECK:STDOUT: %HalfDozen: type = fn_type @HalfDozen [template] -// CHECK:STDOUT: %struct.2: HalfDozen = struct_value () [template] +// CHECK:STDOUT: %struct.3: HalfDozen = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc12: i32 = int_literal 6 [template = constants.%.2] diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index fb3a64dad8cc..cd9e13a3c46f 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -13,9 +13,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_missing_return.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,11 +26,17 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index 2e9762809026..6af8637d9f38 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -14,9 +14,11 @@ fn Procedure() -> i32 { // CHECK:STDOUT: --- fail_return_var_no_returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Procedure: type = fn_type @Procedure [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Procedure = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Procedure: type = fn_type @Procedure [template] +// CHECK:STDOUT: %struct.2: Procedure = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,11 +27,17 @@ fn Procedure() -> i32 { // CHECK:STDOUT: .Procedure = %Procedure.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Procedure.decl: Procedure = fn_decl @Procedure [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Procedure.decl: Procedure = fn_decl @Procedure [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] // CHECK:STDOUT: @Procedure.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index 57c9ce08791c..2032cf936aad 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -31,19 +31,21 @@ fn G() -> C { // CHECK:STDOUT: --- fail_return_with_returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.4: type = unbound_element_type C, i32 [template] // CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [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: %.6: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.3: C = struct_value (%.3, %.7) [template] +// CHECK:STDOUT: %struct.4: C = struct_value (%.3, %.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,18 +56,31 @@ fn G() -> C { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// 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: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @G.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { +// CHECK:STDOUT: %int.make_type_32.loc19_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_18.1: type = value_of_initializer %int.make_type_32.loc19_18 [template = i32] +// CHECK:STDOUT: %.loc19_18.2: type = converted %int.make_type_32.loc19_18, %.loc19_18.1 [template = i32] // CHECK:STDOUT: %.loc19_16: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc19_30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_30.1: type = value_of_initializer %int.make_type_32.loc19_30 [template = i32] +// CHECK:STDOUT: %.loc19_30.2: type = converted %int.make_type_32.loc19_30, %.loc19_30.1 [template = i32] // CHECK:STDOUT: %.loc19_28: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -74,12 +89,17 @@ fn G() -> C { // CHECK:STDOUT: .b = %.loc19_28 // 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: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32, %.loc8_19.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc8 +// CHECK:STDOUT: %.loc8_25: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %v.var, %.loc8_25 // CHECK:STDOUT: %.loc16: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -95,8 +115,8 @@ fn G() -> C { // CHECK:STDOUT: %.loc21_38.3: init i32 = initialize_from %.loc21_29 to %.loc21_38.2 [template = constants.%.3] // CHECK:STDOUT: %.loc21_38.4: ref i32 = class_element_access %return, element1 // CHECK:STDOUT: %.loc21_38.5: init i32 = initialize_from %.loc21_37 to %.loc21_38.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_38.6: init C = class_init (%.loc21_38.3, %.loc21_38.5), %return [template = constants.%struct.3] -// CHECK:STDOUT: %.loc21_39: init C = converted %.loc21_38.1, %.loc21_38.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc21_38.6: init C = class_init (%.loc21_38.3, %.loc21_38.5), %return [template = constants.%struct.4] +// CHECK:STDOUT: %.loc21_39: init C = converted %.loc21_38.1, %.loc21_38.6 [template = constants.%struct.4] // CHECK:STDOUT: assign %return, %.loc21_39 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index cd6f880cdb19..47925a48b5c5 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -38,14 +38,16 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: --- fail_returned_var_shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %SameScope: type = fn_type @SameScope [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: SameScope = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %SameScope: type = fn_type @SameScope [template] +// CHECK:STDOUT: %struct.2: SameScope = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %DifferentScopes: type = fn_type @DifferentScopes [template] -// CHECK:STDOUT: %struct.2: DifferentScopes = struct_value () [template] +// CHECK:STDOUT: %struct.3: DifferentScopes = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,28 +57,48 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: .DifferentScopes = %DifferentScopes.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %SameScope.decl: SameScope = fn_decl @SameScope [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %SameScope.decl: SameScope = fn_decl @SameScope [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7, %.loc7_19.1 [template = i32] // CHECK:STDOUT: @SameScope.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %DifferentScopes.decl: DifferentScopes = fn_decl @DifferentScopes [template = constants.%struct.2] { +// 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: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %DifferentScopes.decl: DifferentScopes = fn_decl @DifferentScopes [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_25.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_25.2: type = converted %int.make_type_32.loc22, %.loc22_25.1 [template = i32] // CHECK:STDOUT: @DifferentScopes.%return: ref i32 = var // CHECK:STDOUT: } +// 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 @SameScope() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc8 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32.loc9, %.loc9_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc9 +// CHECK:STDOUT: %.loc9_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc9_27 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc17: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc17 +// CHECK:STDOUT: %.loc17_27: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc17_27 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: @@ -90,18 +112,24 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: if %.loc23 br !if.then.loc23 else br !if.else.loc23 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc23: +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_21.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_21.2: type = converted %int.make_type_32.loc24, %.loc24_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc24: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc24 +// CHECK:STDOUT: %.loc24_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc24_27 // CHECK:STDOUT: %.loc25: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc25 br !if.then.loc25 else br !if.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc25: +// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc32_23.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] +// CHECK:STDOUT: %.loc32_23.2: type = converted %int.make_type_32.loc32, %.loc32_23.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc32: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc32 +// CHECK:STDOUT: %.loc32_29: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc32_29 // CHECK:STDOUT: br !if.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc25: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 40b8049cfb14..712fd6c00c88 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -18,10 +18,15 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: --- fail_returned_var_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Mismatch: type = fn_type @Mismatch [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Mismatch = struct_value () [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0 [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Mismatch: type = fn_type @Mismatch [template] +// CHECK:STDOUT: %struct.2: Mismatch = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.3: Float = struct_value () [template] +// CHECK:STDOUT: %.3: f64 = float_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -30,16 +35,29 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: .Mismatch = %Mismatch.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mismatch.decl: Mismatch = fn_decl @Mismatch [template = constants.%struct] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Mismatch.decl: Mismatch = fn_decl @Mismatch [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32, %.loc7_18.1 [template = i32] // CHECK:STDOUT: @Mismatch.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mismatch() -> i32 { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc14_19.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc14_19.1) [template = f64] +// CHECK:STDOUT: %.loc14_19.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc14_19.3: type = converted %float.make_type, %.loc14_19.2 [template = f64] // CHECK:STDOUT: %v: f64 = bind_name v, -// CHECK:STDOUT: %.loc14: f64 = float_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_25: f64 = float_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign , // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index a3f7be889c84..cc5df8596f55 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -14,9 +14,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.2: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -26,11 +28,17 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11: f64 = float_literal 1 [template = constants.%.2] diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 0b2fb19bc7de..66a509a6229d 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -17,9 +17,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_value_missing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,11 +30,17 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 27f83d090d49..497cfac85b24 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -13,9 +13,11 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: --- fail_var_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Six = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %struct.2: Six = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -28,13 +30,16 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %x.var: ref type = var x // CHECK:STDOUT: %x: ref type = bind_name x, %x.var -// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.2] { // CHECK:STDOUT: %x.ref: ref type = name_ref x, %x // CHECK:STDOUT: %.loc11: type = bind_value %x.ref // CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11: i32 = int_literal 6 [template = constants.%.2] @@ -43,7 +48,8 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: assign file.%x.var, i32 +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: assign file.%x.var, %int.make_type_32 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index e4d93b755219..77467349f06e 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -23,17 +23,19 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: 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 = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: 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 {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.2: C = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %struct.3: C = struct_value (%.5, %.6) [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] // CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -46,25 +48,40 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { +// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @F.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32, %.loc17_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %.loc9: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] +// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .b = %.loc9 +// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .b = %.loc9_8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] @@ -76,14 +93,17 @@ fn G() -> i32 { // CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 [template = constants.%.5] // CHECK:STDOUT: %.loc13_43.4: ref i32 = class_element_access %return, element1 // CHECK:STDOUT: %.loc13_43.5: init i32 = initialize_from %.loc13_42 to %.loc13_43.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_43.6: init C = class_init (%.loc13_43.3, %.loc13_43.5), %return [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_44: init C = converted %.loc13_43.1, %.loc13_43.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_43.6: init C = class_init (%.loc13_43.3, %.loc13_43.5), %return [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_44: init C = converted %.loc13_43.1, %.loc13_43.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %return, %.loc13_44 // CHECK:STDOUT: return %result to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_24.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_24.2: type = converted %int.make_type_32, %.loc18_24.1 [template = i32] // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var // CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.7] diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 855dd7bdcea5..17d81a007c49 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -26,14 +26,18 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: --- returned_var_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %UnrelatedScopes: type = fn_type @UnrelatedScopes [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: UnrelatedScopes = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %UnrelatedScopes: type = fn_type @UnrelatedScopes [template] +// CHECK:STDOUT: %struct.2: UnrelatedScopes = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct.3: Bool = struct_value () [template] // CHECK:STDOUT: %EnclosingButAfter: type = fn_type @EnclosingButAfter [template] -// CHECK:STDOUT: %struct.2: EnclosingButAfter = struct_value () [template] +// CHECK:STDOUT: %struct.4: EnclosingButAfter = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,26 +47,47 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: .EnclosingButAfter = %EnclosingButAfter.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UnrelatedScopes.decl: UnrelatedScopes = fn_decl @UnrelatedScopes [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %UnrelatedScopes.decl: UnrelatedScopes = fn_decl @UnrelatedScopes [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7, %.loc7_25.1 [template = i32] // CHECK:STDOUT: @UnrelatedScopes.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %EnclosingButAfter.decl: EnclosingButAfter = fn_decl @EnclosingButAfter [template = constants.%struct.2] { +// 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: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %EnclosingButAfter.decl: EnclosingButAfter = fn_decl @EnclosingButAfter [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc17_25.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc17_25.2: type = converted %bool.make_type, %.loc17_25.1 [template = bool] // CHECK:STDOUT: %b.loc17_22.1: bool = param b // CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc17_22.1 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_34.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_34.2: type = converted %int.make_type_32.loc17, %.loc17_34.1 [template = i32] // CHECK:STDOUT: @EnclosingButAfter.%return: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.7: 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 @UnrelatedScopes() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc8 br !if.then.loc8 else br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc8: +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32.loc9, %.loc9_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc9 +// CHECK:STDOUT: %.loc9_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc9_27 // CHECK:STDOUT: br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc8: @@ -70,10 +95,13 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: if %.loc11 br !if.then.loc11 else br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc11: +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_32.loc12, %.loc12_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc12 +// CHECK:STDOUT: %.loc12_27: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc12_27 // CHECK:STDOUT: br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11: @@ -81,12 +109,17 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @EnclosingButAfter(%b: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_21.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_21.2: type = converted %int.make_type_32.loc19, %.loc19_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var // CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.3] @@ -95,6 +128,9 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: return %.loc19_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_19.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_19.2: type = converted %int.make_type_32.loc22, %.loc22_19.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var // CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.4] diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index 599100760126..d19e75d988e1 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -11,12 +11,14 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: 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 = struct_type {.a: i32} [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template] +// CHECK:STDOUT: %struct.3: {.a: i32} = struct_value (%.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,18 +27,24 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] +// CHECK:STDOUT: %.loc7_22: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: @Main.%return: ref {.a: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.3] // CHECK:STDOUT: %.loc8_17: {.a: i32} = struct_literal (%.loc8_16) -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct.3] +// CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct.3] // CHECK:STDOUT: return %.loc8_18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index d03a6e82b6a2..26dc9644de68 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -12,11 +12,13 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: --- tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %Main: type = fn_type @Main [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: %.5: i32 = int_literal 15 [template] // CHECK:STDOUT: %.6: i32 = int_literal 35 [template] @@ -29,13 +31,23 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { -// CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc8_23.2: type = converted %.loc8_23.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: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc8_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (%int.make_type_32.loc8_15, %int.make_type_32.loc8_20) +// CHECK:STDOUT: %.loc8_23.2: type = value_of_initializer %int.make_type_32.loc8_15 [template = i32] +// CHECK:STDOUT: %.loc8_23.3: type = converted %int.make_type_32.loc8_15, %.loc8_23.2 [template = i32] +// CHECK:STDOUT: %.loc8_23.4: type = value_of_initializer %int.make_type_32.loc8_20 [template = i32] +// CHECK:STDOUT: %.loc8_23.5: type = converted %int.make_type_32.loc8_20, %.loc8_23.4 [template = i32] +// CHECK:STDOUT: %.loc8_23.6: type = converted %.loc8_23.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @Main.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.5] diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index 627c2e579048..dda2cd6f4d5e 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -11,9 +11,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -23,11 +25,17 @@ fn Main() -> i32 { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { +// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index 3b19bedc2db6..52a5b320924f 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -12,8 +12,11 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: --- fail_assign_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = struct_type {} [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 = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,11 +25,17 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.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: {} = struct_literal () diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 4f0b08ef9e2d..e84bd7a6c9b9 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -51,9 +51,11 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: --- fail_duplicate_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 2 [template] @@ -71,23 +73,69 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.decl: F = fn_decl @F [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: %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: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_16.1: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_16.2: type = converted %int.make_type_32.loc14_16, %.loc14_16.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_27.1: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] +// CHECK:STDOUT: %.loc14_27.2: type = converted %int.make_type_32.loc14_27, %.loc14_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_36: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_36.1: type = value_of_initializer %int.make_type_32.loc14_36 [template = i32] +// CHECK:STDOUT: %.loc14_36.2: type = converted %int.make_type_32.loc14_36, %.loc14_36.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_47.1: type = value_of_initializer %int.make_type_32.loc14_47 [template = i32] +// CHECK:STDOUT: %.loc14_47.2: type = converted %int.make_type_32.loc14_47, %.loc14_47.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_56: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_56.1: type = value_of_initializer %int.make_type_32.loc14_56 [template = i32] +// CHECK:STDOUT: %.loc14_56.2: type = converted %int.make_type_32.loc14_56, %.loc14_56.1 [template = i32] // CHECK:STDOUT: @F.%return: ref = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc23_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_13.1: type = value_of_initializer %int.make_type_32.loc23_13 [template = i32] +// CHECK:STDOUT: %.loc23_13.2: type = converted %int.make_type_32.loc23_13, %.loc23_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc23_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_22.1: type = value_of_initializer %int.make_type_32.loc23_22 [template = i32] +// CHECK:STDOUT: %.loc23_22.2: type = converted %int.make_type_32.loc23_22, %.loc23_22.1 [template = i32] // CHECK:STDOUT: %.loc23_35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc23_36: {.a: i32} = struct_literal (%.loc23_35) // CHECK:STDOUT: %v: = bind_name v, +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc32_8.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] +// CHECK:STDOUT: %.loc32_8.2: type = converted %int.make_type_32.loc32, %.loc32_8.1 [template = i32] // CHECK:STDOUT: %.loc32_22: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc32_32: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %w: i32 = bind_name w, -// CHECK:STDOUT: %.loc41: type = struct_type {.a: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc41_13.1: type = value_of_initializer %int.make_type_32.loc41 [template = i32] +// CHECK:STDOUT: %.loc41_13.2: type = converted %int.make_type_32.loc41, %.loc41_13.1 [template = i32] +// CHECK:STDOUT: %.loc41_16: type = struct_type {.a: i32} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc49: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc49_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_13.1: type = value_of_initializer %int.make_type_32.loc49_13 [template = i32] +// CHECK:STDOUT: %.loc49_13.2: type = converted %int.make_type_32.loc49_13, %.loc49_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc49_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc49_22.1: type = value_of_initializer %int.make_type_32.loc49_22 [template = i32] +// CHECK:STDOUT: %.loc49_22.2: type = converted %int.make_type_32.loc49_22, %.loc49_22.1 [template = i32] +// CHECK:STDOUT: %.loc49_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] // CHECK:STDOUT: %y.var: ref {.b: i32, .c: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32, .c: i32} = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> ; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 0197efddd01a..a406764badc6 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -18,9 +18,12 @@ var y: {.b: i32} = x; // CHECK:STDOUT: --- fail_field_name_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.b: 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: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -30,17 +33,27 @@ var y: {.b: i32} = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc11: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %.loc11_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc16: type = struct_type {.b: i32} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] +// CHECK:STDOUT: %.loc16_16: type = struct_type {.b: i32} [template = constants.%.4] // CHECK:STDOUT: %y.var: ref {.b: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32} = bind_name y, %y.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_26: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc11_27: {.b: i32} = struct_literal (%.loc11_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 5e5f1e6279af..4de00bce36c9 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -12,9 +12,12 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: --- fail_field_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.b: f64} [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 = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: f64} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,14 +26,20 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.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_26: f64 = float_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_26: f64 = float_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc10_29: {.b: f64} = struct_literal (%.loc10_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index 078223043dee..1c9b5dde6c93 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -13,9 +13,15 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_member_access_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: f64} [template] -// CHECK:STDOUT: %.2: f64 = float_literal 4 [template] -// CHECK:STDOUT: %struct: {.a: f64} = struct_value (%.2) [template] +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: f64} [template] +// CHECK:STDOUT: %.4: f64 = float_literal 4 [template] +// CHECK:STDOUT: %struct.2: {.a: f64} = struct_value (%.4) [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,19 +31,32 @@ var y: i32 = x.b; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7: type = struct_type {.a: f64} [template = constants.%.1] +// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: f64} = var x // CHECK:STDOUT: %x: ref {.a: f64} = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32, %.loc11_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26: f64 = float_literal 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_26: f64 = float_literal 4 [template = constants.%.4] // CHECK:STDOUT: %.loc7_29.1: {.a: f64} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_29.2: init {.a: f64} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_30: init {.a: f64} = converted %.loc7_29.1, %.loc7_29.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_29.2: init {.a: f64} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_30: init {.a: f64} = converted %.loc7_29.1, %.loc7_29.2 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%x.var, %.loc7_30 // CHECK:STDOUT: %x.ref: ref {.a: f64} = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index cfdc0b9c6399..41998cc94b25 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -13,9 +13,12 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_non_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 4 [template] -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.2) [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 = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 4 [template] +// CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,19 +28,29 @@ var y: i32 = x.b; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.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: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.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_26: i32 = int_literal 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.3] // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%x.var, %.loc7_28 // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index c04c221abf4e..c8b9a39691a2 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -12,10 +12,13 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: --- fail_too_few_values.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: 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: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,14 +27,24 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32.loc10_13 [template = i32] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32.loc10_13, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_22.1: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] +// CHECK:STDOUT: %.loc10_22.2: type = converted %int.make_type_32.loc10_22, %.loc10_22.1 [template = i32] +// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.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_35: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_36: {.a: i32} = struct_literal (%.loc10_35) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index 2f8a2349bd88..d84e48f19630 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -12,7 +12,10 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: --- fail_type_assign.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: 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: type = struct_type {.a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -21,14 +24,24 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.1: 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_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // 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: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32, %.loc10_25.1 [template = i32] +// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 27aa00ca694c..9c95b4d61764 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -22,19 +22,22 @@ var b: {.a: {.b: i32, .c: (i32,)}, .d: i32} = b_ref; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %struct.1: {.a: i32} = struct_value (%.2) [template] -// CHECK:STDOUT: %.3: type = tuple_type (type) [template] -// CHECK:STDOUT: %.4: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.5: type = struct_type {.b: i32, .c: (i32,)} [template] -// CHECK:STDOUT: %.6: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type {.b: i32, .c: (i32,)} [template] -// CHECK:STDOUT: %.8: type = struct_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] -// CHECK:STDOUT: %struct.2: {.b: i32, .c: (i32,)} = struct_value (%.2, %tuple) [template] -// CHECK:STDOUT: %struct.3: {.a: {.b: i32, .c: (i32,)}, .d: i32} = struct_value (%struct.2, %.2) [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 = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template] +// CHECK:STDOUT: %.4: type = tuple_type (type) [template] +// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.6: type = struct_type {.b: i32, .c: (i32,)} [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.b: i32, .c: (i32,)} [template] +// CHECK:STDOUT: %.9: type = struct_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] +// CHECK:STDOUT: %struct.3: {.b: i32, .c: (i32,)} = struct_value (%.3, %tuple) [template] +// CHECK:STDOUT: %struct.4: {.a: {.b: i32, .c: (i32,)}, .d: i32} = struct_value (%struct.3, %.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,43 +47,61 @@ var b: {.a: {.b: i32, .c: (i32,)}, .d: i32} = b_ref; // CHECK:STDOUT: .b_ref = %b_ref // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc4_17.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_17.2: type = converted %int.make_type_32.loc4, %.loc4_17.1 [template = i32] +// CHECK:STDOUT: %.loc4_20: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %a_ref.var: ref {.a: i32} = var a_ref // CHECK:STDOUT: %a_ref: ref {.a: i32} = bind_name a_ref, %a_ref.var -// CHECK:STDOUT: %.loc5_36.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc5_36.2: type = converted %.loc5_36.1, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_37: type = struct_type {.b: i32, .c: (i32,)} [template = constants.%.5] -// CHECK:STDOUT: %.loc5_47: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_22.1: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32] +// CHECK:STDOUT: %.loc5_22.2: type = converted %int.make_type_32.loc5_22, %.loc5_22.1 [template = i32] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_36.1: (type,) = tuple_literal (%int.make_type_32.loc5_32) +// CHECK:STDOUT: %.loc5_36.2: type = value_of_initializer %int.make_type_32.loc5_32 [template = i32] +// CHECK:STDOUT: %.loc5_36.3: type = converted %int.make_type_32.loc5_32, %.loc5_36.2 [template = i32] +// CHECK:STDOUT: %.loc5_36.4: type = converted %.loc5_36.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_37: type = struct_type {.b: i32, .c: (i32,)} [template = constants.%.6] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc5_44: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc5_44.1: type = value_of_initializer %int.make_type_32.loc5_44 [template = i32] +// CHECK:STDOUT: %.loc5_44.2: type = converted %int.make_type_32.loc5_44, %.loc5_44.1 [template = i32] +// CHECK:STDOUT: %.loc5_47: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template = constants.%.7] // CHECK:STDOUT: %b_ref.var: ref {.a: {.b: i32, .c: (i32,)}, .d: i32} = var b_ref // CHECK:STDOUT: %b_ref: ref {.a: {.b: i32, .c: (i32,)}, .d: i32} = bind_name b_ref, %b_ref.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: %.loc4_30: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_30: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc4_31.1: {.a: i32} = struct_literal (%.loc4_30) -// CHECK:STDOUT: %.loc4_31.2: init {.a: i32} = struct_init (%.loc4_30) to file.%a_ref.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc4_32: init {.a: i32} = converted %.loc4_31.1, %.loc4_31.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_31.2: init {.a: i32} = struct_init (%.loc4_30) to file.%a_ref.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc4_32: init {.a: i32} = converted %.loc4_31.1, %.loc4_31.2 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_32 -// CHECK:STDOUT: %.loc6_17: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_26: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_17: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_26: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc6_28.1: (i32,) = tuple_literal (%.loc6_26) // CHECK:STDOUT: %.loc6_29.1: {.b: i32, .c: (i32,)} = struct_literal (%.loc6_17, %.loc6_28.1) -// CHECK:STDOUT: %.loc6_37: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_37: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc6_38.1: {.a: {.b: i32, .c: (i32,)}, .d: i32} = struct_literal (%.loc6_29.1, %.loc6_37) // CHECK:STDOUT: %.loc6_38.2: ref {.b: i32, .c: (i32,)} = struct_access file.%b_ref.var, element0 // CHECK:STDOUT: %.loc6_29.2: ref i32 = struct_access %.loc6_38.2, element0 -// CHECK:STDOUT: %.loc6_29.3: init i32 = initialize_from %.loc6_17 to %.loc6_29.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_29.3: init i32 = initialize_from %.loc6_17 to %.loc6_29.2 [template = constants.%.3] // CHECK:STDOUT: %.loc6_29.4: ref (i32,) = struct_access %.loc6_38.2, element1 // CHECK:STDOUT: %.loc6_28.2: init (i32,) = tuple_init (%.loc6_26) to %.loc6_29.4 [template = constants.%tuple] // CHECK:STDOUT: %.loc6_29.5: init (i32,) = converted %.loc6_28.1, %.loc6_28.2 [template = constants.%tuple] // CHECK:STDOUT: %.loc6_29.6: init (i32,) = initialize_from %.loc6_29.5 to %.loc6_29.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc6_29.7: init {.b: i32, .c: (i32,)} = struct_init (%.loc6_29.3, %.loc6_29.6) to %.loc6_38.2 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc6_38.3: init {.b: i32, .c: (i32,)} = converted %.loc6_29.1, %.loc6_29.7 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc6_29.7: init {.b: i32, .c: (i32,)} = struct_init (%.loc6_29.3, %.loc6_29.6) to %.loc6_38.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc6_38.3: init {.b: i32, .c: (i32,)} = converted %.loc6_29.1, %.loc6_29.7 [template = constants.%struct.3] // CHECK:STDOUT: %.loc6_38.4: ref i32 = struct_access file.%b_ref.var, element1 -// CHECK:STDOUT: %.loc6_38.5: init i32 = initialize_from %.loc6_37 to %.loc6_38.4 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_38.6: init {.a: {.b: i32, .c: (i32,)}, .d: i32} = struct_init (%.loc6_38.3, %.loc6_38.5) to file.%b_ref.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc6_39: init {.a: {.b: i32, .c: (i32,)}, .d: i32} = converted %.loc6_38.1, %.loc6_38.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc6_38.5: init i32 = initialize_from %.loc6_37 to %.loc6_38.4 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_38.6: init {.a: {.b: i32, .c: (i32,)}, .d: i32} = struct_init (%.loc6_38.3, %.loc6_38.5) to file.%b_ref.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc6_39: init {.a: {.b: i32, .c: (i32,)}, .d: i32} = converted %.loc6_38.1, %.loc6_38.6 [template = constants.%struct.4] // CHECK:STDOUT: assign file.%b_ref.var, %.loc6_39 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -88,14 +109,17 @@ var b: {.a: {.b: i32, .c: (i32,)}, .d: i32} = b_ref; // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = tuple_type (type) [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: i32, .c: (i32,)} [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.b: i32, .c: (i32,)} [template] -// CHECK:STDOUT: %.7: type = struct_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.a: {.b: i32, .c: (i32,)}*, .d: 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: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: type = tuple_type (type) [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: i32, .c: (i32,)} [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.b: i32, .c: (i32,)} [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.a: {.b: i32, .c: (i32,)}*, .d: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -106,20 +130,38 @@ var b: {.a: {.b: i32, .c: (i32,)}, .d: i32} = b_ref; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: ref {.a: i32} = import_ref ir0, inst+7, loaded -// CHECK:STDOUT: %import_ref.2: ref {.a: {.b: i32, .c: (i32,)}, .d: i32} = import_ref ir0, inst+38, loaded +// CHECK:STDOUT: %import_ref.1: ref {.a: i32} = import_ref ir0, inst+16, loaded +// CHECK:STDOUT: %import_ref.2: ref {.a: {.b: i32, .c: (i32,)}, .d: i32} = import_ref ir0, inst+59, loaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_32.loc4, %.loc4_13.1 [template = i32] +// CHECK:STDOUT: %.loc4_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %a.var: ref {.a: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32} = bind_name a, %a.var -// CHECK:STDOUT: %.loc5_32.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc5_32.2: type = converted %.loc5_32.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_33: type = struct_type {.b: i32, .c: (i32,)} [template = constants.%.4] -// CHECK:STDOUT: %.loc5_43: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template = constants.%.5] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_18: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_18.1: type = value_of_initializer %int.make_type_32.loc5_18 [template = i32] +// CHECK:STDOUT: %.loc5_18.2: type = converted %int.make_type_32.loc5_18, %.loc5_18.1 [template = i32] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_28: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_32.1: (type,) = tuple_literal (%int.make_type_32.loc5_28) +// CHECK:STDOUT: %.loc5_32.2: type = value_of_initializer %int.make_type_32.loc5_28 [template = i32] +// CHECK:STDOUT: %.loc5_32.3: type = converted %int.make_type_32.loc5_28, %.loc5_32.2 [template = i32] +// CHECK:STDOUT: %.loc5_32.4: type = converted %.loc5_32.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_33: type = struct_type {.b: i32, .c: (i32,)} [template = constants.%.5] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_40: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_40.1: type = value_of_initializer %int.make_type_32.loc5_40 [template = i32] +// CHECK:STDOUT: %.loc5_40.2: type = converted %int.make_type_32.loc5_40, %.loc5_40.1 [template = i32] +// CHECK:STDOUT: %.loc5_43: type = struct_type {.a: {.b: i32, .c: (i32,)}, .d: i32} [template = constants.%.6] // CHECK:STDOUT: %b.var: ref {.a: {.b: i32, .c: (i32,)}, .d: i32} = var b // CHECK:STDOUT: %b: ref {.a: {.b: i32, .c: (i32,)}, .d: 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: %a_ref.ref: ref {.a: i32} = name_ref a_ref, file.%import_ref.1 diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index 398b0108d285..def6c281e7b5 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -13,12 +13,14 @@ fn F() -> i32 { // CHECK:STDOUT: --- literal_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.x: i32, .y: i32, .z: 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 = struct_type {.x: i32, .y: i32, .z: i32} [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] // CHECK:STDOUT: %.5: i32 = int_literal 3 [template] @@ -34,21 +36,39 @@ fn F() -> i32 { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7: type = struct_type {.x: i32, .y: i32, .z: i32} [template = constants.%.1] +// 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: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] +// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc7_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_25 [template = i32] +// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_25, %.loc7_25.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc7_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %int.make_type_32.loc7_34 [template = i32] +// CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_32.loc7_34, %.loc7_34.1 [template = i32] +// CHECK:STDOUT: %.loc7_37: type = struct_type {.x: i32, .y: i32, .z: i32} [template = constants.%.2] // CHECK:STDOUT: @G.%return: ref {.x: i32, .y: i32, .z: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// 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: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> {.x: i32, .y: i32, .z: i32}; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage // CHECK:STDOUT: %G.call: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 // CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.5] diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index 3228c86cf094..804afa418126 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -11,11 +11,17 @@ var z: i32 = y; // CHECK:STDOUT: --- member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: f64, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: f64, .b: i32} [template] -// CHECK:STDOUT: %.3: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct: {.a: f64, .b: i32} = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] +// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: f64, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: f64, .b: i32} [template] +// CHECK:STDOUT: %.5: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %struct.3: {.a: f64, .b: i32} = struct_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,26 +32,47 @@ var z: i32 = y; // CHECK:STDOUT: .z = %z // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7: type = struct_type {.a: f64, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc7_22.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_22.2: type = converted %int.make_type_32.loc7, %.loc7_22.1 [template = i32] +// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: f64, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: f64, .b: i32} = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [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: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] // CHECK:STDOUT: %z.var: ref i32 = var z // CHECK:STDOUT: %z: ref i32 = bind_name z, %z.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_35: f64 = float_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_35: f64 = float_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %.loc7_46.1: {.a: f64, .b: i32} = struct_literal (%.loc7_35, %.loc7_45) // CHECK:STDOUT: %.loc7_46.2: ref f64 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_46.3: init f64 = initialize_from %.loc7_35 to %.loc7_46.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_46.3: init f64 = initialize_from %.loc7_35 to %.loc7_46.2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_46.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc7_46.5: init i32 = initialize_from %.loc7_45 to %.loc7_46.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_46.6: init {.a: f64, .b: i32} = struct_init (%.loc7_46.3, %.loc7_46.5) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_47: init {.a: f64, .b: i32} = converted %.loc7_46.1, %.loc7_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_46.5: init i32 = initialize_from %.loc7_45 to %.loc7_46.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_46.6: init {.a: f64, .b: i32} = struct_init (%.loc7_46.3, %.loc7_46.5) to file.%x.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc7_47: init {.a: f64, .b: i32} = converted %.loc7_46.1, %.loc7_46.6 [template = constants.%struct.3] // CHECK:STDOUT: assign file.%x.var, %.loc7_47 // CHECK:STDOUT: %x.ref: ref {.a: f64, .b: i32} = name_ref x, file.%x // CHECK:STDOUT: %.loc8_15.1: ref i32 = struct_access %x.ref, element1 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index e04080325afb..ab99500cc350 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -13,13 +13,15 @@ fn G() { // CHECK:STDOUT: --- nested_struct_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: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] // CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] // CHECK:STDOUT: %.6: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] @@ -33,29 +35,67 @@ fn G() { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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 // 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: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: 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_29.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_29.2: type = converted %.loc10_29.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_50.2: type = converted %.loc10_50.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_16, %int.make_type_32.loc10_21, %int.make_type_32.loc10_26) +// CHECK:STDOUT: %.loc10_29.2: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] +// CHECK:STDOUT: %.loc10_29.3: type = converted %int.make_type_32.loc10_16, %.loc10_29.2 [template = i32] +// CHECK:STDOUT: %.loc10_29.4: type = value_of_initializer %int.make_type_32.loc10_21 [template = i32] +// CHECK:STDOUT: %.loc10_29.5: type = converted %int.make_type_32.loc10_21, %.loc10_29.4 [template = i32] +// CHECK:STDOUT: %.loc10_29.6: type = value_of_initializer %int.make_type_32.loc10_26 [template = i32] +// CHECK:STDOUT: %.loc10_29.7: type = converted %int.make_type_32.loc10_26, %.loc10_29.6 [template = i32] +// CHECK:STDOUT: %.loc10_29.8: type = converted %.loc10_29.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc10_37: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_37, %int.make_type_32.loc10_42, %int.make_type_32.loc10_47) +// CHECK:STDOUT: %.loc10_50.2: type = value_of_initializer %int.make_type_32.loc10_37 [template = i32] +// CHECK:STDOUT: %.loc10_50.3: type = converted %int.make_type_32.loc10_37, %.loc10_50.2 [template = i32] +// CHECK:STDOUT: %.loc10_50.4: type = value_of_initializer %int.make_type_32.loc10_42 [template = i32] +// CHECK:STDOUT: %.loc10_50.5: type = converted %int.make_type_32.loc10_42, %.loc10_50.4 [template = i32] +// CHECK:STDOUT: %.loc10_50.6: type = value_of_initializer %int.make_type_32.loc10_47 [template = i32] +// CHECK:STDOUT: %.loc10_50.7: type = converted %int.make_type_32.loc10_47, %.loc10_50.6 [template = i32] +// CHECK:STDOUT: %.loc10_50.8: type = converted %.loc10_50.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_61: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc10_61: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 // CHECK:STDOUT: %F.call.loc10_62: init (i32, i32, i32) = call %F.ref.loc10_61() to %.loc10_74.1 -// CHECK:STDOUT: %F.ref.loc10_71: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc10_71: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 // CHECK:STDOUT: %F.call.loc10_72: init (i32, i32, i32) = call %F.ref.loc10_71() to %.loc10_74.2 // CHECK:STDOUT: %.loc10_74.3: {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_literal (%F.call.loc10_62, %F.call.loc10_72) diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index e92f44244b8d..898a92059887 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -10,9 +10,12 @@ var y: {.a: i32} = x; // CHECK:STDOUT: --- one_entry.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 4 [template] -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.2) [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 = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 4 [template] +// CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,20 +25,30 @@ var y: {.a: i32} = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc8: type = struct_type {.a: i32} [template = constants.%.1] +// 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_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.a: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32} = bind_name y, %y.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_26: i32 = int_literal 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.3] // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%x.var, %.loc7_28 // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x // CHECK:STDOUT: %.loc8_20.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 7faeb69ce1f5..6f6e572f6016 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -16,17 +16,22 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: --- reorder_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %MakeI32: type = fn_type @MakeI32 [template] +// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: MakeI32 = struct_value () [template] +// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template] +// CHECK:STDOUT: %MakeI32: type = fn_type @MakeI32 [template] +// CHECK:STDOUT: %struct.2: MakeI32 = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %struct.3: Float = struct_value () [template] // CHECK:STDOUT: %MakeF64: type = fn_type @MakeF64 [template] -// CHECK:STDOUT: %struct.2: MakeF64 = struct_value () [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %struct.4: MakeF64 = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: f64} [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.3: F = struct_value () [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: f64} [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: f64, .a: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.b: f64, .a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -37,28 +42,61 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %MakeI32.decl: MakeI32 = fn_decl @MakeI32 [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %MakeI32.decl: MakeI32 = fn_decl @MakeI32 [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7, %.loc7_17.1 [template = i32] // CHECK:STDOUT: @MakeI32.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeF64.decl: MakeF64 = fn_decl @MakeF64 [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %MakeF64.decl: MakeF64 = fn_decl @MakeF64 [template = constants.%struct.4] { +// CHECK:STDOUT: %.loc8_17.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.3(%.loc8_17.1) [template = f64] +// CHECK:STDOUT: %.loc8_17.2: type = value_of_initializer %float.make_type.loc8 [template = f64] +// CHECK:STDOUT: %.loc8_17.3: type = converted %float.make_type.loc8, %.loc8_17.2 [template = f64] // CHECK:STDOUT: @MakeF64.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: f64} [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] +// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_32.loc10, %.loc10_16.1 [template = i32] +// CHECK:STDOUT: %.loc10_25.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc10: init type = call constants.%struct.3(%.loc10_25.1) [template = f64] +// CHECK:STDOUT: %.loc10_25.2: type = value_of_initializer %float.make_type.loc10 [template = f64] +// CHECK:STDOUT: %.loc10_25.3: type = converted %float.make_type.loc10, %.loc10_25.2 [template = f64] +// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref {.a: i32, .b: f64} = var // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.6: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.7: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.8: 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 @MakeI32() -> i32; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @MakeF64() -> f64; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.2] -// CHECK:STDOUT: %MakeF64.ref: MakeF64 = name_ref MakeF64, file.%MakeF64.decl [template = constants.%struct.2] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_15.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_15.2: type = converted %int.make_type_32.loc11, %.loc11_15.1 [template = i32] +// CHECK:STDOUT: %.loc11_24.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc11: init type = call constants.%struct.3(%.loc11_24.1) [template = f64] +// CHECK:STDOUT: %.loc11_24.2: type = value_of_initializer %float.make_type.loc11 [template = f64] +// CHECK:STDOUT: %.loc11_24.3: type = converted %float.make_type.loc11, %.loc11_24.2 [template = f64] +// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] +// CHECK:STDOUT: %MakeF64.ref: MakeF64 = name_ref MakeF64, file.%MakeF64.decl [template = constants.%struct.4] // CHECK:STDOUT: %MakeF64.call: init f64 = call %MakeF64.ref() -// CHECK:STDOUT: %MakeI32.ref: MakeI32 = name_ref MakeI32, file.%MakeI32.decl [template = constants.%struct.1] +// CHECK:STDOUT: %MakeI32.ref: MakeI32 = name_ref MakeI32, file.%MakeI32.decl [template = constants.%struct.2] // CHECK:STDOUT: %MakeI32.call: init i32 = call %MakeI32.ref() // CHECK:STDOUT: %.loc11_62.1: {.b: f64, .a: i32} = struct_literal (%MakeF64.call, %MakeI32.call) // CHECK:STDOUT: %.loc11_62.2: i32 = value_of_initializer %MakeI32.call @@ -68,7 +106,14 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %struct.loc11: {.a: i32, .b: f64} = struct_value (%.loc11_62.3, %.loc11_62.5) // CHECK:STDOUT: %.loc11_63: {.a: i32, .b: f64} = converted %.loc11_62.1, %struct.loc11 // CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_63 -// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.4] +// CHECK:STDOUT: %.loc12_15.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc12: init type = call constants.%struct.3(%.loc12_15.1) [template = f64] +// CHECK:STDOUT: %.loc12_15.2: type = value_of_initializer %float.make_type.loc12 [template = f64] +// CHECK:STDOUT: %.loc12_15.3: type = converted %float.make_type.loc12, %.loc12_15.2 [template = f64] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_24.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_24.2: type = converted %int.make_type_32.loc12, %.loc12_24.1 [template = i32] +// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.5] // CHECK:STDOUT: %x.ref: {.a: i32, .b: f64} = name_ref x, %x // CHECK:STDOUT: %.loc12_31.1: f64 = struct_access %x.ref, element1 // CHECK:STDOUT: %.loc12_31.2: i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index b3eb4b291931..bcd0101623c5 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -10,14 +10,17 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: --- tuple_as_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: (i32,)} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: (i32,)} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.6) [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: (i32,)} = struct_value (%.5, %tuple) [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: %.4: type = struct_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.7) [template] +// CHECK:STDOUT: %struct.2: {.a: i32, .b: (i32,)} = struct_value (%.6, %tuple) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,32 +30,50 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_27.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc7_27.2: type = converted %.loc7_27.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7_13 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7_13, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_27.1: (type,) = tuple_literal (%int.make_type_32.loc7_23) +// CHECK:STDOUT: %.loc7_27.2: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] +// CHECK:STDOUT: %.loc7_27.3: type = converted %int.make_type_32.loc7_23, %.loc7_27.2 [template = i32] +// CHECK:STDOUT: %.loc7_27.4: type = converted %.loc7_27.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: (i32,)} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: (i32,)} = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_27.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_27.2: type = converted %.loc8_27.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.3] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc8_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8_13 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8_13, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc8_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_27.1: (type,) = tuple_literal (%int.make_type_32.loc8_23) +// CHECK:STDOUT: %.loc8_27.2: type = value_of_initializer %int.make_type_32.loc8_23 [template = i32] +// CHECK:STDOUT: %.loc8_27.3: type = converted %int.make_type_32.loc8_23, %.loc8_27.2 [template = i32] +// CHECK:STDOUT: %.loc8_27.4: type = converted %.loc8_27.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: (i32,)} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: (i32,)} = bind_name y, %y.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_38: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc7_49.1: (i32,) = tuple_literal (%.loc7_47) // CHECK:STDOUT: %.loc7_50.1: {.a: i32, .b: (i32,)} = struct_literal (%.loc7_38, %.loc7_49.1) // CHECK:STDOUT: %.loc7_50.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_50.3: init i32 = initialize_from %.loc7_38 to %.loc7_50.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_50.3: init i32 = initialize_from %.loc7_38 to %.loc7_50.2 [template = constants.%.6] // CHECK:STDOUT: %.loc7_50.4: ref (i32,) = struct_access file.%x.var, element1 // CHECK:STDOUT: %.loc7_49.2: init (i32,) = tuple_init (%.loc7_47) to %.loc7_50.4 [template = constants.%tuple] // CHECK:STDOUT: %.loc7_50.5: init (i32,) = converted %.loc7_49.1, %.loc7_49.2 [template = constants.%tuple] // CHECK:STDOUT: %.loc7_50.6: init (i32,) = initialize_from %.loc7_50.5 to %.loc7_50.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_50.7: init {.a: i32, .b: (i32,)} = struct_init (%.loc7_50.3, %.loc7_50.6) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_51: init {.a: i32, .b: (i32,)} = converted %.loc7_50.1, %.loc7_50.7 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_50.7: init {.a: i32, .b: (i32,)} = struct_init (%.loc7_50.3, %.loc7_50.6) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_51: init {.a: i32, .b: (i32,)} = converted %.loc7_50.1, %.loc7_50.7 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%x.var, %.loc7_51 // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: (i32,)} = name_ref x, file.%x // CHECK:STDOUT: %.loc8_32.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index b24d99e66940..6ed6a4eb58d8 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -13,11 +13,14 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: --- two_entries.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.3, %.4) [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 = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,35 +30,69 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc7_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7_13 [template = i32] +// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7_13, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.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: %.loc7_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc7_44: {.a: i32, .b: i32} = struct_literal (%.loc7_35, %.loc7_43) -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc7_35, %.loc7_43) [template = constants.%struct] -// CHECK:STDOUT: %.loc7_45: {.a: i32, .b: i32} = converted %.loc7_44, %struct [template = constants.%struct] +// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc7_35, %.loc7_43) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_45: {.a: i32, .b: i32} = converted %.loc7_44, %struct [template = constants.%struct.2] // CHECK:STDOUT: %v: {.a: i32, .b: i32} = bind_name v, %.loc7_45 -// CHECK:STDOUT: %.loc8: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc8_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8_13 [template = i32] +// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8_13, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc8_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc8_22.1: type = value_of_initializer %int.make_type_32.loc8_22 [template = i32] +// CHECK:STDOUT: %.loc8_22.2: type = converted %int.make_type_32.loc8_22, %.loc8_22.1 [template = i32] +// CHECK:STDOUT: %.loc8_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %v.ref: {.a: i32, .b: i32} = name_ref v, %v // CHECK:STDOUT: %w: {.a: i32, .b: i32} = bind_name w, %v.ref -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc10_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32.loc10_13 [template = i32] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32.loc10_13, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_22.1: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] +// CHECK:STDOUT: %.loc10_22.2: type = converted %int.make_type_32.loc10_22, %.loc10_22.1 [template = i32] +// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc11: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc11_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11_13 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11_13, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_22.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_22.2: type = converted %int.make_type_32.loc11_22, %.loc11_22.1 [template = i32] +// CHECK:STDOUT: %.loc11_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: i32} = bind_name y, %y.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_35: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_43: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_44.1: {.a: i32, .b: i32} = struct_literal (%.loc10_35, %.loc10_43) // CHECK:STDOUT: %.loc10_44.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_44.3: init i32 = initialize_from %.loc10_35 to %.loc10_44.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_44.3: init i32 = initialize_from %.loc10_35 to %.loc10_44.2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_44.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc10_44.5: init i32 = initialize_from %.loc10_43 to %.loc10_44.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_44.6: init {.a: i32, .b: i32} = struct_init (%.loc10_44.3, %.loc10_44.5) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_45: init {.a: i32, .b: i32} = converted %.loc10_44.1, %.loc10_44.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_44.5: init i32 = initialize_from %.loc10_43 to %.loc10_44.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_44.6: init {.a: i32, .b: i32} = struct_init (%.loc10_44.3, %.loc10_44.5) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc10_45: init {.a: i32, .b: i32} = converted %.loc10_44.1, %.loc10_44.6 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%x.var, %.loc10_45 // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: i32} = name_ref x, file.%x // CHECK:STDOUT: %.loc11_29.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/tuples/fail_assign_nested.carbon b/toolchain/check/testdata/tuples/fail_assign_nested.carbon index 36e673dcbbdf..18d8f66701c8 100644 --- a/toolchain/check/testdata/tuples/fail_assign_nested.carbon +++ b/toolchain/check/testdata/tuples/fail_assign_nested.carbon @@ -12,21 +12,24 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: --- fail_assign_nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type ((type, type), (type, type)) [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = tuple_type ((i32, i32), (i32, i32)) [template] -// CHECK:STDOUT: %.5: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.6: type = tuple_type ((i32, i32)*, (i32, i32)*) [template] -// CHECK:STDOUT: %.7: type = ptr_type ((i32, i32)*, (i32, i32)*) [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.11: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.12: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.15: type = tuple_type ((i32, i32, i32), (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: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type ((type, type), (type, type)) [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.5: type = tuple_type ((i32, i32), (i32, i32)) [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.7: type = tuple_type ((i32, i32)*, (i32, i32)*) [template] +// CHECK:STDOUT: %.8: type = ptr_type ((i32, i32)*, (i32, i32)*) [template] +// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.12: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.13: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.15: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.16: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -35,25 +38,43 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_18: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_30: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_10: 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.loc10_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_18: (type, type) = tuple_literal (%int.make_type_32.loc10_10, %int.make_type_32.loc10_15) +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_30: (type, type) = tuple_literal (%int.make_type_32.loc10_22, %int.make_type_32.loc10_27) // CHECK:STDOUT: %.loc10_31.1: ((type, type), (type, type)) = tuple_literal (%.loc10_18, %.loc10_30) -// CHECK:STDOUT: %.loc10_31.2: type = converted %.loc10_18, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_31.3: type = converted %.loc10_30, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_31.4: type = converted %.loc10_31.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_31.2: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32] +// CHECK:STDOUT: %.loc10_31.3: type = converted %int.make_type_32.loc10_10, %.loc10_31.2 [template = i32] +// CHECK:STDOUT: %.loc10_31.4: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] +// CHECK:STDOUT: %.loc10_31.5: type = converted %int.make_type_32.loc10_15, %.loc10_31.4 [template = i32] +// CHECK:STDOUT: %.loc10_31.6: type = converted %.loc10_18, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_31.7: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] +// CHECK:STDOUT: %.loc10_31.8: type = converted %int.make_type_32.loc10_22, %.loc10_31.7 [template = i32] +// CHECK:STDOUT: %.loc10_31.9: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] +// CHECK:STDOUT: %.loc10_31.10: type = converted %int.make_type_32.loc10_27, %.loc10_31.9 [template = i32] +// CHECK:STDOUT: %.loc10_31.11: type = converted %.loc10_30, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_31.12: type = converted %.loc10_31.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %x.var: ref ((i32, i32), (i32, i32)) = var x // CHECK:STDOUT: %x: ref ((i32, i32), (i32, i32)) = bind_name x, %x.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_37: i32 = int_literal 1 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2 [template = constants.%.10] +// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3 [template = constants.%.11] // CHECK:STDOUT: %.loc10_44: (i32, i32, i32) = tuple_literal (%.loc10_37, %.loc10_40, %.loc10_43) -// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4 [template = constants.%.12] -// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5 [template = constants.%.13] -// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6 [template = constants.%.14] +// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6 [template = constants.%.15] // CHECK:STDOUT: %.loc10_55: (i32, i32, i32) = tuple_literal (%.loc10_48, %.loc10_51, %.loc10_54) // CHECK:STDOUT: %.loc10_56: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_44, %.loc10_55) // CHECK:STDOUT: assign file.%x.var, diff --git a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon index c4b8e49ddf47..18e06f464f40 100644 --- a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon +++ b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon @@ -12,12 +12,15 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: --- fail_element_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 65.890000000000001 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, f64) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 65.890000000000001 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, f64) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,19 +29,29 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.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.loc10_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.loc10_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) +// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] +// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] +// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] +// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] +// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.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_22: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: f64 = float_literal 65.890000000000001 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_25: f64 = float_literal 65.890000000000001 [template = constants.%.6] // CHECK:STDOUT: %.loc10_30.1: (i32, f64) = tuple_literal (%.loc10_22, %.loc10_25) // CHECK:STDOUT: %.loc10_30.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_30.3: init i32 = initialize_from %.loc10_22 to %.loc10_30.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_30.3: init i32 = initialize_from %.loc10_22 to %.loc10_30.2 [template = constants.%.5] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index ace70ecff4f3..faf870e880f9 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -20,10 +20,13 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, Incomplete) [template] -// CHECK:STDOUT: %.3: type = ptr_type Incomplete [template] -// CHECK:STDOUT: %.4: 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: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, Incomplete) [template] +// CHECK:STDOUT: %.4: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -35,23 +38,29 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} +// 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: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (i32, %Incomplete.ref.loc15) -// CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_24.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (%int.make_type_32, %Incomplete.ref.loc15) +// CHECK:STDOUT: %.loc15_24.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_24.3: type = converted %int.make_type_32, %.loc15_24.2 [template = i32] +// CHECK:STDOUT: %.loc15_24.4: type = converted %.loc15_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %t.var: ref = var t // CHECK:STDOUT: %t: ref = bind_name t, %t.var // CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3] +// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.4] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: ref = name_ref t, file.%t -// CHECK:STDOUT: %.loc17_25: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_25: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc17_22: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/tuples/fail_too_few_element.carbon b/toolchain/check/testdata/tuples/fail_too_few_element.carbon index 073e7837b9aa..f19389a45790 100644 --- a/toolchain/check/testdata/tuples/fail_too_few_element.carbon +++ b/toolchain/check/testdata/tuples/fail_too_few_element.carbon @@ -12,11 +12,14 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: --- fail_too_few_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = tuple_type (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: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,15 +28,25 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.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.loc10_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.loc10_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) +// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] +// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] +// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] +// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] +// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.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_22: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_25: (i32,) = tuple_literal (%.loc10_22) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/tuples/fail_type_assign.carbon b/toolchain/check/testdata/tuples/fail_type_assign.carbon index b7d4fe3fb0ff..f8522afa8b04 100644 --- a/toolchain/check/testdata/tuples/fail_type_assign.carbon +++ b/toolchain/check/testdata/tuples/fail_type_assign.carbon @@ -12,8 +12,11 @@ var x: (i32, ) = (i32, ); // CHECK:STDOUT: --- fail_type_assign.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: Int32 = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,15 +25,23 @@ var x: (i32, ) = (i32, ); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_14.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.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: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_14.1: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc10_14.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_14.3: type = converted %int.make_type_32, %.loc10_14.2 [template = i32] +// CHECK:STDOUT: %.loc10_14.4: type = converted %.loc10_14.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // 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: (type,) = tuple_literal (i32) +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10: (type,) = tuple_literal (%int.make_type_32) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/import.carbon b/toolchain/check/testdata/tuples/import.carbon index 71ef78031743..bba8300a2294 100644 --- a/toolchain/check/testdata/tuples/import.carbon +++ b/toolchain/check/testdata/tuples/import.carbon @@ -21,25 +21,28 @@ var b: (((i32,), i32), (i32, i32)) = b_ref; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %tuple.1: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.4: type = tuple_type ((type,), type) [template] -// CHECK:STDOUT: %.5: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.6: type = tuple_type (((type,), type), (type, type)) [template] -// CHECK:STDOUT: %.7: type = tuple_type ((i32,), i32) [template] -// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.9: type = tuple_type (((i32,), i32), (i32, i32)) [template] -// CHECK:STDOUT: %.10: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.11: type = ptr_type ((i32,), i32) [template] -// CHECK:STDOUT: %.12: type = tuple_type (((i32,), i32)*, (i32, i32)*) [template] -// CHECK:STDOUT: %.13: type = ptr_type (((i32,), i32)*, (i32, i32)*) [template] -// CHECK:STDOUT: %.14: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.16: i32 = int_literal 3 [template] -// CHECK:STDOUT: %tuple.2: ((i32,), i32) = tuple_value (%tuple.1, %.14) [template] -// CHECK:STDOUT: %tuple.3: (i32, i32) = tuple_value (%.15, %.16) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %tuple.1: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %.5: type = tuple_type ((type,), type) [template] +// CHECK:STDOUT: %.6: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.7: type = tuple_type (((type,), type), (type, type)) [template] +// CHECK:STDOUT: %.8: type = tuple_type ((i32,), i32) [template] +// CHECK:STDOUT: %.9: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.10: type = tuple_type (((i32,), i32), (i32, i32)) [template] +// CHECK:STDOUT: %.11: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.12: type = ptr_type ((i32,), i32) [template] +// CHECK:STDOUT: %.13: type = tuple_type (((i32,), i32)*, (i32, i32)*) [template] +// CHECK:STDOUT: %.14: type = ptr_type (((i32,), i32)*, (i32, i32)*) [template] +// CHECK:STDOUT: %.15: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.16: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.17: i32 = int_literal 3 [template] +// CHECK:STDOUT: %tuple.2: ((i32,), i32) = tuple_value (%tuple.1, %.15) [template] +// CHECK:STDOUT: %tuple.3: (i32, i32) = tuple_value (%.16, %.17) [template] // CHECK:STDOUT: %tuple.4: (((i32,), i32), (i32, i32)) = tuple_value (%tuple.2, %tuple.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,35 +53,57 @@ var b: (((i32,), i32), (i32, i32)) = b_ref; // CHECK:STDOUT: .b_ref = %b_ref // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4_17.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc4_17.2: type = converted %.loc4_17.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.loc4: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc4_17.1: (type,) = tuple_literal (%int.make_type_32.loc4) +// CHECK:STDOUT: %.loc4_17.2: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_17.3: type = converted %int.make_type_32.loc4, %.loc4_17.2 [template = i32] +// CHECK:STDOUT: %.loc4_17.4: type = converted %.loc4_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a_ref.var: ref (i32,) = var a_ref // CHECK:STDOUT: %a_ref: ref (i32,) = bind_name a_ref, %a_ref.var -// CHECK:STDOUT: %.loc5_19: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc5_25: ((type,), type) = tuple_literal (%.loc5_19, i32) -// CHECK:STDOUT: %.loc5_37: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_19: (type,) = tuple_literal (%int.make_type_32.loc5_15) +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_25: ((type,), type) = tuple_literal (%.loc5_19, %int.make_type_32.loc5_22) +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_29: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_34: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_37: (type, type) = tuple_literal (%int.make_type_32.loc5_29, %int.make_type_32.loc5_34) // CHECK:STDOUT: %.loc5_38.1: (((type,), type), (type, type)) = tuple_literal (%.loc5_25, %.loc5_37) -// CHECK:STDOUT: %.loc5_38.2: type = converted %.loc5_19, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc5_38.3: type = converted %.loc5_25, constants.%.7 [template = constants.%.7] -// CHECK:STDOUT: %.loc5_38.4: type = converted %.loc5_37, constants.%.8 [template = constants.%.8] -// CHECK:STDOUT: %.loc5_38.5: type = converted %.loc5_38.1, constants.%.9 [template = constants.%.9] +// CHECK:STDOUT: %.loc5_38.2: type = value_of_initializer %int.make_type_32.loc5_15 [template = i32] +// CHECK:STDOUT: %.loc5_38.3: type = converted %int.make_type_32.loc5_15, %.loc5_38.2 [template = i32] +// CHECK:STDOUT: %.loc5_38.4: type = converted %.loc5_19, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_38.5: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32] +// CHECK:STDOUT: %.loc5_38.6: type = converted %int.make_type_32.loc5_22, %.loc5_38.5 [template = i32] +// CHECK:STDOUT: %.loc5_38.7: type = converted %.loc5_25, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %.loc5_38.8: type = value_of_initializer %int.make_type_32.loc5_29 [template = i32] +// CHECK:STDOUT: %.loc5_38.9: type = converted %int.make_type_32.loc5_29, %.loc5_38.8 [template = i32] +// CHECK:STDOUT: %.loc5_38.10: type = value_of_initializer %int.make_type_32.loc5_34 [template = i32] +// CHECK:STDOUT: %.loc5_38.11: type = converted %int.make_type_32.loc5_34, %.loc5_38.10 [template = i32] +// CHECK:STDOUT: %.loc5_38.12: type = converted %.loc5_37, constants.%.9 [template = constants.%.9] +// CHECK:STDOUT: %.loc5_38.13: type = converted %.loc5_38.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %b_ref.var: ref (((i32,), i32), (i32, i32)) = var b_ref // CHECK:STDOUT: %b_ref: ref (((i32,), i32), (i32, i32)) = bind_name b_ref, %b_ref.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: %.loc4_22: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_22: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc4_24.1: (i32,) = tuple_literal (%.loc4_22) // CHECK:STDOUT: %.loc4_24.2: init (i32,) = tuple_init (%.loc4_22) to file.%a_ref.var [template = constants.%tuple.1] // CHECK:STDOUT: %.loc4_25: init (i32,) = converted %.loc4_24.1, %.loc4_24.2 [template = constants.%tuple.1] // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_25 -// CHECK:STDOUT: %.loc5_45: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_45: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc5_47.1: (i32,) = tuple_literal (%.loc5_45) -// CHECK:STDOUT: %.loc5_50: i32 = int_literal 1 [template = constants.%.14] +// CHECK:STDOUT: %.loc5_50: i32 = int_literal 1 [template = constants.%.15] // CHECK:STDOUT: %.loc5_51.1: ((i32,), i32) = tuple_literal (%.loc5_47.1, %.loc5_50) -// CHECK:STDOUT: %.loc5_55: i32 = int_literal 2 [template = constants.%.15] -// CHECK:STDOUT: %.loc5_58: i32 = int_literal 3 [template = constants.%.16] +// CHECK:STDOUT: %.loc5_55: i32 = int_literal 2 [template = constants.%.16] +// CHECK:STDOUT: %.loc5_58: i32 = int_literal 3 [template = constants.%.17] // CHECK:STDOUT: %.loc5_59.1: (i32, i32) = tuple_literal (%.loc5_55, %.loc5_58) // CHECK:STDOUT: %.loc5_60.1: (((i32,), i32), (i32, i32)) = tuple_literal (%.loc5_51.1, %.loc5_59.1) // CHECK:STDOUT: %.loc5_60.2: ref ((i32,), i32) = tuple_access file.%b_ref.var, element0 @@ -87,14 +112,14 @@ var b: (((i32,), i32), (i32, i32)) = b_ref; // CHECK:STDOUT: %.loc5_51.3: init (i32,) = converted %.loc5_47.1, %.loc5_47.2 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc5_51.4: init (i32,) = initialize_from %.loc5_51.3 to %.loc5_51.2 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc5_51.5: ref i32 = tuple_access %.loc5_60.2, element1 -// CHECK:STDOUT: %.loc5_51.6: init i32 = initialize_from %.loc5_50 to %.loc5_51.5 [template = constants.%.14] +// CHECK:STDOUT: %.loc5_51.6: init i32 = initialize_from %.loc5_50 to %.loc5_51.5 [template = constants.%.15] // CHECK:STDOUT: %.loc5_51.7: init ((i32,), i32) = tuple_init (%.loc5_51.4, %.loc5_51.6) to %.loc5_60.2 [template = constants.%tuple.2] // CHECK:STDOUT: %.loc5_60.3: init ((i32,), i32) = converted %.loc5_51.1, %.loc5_51.7 [template = constants.%tuple.2] // CHECK:STDOUT: %.loc5_60.4: ref (i32, i32) = tuple_access file.%b_ref.var, element1 // CHECK:STDOUT: %.loc5_59.2: ref i32 = tuple_access %.loc5_60.4, element0 -// CHECK:STDOUT: %.loc5_59.3: init i32 = initialize_from %.loc5_55 to %.loc5_59.2 [template = constants.%.15] +// CHECK:STDOUT: %.loc5_59.3: init i32 = initialize_from %.loc5_55 to %.loc5_59.2 [template = constants.%.16] // CHECK:STDOUT: %.loc5_59.4: ref i32 = tuple_access %.loc5_60.4, element1 -// CHECK:STDOUT: %.loc5_59.5: init i32 = initialize_from %.loc5_58 to %.loc5_59.4 [template = constants.%.16] +// CHECK:STDOUT: %.loc5_59.5: init i32 = initialize_from %.loc5_58 to %.loc5_59.4 [template = constants.%.17] // CHECK:STDOUT: %.loc5_59.6: init (i32, i32) = tuple_init (%.loc5_59.3, %.loc5_59.5) to %.loc5_60.4 [template = constants.%tuple.3] // CHECK:STDOUT: %.loc5_60.5: init (i32, i32) = converted %.loc5_59.1, %.loc5_59.6 [template = constants.%tuple.3] // CHECK:STDOUT: %.loc5_60.6: init (((i32,), i32), (i32, i32)) = tuple_init (%.loc5_60.3, %.loc5_60.5) to file.%b_ref.var [template = constants.%tuple.4] @@ -106,18 +131,21 @@ var b: (((i32,), i32), (i32, i32)) = b_ref; // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = tuple_type ((type,), type) [template] -// CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.5: type = tuple_type (((type,), type), (type, type)) [template] -// CHECK:STDOUT: %.6: type = tuple_type ((i32,), i32) [template] -// CHECK:STDOUT: %.7: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.8: type = tuple_type (((i32,), i32), (i32, i32)) [template] -// CHECK:STDOUT: %.9: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.10: type = ptr_type ((i32,), i32) [template] -// CHECK:STDOUT: %.11: type = tuple_type (((i32,), i32)*, (i32, i32)*) [template] -// CHECK:STDOUT: %.12: type = ptr_type (((i32,), 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: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = tuple_type ((type,), type) [template] +// CHECK:STDOUT: %.5: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.6: type = tuple_type (((type,), type), (type, type)) [template] +// CHECK:STDOUT: %.7: type = tuple_type ((i32,), i32) [template] +// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.9: type = tuple_type (((i32,), i32), (i32, i32)) [template] +// CHECK:STDOUT: %.10: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.11: type = ptr_type ((i32,), i32) [template] +// CHECK:STDOUT: %.12: type = tuple_type (((i32,), i32)*, (i32, i32)*) [template] +// CHECK:STDOUT: %.13: type = ptr_type (((i32,), i32)*, (i32, i32)*) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -128,25 +156,47 @@ var b: (((i32,), i32), (i32, i32)) = b_ref; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: ref (i32,) = import_ref ir0, inst+7, loaded -// CHECK:STDOUT: %import_ref.2: ref (((i32,), i32), (i32, i32)) = import_ref ir0, inst+35, loaded +// CHECK:STDOUT: %import_ref.1: ref (i32,) = import_ref ir0, inst+16, loaded +// CHECK:STDOUT: %import_ref.2: ref (((i32,), i32), (i32, i32)) = import_ref ir0, inst+60, loaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc4_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc4_13.2: type = converted %.loc4_13.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc4_13.1: (type,) = tuple_literal (%int.make_type_32.loc4) +// CHECK:STDOUT: %.loc4_13.2: type = value_of_initializer %int.make_type_32.loc4 [template = i32] +// CHECK:STDOUT: %.loc4_13.3: type = converted %int.make_type_32.loc4, %.loc4_13.2 [template = i32] +// CHECK:STDOUT: %.loc4_13.4: type = converted %.loc4_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var -// CHECK:STDOUT: %.loc5_15: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc5_21: ((type,), type) = tuple_literal (%.loc5_15, i32) -// CHECK:STDOUT: %.loc5_33: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_15: (type,) = tuple_literal (%int.make_type_32.loc5_11) +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_18: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_21: ((type,), type) = tuple_literal (%.loc5_15, %int.make_type_32.loc5_18) +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_25: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc5_30: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc5_33: (type, type) = tuple_literal (%int.make_type_32.loc5_25, %int.make_type_32.loc5_30) // CHECK:STDOUT: %.loc5_34.1: (((type,), type), (type, type)) = tuple_literal (%.loc5_21, %.loc5_33) -// CHECK:STDOUT: %.loc5_34.2: type = converted %.loc5_15, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc5_34.3: type = converted %.loc5_21, constants.%.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc5_34.4: type = converted %.loc5_33, constants.%.7 [template = constants.%.7] -// CHECK:STDOUT: %.loc5_34.5: type = converted %.loc5_34.1, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %.loc5_34.2: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32] +// CHECK:STDOUT: %.loc5_34.3: type = converted %int.make_type_32.loc5_11, %.loc5_34.2 [template = i32] +// CHECK:STDOUT: %.loc5_34.4: type = converted %.loc5_15, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_34.5: type = value_of_initializer %int.make_type_32.loc5_18 [template = i32] +// CHECK:STDOUT: %.loc5_34.6: type = converted %int.make_type_32.loc5_18, %.loc5_34.5 [template = i32] +// CHECK:STDOUT: %.loc5_34.7: type = converted %.loc5_21, constants.%.7 [template = constants.%.7] +// CHECK:STDOUT: %.loc5_34.8: type = value_of_initializer %int.make_type_32.loc5_25 [template = i32] +// CHECK:STDOUT: %.loc5_34.9: type = converted %int.make_type_32.loc5_25, %.loc5_34.8 [template = i32] +// CHECK:STDOUT: %.loc5_34.10: type = value_of_initializer %int.make_type_32.loc5_30 [template = i32] +// CHECK:STDOUT: %.loc5_34.11: type = converted %int.make_type_32.loc5_30, %.loc5_34.10 [template = i32] +// CHECK:STDOUT: %.loc5_34.12: type = converted %.loc5_33, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %.loc5_34.13: type = converted %.loc5_34.1, constants.%.9 [template = constants.%.9] // CHECK:STDOUT: %b.var: ref (((i32,), i32), (i32, i32)) = var b // CHECK:STDOUT: %b: ref (((i32,), i32), (i32, 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: %a_ref.ref: ref (i32,) = name_ref a_ref, file.%import_ref.1 diff --git a/toolchain/check/testdata/tuples/nested_tuple.carbon b/toolchain/check/testdata/tuples/nested_tuple.carbon index 0dad937cc784..9b68c703fb39 100644 --- a/toolchain/check/testdata/tuples/nested_tuple.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple.carbon @@ -9,18 +9,21 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: --- nested_tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type ((type, type), type) [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = tuple_type ((i32, i32), i32) [template] -// CHECK:STDOUT: %.5: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.6: type = tuple_type ((i32, i32)*, i32) [template] -// CHECK:STDOUT: %.7: type = ptr_type ((i32, i32)*, i32) [template] -// CHECK:STDOUT: %.8: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 76 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 6 [template] -// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.8, %.9) [template] -// CHECK:STDOUT: %tuple.2: ((i32, i32), i32) = tuple_value (%tuple.1, %.10) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type ((type, type), type) [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.5: type = tuple_type ((i32, i32), i32) [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.7: type = tuple_type ((i32, i32)*, i32) [template] +// CHECK:STDOUT: %.8: type = ptr_type ((i32, i32)*, i32) [template] +// CHECK:STDOUT: %.9: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 76 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 6 [template] +// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.9, %.10) [template] +// CHECK:STDOUT: %tuple.2: ((i32, i32), i32) = tuple_value (%tuple.1, %.11) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,30 +32,44 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_18: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_24.1: ((type, type), type) = tuple_literal (%.loc7_18, i32) -// CHECK:STDOUT: %.loc7_24.2: type = converted %.loc7_18, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_24.3: type = converted %.loc7_24.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7_10: 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_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_18: (type, type) = tuple_literal (%int.make_type_32.loc7_10, %int.make_type_32.loc7_15) +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc7_21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_24.1: ((type, type), type) = tuple_literal (%.loc7_18, %int.make_type_32.loc7_21) +// CHECK:STDOUT: %.loc7_24.2: type = value_of_initializer %int.make_type_32.loc7_10 [template = i32] +// CHECK:STDOUT: %.loc7_24.3: type = converted %int.make_type_32.loc7_10, %.loc7_24.2 [template = i32] +// CHECK:STDOUT: %.loc7_24.4: type = value_of_initializer %int.make_type_32.loc7_15 [template = i32] +// CHECK:STDOUT: %.loc7_24.5: type = converted %int.make_type_32.loc7_15, %.loc7_24.4 [template = i32] +// CHECK:STDOUT: %.loc7_24.6: type = converted %.loc7_18, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_24.7: type = value_of_initializer %int.make_type_32.loc7_21 [template = i32] +// CHECK:STDOUT: %.loc7_24.8: type = converted %int.make_type_32.loc7_21, %.loc7_24.7 [template = i32] +// CHECK:STDOUT: %.loc7_24.9: type = converted %.loc7_24.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %x.var: ref ((i32, i32), i32) = var x // CHECK:STDOUT: %x: ref ((i32, i32), i32) = bind_name x, %x.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_30: i32 = int_literal 12 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 12 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76 [template = constants.%.10] // CHECK:STDOUT: %.loc7_36.1: (i32, i32) = tuple_literal (%.loc7_30, %.loc7_34) -// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6 [template = constants.%.10] +// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6 [template = constants.%.11] // CHECK:STDOUT: %.loc7_40.1: ((i32, i32), i32) = tuple_literal (%.loc7_36.1, %.loc7_39) // CHECK:STDOUT: %.loc7_40.2: ref (i32, i32) = tuple_access file.%x.var, element0 // CHECK:STDOUT: %.loc7_36.2: ref i32 = tuple_access %.loc7_40.2, element0 -// CHECK:STDOUT: %.loc7_36.3: init i32 = initialize_from %.loc7_30 to %.loc7_36.2 [template = constants.%.8] +// CHECK:STDOUT: %.loc7_36.3: init i32 = initialize_from %.loc7_30 to %.loc7_36.2 [template = constants.%.9] // CHECK:STDOUT: %.loc7_36.4: ref i32 = tuple_access %.loc7_40.2, element1 -// CHECK:STDOUT: %.loc7_36.5: init i32 = initialize_from %.loc7_34 to %.loc7_36.4 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_36.5: init i32 = initialize_from %.loc7_34 to %.loc7_36.4 [template = constants.%.10] // CHECK:STDOUT: %.loc7_36.6: init (i32, i32) = tuple_init (%.loc7_36.3, %.loc7_36.5) to %.loc7_40.2 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc7_40.3: init (i32, i32) = converted %.loc7_36.1, %.loc7_36.6 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc7_40.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc7_40.5: init i32 = initialize_from %.loc7_39 to %.loc7_40.4 [template = constants.%.10] +// CHECK:STDOUT: %.loc7_40.5: init i32 = initialize_from %.loc7_39 to %.loc7_40.4 [template = constants.%.11] // CHECK:STDOUT: %.loc7_40.6: init ((i32, i32), i32) = tuple_init (%.loc7_40.3, %.loc7_40.5) to file.%x.var [template = constants.%tuple.2] // CHECK:STDOUT: %.loc7_41: init ((i32, i32), i32) = converted %.loc7_40.1, %.loc7_40.6 [template = constants.%tuple.2] // CHECK:STDOUT: assign file.%x.var, %.loc7_41 diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index b5e6b9277892..d8ae17e86813 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -17,20 +17,22 @@ fn H() { // CHECK:STDOUT: --- nested_tuple_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: type = tuple_type ((type, type, type), (type, type, type)) [template] // CHECK:STDOUT: %.5: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] // CHECK:STDOUT: %.6: type = ptr_type (i32, i32, i32) [template] // CHECK:STDOUT: %.7: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] // CHECK:STDOUT: %.8: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %struct.4: H = struct_value () [template] // CHECK:STDOUT: %.9: type = tuple_type (type, (type, type, type), type) [template] // CHECK:STDOUT: %.10: type = tuple_type (i32, (i32, i32, i32), i32) [template] // CHECK:STDOUT: %.11: type = tuple_type (i32, (i32, i32, i32)*, i32) [template] @@ -47,31 +49,74 @@ fn H() { // CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = 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 // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} +// 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: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} +// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.14: 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: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_42: (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: (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: %int.make_type_32.loc10_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc10_39: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc10_42: (type, type, type) = tuple_literal (%int.make_type_32.loc10_29, %int.make_type_32.loc10_34, %int.make_type_32.loc10_39) // CHECK:STDOUT: %.loc10_43.1: ((type, type, type), (type, type, type)) = tuple_literal (%.loc10_25, %.loc10_42) -// CHECK:STDOUT: %.loc10_43.2: type = converted %.loc10_25, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_43.3: type = converted %.loc10_42, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_43.4: type = converted %.loc10_43.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_43.2: type = value_of_initializer %int.make_type_32.loc10_12 [template = i32] +// CHECK:STDOUT: %.loc10_43.3: type = converted %int.make_type_32.loc10_12, %.loc10_43.2 [template = i32] +// CHECK:STDOUT: %.loc10_43.4: type = value_of_initializer %int.make_type_32.loc10_17 [template = i32] +// CHECK:STDOUT: %.loc10_43.5: type = converted %int.make_type_32.loc10_17, %.loc10_43.4 [template = i32] +// CHECK:STDOUT: %.loc10_43.6: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] +// CHECK:STDOUT: %.loc10_43.7: type = converted %int.make_type_32.loc10_22, %.loc10_43.6 [template = i32] +// CHECK:STDOUT: %.loc10_43.8: type = converted %.loc10_25, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_43.9: type = value_of_initializer %int.make_type_32.loc10_29 [template = i32] +// CHECK:STDOUT: %.loc10_43.10: type = converted %int.make_type_32.loc10_29, %.loc10_43.9 [template = i32] +// CHECK:STDOUT: %.loc10_43.11: type = value_of_initializer %int.make_type_32.loc10_34 [template = i32] +// CHECK:STDOUT: %.loc10_43.12: type = converted %int.make_type_32.loc10_34, %.loc10_43.11 [template = i32] +// CHECK:STDOUT: %.loc10_43.13: type = value_of_initializer %int.make_type_32.loc10_39 [template = i32] +// CHECK:STDOUT: %.loc10_43.14: type = converted %int.make_type_32.loc10_39, %.loc10_43.13 [template = i32] +// CHECK:STDOUT: %.loc10_43.15: type = converted %.loc10_42, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_43.16: type = converted %.loc10_43.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %v.var: ref ((i32, i32, i32), (i32, i32, i32)) = var v // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_48: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc10_48: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 // CHECK:STDOUT: %F.call.loc10_49: init (i32, i32, i32) = call %F.ref.loc10_48() to %.loc10_56.1 -// CHECK:STDOUT: %F.ref.loc10_53: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %F.ref.loc10_53: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc10_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %F.call.loc10_54: init (i32, i32, i32) = call %F.ref.loc10_53() to %.loc10_56.2 // CHECK:STDOUT: %.loc10_56.3: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc10_49, %F.call.loc10_54) @@ -83,14 +128,29 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: fn @H() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_30: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc14_36.1: (type, (type, type, type), type) = tuple_literal (i32, %.loc14_30, i32) -// CHECK:STDOUT: %.loc14_36.2: type = converted %.loc14_30, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_36.3: type = converted %.loc14_36.1, constants.%.10 [template = constants.%.10] +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_30: (type, type, type) = tuple_literal (%int.make_type_32.loc14_17, %int.make_type_32.loc14_22, %int.make_type_32.loc14_27) +// CHECK:STDOUT: %int.make_type_32.loc14_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_36.1: (type, (type, type, type), type) = tuple_literal (%int.make_type_32.loc14_11, %.loc14_30, %int.make_type_32.loc14_33) +// CHECK:STDOUT: %.loc14_36.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_36.3: type = converted %int.make_type_32.loc14_11, %.loc14_36.2 [template = i32] +// CHECK:STDOUT: %.loc14_36.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32] +// CHECK:STDOUT: %.loc14_36.5: type = converted %int.make_type_32.loc14_17, %.loc14_36.4 [template = i32] +// CHECK:STDOUT: %.loc14_36.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_36.7: type = converted %int.make_type_32.loc14_22, %.loc14_36.6 [template = i32] +// CHECK:STDOUT: %.loc14_36.8: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] +// CHECK:STDOUT: %.loc14_36.9: type = converted %int.make_type_32.loc14_27, %.loc14_36.8 [template = i32] +// CHECK:STDOUT: %.loc14_36.10: type = converted %.loc14_30, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_36.11: type = value_of_initializer %int.make_type_32.loc14_33 [template = i32] +// CHECK:STDOUT: %.loc14_36.12: type = converted %int.make_type_32.loc14_33, %.loc14_36.11 [template = i32] +// CHECK:STDOUT: %.loc14_36.13: type = converted %.loc14_36.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %v.var: ref (i32, (i32, i32, i32), i32) = var v // CHECK:STDOUT: %v: ref (i32, (i32, i32, i32), i32) = bind_name v, %v.var // CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 [template = constants.%.13] -// 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: %.loc14_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %F.call: init (i32, i32, i32) = call %F.ref() to %.loc14_50.1 // CHECK:STDOUT: %.loc14_49: i32 = int_literal 2 [template = constants.%.14] diff --git a/toolchain/check/testdata/tuples/one_element.carbon b/toolchain/check/testdata/tuples/one_element.carbon index 1029f7d4991c..ef23c37fae45 100644 --- a/toolchain/check/testdata/tuples/one_element.carbon +++ b/toolchain/check/testdata/tuples/one_element.carbon @@ -10,10 +10,13 @@ var y: (i32,) = x; // CHECK:STDOUT: --- one_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 4 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 4 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,19 +26,29 @@ var y: (i32,) = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.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: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) +// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] +// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_13.2: type = converted %.loc8_13.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2: 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_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) +// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] +// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %y.var: ref (i32,) = var y // CHECK:STDOUT: %y: ref (i32,) = bind_name y, %y.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_18: i32 = int_literal 4 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 4 [template = constants.%.4] // CHECK:STDOUT: %.loc7_20.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_20.2: init (i32,) = tuple_init (%.loc7_18) to file.%x.var [template = constants.%tuple] // CHECK:STDOUT: %.loc7_21: init (i32,) = converted %.loc7_20.1, %.loc7_20.2 [template = constants.%tuple] diff --git a/toolchain/check/testdata/tuples/two_elements.carbon b/toolchain/check/testdata/tuples/two_elements.carbon index 1b6e13b0a497..2d6fc47afbfa 100644 --- a/toolchain/check/testdata/tuples/two_elements.carbon +++ b/toolchain/check/testdata/tuples/two_elements.carbon @@ -13,12 +13,15 @@ var y: (i32, i32) = x; // CHECK:STDOUT: --- two_elements.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 102 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [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) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 102 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,37 +31,71 @@ var y: (i32, i32) = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102 [template = constants.%.5] +// 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: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) +// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] +// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] +// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] +// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] +// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102 [template = constants.%.6] // CHECK:STDOUT: %.loc7_28: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) // CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc7_22, %.loc7_25) [template = constants.%tuple] // CHECK:STDOUT: %.loc7_29: (i32, i32) = converted %.loc7_28, %tuple [template = constants.%tuple] // CHECK:STDOUT: %v: (i32, i32) = bind_name v, %.loc7_29 -// CHECK:STDOUT: %.loc8_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc8_17.2: type = converted %.loc8_17.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc8_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc8_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc8_17.1: (type, type) = tuple_literal (%int.make_type_32.loc8_9, %int.make_type_32.loc8_14) +// CHECK:STDOUT: %.loc8_17.2: type = value_of_initializer %int.make_type_32.loc8_9 [template = i32] +// CHECK:STDOUT: %.loc8_17.3: type = converted %int.make_type_32.loc8_9, %.loc8_17.2 [template = i32] +// CHECK:STDOUT: %.loc8_17.4: type = value_of_initializer %int.make_type_32.loc8_14 [template = i32] +// CHECK:STDOUT: %.loc8_17.5: type = converted %int.make_type_32.loc8_14, %.loc8_17.4 [template = i32] +// CHECK:STDOUT: %.loc8_17.6: type = converted %.loc8_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.ref: (i32, i32) = name_ref v, %v // CHECK:STDOUT: %w: (i32, i32) = bind_name w, %v.ref -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc10_9: 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.loc10_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) +// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] +// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] +// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] +// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] +// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %y.var: ref (i32, i32) = var y // CHECK:STDOUT: %y: ref (i32, i32) = bind_name y, %y.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_22: i32 = int_literal 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 102 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 102 [template = constants.%.6] // CHECK:STDOUT: %.loc10_28.1: (i32, i32) = tuple_literal (%.loc10_22, %.loc10_25) // CHECK:STDOUT: %.loc10_28.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_28.3: init i32 = initialize_from %.loc10_22 to %.loc10_28.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_28.3: init i32 = initialize_from %.loc10_22 to %.loc10_28.2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_28.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc10_28.5: init i32 = initialize_from %.loc10_25 to %.loc10_28.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_28.5: init i32 = initialize_from %.loc10_25 to %.loc10_28.4 [template = constants.%.6] // CHECK:STDOUT: %.loc10_28.6: init (i32, i32) = tuple_init (%.loc10_28.3, %.loc10_28.5) to file.%x.var [template = constants.%tuple] // CHECK:STDOUT: %.loc10_29: init (i32, i32) = converted %.loc10_28.1, %.loc10_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign file.%x.var, %.loc10_29 diff --git a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon index 6200331ef698..b55cb2941c26 100644 --- a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon +++ b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon @@ -58,6 +58,8 @@ var y2: bool = false or true; // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -77,12 +79,22 @@ var y2: bool = false or true; // CHECK:STDOUT: %.loc33_10.2: type = converted %.loc33_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x2.var: ref () = var x2 // CHECK:STDOUT: %x2: ref () = bind_name x2, %x2.var +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %bool.make_type.loc43: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc43_8.1: type = value_of_initializer %bool.make_type.loc43 [template = bool] +// CHECK:STDOUT: %.loc43_8.2: type = converted %bool.make_type.loc43, %.loc43_8.1 [template = bool] // CHECK:STDOUT: %y.var: ref bool = var y // CHECK:STDOUT: %y: ref bool = bind_name y, %y.var +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %bool.make_type.loc52: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc52_9.1: type = value_of_initializer %bool.make_type.loc52 [template = bool] +// CHECK:STDOUT: %.loc52_9.2: type = converted %bool.make_type.loc52, %.loc52_9.1 [template = bool] // CHECK:STDOUT: %y2.var: ref bool = var y2 // CHECK:STDOUT: %y2: ref bool = bind_name y2, %y2.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc19: bool = bool_literal true [template = constants.%.2] diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index 34027557cddc..a40a5163775e 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -29,25 +29,27 @@ fn While() { // CHECK:STDOUT: --- break_continue.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: %B: type = fn_type @B [template] -// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %C: type = fn_type @C [template] -// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] // CHECK:STDOUT: %D: type = fn_type @D [template] -// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %E: type = fn_type @E [template] -// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.6: F = struct_value () [template] +// CHECK:STDOUT: %struct.7: F = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.7: G = struct_value () [template] +// CHECK:STDOUT: %struct.8: G = struct_value () [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.8: H = struct_value () [template] +// CHECK:STDOUT: %struct.9: H = struct_value () [template] // CHECK:STDOUT: %While: type = fn_type @While [template] -// CHECK:STDOUT: %struct.9: While = struct_value () [template] +// CHECK:STDOUT: %struct.10: While = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -64,33 +66,67 @@ fn While() { // CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] +// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] // CHECK:STDOUT: @A.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] +// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] // CHECK:STDOUT: @B.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { +// CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %bool.make_type.loc9 [template = bool] +// CHECK:STDOUT: %.loc9_11.2: type = converted %bool.make_type.loc9, %.loc9_11.1 [template = bool] // CHECK:STDOUT: @C.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] { +// CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] { +// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] +// CHECK:STDOUT: %.loc10_11.2: type = converted %bool.make_type.loc10, %.loc10_11.1 [template = bool] // CHECK:STDOUT: @D.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] { +// CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] { +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] // CHECK:STDOUT: @E.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.6] { +// CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.7] { +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_11.2: type = converted %bool.make_type.loc12, %.loc12_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.7] { +// CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.8] { +// CHECK:STDOUT: %bool.make_type.loc13: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %bool.make_type.loc13 [template = bool] +// CHECK:STDOUT: %.loc13_11.2: type = converted %bool.make_type.loc13, %.loc13_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.8] { +// CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.9] { +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_11.2: type = converted %bool.make_type.loc14, %.loc14_11.1 [template = bool] // CHECK:STDOUT: @H.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.9] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.10] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> bool; @@ -112,14 +148,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc17: -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init bool = call %A.ref() // CHECK:STDOUT: %.loc17_13.1: bool = value_of_initializer %A.call // CHECK:STDOUT: %.loc17_13.2: bool = converted %A.call, %.loc17_13.1 // CHECK:STDOUT: if %.loc17_13.2 br !while.body.loc17 else br !while.done.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc17: -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init bool = call %B.ref() // CHECK:STDOUT: %.loc18_12.1: bool = value_of_initializer %B.call // CHECK:STDOUT: %.loc18_12.2: bool = converted %B.call, %.loc18_12.1 @@ -129,7 +165,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc18: -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4] // CHECK:STDOUT: %C.call: init bool = call %C.ref() // CHECK:STDOUT: %.loc19_12.1: bool = value_of_initializer %C.call // CHECK:STDOUT: %.loc19_12.2: bool = converted %C.call, %.loc19_12.1 @@ -142,14 +178,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc20: -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5] // CHECK:STDOUT: %D.call: init bool = call %D.ref() // CHECK:STDOUT: %.loc20_15.1: bool = value_of_initializer %D.call // CHECK:STDOUT: %.loc20_15.2: bool = converted %D.call, %.loc20_15.1 // CHECK:STDOUT: if %.loc20_15.2 br !while.body.loc20 else br !while.done.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc20: -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6] // CHECK:STDOUT: %E.call: init bool = call %E.ref() // CHECK:STDOUT: %.loc21_14.1: bool = value_of_initializer %E.call // CHECK:STDOUT: %.loc21_14.2: bool = converted %E.call, %.loc21_14.1 @@ -159,7 +195,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc21: -// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.6] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.7] // CHECK:STDOUT: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc22_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc22_14.2: bool = converted %F.call, %.loc22_14.1 @@ -172,7 +208,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.done.loc20: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.7] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.8] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc24_12.1: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc24_12.2: bool = converted %G.call, %.loc24_12.1 @@ -182,7 +218,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc24: -// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.8] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.9] // CHECK:STDOUT: %H.call: init bool = call %H.ref() // CHECK:STDOUT: %.loc25_12.1: bool = value_of_initializer %H.call // CHECK:STDOUT: %.loc25_12.2: bool = converted %H.call, %.loc25_12.1 diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 66c0057040c2..46c298d3d6c3 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -22,17 +22,19 @@ fn While() { // CHECK:STDOUT: --- unreachable_end.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Cond = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] +// CHECK:STDOUT: %struct.2: Cond = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.4: H = struct_value () [template] +// CHECK:STDOUT: %struct.5: H = struct_value () [template] // CHECK:STDOUT: %While: type = fn_type @While [template] -// CHECK:STDOUT: %struct.5: While = struct_value () [template] +// CHECK:STDOUT: %struct.6: While = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,15 +47,21 @@ fn While() { // CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_14.2: type = converted %bool.make_type, %.loc7_14.1 [template = bool] // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} -// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.5] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.5] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); @@ -64,24 +72,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.2] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call // CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.4] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.4] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.5] // CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index a8dfa40bc675..d84cd00bddc6 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -21,17 +21,19 @@ fn While() { // CHECK:STDOUT: --- while.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] -// CHECK:STDOUT: %struct.1: Cond = struct_value () [template] +// CHECK:STDOUT: %struct.1: Bool = struct_value () [template] +// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] +// CHECK:STDOUT: %struct.2: Cond = struct_value () [template] // CHECK:STDOUT: %F: type = fn_type @F [template] -// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %G: type = fn_type @G [template] -// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] // CHECK:STDOUT: %H: type = fn_type @H [template] -// CHECK:STDOUT: %struct.4: H = struct_value () [template] +// CHECK:STDOUT: %struct.5: H = struct_value () [template] // CHECK:STDOUT: %While: type = fn_type @While [template] -// CHECK:STDOUT: %struct.5: While = struct_value () [template] +// CHECK:STDOUT: %struct.6: While = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,15 +46,21 @@ fn While() { // CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.1] { +// CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.2] { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_14.2: type = converted %bool.make_type, %.loc7_14.1 [template = bool] // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} -// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} -// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.5] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.5] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); @@ -63,24 +71,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.2] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call // CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.4] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.4] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.5] // CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 486e8a74b141..e6a266f51071 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -50,13 +50,13 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: ; ModuleID = 'adapt_class.carbon' // CHECK:STDOUT: source_filename = "adapt_class.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.2.loc9_28 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.3.loc9_28 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, i32 }) %return) { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 // CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc9_28, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.3.loc9_28, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 46fd8c3053ac..420dc9869f3d 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -29,14 +29,14 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: ; ModuleID = 'base.carbon' // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.3.loc18_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } +// CHECK:STDOUT: @struct.4.loc18_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ { i32 }, i32 }) %return) { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_35.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 0 // CHECK:STDOUT: %.loc18_26.2.b = getelementptr inbounds { i32 }, ptr %.loc18_35.2.base, i32 0, i32 0 // CHECK:STDOUT: %.loc18_35.4.d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.3.loc18_36, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.4.loc18_36, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index 0a76c17f27d3..edd23d34b913 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -13,7 +13,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'struct_param.carbon' // CHECK:STDOUT: source_filename = "struct_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.5.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @struct.6.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { // CHECK:STDOUT: entry: @@ -22,6 +22,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.5.loc10_4.3) +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.6.loc10_4.3) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 8475a6ce94b2..82dee5f62fa1 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -14,7 +14,7 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'address_of_field.carbon' // CHECK:STDOUT: source_filename = "address_of_field.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.3.loc10_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.4.loc10_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: @@ -23,7 +23,7 @@ fn F() { // CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc10_46.2.a = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 0 // CHECK:STDOUT: %.loc10_46.4.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.3.loc10_47, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.4.loc10_47, i64 8, i1 false) // CHECK:STDOUT: %.loc11_7.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 // CHECK:STDOUT: call void @G(ptr %.loc11_7.b) // CHECK:STDOUT: ret void diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index ecd165bd708e..452aef63d5d0 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -14,21 +14,21 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'member_access.carbon' // CHECK:STDOUT: source_filename = "member_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.2.loc8_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } +// CHECK:STDOUT: @struct.4.loc8_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8 // CHECK:STDOUT: %.loc8_48.2.a = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc8_48.4.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.2.loc8_49, i64 16, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.4.loc8_49, i64 16, i1 false) // CHECK:STDOUT: %y.var = alloca i32, align 4 // CHECK:STDOUT: %.loc9_17.1.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 // CHECK:STDOUT: %.loc9_17.2 = load i32, ptr %.loc9_17.1.b, align 4 // CHECK:STDOUT: store i32 %.loc9_17.2, ptr %y.var, align 4 // CHECK:STDOUT: %z.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc10 = load i32, ptr %y.var, align 4 -// CHECK:STDOUT: store i32 %.loc10, ptr %z.var, align 4 +// CHECK:STDOUT: %.loc10_16 = load i32, ptr %y.var, align 4 +// CHECK:STDOUT: store i32 %.loc10_16, ptr %z.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 780fb806a9ed..0d269e313e92 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -13,14 +13,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'two_entries.carbon' // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.2.loc8_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.3.loc8_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc8_46.2.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc8_46.4.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.2.loc8_47, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.3.loc8_47, i64 8, i1 false) // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc9_31.1.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc9_31.2 = load i32, ptr %.loc9_31.1.a, align 4