From 3776c068de6d2e0b9744ed99aee606ed66f9db5d Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 18 Apr 2024 19:19:30 -0700 Subject: [PATCH] Unify instruction naming between SemIR and LLVM IR (#3898) Factor out `SemIR::InstNamer` and also use it when lowering to LLVM IR. Automatically name all instructions created with our `IRBuilder` based on the name computed by the `InstNamer`, and likewise name basic blocks using the label generated by the `InstNamer`. Move some of the existing naming logic out from lower into `InstNamer` so that it's also used in SemIR. In particular, we now name call instructions after their callee, or after the builtin name for calls to builtins. Computing and adding these names isn't completely free. This instruction naming is designed to be optional, so that we can turn it off for builds where the LLVM IR will only be converted to assembly and won't be seen by a human, but so far it's enabled unconditionally. We can tune that later as needed. --- .../testdata/array/array_in_place.carbon | 8 +- .../testdata/array/assign_return_value.carbon | 20 +- .../testdata/array/canonicalize_index.carbon | 4 +- .../testdata/array/fail_bound_negative.carbon | 4 +- .../testdata/array/function_param.carbon | 6 +- .../testdata/as/adapter_conversion.carbon | 6 +- toolchain/check/testdata/as/identity.carbon | 6 +- toolchain/check/testdata/as/tuple.carbon | 24 +- .../testdata/builtins/bool/make_type.carbon | 6 +- .../testdata/builtins/float/make_type.carbon | 24 +- .../check/testdata/builtins/int/and.carbon | 10 +- .../testdata/builtins/int/complement.carbon | 16 +- .../check/testdata/builtins/int/eq.carbon | 18 +- .../testdata/builtins/int/greater.carbon | 48 +- .../testdata/builtins/int/greater_eq.carbon | 48 +- .../testdata/builtins/int/left_shift.carbon | 64 +- .../check/testdata/builtins/int/less.carbon | 48 +- .../testdata/builtins/int/less_eq.carbon | 48 +- .../testdata/builtins/int/make_type_32.carbon | 6 +- .../builtins/int/make_type_signed.carbon | 60 +- .../builtins/int/make_type_unsigned.carbon | 60 +- .../check/testdata/builtins/int/neq.carbon | 18 +- .../check/testdata/builtins/int/or.carbon | 10 +- .../testdata/builtins/int/right_shift.carbon | 72 +-- .../check/testdata/builtins/int/sadd.carbon | 52 +- .../check/testdata/builtins/int/sdiv.carbon | 82 +-- .../check/testdata/builtins/int/smod.carbon | 82 +-- .../check/testdata/builtins/int/smul.carbon | 22 +- .../testdata/builtins/int/snegate.carbon | 82 +-- .../check/testdata/builtins/int/ssub.carbon | 40 +- .../check/testdata/builtins/int/uadd.carbon | 52 +- .../check/testdata/builtins/int/udiv.carbon | 82 +-- .../check/testdata/builtins/int/umod.carbon | 82 +-- .../check/testdata/builtins/int/umul.carbon | 22 +- .../testdata/builtins/int/unegate.carbon | 82 +-- .../check/testdata/builtins/int/usub.carbon | 40 +- .../check/testdata/builtins/int/xor.carbon | 10 +- .../class/base_function_unqualified.carbon | 4 +- toolchain/check/testdata/class/basic.carbon | 6 +- .../check/testdata/class/extend_adapt.carbon | 2 +- .../testdata/class/fail_incomplete.carbon | 10 +- .../class/fail_init_as_inplace.carbon | 4 +- .../check/testdata/class/fail_method.carbon | 10 +- .../check/testdata/class/init_adapt.carbon | 20 +- .../check/testdata/class/init_nested.carbon | 8 +- toolchain/check/testdata/class/method.carbon | 20 +- .../check/testdata/class/reenter_scope.carbon | 8 +- toolchain/check/testdata/class/reorder.carbon | 6 +- .../testdata/class/reorder_qualified.carbon | 8 +- toolchain/check/testdata/class/scope.carbon | 14 +- .../check/testdata/class/static_method.carbon | 6 +- toolchain/check/testdata/const/import.carbon | 4 +- .../expr_category/in_place_tuple_init.carbon | 20 +- .../testdata/function/builtin/call.carbon | 4 +- .../builtin/call_from_operator.carbon | 14 +- .../testdata/function/builtin/import.carbon | 4 +- .../testdata/function/builtin/method.carbon | 4 +- .../check/testdata/function/call/alias.carbon | 4 +- .../function/call/empty_struct.carbon | 4 +- .../testdata/function/call/empty_tuple.carbon | 4 +- .../function/call/fail_param_count.carbon | 16 +- .../function/call/fail_param_type.carbon | 4 +- .../call/fail_return_type_mismatch.carbon | 2 +- .../check/testdata/function/call/i32.carbon | 6 +- .../function/call/more_param_ir.carbon | 2 +- .../testdata/function/call/params_one.carbon | 4 +- .../function/call/params_one_comma.carbon | 8 +- .../testdata/function/call/params_two.carbon | 2 +- .../function/call/params_two_comma.carbon | 4 +- .../testdata/function/call/params_zero.carbon | 2 +- .../function/call/return_implicit.carbon | 4 +- .../fail_import_incomplete_return.carbon | 14 +- .../function/declaration/import.carbon | 132 ++--- .../function/declaration/simple.carbon | 2 +- .../function/definition/import.carbon | 16 +- .../testdata/global/simple_with_fun.carbon | 4 +- toolchain/check/testdata/if/else.carbon | 6 +- toolchain/check/testdata/if/no_else.carbon | 4 +- .../if_expr/constant_condition.carbon | 28 +- .../testdata/if_expr/control_flow.carbon | 14 +- .../check/testdata/if_expr/struct.carbon | 2 +- toolchain/check/testdata/impl/compound.carbon | 6 +- .../check/testdata/impl/extend_impl.carbon | 4 +- .../check/testdata/impl/lookup/alias.carbon | 4 +- .../check/testdata/impl/lookup/import.carbon | 2 +- .../check/testdata/index/expr_category.carbon | 6 +- .../index/fail_empty_tuple_access.carbon | 8 +- .../testdata/index/fail_expr_category.carbon | 12 +- .../index/tuple_return_value_access.carbon | 8 +- .../testdata/interface/default_fn.carbon | 2 +- .../testdata/namespace/add_to_import.carbon | 4 +- .../check/testdata/namespace/alias.carbon | 12 +- .../check/testdata/namespace/function.carbon | 2 +- .../check/testdata/namespace/imported.carbon | 16 +- .../namespace/imported_indirect.carbon | 4 +- .../check/testdata/namespace/merging.carbon | 8 +- .../check/testdata/namespace/nested.carbon | 2 +- .../check/testdata/namespace/shadow.carbon | 2 +- .../namespace/unqualified_lookup.carbon | 12 +- .../testdata/operators/builtin/and.carbon | 12 +- .../fail_and_or_not_in_function.carbon | 6 +- .../fail_assignment_to_non_assignable.carbon | 6 +- .../fail_redundant_compound_access.carbon | 4 +- .../testdata/operators/builtin/or.carbon | 12 +- .../check/testdata/package_expr/syntax.carbon | 2 +- .../packages/cross_package_import.carbon | 8 +- .../testdata/packages/loaded_global.carbon | 16 +- .../pointer/fail_address_of_value.carbon | 12 +- .../testdata/return/fail_call_in_type.carbon | 6 +- .../struct/literal_member_access.carbon | 22 +- .../struct/nested_struct_in_place.carbon | 8 +- .../testdata/struct/reorder_fields.carbon | 14 +- .../tuples/nested_tuple_in_place.carbon | 14 +- .../testdata/while/break_continue.carbon | 48 +- .../testdata/while/unreachable_end.carbon | 12 +- toolchain/check/testdata/while/while.carbon | 12 +- toolchain/driver/BUILD | 1 + toolchain/driver/driver.cpp | 6 +- toolchain/lower/BUILD | 2 + toolchain/lower/file_context.cpp | 2 + toolchain/lower/file_context.h | 6 + toolchain/lower/function_context.cpp | 30 +- toolchain/lower/function_context.h | 27 +- toolchain/lower/handle.cpp | 170 +++--- toolchain/lower/lower.cpp | 6 +- toolchain/lower/lower.h | 4 +- toolchain/lower/testdata/alias/local.carbon | 9 +- .../testdata/array/array_in_place.carbon | 11 +- .../testdata/array/assign_return_value.carbon | 32 +- toolchain/lower/testdata/array/base.carbon | 69 +-- .../testdata/array/function_param.carbon | 26 +- .../lower/testdata/basics/false_true.carbon | 2 + .../lower/testdata/basics/int_types.carbon | 4 + .../testdata/basics/numeric_literals.carbon | 45 +- .../lower/testdata/basics/type_values.carbon | 3 + toolchain/lower/testdata/basics/zero.carbon | 1 + toolchain/lower/testdata/builtins/int.carbon | 90 +-- .../builtins/method_vs_nonmethod.carbon | 10 +- .../builtins/overloaded_operator.carbon | 13 +- .../lower/testdata/builtins/types.carbon | 13 +- toolchain/lower/testdata/builtins/uint.carbon | 90 +-- toolchain/lower/testdata/class/adapt.carbon | 27 +- toolchain/lower/testdata/class/base.carbon | 35 +- toolchain/lower/testdata/class/basic.carbon | 7 +- toolchain/lower/testdata/class/field.carbon | 26 +- toolchain/lower/testdata/class/method.carbon | 5 +- toolchain/lower/testdata/class/self.carbon | 12 +- .../lower/testdata/class/value_access.carbon | 35 +- .../function/call/empty_struct.carbon | 4 +- .../testdata/function/call/empty_tuple.carbon | 4 +- .../lower/testdata/function/call/i32.carbon | 8 +- .../call/implicit_empty_tuple_as_arg.carbon | 7 +- .../testdata/function/call/params_one.carbon | 2 + .../function/call/params_one_comma.carbon | 2 + .../testdata/function/call/params_two.carbon | 2 + .../function/call/params_two_comma.carbon | 2 + .../testdata/function/call/params_zero.carbon | 2 + .../function/call/return_implicit.carbon | 4 +- .../function/call/struct_param.carbon | 14 +- .../testdata/function/call/tuple_param.carbon | 14 +- .../call/tuple_param_with_return_slot.carbon | 38 +- .../testdata/function/call/var_param.carbon | 10 +- .../function/declaration/simple.carbon | 1 + .../function/definition/empty_struct.carbon | 1 + .../function/definition/params_one.carbon | 1 + .../function/definition/params_two.carbon | 1 + .../function/definition/params_zero.carbon | 1 + .../function/generic/type_param.carbon | 7 +- toolchain/lower/testdata/if/else.carbon | 16 +- toolchain/lower/testdata/if/no_else.carbon | 11 +- toolchain/lower/testdata/if_expr/basic.carbon | 23 +- .../lower/testdata/if_expr/empty_block.carbon | 45 +- .../lower/testdata/impl/assoc_fn_alias.carbon | 12 +- .../lower/testdata/impl/extend_impl.carbon | 11 +- toolchain/lower/testdata/impl/impl.carbon | 12 +- .../testdata/impl/instance_method.carbon | 6 +- .../index/array_element_access.carbon | 75 +-- .../index/tuple_element_access.carbon | 31 +- .../index/tuple_return_value_access.carbon | 22 +- .../lower/testdata/interface/assoc.carbon | 1 + .../lower/testdata/interface/basic.carbon | 2 + toolchain/lower/testdata/let/local.carbon | 1 + toolchain/lower/testdata/let/tuple.carbon | 89 +-- .../lower/testdata/namespace/function.carbon | 3 + .../lower/testdata/namespace/nested.carbon | 2 + toolchain/lower/testdata/operators/and.carbon | 19 +- .../testdata/operators/and_empty_block.carbon | 13 +- .../testdata/operators/assignment.carbon | 17 +- toolchain/lower/testdata/operators/not.carbon | 5 +- toolchain/lower/testdata/operators/or.carbon | 21 +- .../testdata/operators/or_empty_block.carbon | 15 +- .../testdata/operators/overloaded.carbon | 75 +-- .../packages/cross_package_call.carbon | 2 + .../testdata/pointer/address_of_field.carbon | 15 +- .../testdata/pointer/address_of_unused.carbon | 5 +- toolchain/lower/testdata/pointer/basic.carbon | 14 +- .../pointer/pointer_to_pointer.carbon | 23 +- .../testdata/return/code_after_return.carbon | 2 + .../lower/testdata/return/no_value.carbon | 1 + .../lower/testdata/return/return_var.carbon | 9 +- .../testdata/return/return_var_byval.carbon | 9 +- toolchain/lower/testdata/return/value.carbon | 1 + toolchain/lower/testdata/return/var.carbon | 9 +- toolchain/lower/testdata/struct/empty.carbon | 5 +- .../testdata/struct/member_access.carbon | 25 +- .../testdata/struct/nested_struct.carbon | 1 + .../struct/nested_struct_in_place.carbon | 11 +- .../lower/testdata/struct/one_entry.carbon | 15 +- .../lower/testdata/struct/two_entries.carbon | 29 +- toolchain/lower/testdata/tuple/empty.carbon | 5 +- .../lower/testdata/tuple/nested_tuple.carbon | 1 + .../tuple/nested_tuple_in_place.carbon | 11 +- .../lower/testdata/tuple/one_entry.carbon | 15 +- .../lower/testdata/tuple/two_entries.carbon | 29 +- .../testdata/tuple/value_formation.carbon | 69 +-- .../testdata/tuple/value_forwarding.carbon | 13 +- toolchain/lower/testdata/var/local.carbon | 9 +- .../testdata/while/break_continue.carbon | 36 +- .../lower/testdata/while/preheader.carbon | 36 +- .../testdata/while/unreachable_end.carbon | 13 +- toolchain/lower/testdata/while/while.carbon | 15 +- toolchain/sem_ir/BUILD | 18 + toolchain/sem_ir/formatter.cpp | 553 +----------------- toolchain/sem_ir/inst_namer.cpp | 493 ++++++++++++++++ toolchain/sem_ir/inst_namer.h | 171 ++++++ 225 files changed, 2835 insertions(+), 2455 deletions(-) create mode 100644 toolchain/sem_ir/inst_namer.cpp create mode 100644 toolchain/sem_ir/inst_namer.h diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index 843b83d6a99a..0d0f11825a10 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -54,15 +54,15 @@ fn G() { // CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3 +// 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: = name_ref F, file.%F [template = file.%F] // 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.%.9] // CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.4 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_40: init (i32, i32, i32) = call %F.ref.loc10_39() to %.loc10_42.6 -// CHECK:STDOUT: %.loc10_42.7: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_35, %.loc10_40) -// CHECK:STDOUT: %.loc10_42.8: init [(i32, i32, i32); 2] = array_init (%.loc10_35, %.loc10_40) to %v.var +// CHECK:STDOUT: %F.call.loc10_40: init (i32, i32, i32) = call %F.ref.loc10_39() to %.loc10_42.6 +// CHECK:STDOUT: %.loc10_42.7: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc10_35, %F.call.loc10_40) +// CHECK:STDOUT: %.loc10_42.8: init [(i32, i32, i32); 2] = array_init (%F.call.loc10_35, %F.call.loc10_40) to %v.var // CHECK:STDOUT: %.loc10_43: init [(i32, i32, i32); 2] = converted %.loc10_42.7, %.loc10_42.8 // CHECK:STDOUT: assign %v.var, %.loc10_43 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index 7e0ed8742fb5..c19d30750e05 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -53,16 +53,16 @@ fn Run() { // CHECK:STDOUT: %t.var: ref [i32; 1] = var t // CHECK:STDOUT: %t: ref [i32; 1] = bind_name t, %t.var // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc10_22.1: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary_storage -// CHECK:STDOUT: %.loc10_22.3: ref (i32,) = temporary %.loc10_22.2, %.loc10_22.1 -// CHECK:STDOUT: %.loc10_22.4: ref i32 = tuple_access %.loc10_22.3, element0 -// CHECK:STDOUT: %.loc10_22.5: i32 = bind_value %.loc10_22.4 -// CHECK:STDOUT: %.loc10_22.6: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_22.7: ref i32 = array_index %t.var, %.loc10_22.6 -// CHECK:STDOUT: %.loc10_22.8: init i32 = initialize_from %.loc10_22.5 to %.loc10_22.7 -// CHECK:STDOUT: %.loc10_22.9: init [i32; 1] = array_init (%.loc10_22.8) to %t.var -// CHECK:STDOUT: %.loc10_24: init [i32; 1] = converted %.loc10_22.1, %.loc10_22.9 +// 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 +// CHECK:STDOUT: %.loc10_22.3: ref i32 = tuple_access %.loc10_22.2, element0 +// CHECK:STDOUT: %.loc10_22.4: i32 = bind_value %.loc10_22.3 +// CHECK:STDOUT: %.loc10_22.5: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_22.6: ref i32 = array_index %t.var, %.loc10_22.5 +// CHECK:STDOUT: %.loc10_22.7: init i32 = initialize_from %.loc10_22.4 to %.loc10_22.6 +// CHECK:STDOUT: %.loc10_22.8: init [i32; 1] = array_init (%.loc10_22.7) to %t.var +// CHECK:STDOUT: %.loc10_24: init [i32; 1] = converted %F.call, %.loc10_22.8 // CHECK:STDOUT: assign %t.var, %.loc10_24 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index e734160a4b7c..cc29aee32a6a 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -39,8 +39,8 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc9_21: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc9_23: type = array_type %.loc9_17, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.3] +// CHECK:STDOUT: %.loc9_23: type = array_type %int.sadd, i32 [template = constants.%.4] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a.loc9: ref [i32; 3] = bind_name a, %a.var // CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 [template = constants.%.3] diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index 603a997dbea3..2192e80965e7 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -32,8 +32,8 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_20: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_23: type = array_type %.loc12_20, i32 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.2] +// 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: } diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 8fb074f93f65..89e0eaec2065 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -78,9 +78,9 @@ fn G() -> i32 { // CHECK:STDOUT: %.loc12_11.1: init [i32; 3] = converted %.loc12_20.1, %.loc12_20.12 [template = constants.%.8] // CHECK:STDOUT: %.loc12_11.2: ref [i32; 3] = temporary %.loc12_20.2, %.loc12_11.1 // CHECK:STDOUT: %.loc12_11.3: [i32; 3] = bind_value %.loc12_11.2 -// CHECK:STDOUT: %.loc12_11.4: init i32 = call %F.ref(%.loc12_11.3, %.loc12_23) -// CHECK:STDOUT: %.loc12_25.1: i32 = value_of_initializer %.loc12_11.4 -// CHECK:STDOUT: %.loc12_25.2: i32 = converted %.loc12_11.4, %.loc12_25.1 +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc12_11.3, %.loc12_23) +// CHECK:STDOUT: %.loc12_25.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc12_25.2: i32 = converted %F.call, %.loc12_25.1 // CHECK:STDOUT: return %.loc12_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index 9c9f45580b2f..f95a47bdbdd7 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -201,10 +201,10 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %Make.ref: = name_ref Make, @A.%Make [template = @A.%Make] // CHECK:STDOUT: %.loc24_5: ref B = splice_block file.%b_factory.var {} -// CHECK:STDOUT: %.loc24_26: init A = call %Make.ref() to %.loc24_5 +// 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] -// CHECK:STDOUT: %.loc24_29.1: init B = as_compatible %.loc24_26 -// CHECK:STDOUT: %.loc24_29.2: init B = converted %.loc24_26, %.loc24_29.1 +// CHECK:STDOUT: %.loc24_29.1: init B = as_compatible %Make.call +// CHECK:STDOUT: %.loc24_29.2: init B = converted %Make.call, %.loc24_29.1 // CHECK:STDOUT: assign file.%b_factory.var, %.loc24_29.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index c11b3261c591..bc17addd9303 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -97,10 +97,10 @@ fn Initializing() { // CHECK:STDOUT: %x.var: ref X = var x // CHECK:STDOUT: %x: ref X = bind_name x, %x.var // CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] -// CHECK:STDOUT: %.loc24_7: ref X = splice_block %x.var {} -// CHECK:STDOUT: %.loc24_19: init X = call %Make.ref() to %.loc24_7 +// CHECK:STDOUT: %.loc24: ref X = splice_block %x.var {} +// CHECK:STDOUT: %Make.call: init X = call %Make.ref() to %.loc24 // CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: assign %x.var, %.loc24_19 +// CHECK:STDOUT: assign %x.var, %Make.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/tuple.carbon b/toolchain/check/testdata/as/tuple.carbon index 54ebbe335671..fc569ee1e1f1 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -66,20 +66,20 @@ fn Var() { // CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc15_24.1: ref X = temporary_storage -// CHECK:STDOUT: %.loc15_24.2: init X = call %Make.ref.loc15_20() to %.loc15_24.1 +// CHECK:STDOUT: %Make.call.loc15_24: init X = call %Make.ref.loc15_20() to %.loc15_24.1 // CHECK:STDOUT: %Make.ref.loc15_28: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc15_32.1: ref X = temporary_storage -// CHECK:STDOUT: %.loc15_32.2: init X = call %Make.ref.loc15_28() to %.loc15_32.1 -// CHECK:STDOUT: %.loc15_34.1: (X, X) = tuple_literal (%.loc15_24.2, %.loc15_32.2) +// CHECK:STDOUT: %Make.call.loc15_32: init X = call %Make.ref.loc15_28() to %.loc15_32.1 +// CHECK:STDOUT: %.loc15_34.1: (X, X) = tuple_literal (%Make.call.loc15_24, %Make.call.loc15_32) // CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc15_44.1: (type, type) = tuple_literal (%X.ref.loc15_40, %X.ref.loc15_43) // CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_24.3: ref X = temporary %.loc15_24.1, %.loc15_24.2 -// CHECK:STDOUT: %.loc15_24.4: X = bind_value %.loc15_24.3 -// CHECK:STDOUT: %.loc15_32.3: ref X = temporary %.loc15_32.1, %.loc15_32.2 -// CHECK:STDOUT: %.loc15_32.4: X = bind_value %.loc15_32.3 -// CHECK:STDOUT: %.loc15_34.2: (X, X) = tuple_value (%.loc15_24.4, %.loc15_32.4) +// CHECK:STDOUT: %.loc15_24.2: ref X = temporary %.loc15_24.1, %Make.call.loc15_24 +// CHECK:STDOUT: %.loc15_24.3: X = bind_value %.loc15_24.2 +// CHECK:STDOUT: %.loc15_32.2: ref X = temporary %.loc15_32.1, %Make.call.loc15_32 +// CHECK:STDOUT: %.loc15_32.3: X = bind_value %.loc15_32.2 +// CHECK:STDOUT: %.loc15_34.2: (X, X) = tuple_value (%.loc15_24.3, %.loc15_32.3) // CHECK:STDOUT: %.loc15_45: (X, X) = converted %.loc15_34.1, %.loc15_34.2 // CHECK:STDOUT: %a: (X, X) = bind_name a, %.loc15_45 // CHECK:STDOUT: return @@ -95,16 +95,16 @@ fn Var() { // CHECK:STDOUT: %b: ref (X, X) = bind_name b, %b.var // CHECK:STDOUT: %Make.ref.loc20_20: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc20_34.1: ref X = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc20_24: init X = call %Make.ref.loc20_20() to %.loc20_34.1 +// CHECK:STDOUT: %Make.call.loc20_24: init X = call %Make.ref.loc20_20() to %.loc20_34.1 // CHECK:STDOUT: %Make.ref.loc20_28: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc20_34.2: ref X = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 -// CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%.loc20_24, %.loc20_32) +// CHECK:STDOUT: %Make.call.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 +// CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%Make.call.loc20_24, %Make.call.loc20_32) // CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc20_44.1: (type, type) = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) // CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%.loc20_24, %.loc20_32) to %b.var +// CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%Make.call.loc20_24, %Make.call.loc20_32) to %b.var // CHECK:STDOUT: %.loc20_45: init (X, X) = converted %.loc20_34.3, %.loc20_34.4 // CHECK:STDOUT: assign %b.var, %.loc20_45 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/builtins/bool/make_type.carbon b/toolchain/check/testdata/builtins/bool/make_type.carbon index 569a5cdccbb9..e56c7432fd06 100644 --- a/toolchain/check/testdata/builtins/bool/make_type.carbon +++ b/toolchain/check/testdata/builtins/bool/make_type.carbon @@ -48,9 +48,9 @@ var b: Bool() = false; // CHECK:STDOUT: %import_ref: = import_ref ir2, inst+3, loc_11 [template = imports.%Bool] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Bool.ref: = name_ref Bool, %import_ref [template = imports.%Bool] -// CHECK:STDOUT: %.loc6_12: init type = call %Bool.ref() [template = bool] -// CHECK:STDOUT: %.loc6_13.1: type = value_of_initializer %.loc6_12 [template = bool] -// CHECK:STDOUT: %.loc6_13.2: type = converted %.loc6_12, %.loc6_13.1 [template = bool] +// CHECK:STDOUT: %bool.make_type: init type = call %Bool.ref() [template = bool] +// CHECK:STDOUT: %.loc6_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_13.2: type = converted %bool.make_type, %.loc6_13.1 [template = bool] // CHECK:STDOUT: %b.var: ref bool = var b // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index aec61c6066fa..8d6dc18e1b63 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -75,9 +75,9 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Float.ref: = name_ref Float, %import_ref [template = imports.%Float] // CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_13: init type = call %Float.ref(%.loc6_14) [template = f64] -// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %.loc6_13 [template = f64] -// CHECK:STDOUT: %.loc6_16.2: type = converted %.loc6_13, %.loc6_16.1 [template = f64] +// 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: = fn_decl @GetFloat [template] { @@ -93,9 +93,9 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Float.ref: = name_ref Float, file.%import_ref [template = imports.%Float] // CHECK:STDOUT: %dyn_size.ref: i32 = name_ref dyn_size, %dyn_size -// CHECK:STDOUT: %.loc9_15: init type = call %Float.ref(%dyn_size.ref) -// CHECK:STDOUT: %.loc9_25.1: type = value_of_initializer %.loc9_15 -// CHECK:STDOUT: %.loc9_25.2: type = converted %.loc9_15, %.loc9_25.1 +// 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 +// CHECK:STDOUT: %.loc9_25.2: type = converted %float.make_type, %.loc9_25.1 // CHECK:STDOUT: return %.loc9_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -125,9 +125,9 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Float.ref.loc10: = name_ref Float, %import_ref [template = imports.%Float] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 32 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_25: init type = call %Float.ref.loc10(%.loc10_26) [template = ] -// CHECK:STDOUT: %.loc10_28.1: type = value_of_initializer %.loc10_25 [template = ] -// CHECK:STDOUT: %.loc10_28.2: type = converted %.loc10_25, %.loc10_28.1 [template = ] +// 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: %dyn_size.var: ref i32 = var dyn_size @@ -135,9 +135,9 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Float.ref.loc16: = name_ref Float, %import_ref [template = imports.%Float] // 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: %.loc16_15: init type = call %Float.ref.loc16(%.loc16_16) -// CHECK:STDOUT: %.loc16_24.1: type = value_of_initializer %.loc16_15 -// CHECK:STDOUT: %.loc16_24.2: type = converted %.loc16_15, %.loc16_24.1 +// CHECK:STDOUT: %float.make_type.loc16: init type = call %Float.ref.loc16(%.loc16_16) +// CHECK:STDOUT: %.loc16_24.1: type = value_of_initializer %float.make_type.loc16 +// CHECK:STDOUT: %.loc16_24.2: type = converted %float.make_type.loc16, %.loc16_24.1 // CHECK:STDOUT: %dyn.var: ref = var dyn // CHECK:STDOUT: %dyn: ref = bind_name dyn, %dyn.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index b01af618045f..b56c4892738e 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -43,8 +43,8 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] // CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_27: type = array_type %int.and, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 8] = var arr // CHECK:STDOUT: %arr: ref [i32; 8] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 8 [template = constants.%.3] @@ -69,9 +69,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %And.ref: = name_ref And, file.%And [template = file.%And] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %And.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.and +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.and, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index fee20dcbadaa..92e682d9d221 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -51,12 +51,12 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] // CHECK:STDOUT: %Complement.ref: = name_ref Complement, %Complement [template = %Complement] // CHECK:STDOUT: %.loc5_31: i32 = int_literal 1193046 [template = constants.%.1] -// CHECK:STDOUT: %.loc5_30: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.2] +// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.2] // CHECK:STDOUT: %.loc5_42: i32 = int_literal 16777215 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19.1: i32 = value_of_initializer %.loc5_30 [template = constants.%.2] -// CHECK:STDOUT: %.loc5_19.2: i32 = converted %.loc5_30, %.loc5_19.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc5_19.3: init i32 = call %And.ref(%.loc5_19.2, %.loc5_42) [template = constants.%.4] -// CHECK:STDOUT: %.loc5_51: type = array_type %.loc5_19.3, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_19.1: i32 = value_of_initializer %int.complement [template = constants.%.2] +// CHECK:STDOUT: %.loc5_19.2: i32 = converted %int.complement, %.loc5_19.1 [template = constants.%.2] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_19.2, %.loc5_42) [template = constants.%.4] +// CHECK:STDOUT: %.loc5_51: type = array_type %int.and, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 15584169] = var arr // CHECK:STDOUT: %arr: ref [i32; 15584169] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc6_18: i32 = int_literal 15584169 [template = constants.%.4] @@ -80,9 +80,9 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Complement.ref: = name_ref Complement, file.%Complement [template = file.%Complement] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc9_20: init i32 = call %Complement.ref(%a.ref) -// CHECK:STDOUT: %.loc9_23.1: i32 = value_of_initializer %.loc9_20 -// CHECK:STDOUT: %.loc9_23.2: i32 = converted %.loc9_20, %.loc9_23.1 +// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%a.ref) +// CHECK:STDOUT: %.loc9_23.1: i32 = value_of_initializer %int.complement +// CHECK:STDOUT: %.loc9_23.2: i32 = converted %int.complement, %.loc9_23.1 // CHECK:STDOUT: return %.loc9_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 27fc86433c7c..2a966b4ba198 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -97,9 +97,9 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %Eq.ref.loc8: = name_ref Eq, file.%Eq [template = file.%Eq] // CHECK:STDOUT: %.loc8_19: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_18: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_22) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %.loc8_18 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %.loc8_18, %.loc8_13.1 [template = constants.%.5] +// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_22) [template = constants.%.5] +// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %int.eq.loc8 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_13.2: bool = converted %int.eq.loc8, %.loc8_13.1 [template = constants.%.5] // 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: @@ -116,9 +116,9 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %Eq.ref.loc9: = name_ref Eq, file.%Eq [template = file.%Eq] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_19: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %.loc9_19 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %.loc9_19, %.loc9_14.1 [template = constants.%.7] +// CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.eq.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.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: @@ -139,9 +139,9 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %Eq.ref: = name_ref Eq, file.%Eq [template = file.%Eq] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc13_12: init bool = call %Eq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc13_18.1: bool = value_of_initializer %.loc13_12 -// CHECK:STDOUT: %.loc13_18.2: bool = converted %.loc13_12, %.loc13_18.1 +// CHECK:STDOUT: %int.eq: init bool = call %Eq.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc13_18.1: bool = value_of_initializer %int.eq +// CHECK:STDOUT: %.loc13_18.2: bool = converted %int.eq, %.loc13_18.1 // CHECK:STDOUT: return %.loc13_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index 39a1bbc5c114..877fb913779f 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -102,9 +102,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Greater.ref.loc9: = name_ref Greater, file.%Greater [template = file.%Greater] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_28: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_24: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %.loc9_24 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %.loc9_24, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_28) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater.loc9, %.loc9_14.1 [template = constants.%.6] // 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: @@ -121,9 +121,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Greater.ref.loc10: = name_ref Greater, file.%Greater [template = file.%Greater] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_28: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_24: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %.loc10_24 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %.loc10_24, %.loc10_14.1 [template = constants.%.6] +// CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_28) [template = constants.%.6] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.greater.loc10 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.greater.loc10, %.loc10_14.1 [template = constants.%.6] // 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: @@ -140,9 +140,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Greater.ref.loc11: = name_ref Greater, file.%Greater [template = file.%Greater] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_23: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %.loc11_23 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %.loc11_23, %.loc11_13.1 [template = constants.%.8] +// CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater.loc11 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater.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: @@ -159,13 +159,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Greater.ref.loc12: = name_ref Greater, file.%Greater [template = file.%Greater] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc12_32: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_31: init i32 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.9] +// 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] -// CHECK:STDOUT: %.loc12_24.1: i32 = value_of_initializer %.loc12_31 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_24.2: i32 = converted %.loc12_31, %.loc12_24.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_24.3: init bool = call %Greater.ref.loc12(%.loc12_24.2, %.loc12_36) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %.loc12_24.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %.loc12_24.3, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_24.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_24.2: i32 = converted %int.snegate.loc12, %.loc12_24.1 [template = constants.%.9] +// CHECK:STDOUT: %int.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_24.2, %.loc12_36) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater.loc12, %.loc12_14.1 [template = constants.%.6] // 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: @@ -183,12 +183,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_33: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %.loc13_33 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.2: i32 = converted %.loc13_33, %.loc13_23.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.3: init bool = call %Greater.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %.loc13_23.3 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %.loc13_23.3, %.loc13_13.1 [template = constants.%.8] +// 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] +// CHECK:STDOUT: %.loc13_23.2: i32 = converted %int.snegate.loc13, %.loc13_23.1 [template = constants.%.9] +// CHECK:STDOUT: %int.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 %int.greater.loc13 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater.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: @@ -209,9 +209,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Greater.ref: = name_ref Greater, file.%Greater [template = file.%Greater] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc17_17: init bool = call %Greater.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_23.1: bool = value_of_initializer %.loc17_17 -// CHECK:STDOUT: %.loc17_23.2: bool = converted %.loc17_17, %.loc17_23.1 +// CHECK:STDOUT: %int.greater: init bool = call %Greater.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc17_23.1: bool = value_of_initializer %int.greater +// CHECK:STDOUT: %.loc17_23.2: bool = converted %int.greater, %.loc17_23.1 // CHECK:STDOUT: return %.loc17_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index 2f1edc2a691f..f6e7cff43e51 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -102,9 +102,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %GreaterEq.ref.loc9: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] // CHECK:STDOUT: %.loc9_27: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_30: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_26: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_30) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %.loc9_26 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %.loc9_26, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_30) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater_eq.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater_eq.loc9, %.loc9_14.1 [template = constants.%.6] // 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: @@ -121,9 +121,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %GreaterEq.ref.loc10: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_29) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %.loc10_25 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %.loc10_25, %.loc10_13.1 [template = constants.%.7] +// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_29) [template = constants.%.7] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.greater_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: @@ -140,9 +140,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %GreaterEq.ref.loc11: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] // CHECK:STDOUT: %.loc11_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_29: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_25: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_29) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %.loc11_25 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %.loc11_25, %.loc11_13.1 [template = constants.%.7] +// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_29) [template = constants.%.7] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater_eq.loc11, %.loc11_13.1 [template = constants.%.7] // 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: @@ -159,13 +159,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %GreaterEq.ref.loc12: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc12_34: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_33: init i32 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.9] +// 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] -// CHECK:STDOUT: %.loc12_26.1: i32 = value_of_initializer %.loc12_33 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_26.2: i32 = converted %.loc12_33, %.loc12_26.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_26.3: init bool = call %GreaterEq.ref.loc12(%.loc12_26.2, %.loc12_38) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %.loc12_26.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %.loc12_26.3, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_26.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_26.2: i32 = converted %int.snegate.loc12, %.loc12_26.1 [template = constants.%.9] +// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_26.2, %.loc12_38) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater_eq.loc12, %.loc12_14.1 [template = constants.%.6] // 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: @@ -183,12 +183,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc13_26: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc13_36: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_35: init i32 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_25.1: i32 = value_of_initializer %.loc13_35 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_25.2: i32 = converted %.loc13_35, %.loc13_25.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_25.3: init bool = call %GreaterEq.ref.loc13(%.loc13_26, %.loc13_25.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %.loc13_25.3 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %.loc13_25.3, %.loc13_13.1 [template = constants.%.7] +// 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] +// CHECK:STDOUT: %.loc13_25.2: i32 = converted %int.snegate.loc13, %.loc13_25.1 [template = constants.%.9] +// CHECK:STDOUT: %int.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 %int.greater_eq.loc13 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater_eq.loc13, %.loc13_13.1 [template = constants.%.7] // 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: @@ -209,9 +209,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %GreaterEq.ref: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc17_19: init bool = call %GreaterEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_25.1: bool = value_of_initializer %.loc17_19 -// CHECK:STDOUT: %.loc17_25.2: bool = converted %.loc17_19, %.loc17_25.1 +// CHECK:STDOUT: %int.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc17_25.1: bool = value_of_initializer %int.greater_eq +// CHECK:STDOUT: %.loc17_25.2: bool = converted %int.greater_eq, %.loc17_25.1 // CHECK:STDOUT: return %.loc17_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 716a6e9eadb6..caa7f119ca04 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -87,8 +87,8 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %LeftShift.ref: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc4_26: i32 = int_literal 5 [template = constants.%.1] // CHECK:STDOUT: %.loc4_29: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_25: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_31: type = array_type %.loc4_25, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_31: type = array_type %int.left_shift, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 20] = var arr // CHECK:STDOUT: %arr: ref [i32; 20] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 20 [template = constants.%.3] @@ -113,9 +113,9 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %LeftShift.ref: = name_ref LeftShift, file.%LeftShift [template = file.%LeftShift] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_19: init i32 = call %LeftShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_25.1: i32 = value_of_initializer %.loc8_19 -// CHECK:STDOUT: %.loc8_25.2: i32 = converted %.loc8_19, %.loc8_25.1 +// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_25.1: i32 = value_of_initializer %int.left_shift +// CHECK:STDOUT: %.loc8_25.2: i32 = converted %int.left_shift, %.loc8_25.1 // CHECK:STDOUT: return %.loc8_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -154,62 +154,62 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %LeftShift.ref.loc8: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc8_32: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_28: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %.loc8_28 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.2: i32 = converted %.loc8_28, %.loc8_35.1 [template = constants.%.3] +// CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.3] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_35.2 // CHECK:STDOUT: %LeftShift.ref.loc13: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc13_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc13_32: i32 = int_literal 32 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_28: init i32 = call %LeftShift.ref.loc13(%.loc13_29, %.loc13_32) [template = ] -// CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %.loc13_28 [template = ] -// CHECK:STDOUT: %.loc13_35.2: i32 = converted %.loc13_28, %.loc13_35.1 [template = ] +// 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: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc18_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc18_32: i32 = int_literal 33 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_28: init i32 = call %LeftShift.ref.loc18(%.loc18_29, %.loc18_32) [template = ] -// CHECK:STDOUT: %.loc18_35.1: i32 = value_of_initializer %.loc18_28 [template = ] -// CHECK:STDOUT: %.loc18_35.2: i32 = converted %.loc18_28, %.loc18_35.1 [template = ] +// 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: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc21_33: i32 = int_literal 1000 [template = constants.%.6] // CHECK:STDOUT: %.loc21_39: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %.loc21_32: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %.loc21_32 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.2: i32 = converted %.loc21_32, %.loc21_42.1 [template = constants.%.7] +// CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.7] +// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.7] // CHECK:STDOUT: %overflow_1: i32 = bind_name overflow_1, %.loc21_42.2 // CHECK:STDOUT: %LeftShift.ref.loc26: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc26_33: i32 = int_literal 1000 [template = constants.%.6] // CHECK:STDOUT: %.loc26_39: i32 = int_literal 32 [template = constants.%.4] -// CHECK:STDOUT: %.loc26_32: init i32 = call %LeftShift.ref.loc26(%.loc26_33, %.loc26_39) [template = ] -// CHECK:STDOUT: %.loc26_42.1: i32 = value_of_initializer %.loc26_32 [template = ] -// CHECK:STDOUT: %.loc26_42.2: i32 = converted %.loc26_32, %.loc26_42.1 [template = ] +// 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: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc29_36: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc29_39: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %.loc29_35: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %.loc29_35 [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.2: i32 = converted %.loc29_35, %.loc29_42.1 [template = constants.%.7] +// CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.7] +// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.7] +// CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.7] // CHECK:STDOUT: %no_overflow_1: i32 = bind_name no_overflow_1, %.loc29_42.2 // CHECK:STDOUT: %LeftShift.ref.loc34: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc34_36: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc34_39: i32 = int_literal 32 [template = constants.%.4] -// CHECK:STDOUT: %.loc34_35: init i32 = call %LeftShift.ref.loc34(%.loc34_36, %.loc34_39) [template = ] -// CHECK:STDOUT: %.loc34_42.1: i32 = value_of_initializer %.loc34_35 [template = ] -// CHECK:STDOUT: %.loc34_42.2: i32 = converted %.loc34_35, %.loc34_42.1 [template = ] +// 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: = name_ref LeftShift, %LeftShift [template = %LeftShift] // CHECK:STDOUT: %.loc40_31: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc40_41: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc40_40: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.8] -// CHECK:STDOUT: %.loc40_30.1: i32 = value_of_initializer %.loc40_40 [template = constants.%.8] -// CHECK:STDOUT: %.loc40_30.2: i32 = converted %.loc40_40, %.loc40_30.1 [template = constants.%.8] -// CHECK:STDOUT: %.loc40_30.3: init i32 = call %LeftShift.ref.loc40(%.loc40_31, %.loc40_30.2) [template = ] -// CHECK:STDOUT: %.loc40_44.1: i32 = value_of_initializer %.loc40_30.3 [template = ] -// CHECK:STDOUT: %.loc40_44.2: i32 = converted %.loc40_30.3, %.loc40_44.1 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.8] +// CHECK:STDOUT: %.loc40_30.1: i32 = value_of_initializer %int.snegate [template = constants.%.8] +// CHECK:STDOUT: %.loc40_30.2: i32 = converted %int.snegate, %.loc40_30.1 [template = constants.%.8] +// CHECK:STDOUT: %int.left_shift.loc40: init i32 = call %LeftShift.ref.loc40(%.loc40_31, %.loc40_30.2) [template = ] +// CHECK:STDOUT: %.loc40_44.1: i32 = value_of_initializer %int.left_shift.loc40 [template = ] +// CHECK:STDOUT: %.loc40_44.2: i32 = converted %int.left_shift.loc40, %.loc40_44.1 [template = ] // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc40_44.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index 97c596e1a126..aaf5cf7ab8b1 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -102,9 +102,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Less.ref.loc9: = name_ref Less, file.%Less [template = file.%Less] // CHECK:STDOUT: %.loc9_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_24: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_20: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_24) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %.loc9_20 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %.loc9_20, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_24) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less.loc9, %.loc9_13.1 [template = constants.%.6] // 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: @@ -121,9 +121,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Less.ref.loc10: = name_ref Less, file.%Less [template = file.%Less] // CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_21: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_25) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %.loc10_21 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %.loc10_21, %.loc10_14.1 [template = constants.%.7] +// CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_25) [template = constants.%.7] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.less.loc10 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.less.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: @@ -140,9 +140,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Less.ref.loc11: = name_ref Less, file.%Less [template = file.%Less] // CHECK:STDOUT: %.loc11_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_25: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_21: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_25) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_21 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_21, %.loc11_14.1 [template = constants.%.7] +// CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_25) [template = constants.%.7] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less.loc11 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less.loc11, %.loc11_14.1 [template = constants.%.7] // 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: @@ -159,13 +159,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Less.ref.loc12: = name_ref Less, file.%Less [template = file.%Less] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc12_28: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_27: init i32 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.9] +// 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] -// CHECK:STDOUT: %.loc12_20.1: i32 = value_of_initializer %.loc12_27 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_20.2: i32 = converted %.loc12_27, %.loc12_20.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_20.3: init bool = call %Less.ref.loc12(%.loc12_20.2, %.loc12_32) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %.loc12_20.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %.loc12_20.3, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_20.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_20.2: i32 = converted %int.snegate.loc12, %.loc12_20.1 [template = constants.%.9] +// CHECK:STDOUT: %int.less.loc12: init bool = call %Less.ref.loc12(%.loc12_20.2, %.loc12_32) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less.loc12, %.loc12_13.1 [template = constants.%.6] // 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: @@ -183,12 +183,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc13_22: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc13_32: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_31: init i32 = call %Negate.ref.loc13(%.loc13_32) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_21.1: i32 = value_of_initializer %.loc13_31 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_21.2: i32 = converted %.loc13_31, %.loc13_21.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_21.3: init bool = call %Less.ref.loc13(%.loc13_22, %.loc13_21.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %.loc13_21.3 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %.loc13_21.3, %.loc13_14.1 [template = constants.%.7] +// 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] +// CHECK:STDOUT: %.loc13_21.2: i32 = converted %int.snegate.loc13, %.loc13_21.1 [template = constants.%.9] +// CHECK:STDOUT: %int.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 %int.less.loc13 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less.loc13, %.loc13_14.1 [template = constants.%.7] // 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: @@ -209,9 +209,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Less.ref: = name_ref Less, file.%Less [template = file.%Less] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc17_14: init bool = call %Less.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_20.1: bool = value_of_initializer %.loc17_14 -// CHECK:STDOUT: %.loc17_20.2: bool = converted %.loc17_14, %.loc17_20.1 +// CHECK:STDOUT: %int.less: init bool = call %Less.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc17_20.1: bool = value_of_initializer %int.less +// CHECK:STDOUT: %.loc17_20.2: bool = converted %int.less, %.loc17_20.1 // CHECK:STDOUT: return %.loc17_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index fe4151ae8765..76796942efee 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -102,9 +102,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %LessEq.ref.loc9: = name_ref LessEq, file.%LessEq [template = file.%LessEq] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_26: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_22: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %.loc9_22 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %.loc9_22, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_26) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less_eq.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less_eq.loc9, %.loc9_13.1 [template = constants.%.6] // 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: @@ -121,9 +121,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %LessEq.ref.loc10: = name_ref LessEq, file.%LessEq [template = file.%LessEq] // CHECK:STDOUT: %.loc10_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_22: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %.loc10_22 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %.loc10_22, %.loc10_13.1 [template = constants.%.6] +// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_26) [template = constants.%.6] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.less_eq.loc10, %.loc10_13.1 [template = constants.%.6] // 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: @@ -140,9 +140,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %LessEq.ref.loc11: = name_ref LessEq, file.%LessEq [template = file.%LessEq] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_23: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_23 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_23, %.loc11_14.1 [template = constants.%.8] +// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less_eq.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: @@ -159,13 +159,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %LessEq.ref.loc12: = name_ref LessEq, file.%LessEq [template = file.%LessEq] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc12_30: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_29: init i32 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.9] +// 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] -// CHECK:STDOUT: %.loc12_22.1: i32 = value_of_initializer %.loc12_29 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_22.2: i32 = converted %.loc12_29, %.loc12_22.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_22.3: init bool = call %LessEq.ref.loc12(%.loc12_22.2, %.loc12_34) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %.loc12_22.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %.loc12_22.3, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_22.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_22.2: i32 = converted %int.snegate.loc12, %.loc12_22.1 [template = constants.%.9] +// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_22.2, %.loc12_34) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less_eq.loc12, %.loc12_13.1 [template = constants.%.6] // 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: @@ -183,12 +183,12 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_33: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %.loc13_33 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.2: i32 = converted %.loc13_33, %.loc13_23.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_23.3: init bool = call %LessEq.ref.loc13(%.loc13_24, %.loc13_23.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %.loc13_23.3 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %.loc13_23.3, %.loc13_14.1 [template = constants.%.8] +// 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] +// CHECK:STDOUT: %.loc13_23.2: i32 = converted %int.snegate.loc13, %.loc13_23.1 [template = constants.%.9] +// CHECK:STDOUT: %int.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 %int.less_eq.loc13 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less_eq.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: @@ -209,9 +209,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %LessEq.ref: = name_ref LessEq, file.%LessEq [template = file.%LessEq] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc17_16: init bool = call %LessEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_22.1: bool = value_of_initializer %.loc17_16 -// CHECK:STDOUT: %.loc17_22.2: bool = converted %.loc17_16, %.loc17_22.1 +// CHECK:STDOUT: %int.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc17_22.1: bool = value_of_initializer %int.less_eq +// CHECK:STDOUT: %.loc17_22.2: bool = converted %int.less_eq, %.loc17_22.1 // CHECK:STDOUT: return %.loc17_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_32.carbon b/toolchain/check/testdata/builtins/int/make_type_32.carbon index 4c3916ddf256..c9077b306c2b 100644 --- a/toolchain/check/testdata/builtins/int/make_type_32.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_32.carbon @@ -48,9 +48,9 @@ var i: Int() = 0; // CHECK:STDOUT: %import_ref: = import_ref ir2, inst+3, loc_11 [template = imports.%Int] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc6_11: init type = call %Int.ref() [template = i32] -// CHECK:STDOUT: %.loc6_12.1: type = value_of_initializer %.loc6_11 [template = i32] -// CHECK:STDOUT: %.loc6_12.2: type = converted %.loc6_11, %.loc6_12.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32: init type = call %Int.ref() [template = i32] +// CHECK:STDOUT: %.loc6_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc6_12.2: type = converted %int.make_type_32, %.loc6_12.1 [template = i32] // CHECK:STDOUT: %i.var: ref i32 = var i // CHECK:STDOUT: %i: ref i32 = bind_name i, %i.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 294c1b2ba181..b5fdf6bbdaa1 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -105,31 +105,31 @@ var m: Int(1000000000); // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %Int.ref.loc6_9: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc6_13: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %.loc6_12 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.2: type = converted %.loc6_12, %.loc6_15.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.2] +// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.2] // 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: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc6_25: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %.loc6_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.2: type = converted %.loc6_24, %.loc6_27.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.2] +// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_24, %.loc6_27.1 [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref i64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %Int.ref.loc10_9: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc10_13: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %.loc10_12 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_12, %.loc10_15.1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.4] // 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: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %.loc10_24 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.2: type = converted %.loc10_24, %.loc10_27.1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.4] // CHECK:STDOUT: @G.%return: ref i13 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { @@ -137,16 +137,16 @@ var m: Int(1000000000); // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N, %N.loc14_13.1 [symbolic] // CHECK:STDOUT: %Int.ref.loc14_25: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %N.ref.loc14_29: i32 = name_ref N, @Symbolic.%N [symbolic = @Symbolic.%N] -// CHECK:STDOUT: %.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %.loc14_28 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_30.2: type = converted %.loc14_28, %.loc14_30.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = constants.%.5] // 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: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %N.ref.loc14_40: i32 = name_ref N, @Symbolic.%N [symbolic = @Symbolic.%N] -// CHECK:STDOUT: %.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %.loc14_39 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_41.2: type = converted %.loc14_39, %.loc14_41.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_41.2: type = converted %int.make_type_signed.loc14_39, %.loc14_41.1 [symbolic = constants.%.5] // CHECK:STDOUT: @Symbolic.%return: ref Core.Int(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -187,9 +187,9 @@ var m: Int(1000000000); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc10_12: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_11: init type = call %Int.ref(%.loc10_12) [template = ] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %.loc10_11 [template = ] -// CHECK:STDOUT: %.loc10_13.2: type = converted %.loc10_11, %.loc10_13.1 [template = ] +// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc10_12) [template = ] +// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_signed [template = ] +// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_signed, %.loc10_13.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n // CHECK:STDOUT: %n: ref = bind_name n, %n.var // CHECK:STDOUT: } @@ -220,12 +220,12 @@ var m: Int(1000000000); // CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_19: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_18: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_11.1: i32 = value_of_initializer %.loc12_18 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_11.2: i32 = converted %.loc12_18, %.loc12_11.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_11.3: init type = call %Int.ref(%.loc12_11.2) [template = ] -// CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %.loc12_11.3 [template = ] -// CHECK:STDOUT: %.loc12_21.2: type = converted %.loc12_11.3, %.loc12_21.1 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.2] +// CHECK:STDOUT: %.loc12_11.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] +// CHECK:STDOUT: %.loc12_11.2: i32 = converted %int.snegate, %.loc12_11.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc12_11.2) [template = ] +// CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_signed [template = ] +// CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_signed, %.loc12_21.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n // CHECK:STDOUT: %n.loc12: ref = bind_name n, %n.var // CHECK:STDOUT: } @@ -250,9 +250,9 @@ var m: Int(1000000000); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] // CHECK:STDOUT: %.loc9_12: i32 = int_literal 1000000000 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_11: init type = call %Int.ref(%.loc9_12) [template = ] -// CHECK:STDOUT: %.loc9_22.1: type = value_of_initializer %.loc9_11 [template = ] -// CHECK:STDOUT: %.loc9_22.2: type = converted %.loc9_11, %.loc9_22.1 [template = ] +// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc9_12) [template = ] +// CHECK:STDOUT: %.loc9_22.1: type = value_of_initializer %int.make_type_signed [template = ] +// CHECK:STDOUT: %.loc9_22.2: type = converted %int.make_type_signed, %.loc9_22.1 [template = ] // CHECK:STDOUT: %m.var: ref = var m // CHECK:STDOUT: %m: ref = bind_name m, %m.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 97f4b2b5acce..4279ce617975 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -105,31 +105,31 @@ var m: UInt(1000000000); // CHECK:STDOUT: %F: = fn_decl @F [template] { // CHECK:STDOUT: %UInt.ref.loc6_9: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %.loc6_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.2: type = converted %.loc6_13, %.loc6_16.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.2] +// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.2] // 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: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc6_27: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %.loc6_26 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.2: type = converted %.loc6_26, %.loc6_29.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.2] +// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_26, %.loc6_29.1 [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref u64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G: = fn_decl @G [template] { // CHECK:STDOUT: %UInt.ref.loc10_9: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc10_14: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %.loc10_13 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.2: type = converted %.loc10_13, %.loc10_16.1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.4] // 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: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc10_27: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %.loc10_26 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.2: type = converted %.loc10_26, %.loc10_29.1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.4] // CHECK:STDOUT: @G.%return: ref u13 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { @@ -137,16 +137,16 @@ var m: UInt(1000000000); // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N, %N.loc14_13.1 [symbolic] // CHECK:STDOUT: %UInt.ref.loc14_25: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %N.ref.loc14_30: i32 = name_ref N, @Symbolic.%N [symbolic = @Symbolic.%N] -// CHECK:STDOUT: %.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %.loc14_29 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_31.2: type = converted %.loc14_29, %.loc14_31.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = constants.%.5] // 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: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %N.ref.loc14_42: i32 = name_ref N, @Symbolic.%N [symbolic = @Symbolic.%N] -// CHECK:STDOUT: %.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %.loc14_41 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_43.2: type = converted %.loc14_41, %.loc14_43.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc14_43.2: type = converted %int.make_type_unsigned.loc14_41, %.loc14_43.1 [symbolic = constants.%.5] // CHECK:STDOUT: @Symbolic.%return: ref Core.UInt(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -187,9 +187,9 @@ var m: UInt(1000000000); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc10_13: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_12: init type = call %UInt.ref(%.loc10_13) [template = ] -// CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %.loc10_12 [template = ] -// CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_12, %.loc10_14.1 [template = ] +// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc10_13) [template = ] +// CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_unsigned [template = ] +// CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_unsigned, %.loc10_14.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n // CHECK:STDOUT: %n: ref = bind_name n, %n.var // CHECK:STDOUT: } @@ -220,12 +220,12 @@ var m: UInt(1000000000); // CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_20: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_19: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_12.1: i32 = value_of_initializer %.loc12_19 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_12.2: i32 = converted %.loc12_19, %.loc12_12.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_12.3: init type = call %UInt.ref(%.loc12_12.2) [template = ] -// CHECK:STDOUT: %.loc12_22.1: type = value_of_initializer %.loc12_12.3 [template = ] -// CHECK:STDOUT: %.loc12_22.2: type = converted %.loc12_12.3, %.loc12_22.1 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.2] +// CHECK:STDOUT: %.loc12_12.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] +// CHECK:STDOUT: %.loc12_12.2: i32 = converted %int.snegate, %.loc12_12.1 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc12_12.2) [template = ] +// CHECK:STDOUT: %.loc12_22.1: type = value_of_initializer %int.make_type_unsigned [template = ] +// CHECK:STDOUT: %.loc12_22.2: type = converted %int.make_type_unsigned, %.loc12_22.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n // CHECK:STDOUT: %n.loc12: ref = bind_name n, %n.var // CHECK:STDOUT: } @@ -250,9 +250,9 @@ var m: UInt(1000000000); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] // CHECK:STDOUT: %.loc9_13: i32 = int_literal 1000000000 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_12: init type = call %UInt.ref(%.loc9_13) [template = ] -// CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %.loc9_12 [template = ] -// CHECK:STDOUT: %.loc9_23.2: type = converted %.loc9_12, %.loc9_23.1 [template = ] +// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc9_13) [template = ] +// CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_unsigned [template = ] +// CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_unsigned, %.loc9_23.1 [template = ] // CHECK:STDOUT: %m.var: ref = var m // CHECK:STDOUT: %m: ref = bind_name m, %m.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index 8374a6fff700..223432d3fff4 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -88,9 +88,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Neq.ref.loc8: = name_ref Neq, file.%Neq [template = file.%Neq] // CHECK:STDOUT: %.loc8_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_24: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_20: init bool = call %Neq.ref.loc8(%.loc8_21, %.loc8_24) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_14.1: bool = value_of_initializer %.loc8_20 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_14.2: bool = converted %.loc8_20, %.loc8_14.1 [template = constants.%.5] +// CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21, %.loc8_24) [template = constants.%.5] +// CHECK:STDOUT: %.loc8_14.1: bool = value_of_initializer %int.neq.loc8 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_14.2: bool = converted %int.neq.loc8, %.loc8_14.1 [template = constants.%.5] // CHECK:STDOUT: if %.loc8_14.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8: @@ -107,9 +107,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Neq.ref.loc9: = name_ref Neq, file.%Neq [template = file.%Neq] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_19: init bool = call %Neq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %.loc9_19 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %.loc9_19, %.loc9_13.1 [template = constants.%.7] +// CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.neq.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.neq.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: @@ -130,9 +130,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Neq.ref: = name_ref Neq, file.%Neq [template = file.%Neq] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc13_13: init bool = call %Neq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc13_19.1: bool = value_of_initializer %.loc13_13 -// CHECK:STDOUT: %.loc13_19.2: bool = converted %.loc13_13, %.loc13_19.1 +// CHECK:STDOUT: %int.neq: init bool = call %Neq.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc13_19.1: bool = value_of_initializer %int.neq +// CHECK:STDOUT: %.loc13_19.2: bool = converted %int.neq, %.loc13_19.1 // CHECK:STDOUT: return %.loc13_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 535ed7407aed..64a099e45abe 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -43,8 +43,8 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Or.ref: = name_ref Or, %Or [template = %Or] // CHECK:STDOUT: %.loc4_19: i32 = int_literal 12 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_18: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_26: type = array_type %.loc4_18, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_26: type = array_type %int.or, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 14] = var arr // CHECK:STDOUT: %arr: ref [i32; 14] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 14 [template = constants.%.3] @@ -69,9 +69,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Or.ref: = name_ref Or, file.%Or [template = file.%Or] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_12: init i32 = call %Or.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_18.1: i32 = value_of_initializer %.loc8_12 -// CHECK:STDOUT: %.loc8_18.2: i32 = converted %.loc8_12, %.loc8_18.1 +// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_18.1: i32 = value_of_initializer %int.or +// CHECK:STDOUT: %.loc8_18.2: i32 = converted %int.or, %.loc8_18.1 // CHECK:STDOUT: return %.loc8_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 3a3dc66cd1da..1cb9304ede4c 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -88,8 +88,8 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift.ref: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc4_27: i32 = int_literal 22 [template = constants.%.1] // CHECK:STDOUT: %.loc4_31: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_26: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_33: type = array_type %.loc4_26, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_33: type = array_type %int.right_shift, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 5] = var arr // CHECK:STDOUT: %arr: ref [i32; 5] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 5 [template = constants.%.3] @@ -114,9 +114,9 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift.ref: = name_ref RightShift, file.%RightShift [template = file.%RightShift] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_20: init i32 = call %RightShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_26.1: i32 = value_of_initializer %.loc8_20 -// CHECK:STDOUT: %.loc8_26.2: i32 = converted %.loc8_20, %.loc8_26.1 +// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_26.1: i32 = value_of_initializer %int.right_shift +// CHECK:STDOUT: %.loc8_26.2: i32 = converted %int.right_shift, %.loc8_26.1 // CHECK:STDOUT: return %.loc8_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -161,15 +161,15 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift.ref.loc10: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %Negate.ref.loc10_35: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc10_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.2] // CHECK:STDOUT: %.loc10_46: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %.loc10_41 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %.loc10_41, %.loc10_34.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_34.3: init i32 = call %RightShift.ref.loc10(%.loc10_34.2, %.loc10_46) [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %.loc10_34.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23.2: i32 = converted %.loc10_34.3, %.loc10_23.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23.3: init i32 = call %Negate.ref.loc10_17(%.loc10_23.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc10_49: type = array_type %.loc10_23.3, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.snegate.loc10_41 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.snegate.loc10_41, %.loc10_34.1 [template = constants.%.2] +// CHECK:STDOUT: %int.right_shift.loc10: init i32 = call %RightShift.ref.loc10(%.loc10_34.2, %.loc10_46) [template = constants.%.2] +// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.right_shift.loc10, %.loc10_23.1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_23.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc10_49: type = array_type %int.snegate.loc10_23, i32 [template = constants.%.3] // CHECK:STDOUT: %arr1.var: ref [i32; 1] = var arr1 // CHECK:STDOUT: %arr1: ref [i32; 1] = bind_name arr1, %arr1.var // CHECK:STDOUT: %.loc11_19: i32 = int_literal 1 [template = constants.%.1] @@ -182,15 +182,15 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift.ref.loc14: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %Negate.ref.loc14_35: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc14_42: i32 = int_literal 10 [template = constants.%.5] -// CHECK:STDOUT: %.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.6] +// CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.6] // CHECK:STDOUT: %.loc14_47: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %.loc14_41 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_34.2: i32 = converted %.loc14_41, %.loc14_34.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_34.3: init i32 = call %RightShift.ref.loc14(%.loc14_34.2, %.loc14_47) [template = constants.%.8] -// CHECK:STDOUT: %.loc14_23.1: i32 = value_of_initializer %.loc14_34.3 [template = constants.%.8] -// CHECK:STDOUT: %.loc14_23.2: i32 = converted %.loc14_34.3, %.loc14_23.1 [template = constants.%.8] -// CHECK:STDOUT: %.loc14_23.3: init i32 = call %Negate.ref.loc14_17(%.loc14_23.2) [template = constants.%.9] -// CHECK:STDOUT: %.loc14_50: type = array_type %.loc14_23.3, i32 [template = constants.%.10] +// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %int.snegate.loc14_41 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_34.2: i32 = converted %int.snegate.loc14_41, %.loc14_34.1 [template = constants.%.6] +// CHECK:STDOUT: %int.right_shift.loc14: init i32 = call %RightShift.ref.loc14(%.loc14_34.2, %.loc14_47) [template = constants.%.8] +// CHECK:STDOUT: %.loc14_23.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_23.2: i32 = converted %int.right_shift.loc14, %.loc14_23.1 [template = constants.%.8] +// CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_23.2) [template = constants.%.9] +// CHECK:STDOUT: %.loc14_50: type = array_type %int.snegate.loc14_23, i32 [template = constants.%.10] // CHECK:STDOUT: %arr2.var: ref [i32; 3] = var arr2 // CHECK:STDOUT: %arr2: ref [i32; 3] = bind_name arr2, %arr2.var // CHECK:STDOUT: %.loc15_19: i32 = int_literal 3 [template = constants.%.9] @@ -238,34 +238,34 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift.ref.loc8: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc8_33: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_29: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %.loc8_29 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.2: i32 = converted %.loc8_29, %.loc8_36.1 [template = constants.%.3] +// CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.3] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_36.2 // CHECK:STDOUT: %RightShift.ref.loc13: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc13_30: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc13_33: i32 = int_literal 32 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_29: init i32 = call %RightShift.ref.loc13(%.loc13_30, %.loc13_33) [template = ] -// CHECK:STDOUT: %.loc13_36.1: i32 = value_of_initializer %.loc13_29 [template = ] -// CHECK:STDOUT: %.loc13_36.2: i32 = converted %.loc13_29, %.loc13_36.1 [template = ] +// 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: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc18_30: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc18_33: i32 = int_literal 33 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_29: init i32 = call %RightShift.ref.loc18(%.loc18_30, %.loc18_33) [template = ] -// CHECK:STDOUT: %.loc18_36.1: i32 = value_of_initializer %.loc18_29 [template = ] -// CHECK:STDOUT: %.loc18_36.2: i32 = converted %.loc18_29, %.loc18_36.1 [template = ] +// 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: = name_ref RightShift, %RightShift [template = %RightShift] // CHECK:STDOUT: %.loc24_32: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc24_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc24_41: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.6] -// CHECK:STDOUT: %.loc24_31.1: i32 = value_of_initializer %.loc24_41 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_31.2: i32 = converted %.loc24_41, %.loc24_31.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_31.3: init i32 = call %RightShift.ref.loc24(%.loc24_32, %.loc24_31.2) [template = ] -// CHECK:STDOUT: %.loc24_45.1: i32 = value_of_initializer %.loc24_31.3 [template = ] -// CHECK:STDOUT: %.loc24_45.2: i32 = converted %.loc24_31.3, %.loc24_45.1 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.6] +// CHECK:STDOUT: %.loc24_31.1: i32 = value_of_initializer %int.snegate [template = constants.%.6] +// CHECK:STDOUT: %.loc24_31.2: i32 = converted %int.snegate, %.loc24_31.1 [template = constants.%.6] +// CHECK:STDOUT: %int.right_shift.loc24: init i32 = call %RightShift.ref.loc24(%.loc24_32, %.loc24_31.2) [template = ] +// CHECK:STDOUT: %.loc24_45.1: i32 = value_of_initializer %int.right_shift.loc24 [template = ] +// CHECK:STDOUT: %.loc24_45.2: i32 = converted %int.right_shift.loc24, %.loc24_45.1 [template = ] // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc24_45.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 5971968bfaeb..8831c6c8483c 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -113,8 +113,8 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.sadd, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.3] @@ -139,9 +139,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Add.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.sadd +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.sadd, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -198,29 +198,29 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25_27: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc25_26: init i32 = call %TooFew.ref(%.loc25_27) +// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.1] +// 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: = name_ref TooMany, %TooMany [template = %TooMany] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc30_28: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) +// 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: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] // CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc35_41: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) +// 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: = name_ref JustRight, %JustRight [template = %JustRight] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc44_37: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc44_30: init i32 = call %JustRight.ref() [template = ] -// CHECK:STDOUT: %.loc44_39: type = array_type %.loc44_30, i32 [template = ] +// CHECK:STDOUT: %int.sadd: init i32 = call %JustRight.ref() [template = ] +// 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: = fn_decl @RuntimeCallTooFew [template] { @@ -258,9 +258,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc47_16: init i32 = call %TooFew.ref(%a.ref) -// CHECK:STDOUT: %.loc47_19.1: i32 = value_of_initializer %.loc47_16 -// CHECK:STDOUT: %.loc47_19.2: i32 = converted %.loc47_16, %.loc47_19.1 +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) +// CHECK:STDOUT: %.loc47_19.1: i32 = value_of_initializer %TooFew.call +// CHECK:STDOUT: %.loc47_19.2: i32 = converted %TooFew.call, %.loc47_19.1 // CHECK:STDOUT: return %.loc47_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -270,9 +270,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // 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 -// CHECK:STDOUT: %.loc51_17: init i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) -// CHECK:STDOUT: %.loc51_26.1: i32 = value_of_initializer %.loc51_17 -// CHECK:STDOUT: %.loc51_26.2: i32 = converted %.loc51_17, %.loc51_26.1 +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) +// CHECK:STDOUT: %.loc51_26.1: i32 = value_of_initializer %TooMany.call +// CHECK:STDOUT: %.loc51_26.2: i32 = converted %TooMany.call, %.loc51_26.1 // CHECK:STDOUT: return %.loc51_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -281,9 +281,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc55_23: init bool = call %BadReturnType.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc55_29.1: bool = value_of_initializer %.loc55_23 -// CHECK:STDOUT: %.loc55_29.2: bool = converted %.loc55_23, %.loc55_29.1 +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc55_29.1: bool = value_of_initializer %BadReturnType.call +// CHECK:STDOUT: %.loc55_29.2: bool = converted %BadReturnType.call, %.loc55_29.1 // CHECK:STDOUT: return %.loc55_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -312,16 +312,16 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref.loc6: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 2147483647 [template = constants.%.1] // CHECK:STDOUT: %.loc6_30: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_17: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %.loc6_17 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %.loc6_17, %.loc6_32.1 [template = constants.%.1] +// CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.1] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.1] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Add.ref.loc10: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 2147483647 [template = constants.%.1] // CHECK:STDOUT: %.loc10_30: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_17: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %.loc10_17 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.2: i32 = converted %.loc10_17, %.loc10_32.1 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %int.sadd.loc10 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_32.2: i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%.4] // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_32.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 8178c5a1bcee..8b8862b8d682 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -81,8 +81,8 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.sdiv, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] @@ -107,9 +107,9 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Div.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.sdiv +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.sdiv, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -153,53 +153,53 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] // CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.5: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %.loc9_17.5 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %.loc9_17.5, %.loc9_49.1 [template = constants.%.1] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.sdiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.1] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.1] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Div.ref.loc12: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_28: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %.loc12_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %.loc12_28, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.3: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] // CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %.loc12_21.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %.loc12_21.3, %.loc12_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.3: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %.loc12_17.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %.loc12_17.3, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.5] +// CHECK:STDOUT: %int.sdiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Div.ref.loc19: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Sub.ref.loc19: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc19_22: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc19_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.2] // CHECK:STDOUT: %.loc19_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %.loc19_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc19_21.2: i32 = converted %.loc19_28, %.loc19_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc19_21.3: init i32 = call %Sub.ref.loc19(%.loc19_21.2, %.loc19_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.2] +// CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.snegate.loc19_28, %.loc19_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_21.2, %.loc19_43) [template = constants.%.5] // CHECK:STDOUT: %Negate.ref.loc19_47: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc19_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc19_17.1: i32 = value_of_initializer %.loc19_21.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_17.2: i32 = converted %.loc19_21.3, %.loc19_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_17.3: i32 = value_of_initializer %.loc19_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_17.4: i32 = converted %.loc19_53, %.loc19_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_17.5: init i32 = call %Div.ref.loc19(%.loc19_17.2, %.loc19_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %.loc19_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.2: i32 = converted %.loc19_17.5, %.loc19_57.1 [template = constants.%.5] +// CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.4] +// CHECK:STDOUT: %.loc19_17.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_17.2: i32 = converted %int.ssub.loc19, %.loc19_17.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_17.3: i32 = value_of_initializer %int.snegate.loc19_53 [template = constants.%.4] +// CHECK:STDOUT: %.loc19_17.4: i32 = converted %int.snegate.loc19_53, %.loc19_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.sdiv.loc19: init i32 = call %Div.ref.loc19(%.loc19_17.2, %.loc19_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_57.2: i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%.5] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc19_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -232,16 +232,16 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_17: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] -// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %.loc10_17 [template = ] -// CHECK:STDOUT: %.loc10_23.2: i32 = converted %.loc10_17, %.loc10_23.1 [template = ] +// 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: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_17: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] -// CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %.loc15_17 [template = ] -// CHECK:STDOUT: %.loc15_23.2: i32 = converted %.loc15_17, %.loc15_23.1 [template = ] +// CHECK:STDOUT: %int.sdiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] +// CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.sdiv.loc15 [template = ] +// CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.sdiv.loc15, %.loc15_23.1 [template = ] // CHECK:STDOUT: %b.loc15: i32 = bind_name b, %.loc15_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index a1c47ff64120..26a9263af007 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -84,8 +84,8 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.smod, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.3] @@ -110,9 +110,9 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref: = name_ref Mod, file.%Mod [template = file.%Mod] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Mod.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.smod +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.smod, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -157,53 +157,53 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref.loc9: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] // CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.5: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %.loc9_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %.loc9_17.5, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.smod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.5] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_28: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %.loc12_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %.loc12_28, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.3: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] // CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %.loc12_21.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %.loc12_21.3, %.loc12_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.3: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %.loc12_17.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %.loc12_17.3, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.6] +// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Mod.ref.loc20: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Sub.ref.loc20: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc20_22: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc20_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.2] // CHECK:STDOUT: %.loc20_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %.loc20_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc20_21.2: i32 = converted %.loc20_28, %.loc20_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc20_21.3: init i32 = call %Sub.ref.loc20(%.loc20_21.2, %.loc20_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.2] +// CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.snegate.loc20_28, %.loc20_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_21.2, %.loc20_43) [template = constants.%.6] // CHECK:STDOUT: %Negate.ref.loc20_47: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc20_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc20_17.1: i32 = value_of_initializer %.loc20_21.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_17.2: i32 = converted %.loc20_21.3, %.loc20_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_17.3: i32 = value_of_initializer %.loc20_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_17.4: i32 = converted %.loc20_53, %.loc20_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_17.5: init i32 = call %Mod.ref.loc20(%.loc20_17.2, %.loc20_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %.loc20_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.2: i32 = converted %.loc20_17.5, %.loc20_57.1 [template = constants.%.5] +// CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.4] +// CHECK:STDOUT: %.loc20_17.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.6] +// CHECK:STDOUT: %.loc20_17.2: i32 = converted %int.ssub.loc20, %.loc20_17.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc20_17.3: i32 = value_of_initializer %int.snegate.loc20_53 [template = constants.%.4] +// CHECK:STDOUT: %.loc20_17.4: i32 = converted %int.snegate.loc20_53, %.loc20_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.smod.loc20: init i32 = call %Mod.ref.loc20(%.loc20_17.2, %.loc20_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %int.smod.loc20 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_57.2: i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%.5] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc20_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -236,16 +236,16 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_17: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] -// CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %.loc12_17 [template = ] -// CHECK:STDOUT: %.loc12_23.2: i32 = converted %.loc12_17, %.loc12_23.1 [template = ] +// 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: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] -// CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %.loc17_17 [template = ] -// CHECK:STDOUT: %.loc17_23.2: i32 = converted %.loc17_17, %.loc17_23.1 [template = ] +// CHECK:STDOUT: %int.smod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] +// CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.smod.loc17 [template = ] +// CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.smod.loc17, %.loc17_23.1 [template = ] // CHECK:STDOUT: %b.loc17: i32 = bind_name b, %.loc17_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 44abafaafba9..015d19ffc2d9 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -55,8 +55,8 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.smul, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] @@ -81,9 +81,9 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Mul.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.smul +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.smul, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -113,16 +113,16 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref.loc6: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.1] // CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_17: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %.loc6_17 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %.loc6_17, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 // CHECK:STDOUT: %Mul.ref.loc10: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 32768 [template = constants.%.4] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_17: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %.loc10_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %.loc10_17, %.loc10_34.1 [template = constants.%.5] +// CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.smul.loc10 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 1a5d811b299e..bbb90d039983 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -139,11 +139,11 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate.ref.loc4_16: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc4_23: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.2: i32 = converted %.loc4_29, %.loc4_22.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.3: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.3, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.snegate.loc4_29, %.loc4_22.1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_35: type = array_type %int.snegate.loc4_22, i32 [template = constants.%.3] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.1] @@ -154,9 +154,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 // CHECK:STDOUT: %Negate.ref.loc7: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_20: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %.loc7_20 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %.loc7_20, %.loc7_23.1 [template = constants.%.6] +// CHECK:STDOUT: %int.snegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate.loc7, %.loc7_23.1 [template = constants.%.6] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 // CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { // CHECK:STDOUT: %a.loc9_16.1: i32 = param a @@ -173,9 +173,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc10_16: init i32 = call %Negate.ref(%a.ref) -// CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %.loc10_16 -// CHECK:STDOUT: %.loc10_19.2: i32 = converted %.loc10_16, %.loc10_19.1 +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%a.ref) +// CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.snegate +// CHECK:STDOUT: %.loc10_19.2: i32 = converted %int.snegate, %.loc10_19.1 // CHECK:STDOUT: return %.loc10_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -223,25 +223,25 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25: init i32 = call %TooFew.ref() +// 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: = name_ref TooMany, %TooMany [template = %TooMany] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_28: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) +// 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: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_41: init bool = call %BadReturnType.ref(%.loc35_42) +// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.1] +// 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: = name_ref JustRight, %JustRight [template = %JustRight] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc44_30: init i32 = call %JustRight.ref() [template = ] -// CHECK:STDOUT: %.loc44_36: type = array_type %.loc44_30, i32 [template = ] +// CHECK:STDOUT: %int.snegate: init i32 = call %JustRight.ref() [template = ] +// 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: = fn_decl @RuntimeCallTooFew [template] { @@ -279,9 +279,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc54_16: init i32 = call %TooFew.ref() [template = ] -// CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %.loc54_16 [template = ] -// CHECK:STDOUT: %.loc54_19.2: i32 = converted %.loc54_16, %.loc54_19.1 [template = ] +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] +// CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] +// CHECK:STDOUT: %.loc54_19.2: i32 = converted %TooFew.call, %.loc54_19.1 [template = ] // CHECK:STDOUT: return %.loc54_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -291,9 +291,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // 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 -// CHECK:STDOUT: %.loc65_17: init i32 = call %TooMany.ref() [template = ] -// CHECK:STDOUT: %.loc65_26.1: i32 = value_of_initializer %.loc65_17 [template = ] -// CHECK:STDOUT: %.loc65_26.2: i32 = converted %.loc65_17, %.loc65_26.1 [template = ] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref() [template = ] +// CHECK:STDOUT: %.loc65_26.1: i32 = value_of_initializer %TooMany.call [template = ] +// CHECK:STDOUT: %.loc65_26.2: i32 = converted %TooMany.call, %.loc65_26.1 [template = ] // CHECK:STDOUT: return %.loc65_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -302,9 +302,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc76_23: init bool = call %BadReturnType.ref() [template = ] -// CHECK:STDOUT: %.loc76_29.1: bool = value_of_initializer %.loc76_23 [template = ] -// CHECK:STDOUT: %.loc76_29.2: bool = converted %.loc76_23, %.loc76_29.1 [template = ] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] +// CHECK:STDOUT: %.loc76_29.1: bool = value_of_initializer %BadReturnType.call [template = ] +// CHECK:STDOUT: %.loc76_29.2: bool = converted %BadReturnType.call, %.loc76_29.1 [template = ] // CHECK:STDOUT: return %.loc76_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -339,27 +339,27 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate.ref.loc8_14: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.2: i32 = converted %.loc8_27, %.loc8_20.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.3: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %.loc8_20.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %.loc8_20.3, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] +// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.snegate.loc8_27, %.loc8_20.1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.1] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 // CHECK:STDOUT: %Negate.ref.loc14_14: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc14_25: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc14_32: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.2] // CHECK:STDOUT: %.loc14_45: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %.loc14_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_24.2: i32 = converted %.loc14_31, %.loc14_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_24.3: init i32 = call %Sub.ref(%.loc14_24.2, %.loc14_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_20.1: i32 = value_of_initializer %.loc14_24.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_20.2: i32 = converted %.loc14_24.3, %.loc14_20.1 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_20.3: init i32 = call %Negate.ref.loc14_14(%.loc14_20.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %.loc14_20.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.2: i32 = converted %.loc14_20.3, %.loc14_48.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %int.snegate.loc14_31 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_24.2: i32 = converted %int.snegate.loc14_31, %.loc14_24.1 [template = constants.%.2] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc14_24.2, %.loc14_45) [template = constants.%.4] +// CHECK:STDOUT: %.loc14_20.1: i32 = value_of_initializer %int.ssub [template = constants.%.4] +// CHECK:STDOUT: %.loc14_20.2: i32 = converted %int.ssub, %.loc14_20.1 [template = constants.%.4] +// CHECK:STDOUT: %int.snegate.loc14_20: init i32 = call %Negate.ref.loc14_14(%.loc14_20.2) [template = constants.%.4] +// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %int.snegate.loc14_20 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_48.2: i32 = converted %int.snegate.loc14_20, %.loc14_48.1 [template = constants.%.4] // CHECK:STDOUT: %b.loc14: i32 = bind_name b, %.loc14_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 803e2ea3ed61..21e69183d6c4 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -56,8 +56,8 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.ssub, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] @@ -82,9 +82,9 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Sub.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.ssub +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.ssub, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -115,33 +115,33 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref.loc6: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_17: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %.loc6_17 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %.loc6_17, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Sub.ref.loc7_14: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Sub.ref.loc7_18: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] // CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.2: i32 = converted %.loc7_21, %.loc7_17.1 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.3: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %.loc7_17.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %.loc7_17.3, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.ssub.loc7_21 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.ssub.loc7_21, %.loc7_17.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 // CHECK:STDOUT: %Sub.ref.loc11_14: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Sub.ref.loc11_18: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc11_22: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc11_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.3] // CHECK:STDOUT: %.loc11_38: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc11_17.1: i32 = value_of_initializer %.loc11_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_17.2: i32 = converted %.loc11_21, %.loc11_17.1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_17.3: init i32 = call %Sub.ref.loc11_14(%.loc11_17.2, %.loc11_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %.loc11_17.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.2: i32 = converted %.loc11_17.3, %.loc11_40.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_17.1: i32 = value_of_initializer %int.ssub.loc11_21 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_17.2: i32 = converted %int.ssub.loc11_21, %.loc11_17.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc11_17: init i32 = call %Sub.ref.loc11_14(%.loc11_17.2, %.loc11_38) [template = constants.%.2] +// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %int.ssub.loc11_17 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_40.2: i32 = converted %int.ssub.loc11_17, %.loc11_40.1 [template = constants.%.2] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc11_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index 852db0c8c1bd..259680c870b7 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -110,8 +110,8 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.uadd, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.3] @@ -136,9 +136,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Add.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.uadd +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.uadd, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -195,29 +195,29 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25_27: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc25_26: init i32 = call %TooFew.ref(%.loc25_27) +// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.1] +// 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: = name_ref TooMany, %TooMany [template = %TooMany] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc30_28: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) +// 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: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] // CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc35_41: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) +// 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: = name_ref JustRight, %JustRight [template = %JustRight] // CHECK:STDOUT: %.loc43_31: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc43_34: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc43_37: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc43_30: init i32 = call %JustRight.ref() [template = ] -// CHECK:STDOUT: %.loc43_39: type = array_type %.loc43_30, i32 [template = ] +// CHECK:STDOUT: %int.uadd: init i32 = call %JustRight.ref() [template = ] +// 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: = fn_decl @RuntimeCallTooFew [template] { @@ -255,9 +255,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc46_16: init i32 = call %TooFew.ref(%a.ref) -// CHECK:STDOUT: %.loc46_19.1: i32 = value_of_initializer %.loc46_16 -// CHECK:STDOUT: %.loc46_19.2: i32 = converted %.loc46_16, %.loc46_19.1 +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) +// CHECK:STDOUT: %.loc46_19.1: i32 = value_of_initializer %TooFew.call +// CHECK:STDOUT: %.loc46_19.2: i32 = converted %TooFew.call, %.loc46_19.1 // CHECK:STDOUT: return %.loc46_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -267,9 +267,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // 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 -// CHECK:STDOUT: %.loc50_17: init i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) -// CHECK:STDOUT: %.loc50_26.1: i32 = value_of_initializer %.loc50_17 -// CHECK:STDOUT: %.loc50_26.2: i32 = converted %.loc50_17, %.loc50_26.1 +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) +// CHECK:STDOUT: %.loc50_26.1: i32 = value_of_initializer %TooMany.call +// CHECK:STDOUT: %.loc50_26.2: i32 = converted %TooMany.call, %.loc50_26.1 // CHECK:STDOUT: return %.loc50_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -278,9 +278,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc54_23: init bool = call %BadReturnType.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc54_29.1: bool = value_of_initializer %.loc54_23 -// CHECK:STDOUT: %.loc54_29.2: bool = converted %.loc54_23, %.loc54_29.1 +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc54_29.1: bool = value_of_initializer %BadReturnType.call +// CHECK:STDOUT: %.loc54_29.2: bool = converted %BadReturnType.call, %.loc54_29.1 // CHECK:STDOUT: return %.loc54_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -309,16 +309,16 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Add.ref.loc7: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc7_18: i32 = int_literal 2147483647 [template = constants.%.1] // CHECK:STDOUT: %.loc7_30: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_17: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %.loc7_17 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.2: i32 = converted %.loc7_17, %.loc7_32.1 [template = constants.%.1] +// CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.1] +// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.1] // CHECK:STDOUT: %a.loc7: i32 = bind_name a, %.loc7_32.2 // CHECK:STDOUT: %Add.ref.loc8: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc8_18: i32 = int_literal 2147483647 [template = constants.%.1] // CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_17: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %.loc8_17 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.2: i32 = converted %.loc8_17, %.loc8_32.1 [template = constants.%.4] +// CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %int.uadd.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_32.2: i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%.4] // CHECK:STDOUT: %b.loc8: i32 = bind_name b, %.loc8_32.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 92a4372a183f..7c0847d23085 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -77,8 +77,8 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.udiv, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] @@ -103,9 +103,9 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Div.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.udiv +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.udiv, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -150,53 +150,53 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] // CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.5: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %.loc9_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %.loc9_17.5, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.udiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.5] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Div.ref.loc12: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_28: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %.loc12_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %.loc12_28, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.3: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] // CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %.loc12_21.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %.loc12_21.3, %.loc12_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.3: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %.loc12_17.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %.loc12_17.3, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.6] +// CHECK:STDOUT: %int.udiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Div.ref.loc15: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %Sub.ref.loc15: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc15_22: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] // CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %.loc15_28, %.loc15_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.3: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.2] +// 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: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %.loc15_21.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_17.2: i32 = converted %.loc15_21.3, %.loc15_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.4: i32 = converted %.loc15_53, %.loc15_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.5: init i32 = call %Div.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %.loc15_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %.loc15_17.5, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] +// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.udiv.loc15 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%.5] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -229,16 +229,16 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_17: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] -// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %.loc10_17 [template = ] -// CHECK:STDOUT: %.loc10_23.2: i32 = converted %.loc10_17, %.loc10_23.1 [template = ] +// 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: = name_ref Div, %Div [template = %Div] // CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_17: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] -// CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %.loc15_17 [template = ] -// CHECK:STDOUT: %.loc15_23.2: i32 = converted %.loc15_17, %.loc15_23.1 [template = ] +// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] +// CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.udiv.loc15 [template = ] +// CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.udiv.loc15, %.loc15_23.1 [template = ] // CHECK:STDOUT: %b.loc15: i32 = bind_name b, %.loc15_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index c113b800ea85..8c06062942bd 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -79,8 +79,8 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.umod, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.3] @@ -105,9 +105,9 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref: = name_ref Mod, file.%Mod [template = file.%Mod] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Mod.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.umod +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.umod, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -152,53 +152,53 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref.loc9: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] // CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.5: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %.loc9_17.5 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %.loc9_17.5, %.loc9_49.1 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.umod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_28: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] // CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %.loc12_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %.loc12_28, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.3: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] // CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %.loc12_21.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %.loc12_21.3, %.loc12_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.3: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %.loc12_17.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %.loc12_17.3, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.5] +// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Mod.ref.loc15: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %Sub.ref.loc15: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc15_22: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] // CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %.loc15_28, %.loc15_21.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.3: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.2] +// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.5] // CHECK:STDOUT: %Negate.ref.loc15_47: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %.loc15_21.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_17.2: i32 = converted %.loc15_21.3, %.loc15_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.4: i32 = converted %.loc15_53, %.loc15_17.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.5: init i32 = call %Mod.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %.loc15_17.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %.loc15_17.5, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] +// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.4] +// CHECK:STDOUT: %int.umod.loc15: init i32 = call %Mod.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.umod.loc15 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%.5] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -231,16 +231,16 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_17: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] -// CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %.loc12_17 [template = ] -// CHECK:STDOUT: %.loc12_23.2: i32 = converted %.loc12_17, %.loc12_23.1 [template = ] +// 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: = name_ref Mod, %Mod [template = %Mod] // CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] -// CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %.loc17_17 [template = ] -// CHECK:STDOUT: %.loc17_23.2: i32 = converted %.loc17_17, %.loc17_23.1 [template = ] +// CHECK:STDOUT: %int.umod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] +// CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.umod.loc17 [template = ] +// CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.umod.loc17, %.loc17_23.1 [template = ] // CHECK:STDOUT: %b.loc17: i32 = bind_name b, %.loc17_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index 487970ba7852..fdbbea802f9d 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -52,8 +52,8 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.umul, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] @@ -78,9 +78,9 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Mul.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.umul +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.umul, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -110,16 +110,16 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Mul.ref.loc6: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.1] // CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_17: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %.loc6_17 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %.loc6_17, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 // CHECK:STDOUT: %Mul.ref.loc7: = name_ref Mul, %Mul [template = %Mul] // CHECK:STDOUT: %.loc7_18: i32 = int_literal 32768 [template = constants.%.4] // CHECK:STDOUT: %.loc7_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_17: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %.loc7_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.2: i32 = converted %.loc7_17, %.loc7_34.1 [template = constants.%.5] +// CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.5] +// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %int.umul.loc7 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_34.2: i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 8214d1a2f762..ebf198b88675 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -135,11 +135,11 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate.ref.loc4_16: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc4_23: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.2: i32 = converted %.loc4_29, %.loc4_22.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.3: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.3, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.unegate.loc4_29, %.loc4_22.1 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_35: type = array_type %int.unegate.loc4_22, i32 [template = constants.%.3] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.1] @@ -150,9 +150,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 // CHECK:STDOUT: %Negate.ref.loc7: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_20: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %.loc7_20 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %.loc7_20, %.loc7_23.1 [template = constants.%.6] +// CHECK:STDOUT: %int.unegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate.loc7 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate.loc7, %.loc7_23.1 [template = constants.%.6] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 // CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { // CHECK:STDOUT: %a.loc9_16.1: i32 = param a @@ -169,9 +169,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref: = name_ref Negate, file.%Negate [template = file.%Negate] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc10_16: init i32 = call %Negate.ref(%a.ref) -// CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %.loc10_16 -// CHECK:STDOUT: %.loc10_19.2: i32 = converted %.loc10_16, %.loc10_19.1 +// CHECK:STDOUT: %int.unegate: init i32 = call %Negate.ref(%a.ref) +// CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.unegate +// CHECK:STDOUT: %.loc10_19.2: i32 = converted %int.unegate, %.loc10_19.1 // CHECK:STDOUT: return %.loc10_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -219,25 +219,25 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25: init i32 = call %TooFew.ref() +// 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: = name_ref TooMany, %TooMany [template = %TooMany] // CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_28: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) +// 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: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_41: init bool = call %BadReturnType.ref(%.loc35_42) +// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.1] +// 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: = name_ref JustRight, %JustRight [template = %JustRight] // CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc44_30: init i32 = call %JustRight.ref() [template = ] -// CHECK:STDOUT: %.loc44_36: type = array_type %.loc44_30, i32 [template = ] +// CHECK:STDOUT: %int.unegate: init i32 = call %JustRight.ref() [template = ] +// 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: = fn_decl @RuntimeCallTooFew [template] { @@ -275,9 +275,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a -// CHECK:STDOUT: %.loc54_16: init i32 = call %TooFew.ref() [template = ] -// CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %.loc54_16 [template = ] -// CHECK:STDOUT: %.loc54_19.2: i32 = converted %.loc54_16, %.loc54_19.1 [template = ] +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] +// CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] +// CHECK:STDOUT: %.loc54_19.2: i32 = converted %TooFew.call, %.loc54_19.1 [template = ] // CHECK:STDOUT: return %.loc54_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -287,9 +287,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // 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 -// CHECK:STDOUT: %.loc65_17: init i32 = call %TooMany.ref() [template = ] -// CHECK:STDOUT: %.loc65_26.1: i32 = value_of_initializer %.loc65_17 [template = ] -// CHECK:STDOUT: %.loc65_26.2: i32 = converted %.loc65_17, %.loc65_26.1 [template = ] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref() [template = ] +// CHECK:STDOUT: %.loc65_26.1: i32 = value_of_initializer %TooMany.call [template = ] +// CHECK:STDOUT: %.loc65_26.2: i32 = converted %TooMany.call, %.loc65_26.1 [template = ] // CHECK:STDOUT: return %.loc65_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -298,9 +298,9 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc75_23: init bool = call %BadReturnType.ref() [template = ] -// CHECK:STDOUT: %.loc75_29.1: bool = value_of_initializer %.loc75_23 [template = ] -// CHECK:STDOUT: %.loc75_29.2: bool = converted %.loc75_23, %.loc75_29.1 [template = ] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] +// CHECK:STDOUT: %.loc75_29.1: bool = value_of_initializer %BadReturnType.call [template = ] +// CHECK:STDOUT: %.loc75_29.2: bool = converted %BadReturnType.call, %.loc75_29.1 [template = ] // CHECK:STDOUT: return %.loc75_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -335,27 +335,27 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate.ref.loc8_14: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.2: i32 = converted %.loc8_27, %.loc8_20.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.3: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %.loc8_20.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %.loc8_20.3, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] +// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.unegate.loc8_27, %.loc8_20.1 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.1] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 // CHECK:STDOUT: %Negate.ref.loc11_14: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Negate.ref.loc11_25: = name_ref Negate, %Negate [template = %Negate] // CHECK:STDOUT: %.loc11_32: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.2] // CHECK:STDOUT: %.loc11_45: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %.loc11_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %.loc11_31, %.loc11_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_24.3: init i32 = call %Sub.ref(%.loc11_24.2, %.loc11_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_20.1: i32 = value_of_initializer %.loc11_24.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_20.2: i32 = converted %.loc11_24.3, %.loc11_20.1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_20.3: init i32 = call %Negate.ref.loc11_14(%.loc11_20.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %.loc11_20.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.2: i32 = converted %.loc11_20.3, %.loc11_48.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %int.unegate.loc11_31 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_24.2: i32 = converted %int.unegate.loc11_31, %.loc11_24.1 [template = constants.%.2] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc11_24.2, %.loc11_45) [template = constants.%.4] +// CHECK:STDOUT: %.loc11_20.1: i32 = value_of_initializer %int.usub [template = constants.%.4] +// CHECK:STDOUT: %.loc11_20.2: i32 = converted %int.usub, %.loc11_20.1 [template = constants.%.4] +// CHECK:STDOUT: %int.unegate.loc11_20: init i32 = call %Negate.ref.loc11_14(%.loc11_20.2) [template = constants.%.4] +// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %int.unegate.loc11_20 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_48.2: i32 = converted %int.unegate.loc11_20, %.loc11_48.1 [template = constants.%.4] // CHECK:STDOUT: %b.loc11: i32 = bind_name b, %.loc11_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index b1d7b64c61d9..867fc891748c 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -53,8 +53,8 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.usub, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] @@ -79,9 +79,9 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Sub.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.usub +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.usub, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -112,33 +112,33 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Sub.ref.loc6: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_17: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %.loc6_17 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %.loc6_17, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Sub.ref.loc7_14: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Sub.ref.loc7_18: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] // CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.2: i32 = converted %.loc7_21, %.loc7_17.1 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.3: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %.loc7_17.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %.loc7_17.3, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.usub.loc7_21 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.usub.loc7_21, %.loc7_17.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 // CHECK:STDOUT: %Sub.ref.loc8_14: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %Sub.ref.loc8_18: = name_ref Sub, %Sub [template = %Sub] // CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: %.loc8_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.3] // CHECK:STDOUT: %.loc8_38: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_17.1: i32 = value_of_initializer %.loc8_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_17.2: i32 = converted %.loc8_21, %.loc8_17.1 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_17.3: init i32 = call %Sub.ref.loc8_14(%.loc8_17.2, %.loc8_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %.loc8_17.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %.loc8_17.3, %.loc8_40.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_17.1: i32 = value_of_initializer %int.usub.loc8_21 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_17.2: i32 = converted %int.usub.loc8_21, %.loc8_17.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc8_17: init i32 = call %Sub.ref.loc8_14(%.loc8_17.2, %.loc8_38) [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.usub.loc8_17 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.usub.loc8_17, %.loc8_40.1 [template = constants.%.2] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc8_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index 9321c67b56b6..08d1f443dac2 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -43,8 +43,8 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Xor.ref: = name_ref Xor, %Xor [template = %Xor] // CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] // CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_19: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_27: type = array_type %int.xor, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var // CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] @@ -69,9 +69,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Xor.ref: = name_ref Xor, file.%Xor [template = file.%Xor] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b -// CHECK:STDOUT: %.loc8_13: init i32 = call %Xor.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %.loc8_13 -// CHECK:STDOUT: %.loc8_19.2: i32 = converted %.loc8_13, %.loc8_19.1 +// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc8_19.1: i32 = value_of_initializer %int.xor +// CHECK:STDOUT: %.loc8_19.2: i32 = converted %int.xor, %.loc8_19.1 // CHECK:STDOUT: return %.loc8_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 2b5aa6bbb168..6eafe400a642 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -70,14 +70,14 @@ fn Derived.H() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] -// CHECK:STDOUT: %.loc14: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] -// CHECK:STDOUT: %.loc19: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index a7b522eb4514..df40781f6112 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -86,9 +86,9 @@ fn Run() -> i32 { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] // CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.3] -// CHECK:STDOUT: %.loc22_17: init i32 = call %F.ref(%.loc22_18) -// CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %.loc22_17 -// CHECK:STDOUT: %.loc22_20.2: i32 = converted %.loc22_17, %.loc22_20.1 +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc22_18) +// CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc22_20.2: i32 = converted %F.call, %.loc22_20.1 // CHECK:STDOUT: return %.loc22_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/extend_adapt.carbon b/toolchain/check/testdata/class/extend_adapt.carbon index b62dd07636e1..6920f0c0320d 100644 --- a/toolchain/check/testdata/class/extend_adapt.carbon +++ b/toolchain/check/testdata/class/extend_adapt.carbon @@ -156,7 +156,7 @@ class StructAdapter { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a // CHECK:STDOUT: %StaticMemberFunction.ref: = name_ref StaticMemberFunction, @SomeClass.%StaticMemberFunction [template = @SomeClass.%StaticMemberFunction] -// CHECK:STDOUT: %.loc20: init () = call %StaticMemberFunction.ref() +// CHECK:STDOUT: %StaticMemberFunction.call: init () = call %StaticMemberFunction.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 8e9f0841c587..94a9d3a221c8 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -271,18 +271,18 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakeIncomplete.ref.loc106: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc106_18: ref Class = deref %p.ref -// CHECK:STDOUT: %.loc106_17: init () = call %TakeIncomplete.ref.loc106() [template = ] +// CHECK:STDOUT: %.loc106: ref Class = deref %p.ref +// CHECK:STDOUT: %TakeIncomplete.call.loc106: init () = call %TakeIncomplete.ref.loc106() [template = ] // CHECK:STDOUT: %TakeIncomplete.ref.loc118: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] -// CHECK:STDOUT: %.loc118_19: {} = struct_literal () -// CHECK:STDOUT: %.loc118_17: init () = call %TakeIncomplete.ref.loc118() [template = ] +// CHECK:STDOUT: %.loc118: {} = struct_literal () +// CHECK:STDOUT: %TakeIncomplete.call.loc118: init () = call %TakeIncomplete.ref.loc118() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallReturnIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ReturnIncomplete.ref: = name_ref ReturnIncomplete, file.%ReturnIncomplete [template = file.%ReturnIncomplete] -// CHECK:STDOUT: %.loc131: init = call %ReturnIncomplete.ref() +// CHECK:STDOUT: %ReturnIncomplete.call: init = call %ReturnIncomplete.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index a9c47973aa09..ec572968e89f 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -87,8 +87,8 @@ fn F() { // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %.loc22_5: Class* = addr_of %c.ref -// CHECK:STDOUT: %.loc22_4: init () = call %G.ref(%.loc22_5) +// CHECK:STDOUT: %.loc22: Class* = addr_of %c.ref +// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc22) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 078935032f71..2d65ee7734ee 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -92,23 +92,23 @@ fn F(c: Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref.loc15: Class = name_ref c, %c // CHECK:STDOUT: %NoSelf.ref.loc15: = name_ref NoSelf, @Class.%NoSelf [template = @Class.%NoSelf] -// CHECK:STDOUT: %.loc15: init () = call %NoSelf.ref.loc15() +// CHECK:STDOUT: %NoSelf.call.loc15: init () = call %NoSelf.ref.loc15() // CHECK:STDOUT: %c.ref.loc16: Class = name_ref c, %c // CHECK:STDOUT: %WithSelf.ref.loc16: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %.loc16_4: = bound_method %c.ref.loc16, %WithSelf.ref.loc16 // CHECK:STDOUT: %.loc16_13: init () = call %.loc16_4(%c.ref.loc16) // CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %NoSelf.ref.loc18: = name_ref NoSelf, @Class.%NoSelf [template = @Class.%NoSelf] -// CHECK:STDOUT: %.loc18: init () = call %NoSelf.ref.loc18() +// CHECK:STDOUT: %NoSelf.call.loc18: init () = call %NoSelf.ref.loc18() // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc26: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] -// CHECK:STDOUT: %.loc26: init () = call %WithSelf.ref.loc26() [template = ] +// CHECK:STDOUT: %WithSelf.call.loc26: init () = call %WithSelf.ref.loc26() [template = ] // CHECK:STDOUT: %Class.ref.loc34: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc34: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %c.ref.loc34: Class = name_ref c, %c -// CHECK:STDOUT: %.loc34: init () = call %WithSelf.ref.loc34() [template = ] +// CHECK:STDOUT: %WithSelf.call.loc34: init () = call %WithSelf.ref.loc34() [template = ] // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = @Class.%WithSelf] -// CHECK:STDOUT: %.loc42: init () = call %A.ref() [template = ] +// CHECK:STDOUT: %WithSelf.call.loc42: init () = call %A.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index a685ae43156d..1edc517bc5b4 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -169,17 +169,17 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %MakeC.ref: = name_ref MakeC, file.%MakeC [template = file.%MakeC] // CHECK:STDOUT: %.loc23_5: ref AdaptC = splice_block file.%d.var {} -// CHECK:STDOUT: %.loc23_22: init C = call %MakeC.ref() to %.loc23_5 +// 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 %.loc23_22 -// CHECK:STDOUT: %.loc23_25.2: init AdaptC = converted %.loc23_22, %.loc23_25.1 +// 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: = name_ref MakeAdaptC, file.%MakeAdaptC [template = file.%MakeAdaptC] // CHECK:STDOUT: %.loc25_5: ref C = splice_block file.%e.var {} -// CHECK:STDOUT: %.loc25_22: init AdaptC = call %MakeAdaptC.ref() to %.loc25_5 +// 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] -// CHECK:STDOUT: %.loc25_25.1: init C = as_compatible %.loc25_22 -// CHECK:STDOUT: %.loc25_25.2: init C = converted %.loc25_22, %.loc25_25.1 +// CHECK:STDOUT: %.loc25_25.1: init C = as_compatible %MakeAdaptC.call +// CHECK:STDOUT: %.loc25_25.2: init C = converted %MakeAdaptC.call, %.loc25_25.1 // CHECK:STDOUT: assign file.%e.var, %.loc25_25.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -271,12 +271,12 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %MakeC.ref: = name_ref MakeC, file.%MakeC [template = file.%MakeC] -// CHECK:STDOUT: %.loc37_22.1: ref C = temporary_storage -// CHECK:STDOUT: %.loc37_22.2: init C = call %MakeC.ref() to %.loc37_22.1 +// 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: = name_ref MakeAdaptC, file.%MakeAdaptC [template = file.%MakeAdaptC] -// CHECK:STDOUT: %.loc42_22.1: ref AdaptC = temporary_storage -// CHECK:STDOUT: %.loc42_22.2: init AdaptC = call %MakeAdaptC.ref() to %.loc42_22.1 +// CHECK:STDOUT: %.loc42: ref AdaptC = temporary_storage +// CHECK:STDOUT: %MakeAdaptC.call: init AdaptC = call %MakeAdaptC.ref() to %.loc42 // CHECK:STDOUT: assign file.%e.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 072aead22953..c04f817cb618 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -84,12 +84,12 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %MakeInner.ref.loc20_16: = name_ref MakeInner, file.%MakeInner [template = file.%MakeInner] // CHECK:STDOUT: %.loc20_45.1: ref Inner = class_element_access %return, element0 -// CHECK:STDOUT: %.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 +// CHECK:STDOUT: %MakeInner.call.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 // CHECK:STDOUT: %MakeInner.ref.loc20_34: = name_ref MakeInner, file.%MakeInner [template = file.%MakeInner] // CHECK:STDOUT: %.loc20_45.2: ref Inner = class_element_access %return, element1 -// CHECK:STDOUT: %.loc20_43: init Inner = call %MakeInner.ref.loc20_34() to %.loc20_45.2 -// CHECK:STDOUT: %.loc20_45.3: {.c: Inner, .d: Inner} = struct_literal (%.loc20_25, %.loc20_43) -// CHECK:STDOUT: %.loc20_45.4: init Outer = class_init (%.loc20_25, %.loc20_43), %return +// 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) +// CHECK:STDOUT: %.loc20_45.4: init Outer = class_init (%MakeInner.call.loc20_25, %MakeInner.call.loc20_43), %return // CHECK:STDOUT: %.loc20_46: init Outer = converted %.loc20_45.3, %.loc20_45.4 // CHECK:STDOUT: return %.loc20_46 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 0f177b3dd163..09aa44611bb0 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -259,12 +259,12 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc50_14.1: ref Class = temporary_storage -// CHECK:STDOUT: %.loc50_14.2: init Class = call %Make.ref() to %.loc50_14.1 -// CHECK:STDOUT: %.loc50_14.3: ref Class = temporary %.loc50_14.1, %.loc50_14.2 +// 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: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc50_16: = bound_method %.loc50_14.3, %F.ref -// CHECK:STDOUT: %.loc50_14.4: Class = bind_value %.loc50_14.3 -// CHECK:STDOUT: %.loc50_18: init i32 = call %.loc50_16(%.loc50_14.4) +// CHECK:STDOUT: %.loc50_16: = bound_method %.loc50_14.2, %F.ref +// CHECK:STDOUT: %.loc50_14.3: Class = bind_value %.loc50_14.2 +// CHECK:STDOUT: %.loc50_18: init i32 = call %.loc50_16(%.loc50_14.3) // CHECK:STDOUT: %.loc50_20.1: i32 = value_of_initializer %.loc50_18 // CHECK:STDOUT: %.loc50_20.2: i32 = converted %.loc50_18, %.loc50_20.1 // CHECK:STDOUT: return %.loc50_20.2 @@ -274,12 +274,12 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] // CHECK:STDOUT: %.loc54_14.1: ref Class = temporary_storage -// CHECK:STDOUT: %.loc54_14.2: init Class = call %Make.ref() to %.loc54_14.1 -// CHECK:STDOUT: %.loc54_14.3: ref Class = temporary %.loc54_14.1, %.loc54_14.2 +// 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: = name_ref G, @Class.%G [template = @Class.%G] -// CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.3, %G.ref -// CHECK:STDOUT: %.loc54_14.4: Class* = addr_of %.loc54_14.3 -// CHECK:STDOUT: %.loc54_18: init i32 = call %.loc54_16(%.loc54_14.4) +// CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.2, %G.ref +// CHECK:STDOUT: %.loc54_14.3: Class* = addr_of %.loc54_14.2 +// CHECK:STDOUT: %.loc54_18: init i32 = call %.loc54_16(%.loc54_14.3) // CHECK:STDOUT: %.loc54_20.1: i32 = value_of_initializer %.loc54_18 // CHECK:STDOUT: %.loc54_20.2: i32 = converted %.loc54_18, %.loc54_20.1 // CHECK:STDOUT: return %.loc54_20.2 diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 260ae665f35b..4cbf93e03f7b 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -51,11 +51,11 @@ fn Class.F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %G.ref.loc13: = name_ref G, @Class.%G [template = @Class.%G] -// CHECK:STDOUT: %.loc13: init i32 = call %G.ref.loc13() +// CHECK:STDOUT: %G.call.loc13: init i32 = call %G.ref.loc13() // CHECK:STDOUT: %G.ref.loc14: = name_ref G, @Class.%G [template = @Class.%G] -// CHECK:STDOUT: %.loc14_11: init i32 = call %G.ref.loc14() -// CHECK:STDOUT: %.loc14_13.1: i32 = value_of_initializer %.loc14_11 -// CHECK:STDOUT: %.loc14_13.2: i32 = converted %.loc14_11, %.loc14_13.1 +// 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 // CHECK:STDOUT: return %.loc14_13.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder.carbon b/toolchain/check/testdata/class/reorder.carbon index fb5e1a9b3364..6a3d42b09c8d 100644 --- a/toolchain/check/testdata/class/reorder.carbon +++ b/toolchain/check/testdata/class/reorder.carbon @@ -49,9 +49,9 @@ class Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc9_19: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc9_21.1: i32 = value_of_initializer %.loc9_19 -// CHECK:STDOUT: %.loc9_21.2: i32 = converted %.loc9_19, %.loc9_21.1 +// 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 // CHECK:STDOUT: return %.loc9_21.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index 143bd188448c..cf3ef9edd88d 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -178,13 +178,13 @@ class A { // CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%.20] // CHECK:STDOUT: assign %d.var, %.loc28_26 // CHECK:STDOUT: %AF.ref: = name_ref AF, @A.%AF [template = @A.%AF] -// CHECK:STDOUT: %.loc31: init () = call %AF.ref() +// CHECK:STDOUT: %AF.call: init () = call %AF.ref() // CHECK:STDOUT: %BF.ref: = name_ref BF, @B.%BF [template = @B.%BF] -// CHECK:STDOUT: %.loc32: init () = call %BF.ref() +// CHECK:STDOUT: %BF.call: init () = call %BF.ref() // CHECK:STDOUT: %CF.ref: = name_ref CF, @C.%CF [template = @C.%CF] -// CHECK:STDOUT: %.loc33: init () = call %CF.ref() +// CHECK:STDOUT: %CF.call: init () = call %CF.ref() // CHECK:STDOUT: %DF.ref: = name_ref DF, @D.%DF [template = @D.%DF] -// CHECK:STDOUT: %.loc34: init () = call %DF.ref() +// CHECK:STDOUT: %DF.call: init () = call %DF.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index 63821f0ea426..b6a697613c1b 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -70,9 +70,9 @@ fn Run() { // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc13_13: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %.loc13_13 -// CHECK:STDOUT: %.loc13_15.2: i32 = converted %.loc13_13, %.loc13_15.1 +// 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 // CHECK:STDOUT: return %.loc13_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -87,14 +87,14 @@ fn Run() { // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %F.ref.loc22: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc22: init i32 = call %F.ref.loc22() -// CHECK:STDOUT: assign %a.var, %.loc22 +// CHECK:STDOUT: %F.call.loc22: init i32 = call %F.ref.loc22() +// CHECK:STDOUT: assign %a.var, %F.call.loc22 // 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: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc23: init i32 = call %F.ref.loc23() -// CHECK:STDOUT: assign %b.var, %.loc23 +// CHECK:STDOUT: %F.call.loc23: init i32 = call %F.ref.loc23() +// CHECK:STDOUT: assign %b.var, %F.call.loc23 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 5b58c1a64007..005597032f41 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -54,9 +54,9 @@ fn Run() -> i32 { // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc13_13: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %.loc13_13 -// CHECK:STDOUT: %.loc13_15.2: i32 = converted %.loc13_13, %.loc13_15.1 +// 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 // CHECK:STDOUT: return %.loc13_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 4309fd1c3d2a..ef468e54b6a6 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -55,8 +55,8 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc6: init const i32 = call %F.ref() -// CHECK:STDOUT: assign file.%a_ref.var, %.loc6 +// 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 // CHECK:STDOUT: %.loc7: const i32* = addr_of %a_ref.ref // CHECK:STDOUT: assign file.%a_ptr_ref.var, %.loc7 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 8484fa8aabd7..5b13e685f7d7 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -58,27 +58,27 @@ fn H() -> i32 { // CHECK:STDOUT: %v: ref (i32, i32) = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_7: ref (i32, i32) = splice_block %v.var {} -// CHECK:STDOUT: %.loc10_24: init (i32, i32) = call %F.ref.loc10() to %.loc10_7 -// CHECK:STDOUT: assign %v.var, %.loc10_24 +// 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: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc11_3: ref (i32, i32) = splice_block %v.ref {} -// CHECK:STDOUT: %.loc11_8: init (i32, i32) = call %F.ref.loc11() to %.loc11_3 -// CHECK:STDOUT: assign %v.ref, %.loc11_8 +// 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: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc9: ref (i32, i32) = splice_block %return {} -// CHECK:STDOUT: %.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 -// CHECK:STDOUT: return %.loc12 +// CHECK:STDOUT: %F.call.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 +// CHECK:STDOUT: return %F.call.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] // CHECK:STDOUT: %.loc16_11.1: ref (i32, i32) = temporary_storage -// CHECK:STDOUT: %.loc16_11.2: init (i32, i32) = call %G.ref() to %.loc16_11.1 +// CHECK:STDOUT: %G.call: init (i32, i32) = call %G.ref() to %.loc16_11.1 // CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc16_11.3: ref (i32, i32) = temporary %.loc16_11.1, %.loc16_11.2 -// CHECK:STDOUT: %.loc16_15.1: ref i32 = tuple_index %.loc16_11.3, %.loc16_14 +// CHECK:STDOUT: %.loc16_11.2: ref (i32, i32) = temporary %.loc16_11.1, %G.call +// CHECK:STDOUT: %.loc16_15.1: ref i32 = tuple_index %.loc16_11.2, %.loc16_14 // CHECK:STDOUT: %.loc16_15.2: i32 = bind_value %.loc16_15.1 // CHECK:STDOUT: return %.loc16_15.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index 4c3f9857b959..ad5ab3dab7da 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -35,8 +35,8 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_19: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc9_25: type = array_type %.loc9_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc9_25: type = array_type %int.sadd, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/call_from_operator.carbon index bdfd14a7d63f..2386dcc2d4b9 100644 --- a/toolchain/check/testdata/function/builtin/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/call_from_operator.carbon @@ -108,9 +108,9 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %import_ref.5: type = import_ref ir3, inst+1, loc_36 [template = constants.%.1] // CHECK:STDOUT: %import_ref.6 = import_ref ir3, inst+18, unloaded // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc10_18.1: = bound_method %.loc10_16, %.1 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_18.2: init i32 = call %.loc10_18.1(%.loc10_16, %.loc10_20) [template = constants.%.8] -// CHECK:STDOUT: %.loc10_21: type = array_type %.loc10_18.2, i32 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_18: = bound_method %.loc10_16, %.1 [template = constants.%.7] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_18(%.loc10_16, %.loc10_20) [template = constants.%.8] +// CHECK:STDOUT: %.loc10_21: type = array_type %int.sadd, i32 [template = constants.%.9] // 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 ir3, inst+1, loc_47 [template = constants.%.1] @@ -152,9 +152,9 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %.loc10_32: i32 = int_literal 3 [template = constants.%.8] // CHECK:STDOUT: %.loc10_36: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc10_34.1: = bound_method %.loc10_32, %.1 [template = constants.%.12] -// CHECK:STDOUT: %.loc10_34.2: init i32 = call %.loc10_34.1(%.loc10_32, %.loc10_36) [template = constants.%.13] -// CHECK:STDOUT: %.loc10_37.1: (i32, i32, i32) = tuple_literal (%.loc10_26, %.loc10_29, %.loc10_34.2) +// CHECK:STDOUT: %.loc10_34: = bound_method %.loc10_32, %.1 [template = constants.%.12] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_34(%.loc10_32, %.loc10_36) [template = constants.%.13] +// CHECK:STDOUT: %.loc10_37.1: (i32, i32, i32) = tuple_literal (%.loc10_26, %.loc10_29, %int.sadd) // CHECK:STDOUT: %.loc10_37.2: i32 = int_literal 0 [template = constants.%.15] // CHECK:STDOUT: %.loc10_37.3: ref i32 = array_index file.%arr.var, %.loc10_37.2 // CHECK:STDOUT: %.loc10_37.4: init i32 = initialize_from %.loc10_26 to %.loc10_37.3 [template = constants.%.8] @@ -163,7 +163,7 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %.loc10_37.7: init i32 = initialize_from %.loc10_29 to %.loc10_37.6 [template = constants.%.11] // CHECK:STDOUT: %.loc10_37.8: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_37.9: ref i32 = array_index file.%arr.var, %.loc10_37.8 -// CHECK:STDOUT: %.loc10_37.10: init i32 = initialize_from %.loc10_34.2 to %.loc10_37.9 [template = constants.%.13] +// CHECK:STDOUT: %.loc10_37.10: init i32 = initialize_from %int.sadd to %.loc10_37.9 [template = constants.%.13] // CHECK:STDOUT: %.loc10_37.11: init [i32; 3] = array_init (%.loc10_37.4, %.loc10_37.7, %.loc10_37.10) to file.%arr.var [template = constants.%.16] // CHECK:STDOUT: %.loc10_38: init [i32; 3] = converted %.loc10_37.1, %.loc10_37.11 [template = constants.%.16] // CHECK:STDOUT: assign file.%arr.var, %.loc10_38 diff --git a/toolchain/check/testdata/function/builtin/import.carbon b/toolchain/check/testdata/function/builtin/import.carbon index c2b82f141ec1..5fa84a34fc25 100644 --- a/toolchain/check/testdata/function/builtin/import.carbon +++ b/toolchain/check/testdata/function/builtin/import.carbon @@ -59,8 +59,8 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: %Add.ref: = name_ref Add, %import_ref [template = imports.%Add] // CHECK:STDOUT: %.loc4_25: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc4_28: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_24: init i32 = call %Add.ref(%.loc4_25, %.loc4_28) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_30: type = array_type %.loc4_24, i32 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_25, %.loc4_28) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_30: type = array_type %int.sadd, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index a4e6274e2ba2..4ca53ed5102c 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -46,8 +46,8 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] // CHECK:STDOUT: %.loc15_17: = bound_method %.loc15_16, %.1 [template = constants.%.6] // CHECK:STDOUT: %.loc15_24: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_23: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.8] -// CHECK:STDOUT: %.loc15_26: type = array_type %.loc15_23, i32 [template = constants.%.9] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.8] +// CHECK:STDOUT: %.loc15_26: type = array_type %int.sadd, i32 [template = constants.%.9] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/alias.carbon b/toolchain/check/testdata/function/call/alias.carbon index 0f32b5a2a588..540d704461e4 100644 --- a/toolchain/check/testdata/function/call/alias.carbon +++ b/toolchain/check/testdata/function/call/alias.carbon @@ -45,8 +45,8 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%A] -// CHECK:STDOUT: %.loc12: init i32 = call %B.ref() -// CHECK:STDOUT: assign %b.var, %.loc12 +// CHECK:STDOUT: %A.call: init i32 = call %B.ref() +// CHECK:STDOUT: assign %b.var, %A.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/empty_struct.carbon b/toolchain/check/testdata/function/call/empty_struct.carbon index 26c14243ce1e..5b9938cad62d 100644 --- a/toolchain/check/testdata/function/call/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/empty_struct.carbon @@ -50,8 +50,8 @@ fn Main() { // CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] // CHECK:STDOUT: %.loc12_9.1: {} = struct_literal () // CHECK:STDOUT: %.loc12_9.2: {} = struct_value () [template = constants.%.3] -// CHECK:STDOUT: %.loc12_7.1: {} = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_7.2: init {} = call %Echo.ref(%.loc12_7.1) +// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.3] +// CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc12_7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/empty_tuple.carbon b/toolchain/check/testdata/function/call/empty_tuple.carbon index 62b953faf5e5..ed09297f8182 100644 --- a/toolchain/check/testdata/function/call/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/empty_tuple.carbon @@ -49,8 +49,8 @@ fn Main() { // CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc12_9.2: () = tuple_value () [template = constants.%.2] -// CHECK:STDOUT: %.loc12_7.1: () = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_7.2: init () = call %Echo.ref(%.loc12_7.1) +// CHECK:STDOUT: %.loc12_7: () = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.2] +// CHECK:STDOUT: %Echo.call: init () = call %Echo.ref(%.loc12_7) // CHECK:STDOUT: return // CHECK:STDOUT: } // 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 a8695b7cb160..7cfc3d20657e 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -109,23 +109,23 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Run0.ref.loc19: = name_ref Run0, file.%Run0 [template = file.%Run0] -// CHECK:STDOUT: %.loc19_8: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc19_7: init () = call %Run0.ref.loc19() [template = ] +// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Run0.call.loc19: init () = call %Run0.ref.loc19() [template = ] // CHECK:STDOUT: %Run0.ref.loc27: = name_ref Run0, file.%Run0 [template = file.%Run0] // CHECK:STDOUT: %.loc27_8: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc27_11: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc27_7: init () = call %Run0.ref.loc27() [template = ] +// CHECK:STDOUT: %Run0.call.loc27: init () = call %Run0.ref.loc27() [template = ] // CHECK:STDOUT: %Run1.ref.loc36: = name_ref Run1, file.%Run1 [template = file.%Run1] -// CHECK:STDOUT: %.loc36: init () = call %Run1.ref.loc36() [template = ] +// CHECK:STDOUT: %Run1.call.loc36: init () = call %Run1.ref.loc36() [template = ] // CHECK:STDOUT: %Run1.ref.loc44: = name_ref Run1, file.%Run1 [template = file.%Run1] // CHECK:STDOUT: %.loc44_8: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc44_11: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_7: init () = call %Run1.ref.loc44() [template = ] +// CHECK:STDOUT: %Run1.call.loc44: init () = call %Run1.ref.loc44() [template = ] // CHECK:STDOUT: %Run2.ref.loc53: = name_ref Run2, file.%Run2 [template = file.%Run2] -// CHECK:STDOUT: %.loc53: init () = call %Run2.ref.loc53() [template = ] +// CHECK:STDOUT: %Run2.call.loc53: init () = call %Run2.ref.loc53() [template = ] // CHECK:STDOUT: %Run2.ref.loc60: = name_ref Run2, file.%Run2 [template = file.%Run2] -// CHECK:STDOUT: %.loc60_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc60_7: init () = call %Run2.ref.loc60() [template = ] +// CHECK:STDOUT: %.loc60: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %Run2.call.loc60: init () = call %Run2.ref.loc60() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index e3545feda1b2..e87095e60c9b 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -45,8 +45,8 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc16_5: f64 = real_literal 10e-1 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_4: init () = call %G.ref() [template = ] +// CHECK:STDOUT: %.loc16: f64 = real_literal 10e-1 [template = constants.%.1] +// CHECK:STDOUT: %G.call: init () = call %G.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 7e833bdb5e0a..e9cfdb18e1ac 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -43,7 +43,7 @@ fn Run() { // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc13: init f64 = call %Foo.ref() +// CHECK:STDOUT: %Foo.call: init f64 = call %Foo.ref() // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 3a599e852bca..4bb6b8225050 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -44,9 +44,9 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_20: init i32 = call %Echo.ref(%.loc12_21) -// CHECK:STDOUT: assign %b.var, %.loc12_20 +// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12) +// CHECK:STDOUT: assign %b.var, %Echo.call // CHECK:STDOUT: return // CHECK:STDOUT: } // 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 4d9566c64637..f063f7c491ef 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -62,7 +62,7 @@ fn Main() { // CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9 // CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1 -// CHECK:STDOUT: %.loc12_6: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13) +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index 898c7cf5b1fb..727a4c3af9cf 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -39,8 +39,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref(%.loc10_7) +// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index bcac9aec7062..4d7c7f0a7981 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -40,11 +40,11 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7) +// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10) // CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7) +// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index 29ad701d6af4..5f339f1df650 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -44,7 +44,7 @@ fn Main() { // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref(%.loc10_7, %.loc10_10) +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10_7, %.loc10_10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index 3209026b53f6..cb26a12bc8d5 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -45,11 +45,11 @@ fn Main() { // CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) +// CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) // CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) +// CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_zero.carbon b/toolchain/check/testdata/function/call/params_zero.carbon index 85da1efa4e85..ebd73ec5c552 100644 --- a/toolchain/check/testdata/function/call/params_zero.carbon +++ b/toolchain/check/testdata/function/call/params_zero.carbon @@ -35,7 +35,7 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10: init () = call %Foo.ref() +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/return_implicit.carbon b/toolchain/check/testdata/function/call/return_implicit.carbon index d7947b0adb0f..aa0de98f964c 100644 --- a/toolchain/check/testdata/function/call/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/return_implicit.carbon @@ -40,8 +40,8 @@ fn Main() { // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var // CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple [template = file.%MakeImplicitEmptyTuple] -// CHECK:STDOUT: %.loc11_37: init () = call %MakeImplicitEmptyTuple.ref() -// CHECK:STDOUT: assign %b.var, %.loc11_37 +// CHECK:STDOUT: %MakeImplicitEmptyTuple.call: init () = call %MakeImplicitEmptyTuple.ref() +// CHECK:STDOUT: assign %b.var, %MakeImplicitEmptyTuple.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon index 34344e90062d..7f0feb772caf 100644 --- a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon @@ -131,9 +131,9 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%ReturnCUsed [template = file.%ReturnCUsed] -// CHECK:STDOUT: %.loc23: init = call %ReturnCUsed.ref() +// CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() // CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%ReturnDUsed [template = file.%ReturnDUsed] -// CHECK:STDOUT: %.loc34: init = call %ReturnDUsed.ref() +// CHECK:STDOUT: %ReturnDUsed.call: init = call %ReturnDUsed.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -182,16 +182,16 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.decl: invalid = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %ReturnCUnused.ref: = name_ref ReturnCUnused, file.%import_ref.3 [template = imports.%ReturnCUnused] -// CHECK:STDOUT: %.loc22: init = call %ReturnCUnused.ref() +// CHECK:STDOUT: %ReturnCUnused.call: init = call %ReturnCUnused.ref() // CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%import_ref.4 [template = imports.%ReturnCUsed] -// CHECK:STDOUT: %.loc23: init = call %ReturnCUsed.ref() +// CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() // CHECK:STDOUT: %D.decl: invalid = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %ReturnDUnused.ref: = name_ref ReturnDUnused, file.%import_ref.5 [template = imports.%ReturnDUnused] // CHECK:STDOUT: %.loc24_16.1: ref D = temporary_storage -// CHECK:STDOUT: %.loc24_16.2: init D = call %ReturnDUnused.ref() to %.loc24_16.1 -// CHECK:STDOUT: %.loc24_16.3: ref D = temporary %.loc24_16.1, %.loc24_16.2 +// CHECK:STDOUT: %ReturnDUnused.call: init D = call %ReturnDUnused.ref() to %.loc24_16.1 +// CHECK:STDOUT: %.loc24_16.2: ref D = temporary %.loc24_16.1, %ReturnDUnused.call // CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%import_ref.6 [template = imports.%ReturnDUsed] -// CHECK:STDOUT: %.loc25: init = call %ReturnDUsed.ref() +// CHECK:STDOUT: %ReturnDUsed.call: init = call %ReturnDUsed.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index b35b11eedc4f..db22af834bbb 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -353,26 +353,26 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] -// CHECK:STDOUT: %.loc7_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_15: init i32 = call %B.ref(%.loc7_16) -// CHECK:STDOUT: assign file.%b.var, %.loc7_15 +// 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: = name_ref C, file.%import_ref.3 [template = imports.%C] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25.1: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %.loc8_25.2: (i32,) = tuple_value (%.loc8_23) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_21.1: (i32,) = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_21.2: init {.c: i32} = call %C.ref(%.loc8_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc8_21.2 +// CHECK:STDOUT: %.loc8_21: (i32,) = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%.5] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc8_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] -// CHECK:STDOUT: %.loc9: init () = call %D.ref() -// CHECK:STDOUT: assign file.%d.var, %.loc9 +// 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: = name_ref E, file.%import_ref.6 [template = imports.%E] -// CHECK:STDOUT: %.loc10: init () = call %E.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc10 +// CHECK:STDOUT: %E.call: init () = call %E.ref() +// CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -459,26 +459,26 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc12: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc12 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_15: init i32 = call %B.ref(%.loc13_16) -// CHECK:STDOUT: assign file.%b.var, %.loc13_15 +// 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: = name_ref C, file.%C [template = file.%C] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25.1: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %.loc14_25.2: (i32,) = tuple_value (%.loc14_23) [template = constants.%.6] -// CHECK:STDOUT: %.loc14_21.1: (i32,) = converted %.loc14_25.1, %.loc14_25.2 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_21.2: init {.c: i32} = call %C.ref(%.loc14_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc14_21.2 +// CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25.1, %.loc14_25.2 [template = constants.%.6] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] -// CHECK:STDOUT: %.loc15: init () = call %D.ref() -// CHECK:STDOUT: assign file.%d.var, %.loc15 +// 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: = name_ref E, file.%E [template = file.%E] -// CHECK:STDOUT: %.loc16: init () = call %E.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc16 +// CHECK:STDOUT: %E.call: init () = call %E.ref() +// CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -565,26 +565,26 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc12: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc12 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_15: init i32 = call %B.ref(%.loc13_16) -// CHECK:STDOUT: assign file.%b.var, %.loc13_15 +// 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: = name_ref C, file.%C [template = file.%C] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25.1: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %.loc14_25.2: (i32,) = tuple_value (%.loc14_23) [template = constants.%.6] -// CHECK:STDOUT: %.loc14_21.1: (i32,) = converted %.loc14_25.1, %.loc14_25.2 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_21.2: init {.c: i32} = call %C.ref(%.loc14_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc14_21.2 +// CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25.1, %.loc14_25.2 [template = constants.%.6] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] -// CHECK:STDOUT: %.loc15: init () = call %D.ref() -// CHECK:STDOUT: assign file.%d.var, %.loc15 +// 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: = name_ref E, file.%E [template = file.%E] -// CHECK:STDOUT: %.loc16: init () = call %E.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc16 +// CHECK:STDOUT: %E.call: init () = call %E.ref() +// CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -669,26 +669,26 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A.1] -// CHECK:STDOUT: %.loc7: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc7 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B.1] -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_15: init i32 = call %B.ref(%.loc8_16) -// CHECK:STDOUT: assign file.%b.var, %.loc8_15 +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc8) +// CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: = name_ref C, file.%import_ref.3 [template = imports.%C.1] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_25.1: (i32,) = tuple_literal (%.loc9_23) // CHECK:STDOUT: %.loc9_25.2: (i32,) = tuple_value (%.loc9_23) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_21.1: (i32,) = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_21.2: init {.c: i32} = call %C.ref(%.loc9_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc9_21.2 +// CHECK:STDOUT: %.loc9_21: (i32,) = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%.5] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc9_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D.1] -// CHECK:STDOUT: %.loc10: init () = call %D.ref() -// CHECK:STDOUT: assign file.%d.var, %.loc10 +// 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: = name_ref E, file.%import_ref.6 [template = imports.%E.1] -// CHECK:STDOUT: %.loc11: init () = call %E.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc11 +// CHECK:STDOUT: %E.call: init () = call %E.ref() +// CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -773,26 +773,26 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, imports.%A.2 [template = imports.%A.2] -// CHECK:STDOUT: %.loc7: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc7 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, imports.%B.2 [template = imports.%B.2] -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_15: init i32 = call %B.ref(%.loc8_16) -// CHECK:STDOUT: assign file.%b.var, %.loc8_15 +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc8) +// CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: = name_ref C, imports.%C.2 [template = imports.%C.2] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_25.1: (i32,) = tuple_literal (%.loc9_23) // CHECK:STDOUT: %.loc9_25.2: (i32,) = tuple_value (%.loc9_23) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_21.1: (i32,) = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_21.2: init {.c: i32} = call %C.ref(%.loc9_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc9_21.2 +// CHECK:STDOUT: %.loc9_21: (i32,) = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%.5] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc9_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D.1] -// CHECK:STDOUT: %.loc10: init () = call %D.ref() -// CHECK:STDOUT: assign file.%d.var, %.loc10 +// 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: = name_ref E, imports.%E.2 [template = imports.%E.2] -// CHECK:STDOUT: %.loc11: init () = call %E.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc11 +// CHECK:STDOUT: %E.call: init () = call %E.ref() +// CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -834,8 +834,8 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -881,8 +881,8 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -924,8 +924,8 @@ import library "extern_api"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/simple.carbon b/toolchain/check/testdata/function/declaration/simple.carbon index acac9aed1bff..1432f22699f8 100644 --- a/toolchain/check/testdata/function/declaration/simple.carbon +++ b/toolchain/check/testdata/function/declaration/simple.carbon @@ -30,7 +30,7 @@ fn G() { F(); } // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc9: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 35e47ab8325f..a789744848ab 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -208,19 +208,19 @@ fn D() {} // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init () = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] -// CHECK:STDOUT: %.loc7_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_15: init i32 = call %B.ref(%.loc7_16) -// CHECK:STDOUT: assign file.%b.var, %.loc7_15 +// 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: = name_ref C, file.%import_ref.3 [template = imports.%C] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25.1: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %.loc8_25.2: (i32,) = tuple_value (%.loc8_23) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_21.1: (i32,) = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_21.2: init {.c: i32} = call %C.ref(%.loc8_21.1) -// CHECK:STDOUT: assign file.%c.var, %.loc8_21.2 +// CHECK:STDOUT: %.loc8_21: (i32,) = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%.5] +// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc8_21) +// CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index ffbd18aa0155..bdb4c45990cf 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -39,8 +39,8 @@ var a: i32 = test_a(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %test_a.ref: = name_ref test_a, file.%test_a [template = file.%test_a] -// CHECK:STDOUT: %.loc11: init i32 = call %test_a.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc11 +// CHECK:STDOUT: %test_a.call: init i32 = call %test_a.ref() +// CHECK:STDOUT: assign file.%a.var, %test_a.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index 9ba822e1f266..f97b5bf58594 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -63,17 +63,17 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc13: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc15: init () = call %G.ref() +// CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.done: // CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] -// CHECK:STDOUT: %.loc17: init () = call %H.ref() +// CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index 7c0f0d8ae711..07e2892fa7ec 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -53,12 +53,12 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc12: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc14: init () = call %G.ref() +// CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index 494d89581470..a986f04854c8 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -89,16 +89,16 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc11_24.1: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc11_24.2: i32 = value_of_initializer %.loc11_24.1 -// CHECK:STDOUT: %.loc11_24.3: i32 = converted %.loc11_24.1, %.loc11_24.2 -// CHECK:STDOUT: br !if.expr.result(%.loc11_24.3) +// 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: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc11_33: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc11_27.1: i32 = value_of_initializer %.loc11_33 -// CHECK:STDOUT: %.loc11_27.2: i32 = converted %.loc11_33, %.loc11_27.1 +// 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 // CHECK:STDOUT: br !if.expr.result(%.loc11_27.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: @@ -113,16 +113,16 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc15_25.1: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc15_25.2: i32 = value_of_initializer %.loc15_25.1 -// CHECK:STDOUT: %.loc15_25.3: i32 = converted %.loc15_25.1, %.loc15_25.2 -// CHECK:STDOUT: br !if.expr.result(%.loc15_25.3) +// 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: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc15_34: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %.loc15_34 -// CHECK:STDOUT: %.loc15_28.2: i32 = converted %.loc15_34, %.loc15_28.1 +// 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 // CHECK:STDOUT: br !if.expr.result(%.loc15_28.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index a0d48f61a458..1e45c1cd0db5 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -58,16 +58,16 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc11_21.1: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc11_21.2: i32 = value_of_initializer %.loc11_21.1 -// CHECK:STDOUT: %.loc11_21.3: i32 = converted %.loc11_21.1, %.loc11_21.2 -// CHECK:STDOUT: br !if.expr.result(%.loc11_21.3) +// 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: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc11_30: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %.loc11_30 -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %.loc11_30, %.loc11_24.1 +// 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 // CHECK:STDOUT: br !if.expr.result(%.loc11_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 91b9ba42bc6f..da3ef206532d 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -83,7 +83,7 @@ fn F(cond: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc11_5: {.a: i32, .b: i32} = block_arg !if.expr.result -// CHECK:STDOUT: %.loc11_4: init () = call %G.ref(%.loc11_5) +// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc11_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index 9ed96040ec61..495f9913538e 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -124,7 +124,7 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: in Simple> = name_ref F, @Simple.%.loc8 [template = constants.%.3] // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc18: init () = call %.1() +// CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -144,9 +144,9 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: in Simple> = name_ref F, @Simple.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.loc26_4: ref i32 = deref %p.ref +// CHECK:STDOUT: %.loc26: ref i32 = deref %p.ref // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc26_16: init () = call %.1() +// CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index a2be15c524e7..8a3c36de21bd 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -91,11 +91,11 @@ fn G(c: C) { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %F.ref.loc18: in HasF> = name_ref F, @HasF.%.loc8 [template = constants.%.3] // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc18: init () = call %.1() +// CHECK:STDOUT: %F.call.loc18: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %F.ref.loc19: in HasF> = name_ref F, @HasF.%.loc8 [template = constants.%.3] // CHECK:STDOUT: %.2: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc19: init () = call %.2() +// CHECK:STDOUT: %F.call.loc19: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/alias.carbon b/toolchain/check/testdata/impl/lookup/alias.carbon index 834ef3f54ae5..fca6e606e7b3 100644 --- a/toolchain/check/testdata/impl/lookup/alias.carbon +++ b/toolchain/check/testdata/impl/lookup/alias.carbon @@ -97,11 +97,11 @@ fn G(c: C) { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %G.ref.loc20: in HasF> = name_ref G, @C.%G [template = constants.%.3] // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc20: init () = call %.1() +// CHECK:STDOUT: %F.call.loc20: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %G.ref.loc21: in HasF> = name_ref G, @C.%G [template = constants.%.3] // CHECK:STDOUT: %.2: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc21: init () = call %.2() +// CHECK:STDOUT: %F.call.loc21: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index 2a11a0f2559b..7a22c38fc6db 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -144,7 +144,7 @@ fn G(c: Impl.C) { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%import_ref.7 [template = constants.%.2] // CHECK:STDOUT: %F.ref: in HasF> = name_ref F, file.%import_ref.2 [template = constants.%.6] // CHECK:STDOUT: %.1: = interface_witness_access file.%import_ref.5, element0 [template = ] -// CHECK:STDOUT: %.loc5: init () = call %.1() +// CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 7d3cbb291541..0fc10b2962f4 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -138,10 +138,10 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc24_4.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc24_4.2: init [i32; 3] = call %F.ref() to %.loc24_4.1 +// CHECK:STDOUT: %F.call: init [i32; 3] = call %F.ref() to %.loc24_4.1 // CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc24_4.3: ref [i32; 3] = temporary %.loc24_4.1, %.loc24_4.2 -// CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.3, %.loc24_7 +// CHECK:STDOUT: %.loc24_4.2: ref [i32; 3] = temporary %.loc24_4.1, %F.call +// CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.2, %.loc24_7 // CHECK:STDOUT: %.loc24_8.2: i32 = bind_value %.loc24_8.1 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon index e1f240e3082a..929c3fe3d2ae 100644 --- a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon @@ -39,11 +39,11 @@ fn Run() { // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc13_4.1: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: %.loc13_7: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_4.2: ref () = temporary_storage -// CHECK:STDOUT: %.loc13_4.3: ref () = temporary %.loc13_4.2, %.loc13_4.1 -// CHECK:STDOUT: %.loc13_8: ref = tuple_index %.loc13_4.3, +// CHECK:STDOUT: %.loc13_4.1: ref () = temporary_storage +// CHECK:STDOUT: %.loc13_4.2: ref () = temporary %.loc13_4.1, %F.call +// CHECK:STDOUT: %.loc13_8: ref = tuple_index %.loc13_4.2, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index 4d737865810a..c943190d311f 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -89,19 +89,19 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var // CHECK:STDOUT: %F.ref.loc28: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc28_20.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc28_20.2: init [i32; 3] = call %F.ref.loc28() to %.loc28_20.1 +// 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.%.5] -// CHECK:STDOUT: %.loc28_20.3: ref [i32; 3] = temporary %.loc28_20.1, %.loc28_20.2 -// CHECK:STDOUT: %.loc28_24.1: ref i32 = array_index %.loc28_20.3, %.loc28_23 +// CHECK:STDOUT: %.loc28_20.2: ref [i32; 3] = temporary %.loc28_20.1, %F.call.loc28 +// CHECK:STDOUT: %.loc28_24.1: ref i32 = array_index %.loc28_20.2, %.loc28_23 // 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: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc32_4.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc32_4.2: init [i32; 3] = call %F.ref.loc32() to %.loc32_4.1 +// 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.%.5] -// CHECK:STDOUT: %.loc32_4.3: ref [i32; 3] = temporary %.loc32_4.1, %.loc32_4.2 -// CHECK:STDOUT: %.loc32_8.1: ref i32 = array_index %.loc32_4.3, %.loc32_7 +// CHECK:STDOUT: %.loc32_4.2: ref [i32; 3] = temporary %.loc32_4.1, %F.call.loc32 +// CHECK:STDOUT: %.loc32_8.1: ref i32 = array_index %.loc32_4.2, %.loc32_7 // CHECK:STDOUT: %.loc32_8.2: i32 = bind_value %.loc32_8.1 // CHECK:STDOUT: %.loc32_12: i32 = int_literal 4 [template = constants.%.6] // CHECK:STDOUT: assign %.loc32_8.2, %.loc32_12 diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index f277af6c871a..a1758476645b 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -48,11 +48,11 @@ fn Run() -> i32 { // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc10_11.1: init (i32,) = call %F.ref() +// CHECK:STDOUT: %F.call: init (i32,) = call %F.ref() // CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary_storage -// CHECK:STDOUT: %.loc10_11.3: ref (i32,) = temporary %.loc10_11.2, %.loc10_11.1 -// CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.3, %.loc10_14 +// CHECK:STDOUT: %.loc10_11.1: ref (i32,) = temporary_storage +// CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary %.loc10_11.1, %F.call +// CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.2, %.loc10_14 // CHECK:STDOUT: %.loc10_15.2: i32 = bind_value %.loc10_15.1 // CHECK:STDOUT: return %.loc10_15.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/default_fn.carbon b/toolchain/check/testdata/interface/default_fn.carbon index ecf75edfe2f9..7ed941733ec6 100644 --- a/toolchain/check/testdata/interface/default_fn.carbon +++ b/toolchain/check/testdata/interface/default_fn.carbon @@ -87,7 +87,7 @@ class C { // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [template = constants.%.1] // CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc10 [template = constants.%.3] // CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc13: init () = call %.1() +// CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index dd740d0bd153..32ff80194e03 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -63,8 +63,8 @@ var a: i32 = NS.A(); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc6: init i32 = call %A.ref() -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %A.call: init i32 = call %A.ref() +// CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index 6041f258eb0e..325eb1f6357f 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -61,18 +61,18 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ns.ref: = name_ref ns, file.%ns [template = file.%NS] // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc13_28: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc13_30.1: i32 = value_of_initializer %.loc13_28 -// CHECK:STDOUT: %.loc13_30.2: i32 = converted %.loc13_28, %.loc13_30.1 +// 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 // CHECK:STDOUT: return %.loc13_30.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%A] -// CHECK:STDOUT: %.loc17_25: init i32 = call %C.ref() -// CHECK:STDOUT: %.loc17_27.1: i32 = value_of_initializer %.loc17_25 -// CHECK:STDOUT: %.loc17_27.2: i32 = converted %.loc17_25, %.loc17_27.1 +// 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 // CHECK:STDOUT: return %.loc17_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/function.carbon b/toolchain/check/testdata/namespace/function.carbon index 5cd9b019806e..26be6f9a53a1 100644 --- a/toolchain/check/testdata/namespace/function.carbon +++ b/toolchain/check/testdata/namespace/function.carbon @@ -53,7 +53,7 @@ fn Bar() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %Baz.ref: = name_ref Baz, file.%Baz.loc13 [template = file.%Baz.loc13] -// CHECK:STDOUT: %.loc17: init () = call %Baz.ref() +// CHECK:STDOUT: %Baz.call: init () = call %Baz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/imported.carbon b/toolchain/check/testdata/namespace/imported.carbon index d415754c3a1d..7be0329d85ed 100644 --- a/toolchain/check/testdata/namespace/imported.carbon +++ b/toolchain/check/testdata/namespace/imported.carbon @@ -100,24 +100,24 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref.loc4: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %A.ref.loc4: = name_ref A, file.%import_ref.3 [template = imports.%A] -// CHECK:STDOUT: %.loc4: init () = call %A.ref.loc4() -// CHECK:STDOUT: assign file.%a.var, %.loc4 +// CHECK:STDOUT: %A.call.loc4: init () = call %A.ref.loc4() +// CHECK:STDOUT: assign file.%a.var, %A.call.loc4 // CHECK:STDOUT: %NS.ref.loc5: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %ChildNS.ref.loc5: = name_ref ChildNS, file.%ChildNS [template = file.%ChildNS] // CHECK:STDOUT: %B.ref.loc5: = name_ref B, file.%import_ref.4 [template = imports.%B] -// CHECK:STDOUT: %.loc5: init () = call %B.ref.loc5() -// CHECK:STDOUT: assign file.%b.var, %.loc5 +// CHECK:STDOUT: %B.call.loc5: init () = call %B.ref.loc5() +// CHECK:STDOUT: assign file.%b.var, %B.call.loc5 // CHECK:STDOUT: %package.ref.loc7: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref.loc7: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %A.ref.loc7: = name_ref A, file.%import_ref.3 [template = imports.%A] -// CHECK:STDOUT: %.loc7: init () = call %A.ref.loc7() -// CHECK:STDOUT: assign file.%package_a.var, %.loc7 +// CHECK:STDOUT: %A.call.loc7: init () = call %A.ref.loc7() +// CHECK:STDOUT: assign file.%package_a.var, %A.call.loc7 // CHECK:STDOUT: %package.ref.loc8: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref.loc8: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %ChildNS.ref.loc8: = name_ref ChildNS, file.%ChildNS [template = file.%ChildNS] // CHECK:STDOUT: %B.ref.loc8: = name_ref B, file.%import_ref.4 [template = imports.%B] -// CHECK:STDOUT: %.loc8: init () = call %B.ref.loc8() -// CHECK:STDOUT: assign file.%package_b.var, %.loc8 +// CHECK:STDOUT: %B.call.loc8: init () = call %B.ref.loc8() +// CHECK:STDOUT: assign file.%package_b.var, %B.call.loc8 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index 89a9b619e450..df0089b404ad 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -151,8 +151,8 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] // CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] -// CHECK:STDOUT: %.loc5: init () = call %D.ref() -// CHECK:STDOUT: assign file.%e.var, %.loc5 +// CHECK:STDOUT: %D.call: init () = call %D.ref() +// CHECK:STDOUT: assign file.%e.var, %D.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/merging.carbon b/toolchain/check/testdata/namespace/merging.carbon index 70396d65f6a1..8fcc36c4c8f1 100644 --- a/toolchain/check/testdata/namespace/merging.carbon +++ b/toolchain/check/testdata/namespace/merging.carbon @@ -125,16 +125,16 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref.loc12: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.2 [template = imports.%A] -// CHECK:STDOUT: %.loc12: init () = call %A.ref() +// CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: %NS.ref.loc13: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %B1.ref: = name_ref B1, file.%import_ref.3 [template = imports.%B1] -// CHECK:STDOUT: %.loc13: init () = call %B1.ref() +// CHECK:STDOUT: %B1.call: init () = call %B1.ref() // CHECK:STDOUT: %NS.ref.loc14: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %B2.ref: = name_ref B2, file.%import_ref.4 [template = imports.%B2] -// CHECK:STDOUT: %.loc14: init () = call %B2.ref() +// CHECK:STDOUT: %B2.call: init () = call %B2.ref() // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] -// CHECK:STDOUT: %.loc15: init () = call %C.ref() +// CHECK:STDOUT: %C.call: init () = call %C.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/nested.carbon b/toolchain/check/testdata/namespace/nested.carbon index f37a9d3eec40..27c41dc66d25 100644 --- a/toolchain/check/testdata/namespace/nested.carbon +++ b/toolchain/check/testdata/namespace/nested.carbon @@ -47,7 +47,7 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %Bar.ref: = name_ref Bar, file.%Bar [template = file.%Bar] // CHECK:STDOUT: %Wiz.ref: = name_ref Wiz, file.%Wiz [template = file.%Wiz] -// CHECK:STDOUT: %.loc14: init () = call %Wiz.ref() +// CHECK:STDOUT: %Wiz.call: init () = call %Wiz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index 2527eb1e1929..80eebdd69dfc 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -59,7 +59,7 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref.loc16: = name_ref A, file.%A.loc10 [template = file.%A.loc10] -// CHECK:STDOUT: %.loc16: init () = call %A.ref.loc16() +// CHECK:STDOUT: %A.call: init () = call %A.ref.loc16() // CHECK:STDOUT: %.loc17: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc17 br !if.then else br !if.else // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/unqualified_lookup.carbon b/toolchain/check/testdata/namespace/unqualified_lookup.carbon index 8177bb606f9d..c2efe96ae370 100644 --- a/toolchain/check/testdata/namespace/unqualified_lookup.carbon +++ b/toolchain/check/testdata/namespace/unqualified_lookup.carbon @@ -66,27 +66,27 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: fn @CallA() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc15: init () = call %A.ref() +// CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallAB() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc19: init () = call %A.ref() +// CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc20: init () = call %B.ref() +// CHECK:STDOUT: %B.call: init () = call %B.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallABC() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc24: init () = call %A.ref() +// CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc25: init () = call %B.ref() +// CHECK:STDOUT: %B.call: init () = call %B.ref() // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] -// CHECK:STDOUT: %.loc26: init () = call %C.ref() +// CHECK:STDOUT: %C.call: init () = call %C.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index 61a225dcfd14..53b7b62fe0ef 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -72,17 +72,17 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: fn @And() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc11_11: init bool = call %F.ref() -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11 -// CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_11, %.loc11_14.1 +// 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 // CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false [template = constants.%.2] // 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: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc11_19: init bool = call %G.ref() -// CHECK:STDOUT: %.loc11_14.4: bool = value_of_initializer %.loc11_19 -// CHECK:STDOUT: %.loc11_14.5: bool = converted %.loc11_19, %.loc11_14.4 +// 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 // CHECK:STDOUT: br !and.result(%.loc11_14.5) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: 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 288b3973c9c5..7356746074ba 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 @@ -46,9 +46,9 @@ var or_: F(true or true); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.1] -// CHECK:STDOUT: %.loc38_11: init type = call (%.loc38_17) -// CHECK:STDOUT: %.loc38_24.1: type = value_of_initializer %.loc38_11 -// CHECK:STDOUT: %.loc38_24.2: type = converted %.loc38_11, %.loc38_24.1 +// 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: } 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 36f4252e64c5..949113622434 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 @@ -94,9 +94,9 @@ fn Main() { // CHECK:STDOUT: %.loc14_7: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: assign %.loc14_3, %.loc14_7 // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc19_4: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc19_9: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: assign %.loc19_4, %.loc19_9 +// CHECK:STDOUT: %F.call: init i32 = call %F.ref() +// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: assign %F.call, %.loc19 // CHECK:STDOUT: %.loc24_4: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc24_7: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc24_8.1: (i32, i32) = tuple_literal (%.loc24_4, %.loc24_7) 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 6dfbdc1e4fb4..67a068351689 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -59,8 +59,8 @@ fn Main() { // 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: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc19: init i32 = call %F.ref() -// CHECK:STDOUT: assign %a.ref.loc19_3, %.loc19 +// CHECK:STDOUT: %F.call: init i32 = call %F.ref() +// CHECK:STDOUT: assign %a.ref.loc19_3, %F.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index b1a73f1b4fd0..0e68695b9a81 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -72,18 +72,18 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: fn @Or() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc11_11: init bool = call %F.ref() -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11 -// CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_11, %.loc11_14.1 +// 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 // CHECK:STDOUT: %.loc11_14.3: bool = not %.loc11_14.2 // CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true [template = constants.%.1] // 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: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc11_18: init bool = call %G.ref() -// CHECK:STDOUT: %.loc11_14.5: bool = value_of_initializer %.loc11_18 -// CHECK:STDOUT: %.loc11_14.6: bool = converted %.loc11_18, %.loc11_14.5 +// 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 // CHECK:STDOUT: br !or.result(%.loc11_14.6) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index 58564e4fc6e7..2c4b7c25fbbc 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -149,7 +149,7 @@ fn Main() { // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Foo.ref: = name_ref Foo, @C.%Foo [template = @C.%Foo] -// CHECK:STDOUT: %.loc11: init () = call %Foo.ref() +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/cross_package_import.carbon b/toolchain/check/testdata/packages/cross_package_import.carbon index 52c87ff7cc4d..58e985e0682a 100644 --- a/toolchain/check/testdata/packages/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/cross_package_import.carbon @@ -258,10 +258,10 @@ fn Other.G() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref.loc8: = name_ref Other, file.%Other [template = file.%Other] // CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F] -// CHECK:STDOUT: %.loc8: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: %Other.ref.loc9: = name_ref Other, file.%Other [template = file.%Other] // CHECK:STDOUT: %F2.ref: = name_ref F2, file.%import_ref.2 [template = imports.%F2] -// CHECK:STDOUT: %.loc9: init () = call %F2.ref() +// CHECK:STDOUT: %F2.call: init () = call %F2.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -292,7 +292,7 @@ fn Other.G() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref: = name_ref Other, file.%Other [template = file.%Other] // CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F.1] -// CHECK:STDOUT: %.loc8: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -334,7 +334,7 @@ fn Other.G() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref: = name_ref Other, file.%Other [template = file.%Other] // CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F.1] -// CHECK:STDOUT: %.loc24: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/loaded_global.carbon b/toolchain/check/testdata/packages/loaded_global.carbon index b20162e29804..2c015eaa5075 100644 --- a/toolchain/check/testdata/packages/loaded_global.carbon +++ b/toolchain/check/testdata/packages/loaded_global.carbon @@ -77,12 +77,12 @@ var package_b: () = package.B(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref.loc4: = name_ref A, file.%import_ref [template = imports.%A] -// CHECK:STDOUT: %.loc4: init () = call %A.ref.loc4() -// CHECK:STDOUT: assign file.%a.var, %.loc4 +// CHECK:STDOUT: %A.call.loc4: init () = call %A.ref.loc4() +// CHECK:STDOUT: assign file.%a.var, %A.call.loc4 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %A.ref.loc6: = name_ref A, file.%import_ref [template = imports.%A] -// CHECK:STDOUT: %.loc6: init () = call %A.ref.loc6() -// CHECK:STDOUT: assign file.%package_a.var, %.loc6 +// CHECK:STDOUT: %A.call.loc6: init () = call %A.ref.loc6() +// CHECK:STDOUT: assign file.%package_a.var, %A.call.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -129,12 +129,12 @@ var package_b: () = package.B(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %B.ref.loc6: = name_ref B, file.%import_ref [template = imports.%B] -// CHECK:STDOUT: %.loc6: init () = call %B.ref.loc6() -// CHECK:STDOUT: assign file.%b.var, %.loc6 +// CHECK:STDOUT: %B.call.loc6: init () = call %B.ref.loc6() +// CHECK:STDOUT: assign file.%b.var, %B.call.loc6 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %B.ref.loc8: = name_ref B, file.%import_ref [template = imports.%B] -// CHECK:STDOUT: %.loc8: init () = call %B.ref.loc8() -// CHECK:STDOUT: assign file.%package_b.var, %.loc8 +// CHECK:STDOUT: %B.call.loc8: init () = call %B.ref.loc8() +// CHECK:STDOUT: assign file.%package_b.var, %B.call.loc8 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index c9ef11a57822..45a815a5e977 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -189,10 +189,10 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.16] // CHECK:STDOUT: %.loc49_3: bool* = addr_of [template = ] // CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] -// CHECK:STDOUT: %.loc54_5.1: init {.a: i32} = call %H.ref() -// CHECK:STDOUT: %.loc54_5.2: ref {.a: i32} = temporary_storage -// CHECK:STDOUT: %.loc54_5.3: ref {.a: i32} = temporary %.loc54_5.2, %.loc54_5.1 -// CHECK:STDOUT: %.loc54_7: ref i32 = struct_access %.loc54_5.3, element0 +// 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 +// CHECK:STDOUT: %.loc54_7: ref i32 = struct_access %.loc54_5.2, element0 // CHECK:STDOUT: %.loc54_3: i32* = addr_of [template = ] // CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.16] @@ -203,8 +203,8 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: fn @AddressOfCall() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc67_5: init i32 = call %G.ref() -// CHECK:STDOUT: %.loc67_3: i32* = addr_of [template = ] +// CHECK:STDOUT: %G.call: init i32 = call %G.ref() +// CHECK:STDOUT: %.loc67: i32* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 5ce4e857c74d..dc676554d741 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -30,9 +30,9 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: } // CHECK:STDOUT: %Six: = fn_decl @Six [template] { // CHECK:STDOUT: %ReturnType.ref: = name_ref ReturnType, %ReturnType [template = %ReturnType] -// CHECK:STDOUT: %.loc13_23: init type = call %ReturnType.ref() -// CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %.loc13_23 -// CHECK:STDOUT: %.loc13_24.2: type = converted %.loc13_23, %.loc13_24.1 +// CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() +// CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %ReturnType.call +// CHECK:STDOUT: %.loc13_24.2: type = converted %ReturnType.call, %.loc13_24.1 // CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index cff307fd2d99..432c31318f03 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -45,18 +45,18 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage -// CHECK:STDOUT: %.loc10_25.2: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 +// 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.%.4] -// CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %.loc10_25.2, %.loc10_34) -// CHECK:STDOUT: %.loc10_25.3: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %.loc10_25.2 -// CHECK:STDOUT: %.loc10_25.4: ref i32 = struct_access %.loc10_25.3, element0 -// CHECK:STDOUT: %.loc10_25.5: i32 = bind_value %.loc10_25.4 -// CHECK:STDOUT: %.loc10_25.6: ref i32 = struct_access %.loc10_25.3, element1 -// CHECK:STDOUT: %.loc10_25.7: i32 = bind_value %.loc10_25.6 -// CHECK:STDOUT: %.loc10_25.8: ref i32 = struct_access %.loc10_25.3, element2 -// CHECK:STDOUT: %.loc10_25.9: i32 = bind_value %.loc10_25.8 -// CHECK:STDOUT: %.loc10_25.10: {.x: i32, .y: i32, .z: i32} = struct_value (%.loc10_25.5, %.loc10_25.7, %.loc10_25.9) -// CHECK:STDOUT: %.loc10_35.2: {.x: i32, .y: i32, .z: i32} = converted %.loc10_25.2, %.loc10_25.10 +// CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %G.call, %.loc10_34) +// CHECK:STDOUT: %.loc10_25.2: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %G.call +// CHECK:STDOUT: %.loc10_25.3: ref i32 = struct_access %.loc10_25.2, element0 +// CHECK:STDOUT: %.loc10_25.4: i32 = bind_value %.loc10_25.3 +// CHECK:STDOUT: %.loc10_25.5: ref i32 = struct_access %.loc10_25.2, element1 +// CHECK:STDOUT: %.loc10_25.6: i32 = bind_value %.loc10_25.5 +// CHECK:STDOUT: %.loc10_25.7: ref i32 = struct_access %.loc10_25.2, element2 +// CHECK:STDOUT: %.loc10_25.8: i32 = bind_value %.loc10_25.7 +// CHECK:STDOUT: %.loc10_25.9: {.x: i32, .y: i32, .z: i32} = struct_value (%.loc10_25.4, %.loc10_25.6, %.loc10_25.8) +// CHECK:STDOUT: %.loc10_35.2: {.x: i32, .y: i32, .z: i32} = converted %G.call, %.loc10_25.9 // CHECK:STDOUT: %.loc10_35.3: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_value (%.loc10_16, %.loc10_35.2, %.loc10_34) // CHECK:STDOUT: %.loc10_35.4: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = converted %.loc10_35.1, %.loc10_35.3 // CHECK:STDOUT: %.loc10_36: {.x: i32, .y: i32, .z: i32} = struct_access %.loc10_35.4, element1 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index ab667ddde8fe..64c9169341c5 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -49,12 +49,12 @@ fn G() { // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 -// CHECK:STDOUT: %.loc10_62: init (i32, i32, i32) = call %F.ref.loc10_61() to %.loc10_74.1 +// 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: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 -// CHECK:STDOUT: %.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 (%.loc10_62, %.loc10_72) -// CHECK:STDOUT: %.loc10_74.4: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_init (%.loc10_62, %.loc10_72) to %v.var +// 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) +// CHECK:STDOUT: %.loc10_74.4: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_init (%F.call.loc10_62, %F.call.loc10_72) to %v.var // CHECK:STDOUT: %.loc10_75: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = converted %.loc10_74.3, %.loc10_74.4 // CHECK:STDOUT: assign %v.var, %.loc10_75 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 24078c8d87d7..e024bb785e29 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -50,14 +50,14 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] // CHECK:STDOUT: %MakeF64.ref: = name_ref MakeF64, file.%MakeF64 [template = file.%MakeF64] -// CHECK:STDOUT: %.loc11_44: init f64 = call %MakeF64.ref() +// CHECK:STDOUT: %MakeF64.call: init f64 = call %MakeF64.ref() // CHECK:STDOUT: %MakeI32.ref: = name_ref MakeI32, file.%MakeI32 [template = file.%MakeI32] -// CHECK:STDOUT: %.loc11_60: init i32 = call %MakeI32.ref() -// CHECK:STDOUT: %.loc11_62.1: {.b: f64, .a: i32} = struct_literal (%.loc11_44, %.loc11_60) -// CHECK:STDOUT: %.loc11_62.2: i32 = value_of_initializer %.loc11_60 -// CHECK:STDOUT: %.loc11_62.3: i32 = converted %.loc11_60, %.loc11_62.2 -// CHECK:STDOUT: %.loc11_62.4: f64 = value_of_initializer %.loc11_44 -// CHECK:STDOUT: %.loc11_62.5: f64 = converted %.loc11_44, %.loc11_62.4 +// 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 +// CHECK:STDOUT: %.loc11_62.3: i32 = converted %MakeI32.call, %.loc11_62.2 +// CHECK:STDOUT: %.loc11_62.4: f64 = value_of_initializer %MakeF64.call +// CHECK:STDOUT: %.loc11_62.5: f64 = converted %MakeF64.call, %.loc11_62.4 // CHECK:STDOUT: %.loc11_62.6: {.a: i32, .b: f64} = struct_value (%.loc11_62.3, %.loc11_62.5) // CHECK:STDOUT: %.loc11_63: {.a: i32, .b: f64} = converted %.loc11_62.1, %.loc11_62.6 // CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_63 diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index 4524c684187a..f0af2ed6e091 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -63,12 +63,12 @@ fn H() { // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_48: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc10_49: init (i32, i32, i32) = call %F.ref.loc10_48() to %.loc10_56.1 +// 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: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 -// CHECK:STDOUT: %.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 (%.loc10_49, %.loc10_54) -// CHECK:STDOUT: %.loc10_56.4: init ((i32, i32, i32), (i32, i32, i32)) = tuple_init (%.loc10_49, %.loc10_54) to %v.var +// 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) +// CHECK:STDOUT: %.loc10_56.4: init ((i32, i32, i32), (i32, i32, i32)) = tuple_init (%F.call.loc10_49, %F.call.loc10_54) to %v.var // CHECK:STDOUT: %.loc10_57: init ((i32, i32, i32), (i32, i32, i32)) = converted %.loc10_56.3, %.loc10_56.4 // CHECK:STDOUT: assign %v.var, %.loc10_57 // CHECK:STDOUT: return @@ -85,14 +85,14 @@ fn H() { // CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 [template = constants.%.12] // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc14_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 -// CHECK:STDOUT: %.loc14_45: init (i32, i32, i32) = call %F.ref() to %.loc14_50.1 +// 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.%.13] -// CHECK:STDOUT: %.loc14_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc14_41, %.loc14_45, %.loc14_49) +// CHECK:STDOUT: %.loc14_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc14_41, %F.call, %.loc14_49) // CHECK:STDOUT: %.loc14_50.3: ref i32 = tuple_access %v.var, element0 // CHECK:STDOUT: %.loc14_50.4: init i32 = initialize_from %.loc14_41 to %.loc14_50.3 [template = constants.%.12] // CHECK:STDOUT: %.loc14_50.5: ref i32 = tuple_access %v.var, element2 // CHECK:STDOUT: %.loc14_50.6: init i32 = initialize_from %.loc14_49 to %.loc14_50.5 [template = constants.%.13] -// CHECK:STDOUT: %.loc14_50.7: init (i32, (i32, i32, i32), i32) = tuple_init (%.loc14_50.4, %.loc14_45, %.loc14_50.6) to %v.var +// CHECK:STDOUT: %.loc14_50.7: init (i32, (i32, i32, i32), i32) = tuple_init (%.loc14_50.4, %F.call, %.loc14_50.6) to %v.var // CHECK:STDOUT: %.loc14_51: init (i32, (i32, i32, i32), i32) = converted %.loc14_50.2, %.loc14_50.7 // CHECK:STDOUT: assign %v.var, %.loc14_51 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index 6fa4d2315eb5..e8abd2e487ae 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -91,16 +91,16 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc17: // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc17_11: init bool = call %A.ref() -// CHECK:STDOUT: %.loc17_13.1: bool = value_of_initializer %.loc17_11 -// CHECK:STDOUT: %.loc17_13.2: bool = converted %.loc17_11, %.loc17_13.1 +// 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: = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc18_10: init bool = call %B.ref() -// CHECK:STDOUT: %.loc18_12.1: bool = value_of_initializer %.loc18_10 -// CHECK:STDOUT: %.loc18_12.2: bool = converted %.loc18_10, %.loc18_12.1 +// 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 // CHECK:STDOUT: if %.loc18_12.2 br !if.then.loc18 else br !if.else.loc18 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc18: @@ -108,9 +108,9 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc18: // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] -// CHECK:STDOUT: %.loc19_10: init bool = call %C.ref() -// CHECK:STDOUT: %.loc19_12.1: bool = value_of_initializer %.loc19_10 -// CHECK:STDOUT: %.loc19_12.2: bool = converted %.loc19_10, %.loc19_12.1 +// 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 // CHECK:STDOUT: if %.loc19_12.2 br !if.then.loc19 else br !if.else.loc19 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc19: @@ -121,16 +121,16 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc20: // CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] -// CHECK:STDOUT: %.loc20_13: init bool = call %D.ref() -// CHECK:STDOUT: %.loc20_15.1: bool = value_of_initializer %.loc20_13 -// CHECK:STDOUT: %.loc20_15.2: bool = converted %.loc20_13, %.loc20_15.1 +// 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: = name_ref E, file.%E [template = file.%E] -// CHECK:STDOUT: %.loc21_12: init bool = call %E.ref() -// CHECK:STDOUT: %.loc21_14.1: bool = value_of_initializer %.loc21_12 -// CHECK:STDOUT: %.loc21_14.2: bool = converted %.loc21_12, %.loc21_14.1 +// 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 // CHECK:STDOUT: if %.loc21_14.2 br !if.then.loc21 else br !if.else.loc21 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc21: @@ -138,9 +138,9 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc21: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc22_12: init bool = call %F.ref() -// CHECK:STDOUT: %.loc22_14.1: bool = value_of_initializer %.loc22_12 -// CHECK:STDOUT: %.loc22_14.2: bool = converted %.loc22_12, %.loc22_14.1 +// 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 // CHECK:STDOUT: if %.loc22_14.2 br !if.then.loc22 else br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc22: @@ -151,9 +151,9 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !while.done.loc20: // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc24_10: init bool = call %G.ref() -// CHECK:STDOUT: %.loc24_12.1: bool = value_of_initializer %.loc24_10 -// CHECK:STDOUT: %.loc24_12.2: bool = converted %.loc24_10, %.loc24_12.1 +// 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 // CHECK:STDOUT: if %.loc24_12.2 br !if.then.loc24 else br !if.else.loc24 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc24: @@ -161,9 +161,9 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc24: // CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] -// CHECK:STDOUT: %.loc25_10: init bool = call %H.ref() -// CHECK:STDOUT: %.loc25_12.1: bool = value_of_initializer %.loc25_10 -// CHECK:STDOUT: %.loc25_12.2: bool = converted %.loc25_10, %.loc25_12.1 +// 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 // CHECK:STDOUT: if %.loc25_12.2 br !if.then.loc25 else br !if.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc25: diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 9931aaf8af61..faf660897c0a 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -55,24 +55,24 @@ fn While() { // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc14: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: // CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond [template = file.%Cond] -// CHECK:STDOUT: %.loc15_14: init bool = call %Cond.ref() -// CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %.loc15_14 -// CHECK:STDOUT: %.loc15_16.2: bool = converted %.loc15_14, %.loc15_16.1 +// 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: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc16: init () = call %G.ref() +// CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: // CHECK:STDOUT: !while.done: // CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] -// CHECK:STDOUT: %.loc19: init () = call %H.ref() +// CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 619ba4b982c6..45182af69e4b 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -54,24 +54,24 @@ fn While() { // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc14: init () = call %F.ref() +// CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: // CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond [template = file.%Cond] -// CHECK:STDOUT: %.loc15_14: init bool = call %Cond.ref() -// CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %.loc15_14 -// CHECK:STDOUT: %.loc15_16.2: bool = converted %.loc15_14, %.loc15_16.1 +// 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: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc16: init () = call %G.ref() +// CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.done: // CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] -// CHECK:STDOUT: %.loc18: init () = call %H.ref() +// CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/driver/BUILD b/toolchain/driver/BUILD index 3606d52015f6..117770a474d5 100644 --- a/toolchain/driver/BUILD +++ b/toolchain/driver/BUILD @@ -32,6 +32,7 @@ cc_library( "//toolchain/parse", "//toolchain/sem_ir:file", "//toolchain/sem_ir:formatter", + "//toolchain/sem_ir:inst_namer", "//toolchain/source:source_buffer", "@llvm-project//llvm:Core", "@llvm-project//llvm:Support", diff --git a/toolchain/driver/driver.cpp b/toolchain/driver/driver.cpp index e829414ccc95..8ff8d2b1d2e8 100644 --- a/toolchain/driver/driver.cpp +++ b/toolchain/driver/driver.cpp @@ -26,6 +26,7 @@ #include "toolchain/lower/lower.h" #include "toolchain/parse/parse.h" #include "toolchain/sem_ir/formatter.h" +#include "toolchain/sem_ir/inst_namer.h" #include "toolchain/source/source_buffer.h" namespace Carbon { @@ -524,8 +525,11 @@ class Driver::CompilationUnit { LogCall("Lower::LowerToLLVM", [&] { llvm_context_ = std::make_unique(); + // TODO: Consider disabling instruction naming by default if we're not + // producing textual LLVM IR. + SemIR::InstNamer inst_namer(*tokens_, *parse_tree_, *sem_ir_); module_ = Lower::LowerToLLVM(*llvm_context_, input_filename_, *sem_ir_, - vlog_stream_); + &inst_namer, vlog_stream_); }); if (vlog_stream_) { CARBON_VLOG() << "*** llvm::Module ***\n"; diff --git a/toolchain/lower/BUILD b/toolchain/lower/BUILD index 7cc8f92d30b7..76d419e014f7 100644 --- a/toolchain/lower/BUILD +++ b/toolchain/lower/BUILD @@ -19,6 +19,7 @@ cc_library( deps = [ ":context", "//toolchain/sem_ir:file", + "//toolchain/sem_ir:inst_namer", "@llvm-project//llvm:Core", "@llvm-project//llvm:Support", ], @@ -45,6 +46,7 @@ cc_library( "//toolchain/sem_ir:file", "//toolchain/sem_ir:inst", "//toolchain/sem_ir:inst_kind", + "//toolchain/sem_ir:inst_namer", "@llvm-project//llvm:Core", "@llvm-project//llvm:Support", ], diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index 5ce4c31b7746..dc1e826379d5 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -18,10 +18,12 @@ namespace Carbon::Lower { FileContext::FileContext(llvm::LLVMContext& llvm_context, llvm::StringRef module_name, const SemIR::File& sem_ir, + const SemIR::InstNamer* inst_namer, llvm::raw_ostream* vlog_stream) : llvm_context_(&llvm_context), llvm_module_(std::make_unique(module_name, llvm_context)), sem_ir_(&sem_ir), + inst_namer_(inst_namer), vlog_stream_(vlog_stream) { CARBON_CHECK(!sem_ir.has_errors()) << "Generating LLVM IR from invalid SemIR::File is unsupported."; diff --git a/toolchain/lower/file_context.h b/toolchain/lower/file_context.h index f769df834b0d..af146c0c0aec 100644 --- a/toolchain/lower/file_context.h +++ b/toolchain/lower/file_context.h @@ -9,6 +9,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "toolchain/sem_ir/file.h" +#include "toolchain/sem_ir/inst_namer.h" namespace Carbon::Lower { @@ -17,6 +18,7 @@ class FileContext { public: explicit FileContext(llvm::LLVMContext& llvm_context, llvm::StringRef module_name, const SemIR::File& sem_ir, + const SemIR::InstNamer* inst_namer, llvm::raw_ostream* vlog_stream); // Lowers the SemIR::File to LLVM IR. Should only be called once, and handles @@ -50,6 +52,7 @@ class FileContext { auto llvm_context() -> llvm::LLVMContext& { return *llvm_context_; } auto llvm_module() -> llvm::Module& { return *llvm_module_; } auto sem_ir() -> const SemIR::File& { return *sem_ir_; } + auto inst_namer() -> const SemIR::InstNamer* { return inst_namer_; } private: // Builds the declaration for the given function, which should then be cached @@ -80,6 +83,9 @@ class FileContext { // The input SemIR. const SemIR::File* const sem_ir_; + // The instruction namer, if given. + const SemIR::InstNamer* const inst_namer_; + // The optional vlog stream. llvm::raw_ostream* vlog_stream_; diff --git a/toolchain/lower/function_context.cpp b/toolchain/lower/function_context.cpp index f1ac4f66bfab..3ee422060378 100644 --- a/toolchain/lower/function_context.cpp +++ b/toolchain/lower/function_context.cpp @@ -14,14 +14,19 @@ FunctionContext::FunctionContext(FileContext& file_context, llvm::raw_ostream* vlog_stream) : file_context_(&file_context), function_(function), - builder_(file_context.llvm_context()), + builder_(file_context.llvm_context(), llvm::ConstantFolder(), + Inserter(file_context.inst_namer())), vlog_stream_(vlog_stream) {} auto FunctionContext::GetBlock(SemIR::InstBlockId block_id) -> llvm::BasicBlock* { llvm::BasicBlock*& entry = blocks_[block_id]; if (!entry) { - entry = llvm::BasicBlock::Create(llvm_context(), "", function_); + llvm::StringRef label_name; + if (const auto* inst_namer = file_context_->inst_namer()) { + label_name = inst_namer->GetUnscopedLabelFor(block_id); + } + entry = llvm::BasicBlock::Create(llvm_context(), label_name, function_); } return entry; } @@ -34,6 +39,9 @@ auto FunctionContext::TryToReuseBlock(SemIR::InstBlockId block_id, if (block == synthetic_block_) { synthetic_block_ = nullptr; } + if (const auto* inst_namer = file_context_->inst_namer()) { + block->setName(inst_namer->GetUnscopedLabelFor(block_id)); + } return true; } @@ -41,6 +49,7 @@ auto FunctionContext::LowerBlock(SemIR::InstBlockId block_id) -> void { for (const auto& inst_id : sem_ir().inst_blocks().Get(block_id)) { auto inst = sem_ir().insts().Get(inst_id); CARBON_VLOG() << "Lowering " << inst_id << ": " << inst << "\n"; + builder_.getInserter().SetCurrentInstId(inst_id); switch (inst.kind()) { #define CARBON_SEM_IR_INST_KIND(Name) \ case SemIR::Name::Kind: \ @@ -49,6 +58,7 @@ auto FunctionContext::LowerBlock(SemIR::InstBlockId block_id) -> void { #include "toolchain/sem_ir/inst_kind.def" } } + builder_.getInserter().SetCurrentInstId(SemIR::InstId::Invalid); } auto FunctionContext::GetBlockArg(SemIR::InstBlockId block_id, @@ -116,4 +126,20 @@ auto FunctionContext::CopyValue(SemIR::TypeId type_id, SemIR::InstId source_id, } } +auto FunctionContext::Inserter::InsertHelper( + llvm::Instruction* inst, const llvm::Twine& name, llvm::BasicBlock* block, + llvm::BasicBlock::iterator insert_pt) const -> void { + llvm::StringRef base_name; + llvm::StringRef separator; + if (inst_namer_ && !inst->getType()->isVoidTy()) { + base_name = inst_namer_->GetUnscopedNameFor(inst_id_); + } + if (!base_name.empty() && !name.isTriviallyEmpty()) { + separator = "."; + } + + IRBuilderDefaultInserter::InsertHelper(inst, base_name + separator + name, + block, insert_pt); +} + } // namespace Carbon::Lower diff --git a/toolchain/lower/function_context.h b/toolchain/lower/function_context.h index 4f9a2839a518..b7824a2e37ff 100644 --- a/toolchain/lower/function_context.h +++ b/toolchain/lower/function_context.h @@ -96,10 +96,33 @@ class FunctionContext { return file_context_->llvm_context(); } auto llvm_module() -> llvm::Module& { return file_context_->llvm_module(); } - auto builder() -> llvm::IRBuilder<>& { return builder_; } + auto builder() -> llvm::IRBuilderBase& { return builder_; } auto sem_ir() -> const SemIR::File& { return file_context_->sem_ir(); } private: + // Custom instruction inserter for our IR builder. Automatically names + // instructions. + class Inserter : public llvm::IRBuilderDefaultInserter { + public: + explicit Inserter(const SemIR::InstNamer* inst_namer) + : inst_namer_(inst_namer) {} + + // Sets the instruction we are currently emitting. + void SetCurrentInstId(SemIR::InstId inst_id) { inst_id_ = inst_id; } + + private: + auto InsertHelper(llvm::Instruction* inst, const llvm::Twine& name, + llvm::BasicBlock* block, + llvm::BasicBlock::iterator insert_pt) const + -> void override; + + // The instruction namer. + const SemIR::InstNamer* inst_namer_; + + // The current instruction ID. + SemIR::InstId inst_id_ = SemIR::InstId::Invalid; + }; + // Emits a value copy for type `type_id` from `source_id` to `dest_id`. // `source_id` must produce a value representation for `type_id`, and // `dest_id` must be a pointer to a `type_id` object. @@ -112,7 +135,7 @@ class FunctionContext { // The IR function we're generating. llvm::Function* function_; - llvm::IRBuilder<> builder_; + llvm::IRBuilder builder_; // The optional vlog stream. llvm::raw_ostream* vlog_stream_; diff --git a/toolchain/lower/handle.cpp b/toolchain/lower/handle.cpp index 04fe3f07d7fd..ee962cfdd267 100644 --- a/toolchain/lower/handle.cpp +++ b/toolchain/lower/handle.cpp @@ -215,6 +215,7 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, // result type is a signed integer type. constexpr bool SignedOverflowIsUB = false; + // TODO: Move the instruction names here into InstNamer. switch (builtin_kind) { case SemIR::BuiltinFunctionKind::None: CARBON_FATAL() << "No callee in function call."; @@ -230,130 +231,130 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntSNegate: { // Lower `-x` as `0 - x`. auto* operand = context.GetValue(arg_ids[0]); - context.SetLocal(inst_id, - context.builder().CreateSub( - llvm::ConstantInt::getNullValue(operand->getType()), - operand, "neg", - /*HasNUW=*/false, - /*HasNSW=*/SignedOverflowIsUB)); + context.SetLocal( + inst_id, + context.builder().CreateSub( + llvm::ConstantInt::getNullValue(operand->getType()), operand, "", + /*HasNUW=*/false, + /*HasNSW=*/SignedOverflowIsUB)); return; } case SemIR::BuiltinFunctionKind::IntUNegate: { // Lower `-x` as `0 - x`. auto* operand = context.GetValue(arg_ids[0]); - context.SetLocal(inst_id, - context.builder().CreateSub( - llvm::ConstantInt::getNullValue(operand->getType()), - operand, "neg")); + context.SetLocal( + inst_id, + context.builder().CreateSub( + llvm::ConstantInt::getNullValue(operand->getType()), operand)); return; } case SemIR::BuiltinFunctionKind::IntComplement: { // Lower `^x` as `-1 ^ x`. auto* operand = context.GetValue(arg_ids[0]); - context.SetLocal(inst_id, - context.builder().CreateXor( - llvm::ConstantInt::getSigned(operand->getType(), -1), - operand, "cmpl")); + context.SetLocal( + inst_id, + context.builder().CreateXor( + llvm::ConstantInt::getSigned(operand->getType(), -1), operand)); return; } case SemIR::BuiltinFunctionKind::IntSAdd: { - context.SetLocal(inst_id, context.builder().CreateAdd( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "add", - /*HasNUW=*/false, - /*HasNSW=*/SignedOverflowIsUB)); + context.SetLocal( + inst_id, context.builder().CreateAdd(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]), "", + /*HasNUW=*/false, + /*HasNSW=*/SignedOverflowIsUB)); return; } case SemIR::BuiltinFunctionKind::IntSSub: { - context.SetLocal(inst_id, context.builder().CreateSub( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "sub", - /*HasNUW=*/false, - /*HasNSW=*/SignedOverflowIsUB)); + context.SetLocal( + inst_id, context.builder().CreateSub(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]), "", + /*HasNUW=*/false, + /*HasNSW=*/SignedOverflowIsUB)); return; } case SemIR::BuiltinFunctionKind::IntSMul: { - context.SetLocal(inst_id, context.builder().CreateMul( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "mul", - /*HasNUW=*/false, - /*HasNSW=*/SignedOverflowIsUB)); + context.SetLocal( + inst_id, context.builder().CreateMul(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]), "", + /*HasNUW=*/false, + /*HasNSW=*/SignedOverflowIsUB)); return; } case SemIR::BuiltinFunctionKind::IntSDiv: { - context.SetLocal(inst_id, context.builder().CreateSDiv( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "div")); + context.SetLocal( + inst_id, context.builder().CreateSDiv(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntSMod: { - context.SetLocal(inst_id, context.builder().CreateSRem( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "rem")); + context.SetLocal( + inst_id, context.builder().CreateSRem(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntUAdd: { - context.SetLocal(inst_id, context.builder().CreateAdd( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "add")); + context.SetLocal( + inst_id, context.builder().CreateAdd(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntUSub: { - context.SetLocal(inst_id, context.builder().CreateSub( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "sub")); + context.SetLocal( + inst_id, context.builder().CreateSub(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntUMul: { - context.SetLocal(inst_id, context.builder().CreateMul( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "mul")); + context.SetLocal( + inst_id, context.builder().CreateMul(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntUDiv: { - context.SetLocal(inst_id, context.builder().CreateUDiv( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "div")); + context.SetLocal( + inst_id, context.builder().CreateUDiv(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntUMod: { - context.SetLocal(inst_id, context.builder().CreateURem( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "rem")); + context.SetLocal( + inst_id, context.builder().CreateURem(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntAnd: { - context.SetLocal(inst_id, context.builder().CreateAnd( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "and")); + context.SetLocal( + inst_id, context.builder().CreateAnd(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntOr: { - context.SetLocal(inst_id, context.builder().CreateOr( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "or")); + context.SetLocal( + inst_id, context.builder().CreateOr(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntXor: { - context.SetLocal(inst_id, context.builder().CreateXor( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "xor")); + context.SetLocal( + inst_id, context.builder().CreateXor(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntLeftShift: { - context.SetLocal(inst_id, context.builder().CreateShl( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "shl")); + context.SetLocal( + inst_id, context.builder().CreateShl(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntRightShift: { - context.SetLocal(inst_id, IsSignedInt(context, inst_id) - ? context.builder().CreateAShr( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "shr") - : context.builder().CreateLShr( - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "shr")); + context.SetLocal( + inst_id, + IsSignedInt(context, inst_id) + ? context.builder().CreateAShr(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1])) + : context.builder().CreateLShr(context.GetValue(arg_ids[0]), + context.GetValue(arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntEq: @@ -362,12 +363,12 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntLessEq: case SemIR::BuiltinFunctionKind::IntGreater: case SemIR::BuiltinFunctionKind::IntGreaterEq: { - context.SetLocal(inst_id, - context.builder().CreateICmp( - GetBuiltinICmpPredicate( - builtin_kind, IsSignedInt(context, arg_ids[0])), - context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]), "cmp")); + context.SetLocal( + inst_id, + context.builder().CreateICmp( + GetBuiltinICmpPredicate(builtin_kind, + IsSignedInt(context, arg_ids[0])), + context.GetValue(arg_ids[0]), context.GetValue(arg_ids[1]))); return; } } @@ -407,14 +408,7 @@ auto HandleCall(FunctionContext& context, SemIR::InstId inst_id, } } - auto* call = context.builder().CreateCall(callee, args); - context.SetLocal(inst_id, call); - - // Name the call's result the same as the callee. - // TODO: Is this a helpful name? - if (!call->getType()->isVoidTy()) { - call->setName(callee->getName()); - } + context.SetLocal(inst_id, context.builder().CreateCall(callee, args)); } auto HandleConverted(FunctionContext& context, SemIR::InstId inst_id, @@ -567,13 +561,9 @@ auto HandleUnaryOperatorNot(FunctionContext& context, SemIR::InstId inst_id, auto HandleVarStorage(FunctionContext& context, SemIR::InstId inst_id, SemIR::VarStorage inst) -> void { - // TODO: Eventually this name will be optional, and we'll want to provide - // something like `var` as a default. However, that's not possible right now - // so cannot be tested. - auto name = context.sem_ir().names().GetIRBaseName(inst.name_id); - auto* alloca = context.builder().CreateAlloca(context.GetType(inst.type_id), - /*ArraySize=*/nullptr, name); - context.SetLocal(inst_id, alloca); + context.SetLocal(inst_id, + context.builder().CreateAlloca(context.GetType(inst.type_id), + /*ArraySize=*/nullptr)); } } // namespace Carbon::Lower diff --git a/toolchain/lower/lower.cpp b/toolchain/lower/lower.cpp index f11f2ff4a34a..82d06216a237 100644 --- a/toolchain/lower/lower.cpp +++ b/toolchain/lower/lower.cpp @@ -9,9 +9,11 @@ namespace Carbon::Lower { auto LowerToLLVM(llvm::LLVMContext& llvm_context, llvm::StringRef module_name, - const SemIR::File& sem_ir, llvm::raw_ostream* vlog_stream) + const SemIR::File& sem_ir, const SemIR::InstNamer* inst_namer, + llvm::raw_ostream* vlog_stream) -> std::unique_ptr { - FileContext context(llvm_context, module_name, sem_ir, vlog_stream); + FileContext context(llvm_context, module_name, sem_ir, inst_namer, + vlog_stream); return context.Run(); } diff --git a/toolchain/lower/lower.h b/toolchain/lower/lower.h index 16345a18e999..66ec79d80de7 100644 --- a/toolchain/lower/lower.h +++ b/toolchain/lower/lower.h @@ -8,12 +8,14 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "toolchain/sem_ir/file.h" +#include "toolchain/sem_ir/inst_namer.h" namespace Carbon::Lower { // Lowers SemIR to LLVM IR. auto LowerToLLVM(llvm::LLVMContext& llvm_context, llvm::StringRef module_name, - const SemIR::File& sem_ir, llvm::raw_ostream* vlog_stream) + const SemIR::File& sem_ir, const SemIR::InstNamer* inst_namer, + llvm::raw_ostream* vlog_stream) -> std::unique_ptr; } // namespace Carbon::Lower diff --git a/toolchain/lower/testdata/alias/local.carbon b/toolchain/lower/testdata/alias/local.carbon index a00d773a53bc..1606efec7c04 100644 --- a/toolchain/lower/testdata/alias/local.carbon +++ b/toolchain/lower/testdata/alias/local.carbon @@ -14,8 +14,9 @@ fn F() -> i32 { // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { -// CHECK:STDOUT: %a = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %a, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %a, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %a.var, align 4 +// CHECK:STDOUT: %.loc10 = load i32, ptr %a.var, align 4 +// CHECK:STDOUT: ret i32 %.loc10 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/array_in_place.carbon b/toolchain/lower/testdata/array/array_in_place.carbon index 9bda376d9c6c..14acb2dc3593 100644 --- a/toolchain/lower/testdata/array/array_in_place.carbon +++ b/toolchain/lower/testdata/array/array_in_place.carbon @@ -16,10 +16,11 @@ fn G() { // CHECK:STDOUT: declare void @F(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { -// CHECK:STDOUT: %v = alloca [2 x { i32, i32, i32 }], align 8 -// CHECK:STDOUT: %array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %array.index) -// CHECK:STDOUT: %array.index1 = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %array.index1) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8 +// CHECK:STDOUT: %.loc10_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc10_42.2.array.index) +// CHECK:STDOUT: %.loc10_42.5.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc10_42.5.array.index) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index f4c1573ff933..2b6b0c8b7d98 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -14,24 +14,26 @@ fn Run() { // CHECK:STDOUT: source_filename = "assign_return_value.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) { -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 12, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 24, ptr %tuple.elem1, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 12, ptr %.loc7_38.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc7_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 24, ptr %.loc7_38.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { -// CHECK:STDOUT: %t = alloca [2 x i32], align 4 -// CHECK:STDOUT: %temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %temp) -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %temp, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %array.index = getelementptr inbounds [2 x i32], ptr %t, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %array.index, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %temp, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %array.index2 = getelementptr inbounds [2 x i32], ptr %t, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %array.index2, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4 +// CHECK:STDOUT: %.loc10_22.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @F(ptr %.loc10_22.1.temp) +// CHECK:STDOUT: %.loc10_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc10_22.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_22.4 = load i32, ptr %.loc10_22.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_22.6.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc10_22.4, ptr %.loc10_22.6.array.index, align 4 +// CHECK:STDOUT: %.loc10_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc10_22.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc10_22.9 = load i32, ptr %.loc10_22.8.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_22.11.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc10_22.9, ptr %.loc10_22.11.array.index, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index e1148fbfa2fa..009faf0cfd21 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -16,39 +16,40 @@ fn Run() { // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { -// CHECK:STDOUT: %a = alloca [1 x i32], align 4 -// CHECK:STDOUT: %array.index = getelementptr inbounds [1 x i32], ptr %a, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %array.index, align 4 -// CHECK:STDOUT: %b = alloca [2 x double], align 8 -// CHECK:STDOUT: %array.index1 = getelementptr inbounds [2 x double], ptr %b, i32 0, i32 0 -// CHECK:STDOUT: store double 0x4026333333333334, ptr %array.index1, align 8 -// CHECK:STDOUT: %array.index2 = getelementptr inbounds [2 x double], ptr %b, i32 0, i32 1 -// CHECK:STDOUT: store double 2.200000e+00, ptr %array.index2, align 8 -// CHECK:STDOUT: %c = alloca [5 x {}], align 8 -// CHECK:STDOUT: %array.index3 = getelementptr inbounds [5 x {}], ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %array.index4 = getelementptr inbounds [5 x {}], ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %array.index5 = getelementptr inbounds [5 x {}], ptr %c, i32 0, i32 2 -// CHECK:STDOUT: %array.index6 = getelementptr inbounds [5 x {}], ptr %c, i32 0, i32 3 -// CHECK:STDOUT: %array.index7 = getelementptr inbounds [5 x {}], ptr %c, i32 0, i32 4 -// CHECK:STDOUT: %d = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem8 = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %tuple.elem8, align 4 -// CHECK:STDOUT: %tuple.elem9 = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 2 -// CHECK:STDOUT: store i32 3, ptr %tuple.elem9, align 4 -// CHECK:STDOUT: %e = alloca [3 x i32], align 4 -// CHECK:STDOUT: %tuple.elem10 = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem10, align 4 -// CHECK:STDOUT: %array.index11 = getelementptr inbounds [3 x i32], ptr %e, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %array.index11, align 4 -// CHECK:STDOUT: %tuple.elem12 = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem12, align 4 -// CHECK:STDOUT: %array.index13 = getelementptr inbounds [3 x i32], ptr %e, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %array.index13, align 4 -// CHECK:STDOUT: %tuple.elem14 = getelementptr inbounds { i32, i32, i32 }, ptr %d, i32 0, i32 2 -// CHECK:STDOUT: %3 = load i32, ptr %tuple.elem14, align 4 -// CHECK:STDOUT: %array.index15 = getelementptr inbounds [3 x i32], ptr %e, i32 0, i32 2 -// CHECK:STDOUT: store i32 %3, ptr %array.index15, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca [1 x i32], align 4 +// CHECK:STDOUT: %.loc8_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc8_24.3.array.index, align 4 +// CHECK:STDOUT: %b.var = alloca [2 x double], align 8 +// CHECK:STDOUT: %.loc9_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: store double 0x4026333333333334, ptr %.loc9_32.3.array.index, align 8 +// CHECK:STDOUT: %.loc9_32.6.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: store double 2.200000e+00, ptr %.loc9_32.6.array.index, align 8 +// CHECK:STDOUT: %c.var = alloca [5 x {}], align 8 +// CHECK:STDOUT: %.loc10_40.3.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_40.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc10_40.9.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc10_40.12.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 3 +// CHECK:STDOUT: %.loc10_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4 +// CHECK:STDOUT: %d.var = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc11_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc11_36.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc11_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc11_36.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc11_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 3, ptr %.loc11_36.6.tuple.elem, align 4 +// CHECK:STDOUT: %e.var = alloca [3 x i32], align 4 +// CHECK:STDOUT: %.loc12_21.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_21.2 = load i32, ptr %.loc12_21.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_21.4.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc12_21.2, ptr %.loc12_21.4.array.index, align 4 +// CHECK:STDOUT: %.loc12_21.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_21.7 = load i32, ptr %.loc12_21.6.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_21.9.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc12_21.7, ptr %.loc12_21.9.array.index, align 4 +// CHECK:STDOUT: %.loc12_21.11.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc12_21.12 = load i32, ptr %.loc12_21.11.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_21.14.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc12_21.12, ptr %.loc12_21.14.array.index, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/function_param.carbon b/toolchain/lower/testdata/array/function_param.carbon index 216b26a913af..c3642545ba87 100644 --- a/toolchain/lower/testdata/array/function_param.carbon +++ b/toolchain/lower/testdata/array/function_param.carbon @@ -16,19 +16,21 @@ fn G() -> i32 { // CHECK:STDOUT: source_filename = "function_param.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) { -// CHECK:STDOUT: %array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i -// CHECK:STDOUT: %1 = load i32, ptr %array.index, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i +// CHECK:STDOUT: %.loc8_15.3 = load i32, ptr %.loc8_15.2.array.index, align 4 +// CHECK:STDOUT: ret i32 %.loc8_15.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G() { -// CHECK:STDOUT: %temp = alloca [3 x i32], align 4 -// CHECK:STDOUT: %array.index = getelementptr inbounds [3 x i32], ptr %temp, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %array.index, align 4 -// CHECK:STDOUT: %array.index1 = getelementptr inbounds [3 x i32], ptr %temp, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %array.index1, align 4 -// CHECK:STDOUT: %array.index2 = getelementptr inbounds [3 x i32], ptr %temp, i32 0, i32 2 -// CHECK:STDOUT: store i32 3, ptr %array.index2, align 4 -// CHECK:STDOUT: %F = call i32 @F(ptr %temp, i32 1) -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12_20.2.temp = alloca [3 x i32], align 4 +// CHECK:STDOUT: %.loc12_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc12_20.4.array.index, align 4 +// CHECK:STDOUT: %.loc12_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc12_20.7.array.index, align 4 +// CHECK:STDOUT: %.loc12_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 2 +// CHECK:STDOUT: store i32 3, ptr %.loc12_20.10.array.index, align 4 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc12_20.2.temp, i32 1) +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/basics/false_true.carbon b/toolchain/lower/testdata/basics/false_true.carbon index e09e97d685fd..9d20f1ab2421 100644 --- a/toolchain/lower/testdata/basics/false_true.carbon +++ b/toolchain/lower/testdata/basics/false_true.carbon @@ -16,9 +16,11 @@ fn T() -> bool { // CHECK:STDOUT: source_filename = "false_true.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 false // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @T() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/basics/int_types.carbon b/toolchain/lower/testdata/basics/int_types.carbon index 577d4695cb76..5080fbb0417e 100644 --- a/toolchain/lower/testdata/basics/int_types.carbon +++ b/toolchain/lower/testdata/basics/int_types.carbon @@ -13,17 +13,21 @@ fn F_u65536(a: u65536) -> u65536 { return a; } // CHECK:STDOUT: source_filename = "int_types.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i8 @F_i8(i8 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i8 %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i16 @F_u16(i16 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i16 %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @F_i64(i64 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i64 %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i65536 @F_u65536(i65536 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i65536 %a // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/basics/numeric_literals.carbon b/toolchain/lower/testdata/basics/numeric_literals.carbon index 973bbbafe008..8bcd65e8f827 100644 --- a/toolchain/lower/testdata/basics/numeric_literals.carbon +++ b/toolchain/lower/testdata/basics/numeric_literals.carbon @@ -27,27 +27,28 @@ fn F() { // CHECK:STDOUT: source_filename = "numeric_literals.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { -// CHECK:STDOUT: %ints = alloca [4 x i32], align 4 -// CHECK:STDOUT: %array.index = getelementptr inbounds [4 x i32], ptr %ints, i32 0, i32 0 -// CHECK:STDOUT: store i32 8, ptr %array.index, align 4 -// CHECK:STDOUT: %array.index1 = getelementptr inbounds [4 x i32], ptr %ints, i32 0, i32 1 -// CHECK:STDOUT: store i32 9, ptr %array.index1, align 4 -// CHECK:STDOUT: %array.index2 = getelementptr inbounds [4 x i32], ptr %ints, i32 0, i32 2 -// CHECK:STDOUT: store i32 8, ptr %array.index2, align 4 -// CHECK:STDOUT: %array.index3 = getelementptr inbounds [4 x i32], ptr %ints, i32 0, i32 3 -// CHECK:STDOUT: store i32 8, ptr %array.index3, align 4 -// CHECK:STDOUT: %floats = alloca [6 x double], align 8 -// CHECK:STDOUT: %array.index4 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 0 -// CHECK:STDOUT: store double 9.000000e-01, ptr %array.index4, align 8 -// CHECK:STDOUT: %array.index5 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 1 -// CHECK:STDOUT: store double 8.000000e+00, ptr %array.index5, align 8 -// CHECK:STDOUT: %array.index6 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 2 -// CHECK:STDOUT: store double 8.000000e+01, ptr %array.index6, align 8 -// CHECK:STDOUT: %array.index7 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 3 -// CHECK:STDOUT: store double 1.000000e+07, ptr %array.index7, align 8 -// CHECK:STDOUT: %array.index8 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 4 -// CHECK:STDOUT: store double 1.000000e+08, ptr %array.index8, align 8 -// CHECK:STDOUT: %array.index9 = getelementptr inbounds [6 x double], ptr %floats, i32 0, i32 5 -// CHECK:STDOUT: store double 1.000000e-08, ptr %array.index9, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4 +// CHECK:STDOUT: %.loc15_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 8, ptr %.loc15_3.3.array.index, align 4 +// CHECK:STDOUT: %.loc15_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 9, ptr %.loc15_3.6.array.index, align 4 +// CHECK:STDOUT: %.loc15_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 8, ptr %.loc15_3.9.array.index, align 4 +// CHECK:STDOUT: %.loc15_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3 +// CHECK:STDOUT: store i32 8, ptr %.loc15_3.12.array.index, align 4 +// CHECK:STDOUT: %floats.var = alloca [6 x double], align 8 +// CHECK:STDOUT: %.loc23_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0 +// CHECK:STDOUT: store double 9.000000e-01, ptr %.loc23_3.3.array.index, align 8 +// CHECK:STDOUT: %.loc23_3.6.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 1 +// CHECK:STDOUT: store double 8.000000e+00, ptr %.loc23_3.6.array.index, align 8 +// CHECK:STDOUT: %.loc23_3.9.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 2 +// CHECK:STDOUT: store double 8.000000e+01, ptr %.loc23_3.9.array.index, align 8 +// CHECK:STDOUT: %.loc23_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 3 +// CHECK:STDOUT: store double 1.000000e+07, ptr %.loc23_3.12.array.index, align 8 +// CHECK:STDOUT: %.loc23_3.15.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 4 +// CHECK:STDOUT: store double 1.000000e+08, ptr %.loc23_3.15.array.index, align 8 +// CHECK:STDOUT: %.loc23_3.18.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 5 +// CHECK:STDOUT: store double 1.000000e-08, ptr %.loc23_3.18.array.index, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/basics/type_values.carbon b/toolchain/lower/testdata/basics/type_values.carbon index 67f7b194e07c..08dfeb5be1e1 100644 --- a/toolchain/lower/testdata/basics/type_values.carbon +++ b/toolchain/lower/testdata/basics/type_values.carbon @@ -25,13 +25,16 @@ fn F64() -> type { // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: // CHECK:STDOUT: define %type @I32() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define %type @I48() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define %type @F64() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/basics/zero.carbon b/toolchain/lower/testdata/basics/zero.carbon index b7b10d429907..593899e11e34 100644 --- a/toolchain/lower/testdata/basics/zero.carbon +++ b/toolchain/lower/testdata/basics/zero.carbon @@ -12,5 +12,6 @@ fn Main() -> i32 { // CHECK:STDOUT: source_filename = "zero.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index dd5b3999adfc..c7d28b853a7b 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -62,91 +62,109 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: source_filename = "int.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestNegate(i32 %a) { -// CHECK:STDOUT: %neg = sub i32 0, %a -// CHECK:STDOUT: ret i32 %neg +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.snegate = sub i32 0, %a +// CHECK:STDOUT: ret i32 %int.snegate // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestAdd(i32 %a, i32 %b) { -// CHECK:STDOUT: %add = add i32 %a, %b -// CHECK:STDOUT: ret i32 %add +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sadd = add i32 %a, %b +// CHECK:STDOUT: ret i32 %int.sadd // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestSub(i32 %a, i32 %b) { -// CHECK:STDOUT: %sub = sub i32 %a, %b -// CHECK:STDOUT: ret i32 %sub +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.ssub = sub i32 %a, %b +// CHECK:STDOUT: ret i32 %int.ssub // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestMul(i32 %a, i32 %b) { -// CHECK:STDOUT: %mul = mul i32 %a, %b -// CHECK:STDOUT: ret i32 %mul +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.smul = mul i32 %a, %b +// CHECK:STDOUT: ret i32 %int.smul // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestDiv(i32 %a, i32 %b) { -// CHECK:STDOUT: %div = sdiv i32 %a, %b -// CHECK:STDOUT: ret i32 %div +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sdiv = sdiv i32 %a, %b +// CHECK:STDOUT: ret i32 %int.sdiv // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestMod(i32 %a, i32 %b) { -// CHECK:STDOUT: %rem = srem i32 %a, %b -// CHECK:STDOUT: ret i32 %rem +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.smod = srem i32 %a, %b +// CHECK:STDOUT: ret i32 %int.smod // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestComplement(i32 %a) { -// CHECK:STDOUT: %cmpl = xor i32 -1, %a -// CHECK:STDOUT: ret i32 %cmpl +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.complement = xor i32 -1, %a +// CHECK:STDOUT: ret i32 %int.complement // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestAnd(i32 %a, i32 %b) { -// CHECK:STDOUT: %and = and i32 %a, %b -// CHECK:STDOUT: ret i32 %and +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.and = and i32 %a, %b +// CHECK:STDOUT: ret i32 %int.and // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestOr(i32 %a, i32 %b) { -// CHECK:STDOUT: %or = or i32 %a, %b -// CHECK:STDOUT: ret i32 %or +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.or = or i32 %a, %b +// CHECK:STDOUT: ret i32 %int.or // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestXor(i32 %a, i32 %b) { -// CHECK:STDOUT: %xor = xor i32 %a, %b -// CHECK:STDOUT: ret i32 %xor +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.xor = xor i32 %a, %b +// CHECK:STDOUT: ret i32 %int.xor // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestLeftShift(i32 %a, i32 %b) { -// CHECK:STDOUT: %shl = shl i32 %a, %b -// CHECK:STDOUT: ret i32 %shl +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift = shl i32 %a, %b +// CHECK:STDOUT: ret i32 %int.left_shift // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestRightShift(i32 %a, i32 %b) { -// CHECK:STDOUT: %shr = ashr i32 %a, %b -// CHECK:STDOUT: ret i32 %shr +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b +// CHECK:STDOUT: ret i32 %int.right_shift // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestEq(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp eq i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b +// CHECK:STDOUT: ret i1 %int.eq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestNeq(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp ne i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b +// CHECK:STDOUT: ret i1 %int.neq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestLess(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp slt i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b +// CHECK:STDOUT: ret i1 %int.less // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestLessEq(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp sle i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b +// CHECK:STDOUT: ret i1 %int.less_eq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestGreater(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp sgt i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b +// CHECK:STDOUT: ret i1 %int.greater // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestGreaterEq(i32 %a, i32 %b) { -// CHECK:STDOUT: %cmp = icmp sge i32 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b +// CHECK:STDOUT: ret i1 %int.greater_eq // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon index bbd4cb58dad2..cf4637d86d2c 100644 --- a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon +++ b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon @@ -14,11 +14,13 @@ fn TestAddMethod(a: i32, b: i32) -> i32 { return a.(AddMethod)(b); } // CHECK:STDOUT: source_filename = "method_vs_nonmethod.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestAddNonmethod(i32 %a, i32 %b) { -// CHECK:STDOUT: %add = add i32 %a, %b -// CHECK:STDOUT: ret i32 %add +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sadd = add i32 %a, %b +// CHECK:STDOUT: ret i32 %int.sadd // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestAddMethod(i32 %a, i32 %b) { -// CHECK:STDOUT: %add = add i32 %a, %b -// CHECK:STDOUT: ret i32 %add +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sadd = add i32 %a, %b +// CHECK:STDOUT: ret i32 %int.sadd // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/overloaded_operator.carbon b/toolchain/lower/testdata/builtins/overloaded_operator.carbon index 60a457e97e99..2de33b68c790 100644 --- a/toolchain/lower/testdata/builtins/overloaded_operator.carbon +++ b/toolchain/lower/testdata/builtins/overloaded_operator.carbon @@ -32,10 +32,11 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 { // CHECK:STDOUT: source_filename = "user.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @AddThreeIntegers(i32 %a, i32 %b, i32 %c) { -// CHECK:STDOUT: %add = add i32 %a, %b -// CHECK:STDOUT: %temp = alloca i32, align 4 -// CHECK:STDOUT: store i32 %add, ptr %temp, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %temp, align 4 -// CHECK:STDOUT: %add1 = add i32 %1, %c -// CHECK:STDOUT: ret i32 %add1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sadd.loc11_12 = add i32 %a, %b +// CHECK:STDOUT: %.loc11_12.2.temp = alloca i32, align 4 +// CHECK:STDOUT: store i32 %int.sadd.loc11_12, ptr %.loc11_12.2.temp, align 4 +// CHECK:STDOUT: %.loc11_12.4 = load i32, ptr %.loc11_12.2.temp, align 4 +// CHECK:STDOUT: %int.sadd.loc11_16 = add i32 %.loc11_12.4, %c +// CHECK:STDOUT: ret i32 %int.sadd.loc11_16 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/types.carbon b/toolchain/lower/testdata/builtins/types.carbon index 86c794ceb910..d2c75509cad0 100644 --- a/toolchain/lower/testdata/builtins/types.carbon +++ b/toolchain/lower/testdata/builtins/types.carbon @@ -18,11 +18,12 @@ fn F() { // CHECK:STDOUT: source_filename = "types.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { -// CHECK:STDOUT: %i = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %i, align 4 -// CHECK:STDOUT: %f = alloca double, align 8 -// CHECK:STDOUT: store double 0.000000e+00, ptr %f, align 8 -// CHECK:STDOUT: %b = alloca i1, align 1 -// CHECK:STDOUT: store i1 false, ptr %b, align 1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %i.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %i.var, align 4 +// CHECK:STDOUT: %f.var = alloca double, align 8 +// CHECK:STDOUT: store double 0.000000e+00, ptr %f.var, align 8 +// CHECK:STDOUT: %b.var = alloca i1, align 1 +// CHECK:STDOUT: store i1 false, ptr %b.var, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/uint.carbon b/toolchain/lower/testdata/builtins/uint.carbon index c171fd3b0488..69149ee4dc8c 100644 --- a/toolchain/lower/testdata/builtins/uint.carbon +++ b/toolchain/lower/testdata/builtins/uint.carbon @@ -62,91 +62,109 @@ fn TestGreaterEq(a: u64, b: u64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: source_filename = "uint.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestNegate(i64 %a) { -// CHECK:STDOUT: %neg = sub i64 0, %a -// CHECK:STDOUT: ret i64 %neg +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.unegate = sub i64 0, %a +// CHECK:STDOUT: ret i64 %int.unegate // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestAdd(i64 %a, i64 %b) { -// CHECK:STDOUT: %add = add i64 %a, %b -// CHECK:STDOUT: ret i64 %add +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.uadd = add i64 %a, %b +// CHECK:STDOUT: ret i64 %int.uadd // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestSub(i64 %a, i64 %b) { -// CHECK:STDOUT: %sub = sub i64 %a, %b -// CHECK:STDOUT: ret i64 %sub +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.usub = sub i64 %a, %b +// CHECK:STDOUT: ret i64 %int.usub // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestMul(i64 %a, i64 %b) { -// CHECK:STDOUT: %mul = mul i64 %a, %b -// CHECK:STDOUT: ret i64 %mul +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.umul = mul i64 %a, %b +// CHECK:STDOUT: ret i64 %int.umul // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestDiv(i64 %a, i64 %b) { -// CHECK:STDOUT: %div = udiv i64 %a, %b -// CHECK:STDOUT: ret i64 %div +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.udiv = udiv i64 %a, %b +// CHECK:STDOUT: ret i64 %int.udiv // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestMod(i64 %a, i64 %b) { -// CHECK:STDOUT: %rem = urem i64 %a, %b -// CHECK:STDOUT: ret i64 %rem +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.umod = urem i64 %a, %b +// CHECK:STDOUT: ret i64 %int.umod // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestComplement(i64 %a) { -// CHECK:STDOUT: %cmpl = xor i64 -1, %a -// CHECK:STDOUT: ret i64 %cmpl +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.complement = xor i64 -1, %a +// CHECK:STDOUT: ret i64 %int.complement // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestAnd(i64 %a, i64 %b) { -// CHECK:STDOUT: %and = and i64 %a, %b -// CHECK:STDOUT: ret i64 %and +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.and = and i64 %a, %b +// CHECK:STDOUT: ret i64 %int.and // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestOr(i64 %a, i64 %b) { -// CHECK:STDOUT: %or = or i64 %a, %b -// CHECK:STDOUT: ret i64 %or +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.or = or i64 %a, %b +// CHECK:STDOUT: ret i64 %int.or // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestXor(i64 %a, i64 %b) { -// CHECK:STDOUT: %xor = xor i64 %a, %b -// CHECK:STDOUT: ret i64 %xor +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.xor = xor i64 %a, %b +// CHECK:STDOUT: ret i64 %int.xor // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestLeftShift(i64 %a, i64 %b) { -// CHECK:STDOUT: %shl = shl i64 %a, %b -// CHECK:STDOUT: ret i64 %shl +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift = shl i64 %a, %b +// CHECK:STDOUT: ret i64 %int.left_shift // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestRightShift(i64 %a, i64 %b) { -// CHECK:STDOUT: %shr = lshr i64 %a, %b -// CHECK:STDOUT: ret i64 %shr +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift = lshr i64 %a, %b +// CHECK:STDOUT: ret i64 %int.right_shift // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestEq(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp eq i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq = icmp eq i64 %a, %b +// CHECK:STDOUT: ret i1 %int.eq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestNeq(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp ne i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.neq = icmp ne i64 %a, %b +// CHECK:STDOUT: ret i1 %int.neq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestLess(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp ult i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less = icmp ult i64 %a, %b +// CHECK:STDOUT: ret i1 %int.less // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestLessEq(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp ule i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less_eq = icmp ule i64 %a, %b +// CHECK:STDOUT: ret i1 %int.less_eq // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestGreater(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp ugt i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater = icmp ugt i64 %a, %b +// CHECK:STDOUT: ret i1 %int.greater // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @TestGreaterEq(i64 %a, i64 %b) { -// CHECK:STDOUT: %cmp = icmp uge i64 %a, %b -// CHECK:STDOUT: ret i1 %cmp +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater_eq = icmp uge i64 %a, %b +// CHECK:STDOUT: ret i1 %int.greater_eq // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 87d1c69919e6..136b3f2870ba 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -51,33 +51,38 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: source_filename = "adapt_class.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, i32 }) %return) { -// CHECK:STDOUT: %a = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %a, align 4 -// CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %b, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc9_27.2.a, align 4 +// CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc9_27.4.b, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make.1(ptr sret({ i32, i32 }) %return) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Make(ptr %return) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @GetB(ptr %self) { -// CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %self, i32 0, i32 1 -// CHECK:STDOUT: %1 = load i32, ptr %b, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22_14.1.b = getelementptr inbounds { i32, i32 }, ptr %self, i32 0, i32 1 +// CHECK:STDOUT: %.loc22_14.2 = load i32, ptr %.loc22_14.1.b, align 4 +// CHECK:STDOUT: ret i32 %.loc22_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Use() { -// CHECK:STDOUT: %pa = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @Make.1(ptr %pa) -// CHECK:STDOUT: %GetB = call i32 @GetB(ptr %pa) -// CHECK:STDOUT: ret i32 %GetB +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %pa.var = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @Make.1(ptr %pa.var) +// CHECK:STDOUT: %.loc28_17 = call i32 @GetB(ptr %pa.var) +// CHECK:STDOUT: ret i32 %.loc28_17 // CHECK:STDOUT: } // CHECK:STDOUT: ; ModuleID = 'adapt_int.carbon' // CHECK:STDOUT: source_filename = "adapt_int.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @DoStuff(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 08255335fe08..758ea1361037 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -30,28 +30,31 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ { i32 }, i32 }) %return) { -// CHECK:STDOUT: %base = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %b = getelementptr inbounds { i32 }, ptr %base, i32 0, i32 0 -// CHECK:STDOUT: store i32 4, ptr %b, align 4 -// CHECK:STDOUT: %d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 7, ptr %d, align 4 +// 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: store i32 4, ptr %.loc18_26.2.b, align 4 +// CHECK:STDOUT: %.loc18_35.4.d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 7, ptr %.loc18_35.4.d, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Access(ptr sret({ i32, i32 }) %return, ptr %d) { -// CHECK:STDOUT: %d1 = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 1 -// CHECK:STDOUT: %1 = load i32, ptr %d1, align 4 -// CHECK:STDOUT: %base = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 0 -// CHECK:STDOUT: %b = getelementptr inbounds { i32 }, ptr %base, i32 0, i32 0 -// CHECK:STDOUT: %2 = load i32, ptr %b, align 4 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %tuple.elem2, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22_12.1.d = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 1 +// CHECK:STDOUT: %.loc22_12.2 = load i32, ptr %.loc22_12.1.d, align 4 +// CHECK:STDOUT: %.loc22_17.1.base = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_22.1.b = getelementptr inbounds { i32 }, ptr %.loc22_17.1.base, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_22.2 = load i32, ptr %.loc22_22.1.b, align 4 +// CHECK:STDOUT: %.loc22_24.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc22_12.2, ptr %.loc22_24.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc22_24.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc22_22.2, ptr %.loc22_24.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Convert(ptr %p) { -// CHECK:STDOUT: %base = getelementptr inbounds { { i32 }, i32 }, ptr %p, i32 0, i32 0 -// CHECK:STDOUT: ret ptr %base +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc26_11.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %p, i32 0, i32 0 +// CHECK:STDOUT: ret ptr %.loc26_11.2.base // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/basic.carbon b/toolchain/lower/testdata/class/basic.carbon index 929aa434d61f..5d98dbc401fe 100644 --- a/toolchain/lower/testdata/class/basic.carbon +++ b/toolchain/lower/testdata/class/basic.carbon @@ -22,8 +22,9 @@ fn Run() { // CHECK:STDOUT: declare void @F(ptr sret({ i32, ptr }), ptr) // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { -// CHECK:STDOUT: %c = alloca { i32, ptr }, align 8 -// CHECK:STDOUT: %d = alloca { i32, ptr }, align 8 -// CHECK:STDOUT: call void @F(ptr %d, ptr %c) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8 +// CHECK:STDOUT: %d.var = alloca { i32, ptr }, align 8 +// CHECK:STDOUT: call void @F(ptr %d.var, ptr %c.var) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/field.carbon b/toolchain/lower/testdata/class/field.carbon index b688f90b9498..528782c6bc36 100644 --- a/toolchain/lower/testdata/class/field.carbon +++ b/toolchain/lower/testdata/class/field.carbon @@ -24,19 +24,21 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "field.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) { -// CHECK:STDOUT: %b = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %1 = load ptr, ptr %b, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { i32, ptr }, ptr %1, i32 0, i32 0 -// CHECK:STDOUT: %2 = load i32, ptr %a, align 4 -// CHECK:STDOUT: ret i32 %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc13_13.1.b = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 1 +// CHECK:STDOUT: %.loc13_13.2 = load ptr, ptr %.loc13_13.1.b, align 8 +// CHECK:STDOUT: %.loc13_16.1.a = getelementptr inbounds { i32, ptr }, ptr %.loc13_13.2, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_16.2 = load i32, ptr %.loc13_16.1.a, align 4 +// CHECK:STDOUT: ret i32 %.loc13_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %c = alloca { i32, ptr }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %a, align 4 -// CHECK:STDOUT: %b = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: store ptr %c, ptr %b, align 8 -// CHECK:STDOUT: %F = call i32 @F(ptr %c) -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8 +// CHECK:STDOUT: %.loc18_4.a = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc18_4.a, align 4 +// CHECK:STDOUT: %.loc19_4.b = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 1 +// CHECK:STDOUT: store ptr %c.var, ptr %.loc19_4.b, align 8 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %c.var) +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/method.carbon b/toolchain/lower/testdata/class/method.carbon index a754b2918a26..2ee3e104555e 100644 --- a/toolchain/lower/testdata/class/method.carbon +++ b/toolchain/lower/testdata/class/method.carbon @@ -24,7 +24,8 @@ fn F(p: C*) { // CHECK:STDOUT: declare void @Set(ptr, i32) // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr %p) { -// CHECK:STDOUT: %Get = call i32 @Get(ptr %p) -// CHECK:STDOUT: call void @Set(ptr %p, i32 %Get) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15_24 = call i32 @Get(ptr %p) +// CHECK:STDOUT: call void @Set(ptr %p, i32 %.loc15_24) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/self.carbon b/toolchain/lower/testdata/class/self.carbon index 7eb464bc7d0e..a73b6ab6e802 100644 --- a/toolchain/lower/testdata/class/self.carbon +++ b/toolchain/lower/testdata/class/self.carbon @@ -23,13 +23,15 @@ fn C.Set[addr self: C*]() { // CHECK:STDOUT: source_filename = "self.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Get(ptr %self) { -// CHECK:STDOUT: %a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %a, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15_14.1.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_14.2 = load i32, ptr %.loc15_14.1.a, align 4 +// CHECK:STDOUT: ret i32 %.loc15_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Set(ptr %self) { -// CHECK:STDOUT: %a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %a, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc19_10.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc19_10.a, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/value_access.carbon b/toolchain/lower/testdata/class/value_access.carbon index d51bec46538d..e01109f1ad5e 100644 --- a/toolchain/lower/testdata/class/value_access.carbon +++ b/toolchain/lower/testdata/class/value_access.carbon @@ -19,21 +19,22 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: source_filename = "value_access.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) { -// CHECK:STDOUT: %a = getelementptr inbounds { { i32, i32, i32 } }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: %3 = load i32, ptr %tuple.elem2, align 4 -// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %4 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %4, align 4 -// CHECK:STDOUT: %5 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %5, align 4 -// CHECK:STDOUT: %6 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 2 -// CHECK:STDOUT: store i32 %3, ptr %6, align 4 -// CHECK:STDOUT: %tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: %tuple.index.load = load i32, ptr %tuple.index, align 4 -// CHECK:STDOUT: ret i32 %tuple.index.load +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15_11.1.a = getelementptr inbounds { { i32, i32, i32 } }, ptr %c, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_11.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_11.3 = load i32, ptr %.loc15_11.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc15_11.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_11.5 = load i32, ptr %.loc15_11.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc15_11.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 2 +// CHECK:STDOUT: %.loc15_11.7 = load i32, ptr %.loc15_11.6.tuple.elem, align 4 +// CHECK:STDOUT: %.loc15_11.8.tuple = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc15_11.8 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.8.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc15_11.3, ptr %.loc15_11.8, align 4 +// CHECK:STDOUT: %.loc15_11.81 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.8.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc15_11.5, ptr %.loc15_11.81, align 4 +// CHECK:STDOUT: %.loc15_11.82 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.8.tuple, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc15_11.7, ptr %.loc15_11.82, align 4 +// CHECK:STDOUT: %.loc15_15.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.8.tuple, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_15.tuple.index.load = load i32, ptr %.loc15_15.tuple.index, align 4 +// CHECK:STDOUT: ret i32 %.loc15_15.tuple.index.load // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/empty_struct.carbon b/toolchain/lower/testdata/function/call/empty_struct.carbon index 530485949273..b918fe664d45 100644 --- a/toolchain/lower/testdata/function/call/empty_struct.carbon +++ b/toolchain/lower/testdata/function/call/empty_struct.carbon @@ -16,11 +16,13 @@ fn Main() { // CHECK:STDOUT: source_filename = "empty_struct.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %b = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %b.var = alloca {}, align 8 // CHECK:STDOUT: call void @Echo() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/empty_tuple.carbon b/toolchain/lower/testdata/function/call/empty_tuple.carbon index 7a19452fb5b5..71232010014c 100644 --- a/toolchain/lower/testdata/function/call/empty_tuple.carbon +++ b/toolchain/lower/testdata/function/call/empty_tuple.carbon @@ -16,11 +16,13 @@ fn Main() { // CHECK:STDOUT: source_filename = "empty_tuple.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %b = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %b.var = alloca {}, align 8 // CHECK:STDOUT: call void @Echo() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/i32.carbon b/toolchain/lower/testdata/function/call/i32.carbon index 4b6dcc9298f9..dc787d4d93e9 100644 --- a/toolchain/lower/testdata/function/call/i32.carbon +++ b/toolchain/lower/testdata/function/call/i32.carbon @@ -16,12 +16,14 @@ fn Main() { // CHECK:STDOUT: source_filename = "i32.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Echo(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %b = alloca i32, align 4 -// CHECK:STDOUT: %Echo = call i32 @Echo(i32 1) -// CHECK:STDOUT: store i32 %Echo, ptr %b, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %b.var = alloca i32, align 4 +// CHECK:STDOUT: %Echo.call = call i32 @Echo(i32 1) +// CHECK:STDOUT: store i32 %Echo.call, ptr %b.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon index b43157f37631..4fbf462d3a39 100644 --- a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon +++ b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon @@ -17,17 +17,20 @@ fn Main() { // CHECK:STDOUT: source_filename = "implicit_empty_tuple_as_arg.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Bar() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %x = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca {}, align 8 // CHECK:STDOUT: call void @Foo() -// CHECK:STDOUT: %temp = alloca {}, align 8 +// CHECK:STDOUT: %.loc13_22.1.temp = alloca {}, align 8 // CHECK:STDOUT: call void @Bar() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/params_one.carbon b/toolchain/lower/testdata/function/call/params_one.carbon index e2b98e29196b..8bcea8317d6a 100644 --- a/toolchain/lower/testdata/function/call/params_one.carbon +++ b/toolchain/lower/testdata/function/call/params_one.carbon @@ -14,10 +14,12 @@ fn Main() { // CHECK:STDOUT: source_filename = "params_one.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Foo(i32 1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/params_one_comma.carbon b/toolchain/lower/testdata/function/call/params_one_comma.carbon index 87582a5d6e31..c6fb30c4b1cd 100644 --- a/toolchain/lower/testdata/function/call/params_one_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_one_comma.carbon @@ -15,10 +15,12 @@ fn Main() { // CHECK:STDOUT: source_filename = "params_one_comma.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Foo(i32 1) // CHECK:STDOUT: call void @Foo(i32 1) // CHECK:STDOUT: ret void diff --git a/toolchain/lower/testdata/function/call/params_two.carbon b/toolchain/lower/testdata/function/call/params_two.carbon index 841722e141ee..2a5ece658136 100644 --- a/toolchain/lower/testdata/function/call/params_two.carbon +++ b/toolchain/lower/testdata/function/call/params_two.carbon @@ -14,10 +14,12 @@ fn Main() { // CHECK:STDOUT: source_filename = "params_two.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Foo(i32 1, i32 2) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/params_two_comma.carbon b/toolchain/lower/testdata/function/call/params_two_comma.carbon index b22a4330e30f..77c562374383 100644 --- a/toolchain/lower/testdata/function/call/params_two_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_two_comma.carbon @@ -15,10 +15,12 @@ fn Main() { // CHECK:STDOUT: source_filename = "params_two_comma.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Foo(i32 1, i32 2) // CHECK:STDOUT: call void @Foo(i32 1, i32 2) // CHECK:STDOUT: ret void diff --git a/toolchain/lower/testdata/function/call/params_zero.carbon b/toolchain/lower/testdata/function/call/params_zero.carbon index bf994c16dddd..0e8d34dae8eb 100644 --- a/toolchain/lower/testdata/function/call/params_zero.carbon +++ b/toolchain/lower/testdata/function/call/params_zero.carbon @@ -14,10 +14,12 @@ fn Main() { // CHECK:STDOUT: source_filename = "params_zero.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Foo() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/return_implicit.carbon b/toolchain/lower/testdata/function/call/return_implicit.carbon index 2211361ae138..51c67b33c94e 100644 --- a/toolchain/lower/testdata/function/call/return_implicit.carbon +++ b/toolchain/lower/testdata/function/call/return_implicit.carbon @@ -16,11 +16,13 @@ fn Main() { // CHECK:STDOUT: source_filename = "return_implicit.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @MakeImplicitEmptyTuple() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %b = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %b.var = alloca {}, align 8 // CHECK:STDOUT: call void @MakeImplicitEmptyTuple() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index 0089335e4ae9..708730560455 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -14,16 +14,18 @@ fn Main() { // CHECK:STDOUT: source_filename = "struct_param.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %struct = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %1 = getelementptr inbounds { i32, i32 }, ptr %struct, i32 0, i32 0 -// CHECK:STDOUT: store i32 2, ptr %1, align 4 -// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32 }, ptr %struct, i32 0, i32 1 -// CHECK:STDOUT: store i32 3, ptr %2, align 4 -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr %struct) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc10_34.2.struct = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc10_34.2 = getelementptr inbounds { i32, i32 }, ptr %.loc10_34.2.struct, i32 0, i32 0 +// CHECK:STDOUT: store i32 2, ptr %.loc10_34.2, align 4 +// CHECK:STDOUT: %.loc10_34.21 = getelementptr inbounds { i32, i32 }, ptr %.loc10_34.2.struct, i32 0, i32 1 +// CHECK:STDOUT: store i32 3, ptr %.loc10_34.21, align 4 +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr %.loc10_34.2.struct) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param.carbon b/toolchain/lower/testdata/function/call/tuple_param.carbon index c4880b2747cb..7fc65c0f3e6d 100644 --- a/toolchain/lower/testdata/function/call/tuple_param.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param.carbon @@ -14,16 +14,18 @@ fn Main() { // CHECK:STDOUT: source_filename = "tuple_param.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %1 = getelementptr inbounds { i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 2, ptr %1, align 4 -// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 3, ptr %2, align 4 -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr %tuple) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc10_20.2.tuple = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc10_20.2 = getelementptr inbounds { i32, i32 }, ptr %.loc10_20.2.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 2, ptr %.loc10_20.2, align 4 +// CHECK:STDOUT: %.loc10_20.21 = getelementptr inbounds { i32, i32 }, ptr %.loc10_20.2.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 3, ptr %.loc10_20.21, align 4 +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr %.loc10_20.2.tuple) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon index d8b8c38cb485..eb13a0dfb0cd 100644 --- a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon @@ -16,28 +16,30 @@ fn Main() { // CHECK:STDOUT: source_filename = "tuple_param_with_return_slot.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) { -// CHECK:STDOUT: %tuple.index = extractvalue { i32 } %b, 0 -// CHECK:STDOUT: %tuple.index1 = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %tuple.index.load = load i32, ptr %tuple.index1, align 4 -// CHECK:STDOUT: %tuple.index2 = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %tuple.index.load3 = load i32, ptr %tuple.index2, align 4 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %tuple.index, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem4 = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %tuple.index.load, ptr %tuple.elem4, align 4 -// CHECK:STDOUT: %tuple.elem5 = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 2 -// CHECK:STDOUT: store i32 %tuple.index.load3, ptr %tuple.elem5, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8_14.tuple.index = extractvalue { i32 } %b, 0 +// CHECK:STDOUT: %.loc8_20.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 0 +// CHECK:STDOUT: %.loc8_20.tuple.index.load = load i32, ptr %.loc8_20.tuple.index, align 4 +// CHECK:STDOUT: %.loc8_26.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 1 +// CHECK:STDOUT: %.loc8_26.tuple.index.load = load i32, ptr %.loc8_26.tuple.index, align 4 +// CHECK:STDOUT: %.loc8_27.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc8_14.tuple.index, ptr %.loc8_27.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_27.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc8_20.tuple.index.load, ptr %.loc8_27.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_27.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc8_26.tuple.index.load, ptr %.loc8_27.6.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %temp = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %1 = getelementptr inbounds { i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 2, ptr %1, align 4 -// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 3, ptr %2, align 4 -// CHECK:STDOUT: call void @F(ptr %temp, { i32 } { i32 1 }, ptr %tuple) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12_4.1.temp = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc12_20.2.tuple = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc12_20.2 = getelementptr inbounds { i32, i32 }, ptr %.loc12_20.2.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 2, ptr %.loc12_20.2, align 4 +// CHECK:STDOUT: %.loc12_20.21 = getelementptr inbounds { i32, i32 }, ptr %.loc12_20.2.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 3, ptr %.loc12_20.21, align 4 +// CHECK:STDOUT: call void @F(ptr %.loc12_4.1.temp, { i32 } { i32 1 }, ptr %.loc12_20.2.tuple) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/var_param.carbon b/toolchain/lower/testdata/function/call/var_param.carbon index c4ca2373e160..dc7aa2bc6aaf 100644 --- a/toolchain/lower/testdata/function/call/var_param.carbon +++ b/toolchain/lower/testdata/function/call/var_param.carbon @@ -15,13 +15,15 @@ fn Main() { // CHECK:STDOUT: source_filename = "var_param.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @DoNothing(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %a = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %a, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %a, align 4 -// CHECK:STDOUT: call void @DoNothing(i32 %1) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %a.var, align 4 +// CHECK:STDOUT: %.loc11 = load i32, ptr %a.var, align 4 +// CHECK:STDOUT: call void @DoNothing(i32 %.loc11) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/declaration/simple.carbon b/toolchain/lower/testdata/function/declaration/simple.carbon index 7792d0b2859b..756e7e06a9cf 100644 --- a/toolchain/lower/testdata/function/declaration/simple.carbon +++ b/toolchain/lower/testdata/function/declaration/simple.carbon @@ -14,6 +14,7 @@ fn G(n: i32) { F(n); } // CHECK:STDOUT: declare void @F(i32) // CHECK:STDOUT: // CHECK:STDOUT: define void @G(i32 %n) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @F(i32 %n) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/definition/empty_struct.carbon b/toolchain/lower/testdata/function/definition/empty_struct.carbon index b951218d584d..c204a4143268 100644 --- a/toolchain/lower/testdata/function/definition/empty_struct.carbon +++ b/toolchain/lower/testdata/function/definition/empty_struct.carbon @@ -11,5 +11,6 @@ fn Echo(a: {}) { // CHECK:STDOUT: source_filename = "empty_struct.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/definition/params_one.carbon b/toolchain/lower/testdata/function/definition/params_one.carbon index 1220a43bf515..84038f9b6bf3 100644 --- a/toolchain/lower/testdata/function/definition/params_one.carbon +++ b/toolchain/lower/testdata/function/definition/params_one.carbon @@ -10,5 +10,6 @@ fn Foo(a: i32) {} // CHECK:STDOUT: source_filename = "params_one.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/definition/params_two.carbon b/toolchain/lower/testdata/function/definition/params_two.carbon index 6a6bf52e4f74..9751893a3d9a 100644 --- a/toolchain/lower/testdata/function/definition/params_two.carbon +++ b/toolchain/lower/testdata/function/definition/params_two.carbon @@ -10,5 +10,6 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: source_filename = "params_two.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/definition/params_zero.carbon b/toolchain/lower/testdata/function/definition/params_zero.carbon index d5146747e3ef..01f6581c3342 100644 --- a/toolchain/lower/testdata/function/definition/params_zero.carbon +++ b/toolchain/lower/testdata/function/definition/params_zero.carbon @@ -10,5 +10,6 @@ fn Foo() {} // CHECK:STDOUT: source_filename = "params_zero.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/generic/type_param.carbon b/toolchain/lower/testdata/function/generic/type_param.carbon index 3d523fb6acad..a9e7bc22e5f1 100644 --- a/toolchain/lower/testdata/function/generic/type_param.carbon +++ b/toolchain/lower/testdata/function/generic/type_param.carbon @@ -15,8 +15,9 @@ fn F(T:! type) { // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: // CHECK:STDOUT: define void @F(%type %T) { -// CHECK:STDOUT: %p = alloca ptr, align 8 -// CHECK:STDOUT: %1 = load ptr, ptr %p, align 8 -// CHECK:STDOUT: %2 = load {}, ptr %1, align 1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %p.var = alloca ptr, align 8 +// CHECK:STDOUT: %.loc9_15 = load ptr, ptr %p.var, align 8 +// CHECK:STDOUT: %.loc9_14.2 = load {}, ptr %.loc9_15, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/if/else.carbon b/toolchain/lower/testdata/if/else.carbon index 67af395d45dc..f40a44f918da 100644 --- a/toolchain/lower/testdata/if/else.carbon +++ b/toolchain/lower/testdata/if/else.carbon @@ -21,29 +21,33 @@ fn If(b: bool) { // CHECK:STDOUT: source_filename = "else.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @H() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @If(i1 %b) { -// CHECK:STDOUT: br i1 %b, label %1, label %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 +// CHECK:STDOUT: if.then: ; preds = %entry // CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: br label %if.done // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 +// CHECK:STDOUT: if.else: ; preds = %entry // CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: br label %if.done // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %2, %1 +// CHECK:STDOUT: if.done: ; preds = %if.else, %if.then // CHECK:STDOUT: call void @H() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/if/no_else.carbon b/toolchain/lower/testdata/if/no_else.carbon index 928b8fa6cc00..fe8299cc524e 100644 --- a/toolchain/lower/testdata/if/no_else.carbon +++ b/toolchain/lower/testdata/if/no_else.carbon @@ -18,21 +18,24 @@ fn If(b: bool) { // CHECK:STDOUT: source_filename = "no_else.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @If(i1 %b) { -// CHECK:STDOUT: br i1 %b, label %1, label %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 +// CHECK:STDOUT: if.then: ; preds = %entry // CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %2 +// CHECK:STDOUT: br label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1, %0 +// CHECK:STDOUT: if.else: ; preds = %if.then, %entry // CHECK:STDOUT: call void @G() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/if_expr/basic.carbon b/toolchain/lower/testdata/if_expr/basic.carbon index 88b5ebc2921a..fa9c93680415 100644 --- a/toolchain/lower/testdata/if_expr/basic.carbon +++ b/toolchain/lower/testdata/if_expr/basic.carbon @@ -15,25 +15,28 @@ fn Select(b: bool) -> i32 { // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Select(i1 %b) { -// CHECK:STDOUT: br i1 %b, label %1, label %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br i1 %b, label %if.expr.then, label %if.expr.else // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: %F = call i32 @F() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: if.expr.then: ; preds = %entry +// CHECK:STDOUT: %F.call = call i32 @F() +// CHECK:STDOUT: br label %if.expr.result // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 -// CHECK:STDOUT: %G = call i32 @G() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: if.expr.else: ; preds = %entry +// CHECK:STDOUT: %G.call = call i32 @G() +// CHECK:STDOUT: br label %if.expr.result // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %2, %1 -// CHECK:STDOUT: %4 = phi i32 [ %F, %1 ], [ %G, %2 ] -// CHECK:STDOUT: ret i32 %4 +// CHECK:STDOUT: if.expr.result: ; preds = %if.expr.else, %if.expr.then +// CHECK:STDOUT: %0 = phi i32 [ %F.call, %if.expr.then ], [ %G.call, %if.expr.else ] +// CHECK:STDOUT: ret i32 %0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/if_expr/empty_block.carbon b/toolchain/lower/testdata/if_expr/empty_block.carbon index e1290cdb74c2..53bceecd9fda 100644 --- a/toolchain/lower/testdata/if_expr/empty_block.carbon +++ b/toolchain/lower/testdata/if_expr/empty_block.carbon @@ -12,35 +12,36 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: source_filename = "empty_block.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Select(i1 %b, i1 %c, i1 %d) { -// CHECK:STDOUT: br i1 %b, label %1, label %6 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br i1 %b, label %if.expr.then.loc8_10, label %if.expr.else.loc8_10 // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: br i1 %c, label %2, label %3 +// CHECK:STDOUT: if.expr.then.loc8_10: ; preds = %entry +// CHECK:STDOUT: br i1 %c, label %if.expr.then.loc8_20, label %if.expr.else.loc8_20 // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1 -// CHECK:STDOUT: br label %4 +// CHECK:STDOUT: if.expr.then.loc8_20: ; preds = %if.expr.then.loc8_10 +// CHECK:STDOUT: br label %if.expr.result.loc8_20 // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %1 -// CHECK:STDOUT: br label %4 +// CHECK:STDOUT: if.expr.else.loc8_20: ; preds = %if.expr.then.loc8_10 +// CHECK:STDOUT: br label %if.expr.result.loc8_20 // CHECK:STDOUT: -// CHECK:STDOUT: 4: ; preds = %3, %2 -// CHECK:STDOUT: %5 = phi i32 [ 1, %2 ], [ 2, %3 ] -// CHECK:STDOUT: br label %11 +// CHECK:STDOUT: if.expr.result.loc8_20: ; preds = %if.expr.else.loc8_20, %if.expr.then.loc8_20 +// CHECK:STDOUT: %0 = phi i32 [ 1, %if.expr.then.loc8_20 ], [ 2, %if.expr.else.loc8_20 ] +// CHECK:STDOUT: br label %if.expr.result.loc8_10 // CHECK:STDOUT: -// CHECK:STDOUT: 6: ; preds = %0 -// CHECK:STDOUT: br i1 %d, label %7, label %8 +// CHECK:STDOUT: if.expr.else.loc8_10: ; preds = %entry +// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc8_44, label %if.expr.else.loc8_44 // CHECK:STDOUT: -// CHECK:STDOUT: 7: ; preds = %6 -// CHECK:STDOUT: br label %9 +// CHECK:STDOUT: if.expr.then.loc8_44: ; preds = %if.expr.else.loc8_10 +// CHECK:STDOUT: br label %if.expr.result.loc8_44 // CHECK:STDOUT: -// CHECK:STDOUT: 8: ; preds = %6 -// CHECK:STDOUT: br label %9 +// CHECK:STDOUT: if.expr.else.loc8_44: ; preds = %if.expr.else.loc8_10 +// CHECK:STDOUT: br label %if.expr.result.loc8_44 // CHECK:STDOUT: -// CHECK:STDOUT: 9: ; preds = %8, %7 -// CHECK:STDOUT: %10 = phi i32 [ 3, %7 ], [ 4, %8 ] -// CHECK:STDOUT: br label %11 +// CHECK:STDOUT: if.expr.result.loc8_44: ; preds = %if.expr.else.loc8_44, %if.expr.then.loc8_44 +// CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc8_44 ], [ 4, %if.expr.else.loc8_44 ] +// CHECK:STDOUT: br label %if.expr.result.loc8_10 // CHECK:STDOUT: -// CHECK:STDOUT: 11: ; preds = %9, %4 -// CHECK:STDOUT: %12 = phi i32 [ %5, %4 ], [ %10, %9 ] -// CHECK:STDOUT: ret i32 %12 +// CHECK:STDOUT: if.expr.result.loc8_10: ; preds = %if.expr.result.loc8_44, %if.expr.result.loc8_20 +// CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc8_20 ], [ %1, %if.expr.result.loc8_44 ] +// CHECK:STDOUT: ret i32 %2 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon index 7ba45c3e54a8..75029e07a2d5 100644 --- a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon +++ b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon @@ -27,12 +27,14 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: source_filename = "assoc_fn_alias.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) { -// CHECK:STDOUT: %n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %n, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc18_16.2 = load i32, ptr %.loc18_16.1.n, align 4 +// CHECK:STDOUT: ret i32 %.loc18_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { -// CHECK:STDOUT: %F = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc23_13 = call i32 @F(ptr %a) +// CHECK:STDOUT: ret i32 %.loc23_13 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/extend_impl.carbon b/toolchain/lower/testdata/impl/extend_impl.carbon index 661238fe92dc..243892c70570 100644 --- a/toolchain/lower/testdata/impl/extend_impl.carbon +++ b/toolchain/lower/testdata/impl/extend_impl.carbon @@ -28,15 +28,18 @@ fn InstanceAccess(a: A) -> i32 { // CHECK:STDOUT: source_filename = "extend_impl.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TypeAccess() { -// CHECK:STDOUT: %F = call i32 @F() -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %F.call = call i32 @F() +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @InstanceAccess(ptr %a) { -// CHECK:STDOUT: %F = call i32 @F() -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %F.call = call i32 @F() +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/impl.carbon b/toolchain/lower/testdata/impl/impl.carbon index 683c257f0fc3..1f402b6c22a0 100644 --- a/toolchain/lower/testdata/impl/impl.carbon +++ b/toolchain/lower/testdata/impl/impl.carbon @@ -26,12 +26,14 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: source_filename = "impl.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) { -// CHECK:STDOUT: %n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %n, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc17_16.2 = load i32, ptr %.loc17_16.1.n, align 4 +// CHECK:STDOUT: ret i32 %.loc17_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { -// CHECK:STDOUT: %F = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %F +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22_17 = call i32 @F(ptr %a) +// CHECK:STDOUT: ret i32 %.loc22_17 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/instance_method.carbon b/toolchain/lower/testdata/impl/instance_method.carbon index 0714dc963763..411a89701c41 100644 --- a/toolchain/lower/testdata/impl/instance_method.carbon +++ b/toolchain/lower/testdata/impl/instance_method.carbon @@ -26,10 +26,12 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: source_filename = "instance_method.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Get(ptr %self) { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %self // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Call(ptr %a) { -// CHECK:STDOUT: %Get = call ptr @Get(ptr %a) -// CHECK:STDOUT: ret ptr %Get +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22_18 = call ptr @Get(ptr %a) +// CHECK:STDOUT: ret ptr %.loc22_18 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index cdb586d20e61..9d0b940c7b3a 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -18,49 +18,52 @@ fn Run() { // CHECK:STDOUT: source_filename = "array_element_access.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @A(ptr sret({ i32, i32 }) %return) { -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %tuple.elem1, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6_36.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc6_36.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc6_36.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc6_36.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @B(ptr sret([2 x i32]) %return) { -// CHECK:STDOUT: %array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %array.index, align 4 -// CHECK:STDOUT: %array.index1 = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %array.index1, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc8_34.3.array.index, align 4 +// CHECK:STDOUT: %.loc8_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc8_34.6.array.index, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { -// CHECK:STDOUT: %a = alloca [2 x i32], align 4 -// CHECK:STDOUT: %temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @A(ptr %temp) -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %temp, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %array.index = getelementptr inbounds [2 x i32], ptr %a, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %array.index, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %temp, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %array.index2 = getelementptr inbounds [2 x i32], ptr %a, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %array.index2, align 4 -// CHECK:STDOUT: %b = alloca i32, align 4 -// CHECK:STDOUT: %temp3 = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @A(ptr %temp3) -// CHECK:STDOUT: %tuple.index = getelementptr inbounds { i32, i32 }, ptr %temp3, i32 0, i32 0 -// CHECK:STDOUT: %3 = load i32, ptr %tuple.index, align 4 -// CHECK:STDOUT: store i32 %3, ptr %b, align 4 -// CHECK:STDOUT: %c = alloca i32, align 4 -// CHECK:STDOUT: %4 = load i32, ptr %b, align 4 -// CHECK:STDOUT: %array.index4 = getelementptr inbounds [2 x i32], ptr %a, i32 0, i32 %4 -// CHECK:STDOUT: %5 = load i32, ptr %array.index4, align 4 -// CHECK:STDOUT: store i32 %5, ptr %c, align 4 -// CHECK:STDOUT: %d = alloca i32, align 4 -// CHECK:STDOUT: %temp5 = alloca [2 x i32], align 4 -// CHECK:STDOUT: call void @B(ptr %temp5) -// CHECK:STDOUT: %array.index6 = getelementptr inbounds [2 x i32], ptr %temp5, i32 0, i32 1 -// CHECK:STDOUT: %6 = load i32, ptr %array.index6, align 4 -// CHECK:STDOUT: store i32 %6, ptr %d, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca [2 x i32], align 4 +// CHECK:STDOUT: %.loc11_22.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @A(ptr %.loc11_22.1.temp) +// CHECK:STDOUT: %.loc11_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc11_22.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc11_22.4 = load i32, ptr %.loc11_22.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc11_22.6.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc11_22.4, ptr %.loc11_22.6.array.index, align 4 +// CHECK:STDOUT: %.loc11_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc11_22.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc11_22.9 = load i32, ptr %.loc11_22.8.tuple.elem, align 4 +// CHECK:STDOUT: %.loc11_22.11.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc11_22.9, ptr %.loc11_22.11.array.index, align 4 +// CHECK:STDOUT: %b.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc12_17.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @A(ptr %.loc12_17.1.temp) +// CHECK:STDOUT: %.loc12_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc12_17.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_21.2 = load i32, ptr %.loc12_21.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc12_21.2, ptr %b.var, align 4 +// CHECK:STDOUT: %c.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc13_18 = load i32, ptr %b.var, align 4 +// CHECK:STDOUT: %.loc13_19.1.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 %.loc13_18 +// CHECK:STDOUT: %.loc13_19.2 = load i32, ptr %.loc13_19.1.array.index, align 4 +// CHECK:STDOUT: store i32 %.loc13_19.2, ptr %c.var, align 4 +// CHECK:STDOUT: %d.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc14_17.1.temp = alloca [2 x i32], align 4 +// CHECK:STDOUT: call void @B(ptr %.loc14_17.1.temp) +// CHECK:STDOUT: %.loc14_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc14_17.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_21.2 = load i32, ptr %.loc14_21.1.array.index, align 4 +// CHECK:STDOUT: store i32 %.loc14_21.2, ptr %d.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/index/tuple_element_access.carbon b/toolchain/lower/testdata/index/tuple_element_access.carbon index c94468903d61..873755e6ad0a 100644 --- a/toolchain/lower/testdata/index/tuple_element_access.carbon +++ b/toolchain/lower/testdata/index/tuple_element_access.carbon @@ -15,20 +15,21 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "tuple_element_access.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %a = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: store i32 0, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 1 -// CHECK:STDOUT: store i32 1, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: store i32 2, ptr %tuple.elem2, align 4 -// CHECK:STDOUT: %b = alloca i32, align 4 -// CHECK:STDOUT: %tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.index, align 4 -// CHECK:STDOUT: store i32 %1, ptr %b, align 4 -// CHECK:STDOUT: %c = alloca i32, align 4 -// CHECK:STDOUT: %tuple.index3 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.index3, align 4 -// CHECK:STDOUT: store i32 %2, ptr %c, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc8_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 0, ptr %.loc8_36.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 1, ptr %.loc8_36.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 2, ptr %.loc8_36.6.tuple.elem, align 4 +// CHECK:STDOUT: %b.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc9_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc9_19.2 = load i32, ptr %.loc9_19.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc9_19.2, ptr %b.var, align 4 +// CHECK:STDOUT: %c.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc10_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc10_19.2 = load i32, ptr %.loc10_19.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc10_19.2, ptr %c.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/index/tuple_return_value_access.carbon b/toolchain/lower/testdata/index/tuple_return_value_access.carbon index 05d681a7ca6e..ad0c10cf6ffb 100644 --- a/toolchain/lower/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/lower/testdata/index/tuple_return_value_access.carbon @@ -14,19 +14,21 @@ fn Run() { // CHECK:STDOUT: source_filename = "tuple_return_value_access.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) { -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 12, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 24, ptr %tuple.elem1, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 12, ptr %.loc7_38.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc7_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 24, ptr %.loc7_38.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { -// CHECK:STDOUT: %t = alloca i32, align 4 -// CHECK:STDOUT: %temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %temp) -// CHECK:STDOUT: %tuple.index = getelementptr inbounds { i32, i32 }, ptr %temp, i32 0, i32 1 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.index, align 4 -// CHECK:STDOUT: store i32 %1, ptr %t, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %t.var = alloca i32, align 4 +// CHECK:STDOUT: %.loc10_17.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @F(ptr %.loc10_17.1.temp) +// CHECK:STDOUT: %.loc10_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc10_17.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc10_21.2 = load i32, ptr %.loc10_21.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc10_21.2, ptr %t.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/interface/assoc.carbon b/toolchain/lower/testdata/interface/assoc.carbon index 7585a28dc4e3..00d7e432707f 100644 --- a/toolchain/lower/testdata/interface/assoc.carbon +++ b/toolchain/lower/testdata/interface/assoc.carbon @@ -14,5 +14,6 @@ fn F() { I.Assoc; } // CHECK:STDOUT: source_filename = "assoc.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/interface/basic.carbon b/toolchain/lower/testdata/interface/basic.carbon index adddde866517..624a1c38e65b 100644 --- a/toolchain/lower/testdata/interface/basic.carbon +++ b/toolchain/lower/testdata/interface/basic.carbon @@ -21,9 +21,11 @@ fn G(T: J) {} // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/let/local.carbon b/toolchain/lower/testdata/let/local.carbon index 3843072a3e9d..6aefe2da1d02 100644 --- a/toolchain/lower/testdata/let/local.carbon +++ b/toolchain/lower/testdata/let/local.carbon @@ -14,5 +14,6 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 1 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/let/tuple.carbon b/toolchain/lower/testdata/let/tuple.carbon index a359e2ea3318..bb7d347c498e 100644 --- a/toolchain/lower/testdata/let/tuple.carbon +++ b/toolchain/lower/testdata/let/tuple.carbon @@ -15,48 +15,49 @@ fn F() -> i32 { // CHECK:STDOUT: source_filename = "tuple.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { -// CHECK:STDOUT: %a = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: store i32 3, ptr %tuple.elem2, align 4 -// CHECK:STDOUT: %b = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem3 = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 0 -// CHECK:STDOUT: store i32 4, ptr %tuple.elem3, align 4 -// CHECK:STDOUT: %tuple.elem4 = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 1 -// CHECK:STDOUT: store i32 5, ptr %tuple.elem4, align 4 -// CHECK:STDOUT: %tuple.elem5 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem5, align 4 -// CHECK:STDOUT: %tuple.elem6 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem6, align 4 -// CHECK:STDOUT: %tuple.elem7 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: %3 = load i32, ptr %tuple.elem7, align 4 -// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %4 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %4, align 4 -// CHECK:STDOUT: %5 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %5, align 4 -// CHECK:STDOUT: %6 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 2 -// CHECK:STDOUT: store i32 %3, ptr %6, align 4 -// CHECK:STDOUT: %tuple.elem8 = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 0 -// CHECK:STDOUT: %7 = load i32, ptr %tuple.elem8, align 4 -// CHECK:STDOUT: %tuple.elem9 = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 1 -// CHECK:STDOUT: %8 = load i32, ptr %tuple.elem9, align 4 -// CHECK:STDOUT: %tuple10 = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %9 = getelementptr inbounds { i32, i32 }, ptr %tuple10, i32 0, i32 0 -// CHECK:STDOUT: store i32 %7, ptr %9, align 4 -// CHECK:STDOUT: %10 = getelementptr inbounds { i32, i32 }, ptr %tuple10, i32 0, i32 1 -// CHECK:STDOUT: store i32 %8, ptr %10, align 4 -// CHECK:STDOUT: %tuple11 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %11 = getelementptr inbounds { ptr, ptr }, ptr %tuple11, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple, ptr %11, align 8 -// CHECK:STDOUT: %12 = getelementptr inbounds { ptr, ptr }, ptr %tuple11, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple10, ptr %12, align 8 -// CHECK:STDOUT: %tuple.index = getelementptr inbounds { ptr, ptr }, ptr %tuple11, i32 0, i32 1 -// CHECK:STDOUT: %tuple.index.load = load ptr, ptr %tuple.index, align 8 -// CHECK:STDOUT: %tuple.index12 = getelementptr inbounds { i32, i32 }, ptr %tuple.index.load, i32 0, i32 1 -// CHECK:STDOUT: %tuple.index.load13 = load i32, ptr %tuple.index12, align 4 -// CHECK:STDOUT: ret i32 %tuple.index.load13 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc8_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc8_36.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc8_36.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 3, ptr %.loc8_36.6.tuple.elem, align 4 +// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc9_28.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 4, ptr %.loc9_28.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc9_28.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 5, ptr %.loc9_28.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_43.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_43.2 = load i32, ptr %.loc10_43.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_43.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc10_43.4 = load i32, ptr %.loc10_43.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_43.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc10_43.6 = load i32, ptr %.loc10_43.5.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_43.7.tuple = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc10_43.7 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc10_43.7.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc10_43.2, ptr %.loc10_43.7, align 4 +// CHECK:STDOUT: %.loc10_43.71 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc10_43.7.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc10_43.4, ptr %.loc10_43.71, align 4 +// CHECK:STDOUT: %.loc10_43.72 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc10_43.7.tuple, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc10_43.6, ptr %.loc10_43.72, align 4 +// CHECK:STDOUT: %.loc10_46.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_46.2 = load i32, ptr %.loc10_46.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_46.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc10_46.4 = load i32, ptr %.loc10_46.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc10_46.5.tuple = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc10_46.5 = getelementptr inbounds { i32, i32 }, ptr %.loc10_46.5.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc10_46.2, ptr %.loc10_46.5, align 4 +// CHECK:STDOUT: %.loc10_46.53 = getelementptr inbounds { i32, i32 }, ptr %.loc10_46.5.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc10_46.4, ptr %.loc10_46.53, align 4 +// CHECK:STDOUT: %.loc10_47.4.tuple = alloca { ptr, ptr }, align 8 +// CHECK:STDOUT: %.loc10_47.4 = getelementptr inbounds { ptr, ptr }, ptr %.loc10_47.4.tuple, i32 0, i32 0 +// CHECK:STDOUT: store ptr %.loc10_43.7.tuple, ptr %.loc10_47.4, align 8 +// CHECK:STDOUT: %.loc10_47.44 = getelementptr inbounds { ptr, ptr }, ptr %.loc10_47.4.tuple, i32 0, i32 1 +// CHECK:STDOUT: store ptr %.loc10_46.5.tuple, ptr %.loc10_47.44, align 8 +// CHECK:STDOUT: %.loc11_13.tuple.index = getelementptr inbounds { ptr, ptr }, ptr %.loc10_47.4.tuple, i32 0, i32 1 +// CHECK:STDOUT: %.loc11_13.tuple.index.load = load ptr, ptr %.loc11_13.tuple.index, align 8 +// CHECK:STDOUT: %.loc11_16.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc11_13.tuple.index.load, i32 0, i32 1 +// CHECK:STDOUT: %.loc11_16.tuple.index.load = load i32, ptr %.loc11_16.tuple.index, align 4 +// CHECK:STDOUT: ret i32 %.loc11_16.tuple.index.load // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/namespace/function.carbon b/toolchain/lower/testdata/namespace/function.carbon index 393df2acd080..2af350fcde4c 100644 --- a/toolchain/lower/testdata/namespace/function.carbon +++ b/toolchain/lower/testdata/namespace/function.carbon @@ -21,14 +21,17 @@ fn Bar() { // CHECK:STDOUT: source_filename = "function.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Baz() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Baz.1() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Bar() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Baz.1() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/namespace/nested.carbon b/toolchain/lower/testdata/namespace/nested.carbon index f51a391c9b0a..276aba4a6ebc 100644 --- a/toolchain/lower/testdata/namespace/nested.carbon +++ b/toolchain/lower/testdata/namespace/nested.carbon @@ -18,10 +18,12 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: source_filename = "nested.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Wiz() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Baz() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @Wiz() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/and.carbon b/toolchain/lower/testdata/operators/and.carbon index 418c98a51447..b60d40c5f2c4 100644 --- a/toolchain/lower/testdata/operators/and.carbon +++ b/toolchain/lower/testdata/operators/and.carbon @@ -15,22 +15,25 @@ fn And() -> bool { // CHECK:STDOUT: source_filename = "and.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @And() { -// CHECK:STDOUT: %F = call i1 @F() -// CHECK:STDOUT: br i1 %F, label %1, label %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %F.call = call i1 @F() +// CHECK:STDOUT: br i1 %F.call, label %and.rhs, label %and.result // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: %G = call i1 @G() -// CHECK:STDOUT: br label %2 +// CHECK:STDOUT: and.rhs: ; preds = %entry +// CHECK:STDOUT: %G.call = call i1 @G() +// CHECK:STDOUT: br label %and.result // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1, %0 -// CHECK:STDOUT: %3 = phi i1 [ false, %0 ], [ %G, %1 ] -// CHECK:STDOUT: ret i1 %3 +// CHECK:STDOUT: and.result: ; preds = %and.rhs, %entry +// CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %G.call, %and.rhs ] +// CHECK:STDOUT: ret i1 %0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/and_empty_block.carbon b/toolchain/lower/testdata/operators/and_empty_block.carbon index ee7054150415..c8518536710c 100644 --- a/toolchain/lower/testdata/operators/and_empty_block.carbon +++ b/toolchain/lower/testdata/operators/and_empty_block.carbon @@ -14,12 +14,13 @@ fn And(b: bool, c: bool) -> bool { // CHECK:STDOUT: source_filename = "and_empty_block.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @And(i1 %b, i1 %c) { -// CHECK:STDOUT: br i1 %b, label %1, label %2 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br i1 %b, label %and.rhs, label %and.result // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: br label %2 +// CHECK:STDOUT: and.rhs: ; preds = %entry +// CHECK:STDOUT: br label %and.result // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1, %0 -// CHECK:STDOUT: %3 = phi i1 [ false, %0 ], [ %c, %1 ] -// CHECK:STDOUT: ret i1 %3 +// CHECK:STDOUT: and.result: ; preds = %and.rhs, %entry +// CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %c, %and.rhs ] +// CHECK:STDOUT: ret i1 %0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index a0640d9de87d..7c8129282ac0 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -15,13 +15,14 @@ fn Main() { // CHECK:STDOUT: source_filename = "assignment.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { -// CHECK:STDOUT: %a = alloca i32, align 4 -// CHECK:STDOUT: store i32 12, ptr %a, align 4 -// CHECK:STDOUT: store i32 9, ptr %a, align 4 -// CHECK:STDOUT: %b = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %b, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %tuple.elem1, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 12, ptr %a.var, align 4 +// CHECK:STDOUT: store i32 9, ptr %a.var, align 4 +// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc11_12.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc11_12.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc11_12.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc11_12.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/not.carbon b/toolchain/lower/testdata/operators/not.carbon index 35cbab256f01..c4fa3e6b3863 100644 --- a/toolchain/lower/testdata/operators/not.carbon +++ b/toolchain/lower/testdata/operators/not.carbon @@ -12,6 +12,7 @@ fn Not(b: bool) -> bool { // CHECK:STDOUT: source_filename = "not.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Not(i1 %b) { -// CHECK:STDOUT: %1 = xor i1 %b, true -// CHECK:STDOUT: ret i1 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8 = xor i1 %b, true +// CHECK:STDOUT: ret i1 %.loc8 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/or.carbon b/toolchain/lower/testdata/operators/or.carbon index b5214337ac68..f79d3363153a 100644 --- a/toolchain/lower/testdata/operators/or.carbon +++ b/toolchain/lower/testdata/operators/or.carbon @@ -15,23 +15,26 @@ fn Or() -> bool { // CHECK:STDOUT: source_filename = "or.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Or() { -// CHECK:STDOUT: %F = call i1 @F() -// CHECK:STDOUT: %1 = xor i1 %F, true -// CHECK:STDOUT: br i1 %1, label %2, label %3 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %F.call = call i1 @F() +// CHECK:STDOUT: %.loc11_14.3 = xor i1 %F.call, true +// CHECK:STDOUT: br i1 %.loc11_14.3, label %or.rhs, label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 -// CHECK:STDOUT: %G = call i1 @G() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: or.rhs: ; preds = %entry +// CHECK:STDOUT: %G.call = call i1 @G() +// CHECK:STDOUT: br label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %2, %0 -// CHECK:STDOUT: %4 = phi i1 [ true, %0 ], [ %G, %2 ] -// CHECK:STDOUT: ret i1 %4 +// CHECK:STDOUT: or.result: ; preds = %or.rhs, %entry +// CHECK:STDOUT: %0 = phi i1 [ true, %entry ], [ %G.call, %or.rhs ] +// CHECK:STDOUT: ret i1 %0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/or_empty_block.carbon b/toolchain/lower/testdata/operators/or_empty_block.carbon index d0ec265e9bf9..aa3afdd9bed8 100644 --- a/toolchain/lower/testdata/operators/or_empty_block.carbon +++ b/toolchain/lower/testdata/operators/or_empty_block.carbon @@ -14,13 +14,14 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: source_filename = "or_empty_block.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Or(i1 %b, i1 %c) { -// CHECK:STDOUT: %1 = xor i1 %b, true -// CHECK:STDOUT: br i1 %1, label %2, label %3 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc10_12.1 = xor i1 %b, true +// CHECK:STDOUT: br i1 %.loc10_12.1, label %or.rhs, label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: or.rhs: ; preds = %entry +// CHECK:STDOUT: br label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %2, %0 -// CHECK:STDOUT: %4 = phi i1 [ true, %0 ], [ %c, %2 ] -// CHECK:STDOUT: ret i1 %4 +// CHECK:STDOUT: or.result: ; preds = %or.rhs, %entry +// CHECK:STDOUT: %0 = phi i1 [ true, %entry ], [ %c, %or.rhs ] +// CHECK:STDOUT: ret i1 %0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/overloaded.carbon b/toolchain/lower/testdata/operators/overloaded.carbon index f3574436b206..36f9cce7d771 100644 --- a/toolchain/lower/testdata/operators/overloaded.carbon +++ b/toolchain/lower/testdata/operators/overloaded.carbon @@ -45,56 +45,59 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: source_filename = "overloaded.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Op(ptr sret({ i1 }) %return, ptr %self) { -// CHECK:STDOUT: %is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i1, ptr %is_positive, align 1 -// CHECK:STDOUT: %2 = xor i1 %1, true -// CHECK:STDOUT: %is_positive1 = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %2, ptr %is_positive1, align 1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc10_36.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_36.2 = load i1, ptr %.loc10_36.1.is_positive, align 1 +// CHECK:STDOUT: %.loc10_28 = xor i1 %.loc10_36.2, true +// CHECK:STDOUT: %.loc10_48.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i1 %.loc10_28, ptr %.loc10_48.2.is_positive, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Op.1(ptr sret({ i1 }) %return, ptr %self, ptr %other) { -// CHECK:STDOUT: %is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i1, ptr %is_positive, align 1 -// CHECK:STDOUT: br i1 %1, label %2, label %4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15_33.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_33.2 = load i1, ptr %.loc15_33.1.is_positive, align 1 +// CHECK:STDOUT: br i1 %.loc15_33.2, label %and.rhs.loc15, label %and.result.loc15 // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 -// CHECK:STDOUT: %is_positive1 = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %3 = load i1, ptr %is_positive1, align 1 -// CHECK:STDOUT: br label %4 +// CHECK:STDOUT: and.rhs.loc15: ; preds = %entry +// CHECK:STDOUT: %.loc15_55.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_55.2 = load i1, ptr %.loc15_55.1.is_positive, align 1 +// CHECK:STDOUT: br label %and.result.loc15 // CHECK:STDOUT: -// CHECK:STDOUT: 4: ; preds = %2, %0 -// CHECK:STDOUT: %5 = phi i1 [ false, %0 ], [ %3, %2 ] -// CHECK:STDOUT: %6 = xor i1 %5, true -// CHECK:STDOUT: br i1 %6, label %7, label %15 +// CHECK:STDOUT: and.result.loc15: ; preds = %and.rhs.loc15, %entry +// CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %.loc15_55.2, %and.rhs.loc15 ] +// CHECK:STDOUT: %.loc15_69.1 = xor i1 %0, true +// CHECK:STDOUT: br i1 %.loc15_69.1, label %or.rhs, label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 7: ; preds = %4 -// CHECK:STDOUT: %is_positive2 = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %8 = load i1, ptr %is_positive2, align 1 -// CHECK:STDOUT: %9 = xor i1 %8, true -// CHECK:STDOUT: br i1 %9, label %10, label %13 +// CHECK:STDOUT: or.rhs: ; preds = %and.result.loc15 +// CHECK:STDOUT: %.loc16_38.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_38.2 = load i1, ptr %.loc16_38.1.is_positive, align 1 +// CHECK:STDOUT: %.loc16_30 = xor i1 %.loc16_38.2, true +// CHECK:STDOUT: br i1 %.loc16_30, label %and.rhs.loc16, label %and.result.loc16 // CHECK:STDOUT: -// CHECK:STDOUT: 10: ; preds = %7 -// CHECK:STDOUT: %is_positive3 = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %11 = load i1, ptr %is_positive3, align 1 -// CHECK:STDOUT: %12 = xor i1 %11, true -// CHECK:STDOUT: br label %13 +// CHECK:STDOUT: and.rhs.loc16: ; preds = %or.rhs +// CHECK:STDOUT: %.loc16_64.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_64.2 = load i1, ptr %.loc16_64.1.is_positive, align 1 +// CHECK:STDOUT: %.loc16_55 = xor i1 %.loc16_64.2, true +// CHECK:STDOUT: br label %and.result.loc16 // CHECK:STDOUT: -// CHECK:STDOUT: 13: ; preds = %10, %7 -// CHECK:STDOUT: %14 = phi i1 [ false, %7 ], [ %12, %10 ] -// CHECK:STDOUT: br label %15 +// CHECK:STDOUT: and.result.loc16: ; preds = %and.rhs.loc16, %or.rhs +// CHECK:STDOUT: %1 = phi i1 [ false, %or.rhs ], [ %.loc16_55, %and.rhs.loc16 ] +// CHECK:STDOUT: br label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: 15: ; preds = %13, %4 -// CHECK:STDOUT: %16 = phi i1 [ true, %4 ], [ %14, %13 ] -// CHECK:STDOUT: %is_positive4 = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %16, ptr %is_positive4, align 1 +// CHECK:STDOUT: or.result: ; preds = %and.result.loc16, %and.result.loc15 +// CHECK:STDOUT: %2 = phi i1 [ true, %and.result.loc15 ], [ %1, %and.result.loc16 ] +// CHECK:STDOUT: %.loc16_77.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i1 %2, ptr %.loc16_77.2.is_positive, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Calculate(ptr sret({ i1 }) %return, ptr %a, ptr %b) { -// CHECK:STDOUT: %temp = alloca { i1 }, align 8 -// CHECK:STDOUT: call void @Op(ptr %temp, ptr %a) -// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %temp, ptr %b) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc21_10.2.temp = alloca { i1 }, align 8 +// CHECK:STDOUT: call void @Op(ptr %.loc21_10.2.temp, ptr %a) +// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %.loc21_10.2.temp, ptr %b) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/packages/cross_package_call.carbon b/toolchain/lower/testdata/packages/cross_package_call.carbon index 989b979bd8a7..87c55dae42da 100644 --- a/toolchain/lower/testdata/packages/cross_package_call.carbon +++ b/toolchain/lower/testdata/packages/cross_package_call.carbon @@ -20,12 +20,14 @@ fn G() { A.F(); } // CHECK:STDOUT: source_filename = "a.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: ; ModuleID = 'b.carbon' // CHECK:STDOUT: source_filename = "b.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @F() // 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 b08d6145532e..8926f21603e9 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -17,12 +17,13 @@ fn F() { // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { -// CHECK:STDOUT: %s = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { i32, i32 }, ptr %s, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %a, align 4 -// CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %s, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %b, align 4 -// CHECK:STDOUT: %b1 = getelementptr inbounds { i32, i32 }, ptr %s, i32 0, i32 1 -// CHECK:STDOUT: call void @G(ptr %b1) +// CHECK:STDOUT: entry: +// 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: store i32 1, ptr %.loc10_46.2.a, align 4 +// CHECK:STDOUT: %.loc10_46.4.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc10_46.4.b, align 4 +// 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 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/address_of_unused.carbon b/toolchain/lower/testdata/pointer/address_of_unused.carbon index 7f91e2eae275..a5fb0e31e4b2 100644 --- a/toolchain/lower/testdata/pointer/address_of_unused.carbon +++ b/toolchain/lower/testdata/pointer/address_of_unused.carbon @@ -13,7 +13,8 @@ fn F() { // CHECK:STDOUT: source_filename = "address_of_unused.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { -// CHECK:STDOUT: %n = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %n, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %n.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/basic.carbon b/toolchain/lower/testdata/pointer/basic.carbon index f970872be781..ee266bad8ced 100644 --- a/toolchain/lower/testdata/pointer/basic.carbon +++ b/toolchain/lower/testdata/pointer/basic.carbon @@ -17,13 +17,15 @@ fn F() -> i32 { // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G(ptr %p) { -// CHECK:STDOUT: %1 = load i32, ptr %p, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8_10.2 = load i32, ptr %p, align 4 +// CHECK:STDOUT: ret i32 %.loc8_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { -// CHECK:STDOUT: %n = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %n, align 4 -// CHECK:STDOUT: %G = call i32 @G(ptr %n) -// CHECK:STDOUT: ret i32 %G +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %n.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4 +// CHECK:STDOUT: %G.call = call i32 @G(ptr %n.var) +// CHECK:STDOUT: ret i32 %G.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon index aa342072eaf5..d5f7ae37683f 100644 --- a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon +++ b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon @@ -15,15 +15,16 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: source_filename = "pointer_to_pointer.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %p) { -// CHECK:STDOUT: %a = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %p, ptr %a, align 8 -// CHECK:STDOUT: %b = alloca ptr, align 8 -// CHECK:STDOUT: %1 = load ptr, ptr %p, align 8 -// CHECK:STDOUT: store ptr %1, ptr %b, align 8 -// CHECK:STDOUT: %c = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %b, ptr %c, align 8 -// CHECK:STDOUT: %2 = load ptr, ptr %c, align 8 -// CHECK:STDOUT: %3 = load ptr, ptr %2, align 8 -// CHECK:STDOUT: %4 = load i32, ptr %3, align 4 -// CHECK:STDOUT: ret i32 %4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8 +// CHECK:STDOUT: %b.var = alloca ptr, align 8 +// CHECK:STDOUT: %.loc9_17.2 = load ptr, ptr %p, align 8 +// CHECK:STDOUT: store ptr %.loc9_17.2, ptr %b.var, align 8 +// CHECK:STDOUT: %c.var = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8 +// CHECK:STDOUT: %.loc11_12 = load ptr, ptr %c.var, align 8 +// CHECK:STDOUT: %.loc11_11.2 = load ptr, ptr %.loc11_12, align 8 +// CHECK:STDOUT: %.loc11_10.2 = load i32, ptr %.loc11_11.2, align 4 +// CHECK:STDOUT: ret i32 %.loc11_10.2 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/code_after_return.carbon b/toolchain/lower/testdata/return/code_after_return.carbon index ad72dee8453c..fab4640ea743 100644 --- a/toolchain/lower/testdata/return/code_after_return.carbon +++ b/toolchain/lower/testdata/return/code_after_return.carbon @@ -15,9 +15,11 @@ fn Main() { // CHECK:STDOUT: source_filename = "code_after_return.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/no_value.carbon b/toolchain/lower/testdata/return/no_value.carbon index aacd45c05212..8af172e3e4ef 100644 --- a/toolchain/lower/testdata/return/no_value.carbon +++ b/toolchain/lower/testdata/return/no_value.carbon @@ -12,5 +12,6 @@ fn Main() { // CHECK:STDOUT: source_filename = "no_value.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/return_var.carbon b/toolchain/lower/testdata/return/return_var.carbon index 4e94d07d2243..4e2b03eeb122 100644 --- a/toolchain/lower/testdata/return/return_var.carbon +++ b/toolchain/lower/testdata/return/return_var.carbon @@ -19,9 +19,10 @@ fn Make() -> C { // CHECK:STDOUT: source_filename = "return_var.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, ptr }) %return) { -// CHECK:STDOUT: %data = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 42, ptr %data, align 4 -// CHECK:STDOUT: %next = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store ptr %return, ptr %next, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc14_30.2.data = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 42, ptr %.loc14_30.2.data, align 4 +// CHECK:STDOUT: %.loc14_30.4.next = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store ptr %return, ptr %.loc14_30.4.next, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/return_var_byval.carbon b/toolchain/lower/testdata/return/return_var_byval.carbon index d811453a49e9..a81e8fee5d87 100644 --- a/toolchain/lower/testdata/return/return_var_byval.carbon +++ b/toolchain/lower/testdata/return/return_var_byval.carbon @@ -13,8 +13,9 @@ fn Main() -> i32 { // CHECK:STDOUT: source_filename = "return_var_byval.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() { -// CHECK:STDOUT: %x = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %x, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %x, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %x.var, align 4 +// CHECK:STDOUT: %.loc8_16 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc8_16 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/value.carbon b/toolchain/lower/testdata/return/value.carbon index 2600e6ea8038..a3b3e899e701 100644 --- a/toolchain/lower/testdata/return/value.carbon +++ b/toolchain/lower/testdata/return/value.carbon @@ -12,5 +12,6 @@ fn Main() -> i32 { // CHECK:STDOUT: source_filename = "value.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/var.carbon b/toolchain/lower/testdata/return/var.carbon index 0e6934ac584b..43c2cda53afc 100644 --- a/toolchain/lower/testdata/return/var.carbon +++ b/toolchain/lower/testdata/return/var.carbon @@ -13,8 +13,9 @@ fn Main() -> i32 { // CHECK:STDOUT: source_filename = "var.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() { -// CHECK:STDOUT: %x = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %x, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %x, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 0, ptr %x.var, align 4 +// CHECK:STDOUT: %.loc9 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc9 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/empty.carbon b/toolchain/lower/testdata/struct/empty.carbon index d4d915086bae..bb712b99c9c4 100644 --- a/toolchain/lower/testdata/struct/empty.carbon +++ b/toolchain/lower/testdata/struct/empty.carbon @@ -14,7 +14,8 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "empty.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca {}, align 8 -// CHECK:STDOUT: %y = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca {}, align 8 +// CHECK:STDOUT: %y.var = alloca {}, align 8 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index 7f56f5871db2..29ade7a6f9f3 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -15,17 +15,18 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "member_access.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca { double, i32 }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { double, i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: store double 0.000000e+00, ptr %a, align 8 -// CHECK:STDOUT: %b = getelementptr inbounds { double, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: store i32 1, ptr %b, align 4 -// CHECK:STDOUT: %y = alloca i32, align 4 -// CHECK:STDOUT: %b1 = getelementptr inbounds { double, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: %1 = load i32, ptr %b1, align 4 -// CHECK:STDOUT: store i32 %1, ptr %y, align 4 -// CHECK:STDOUT: %z = alloca i32, align 4 -// CHECK:STDOUT: %2 = load i32, ptr %y, align 4 -// CHECK:STDOUT: store i32 %2, ptr %z, align 4 +// 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: store double 0.000000e+00, ptr %.loc8_48.2.a, align 8 +// CHECK:STDOUT: %.loc8_48.4.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 1, ptr %.loc8_48.4.b, align 4 +// 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: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/nested_struct.carbon b/toolchain/lower/testdata/struct/nested_struct.carbon index de2b142545b5..437211359d6c 100644 --- a/toolchain/lower/testdata/struct/nested_struct.carbon +++ b/toolchain/lower/testdata/struct/nested_struct.carbon @@ -13,5 +13,6 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "nested_struct.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon index 98e19fb2dd31..3753a93f8183 100644 --- a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon @@ -16,10 +16,11 @@ fn G() { // CHECK:STDOUT: declare void @F(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { -// CHECK:STDOUT: %v = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %a) -// CHECK:STDOUT: %b = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %b) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 +// CHECK:STDOUT: %.loc10_74.1.a = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc10_74.1.a) +// CHECK:STDOUT: %.loc10_74.2.b = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc10_74.2.b) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/one_entry.carbon b/toolchain/lower/testdata/struct/one_entry.carbon index d4d7d14217a3..857e52fe6e49 100644 --- a/toolchain/lower/testdata/struct/one_entry.carbon +++ b/toolchain/lower/testdata/struct/one_entry.carbon @@ -14,12 +14,13 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "one_entry.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca { i32 }, align 8 -// CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x, align 4 -// CHECK:STDOUT: %y = alloca { i32 }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %a, align 4 -// CHECK:STDOUT: %struct.init = insertvalue { i32 } poison, i32 %1, 0 -// CHECK:STDOUT: store { i32 } %struct.init, ptr %y, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca { i32 }, align 8 +// CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x.var, align 4 +// CHECK:STDOUT: %y.var = alloca { i32 }, align 8 +// CHECK:STDOUT: %.loc9_22.1.a = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc9_22.2 = load i32, ptr %.loc9_22.1.a, align 4 +// CHECK:STDOUT: %.loc9_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc9_22.2, 0 +// CHECK:STDOUT: store { i32 } %.loc9_22.3.struct.init, ptr %y.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 442ac23d4add..cf930967b56b 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -14,19 +14,20 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %a = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %a, align 4 -// CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: store i32 2, ptr %b, align 4 -// CHECK:STDOUT: %y = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %a1 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %a1, align 4 -// CHECK:STDOUT: %a2 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %a2, align 4 -// CHECK:STDOUT: %b3 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %b3, align 4 -// CHECK:STDOUT: %b4 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %b4, align 4 +// 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: store i32 1, ptr %.loc8_46.2.a, align 4 +// CHECK:STDOUT: %.loc8_46.4.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 2, ptr %.loc8_46.4.b, align 4 +// 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 +// CHECK:STDOUT: %.loc9_31.3.a = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc9_31.2, ptr %.loc9_31.3.a, align 4 +// CHECK:STDOUT: %.loc9_31.5.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc9_31.6 = load i32, ptr %.loc9_31.5.b, align 4 +// CHECK:STDOUT: %.loc9_31.7.b = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc9_31.6, ptr %.loc9_31.7.b, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/empty.carbon b/toolchain/lower/testdata/tuple/empty.carbon index 64034cb6e8b0..272502e8cc61 100644 --- a/toolchain/lower/testdata/tuple/empty.carbon +++ b/toolchain/lower/testdata/tuple/empty.carbon @@ -14,7 +14,8 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "empty.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca {}, align 8 -// CHECK:STDOUT: %y = alloca {}, align 8 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca {}, align 8 +// CHECK:STDOUT: %y.var = alloca {}, align 8 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/nested_tuple.carbon b/toolchain/lower/testdata/tuple/nested_tuple.carbon index b0c0fde68f04..224d059cc3d1 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple.carbon @@ -13,5 +13,6 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "nested_tuple.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon index 495f05ad803b..a999e06bd021 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon @@ -16,10 +16,11 @@ fn G() { // CHECK:STDOUT: declare void @F(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: // CHECK:STDOUT: define void @G() { -// CHECK:STDOUT: %v = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %tuple.elem) -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %tuple.elem1) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 +// CHECK:STDOUT: %.loc10_56.1.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc10_56.1.tuple.elem) +// CHECK:STDOUT: %.loc10_56.2.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc10_56.2.tuple.elem) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/one_entry.carbon b/toolchain/lower/testdata/tuple/one_entry.carbon index 2052322e691c..fafcdd67f7a7 100644 --- a/toolchain/lower/testdata/tuple/one_entry.carbon +++ b/toolchain/lower/testdata/tuple/one_entry.carbon @@ -14,12 +14,13 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "one_entry.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca { i32 }, align 8 -// CHECK:STDOUT: store { i32 } { i32 1 }, ptr %x, align 4 -// CHECK:STDOUT: %y = alloca { i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.init = insertvalue { i32 } poison, i32 %1, 0 -// CHECK:STDOUT: store { i32 } %tuple.init, ptr %y, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca { i32 }, align 8 +// CHECK:STDOUT: store { i32 } { i32 1 }, ptr %x.var, align 4 +// CHECK:STDOUT: %y.var = alloca { i32 }, align 8 +// CHECK:STDOUT: %.loc9_20.1.tuple.elem = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc9_20.2 = load i32, ptr %.loc9_20.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc9_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc9_20.2, 0 +// CHECK:STDOUT: store { i32 } %.loc9_20.3.tuple.init, ptr %y.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/two_entries.carbon b/toolchain/lower/testdata/tuple/two_entries.carbon index 044b359acf3d..e8c89c2bdc17 100644 --- a/toolchain/lower/testdata/tuple/two_entries.carbon +++ b/toolchain/lower/testdata/tuple/two_entries.carbon @@ -14,19 +14,20 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: store i32 12, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: store i32 7, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %y = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem2, align 4 -// CHECK:STDOUT: %tuple.elem3 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %tuple.elem3, align 4 -// CHECK:STDOUT: %tuple.elem4 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem4, align 4 -// CHECK:STDOUT: %tuple.elem5 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %tuple.elem5, align 4 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc8_29.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 12, ptr %.loc8_29.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc8_29.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 7, ptr %.loc8_29.4.tuple.elem, align 4 +// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %.loc9_23.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc9_23.2 = load i32, ptr %.loc9_23.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc9_23.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc9_23.2, ptr %.loc9_23.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc9_23.5.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc9_23.6 = load i32, ptr %.loc9_23.5.tuple.elem, align 4 +// CHECK:STDOUT: %.loc9_23.7.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc9_23.6, ptr %.loc9_23.7.tuple.elem, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/value_formation.carbon b/toolchain/lower/testdata/tuple/value_formation.carbon index 78c4a40da120..48ca62c95ae9 100644 --- a/toolchain/lower/testdata/tuple/value_formation.carbon +++ b/toolchain/lower/testdata/tuple/value_formation.carbon @@ -18,39 +18,40 @@ fn F() { // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { -// CHECK:STDOUT: %a = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %b = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 0 -// CHECK:STDOUT: %1 = load i32, ptr %tuple.elem, align 4 -// CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 1 -// CHECK:STDOUT: %2 = load i32, ptr %tuple.elem1, align 4 -// CHECK:STDOUT: %tuple.elem2 = getelementptr inbounds { i32, i32, i32 }, ptr %a, i32 0, i32 2 -// CHECK:STDOUT: %3 = load i32, ptr %tuple.elem2, align 4 -// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %4 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 %1, ptr %4, align 4 -// CHECK:STDOUT: %5 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 %2, ptr %5, align 4 -// CHECK:STDOUT: %6 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 2 -// CHECK:STDOUT: store i32 %3, ptr %6, align 4 -// CHECK:STDOUT: %tuple.elem3 = getelementptr inbounds { i32, i32, i32 }, ptr %b, i32 0, i32 0 -// CHECK:STDOUT: %7 = load i32, ptr %tuple.elem3, align 4 -// CHECK:STDOUT: %tuple.elem4 = getelementptr inbounds { i32, i32, i32 }, ptr %b, i32 0, i32 1 -// CHECK:STDOUT: %8 = load i32, ptr %tuple.elem4, align 4 -// CHECK:STDOUT: %tuple.elem5 = getelementptr inbounds { i32, i32, i32 }, ptr %b, i32 0, i32 2 -// CHECK:STDOUT: %9 = load i32, ptr %tuple.elem5, align 4 -// CHECK:STDOUT: %tuple6 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %10 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple6, i32 0, i32 0 -// CHECK:STDOUT: store i32 %7, ptr %10, align 4 -// CHECK:STDOUT: %11 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple6, i32 0, i32 1 -// CHECK:STDOUT: store i32 %8, ptr %11, align 4 -// CHECK:STDOUT: %12 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple6, i32 0, i32 2 -// CHECK:STDOUT: store i32 %9, ptr %12, align 4 -// CHECK:STDOUT: %tuple7 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %13 = getelementptr inbounds { ptr, ptr }, ptr %tuple7, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple, ptr %13, align 8 -// CHECK:STDOUT: %14 = getelementptr inbounds { ptr, ptr }, ptr %tuple7, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple6, ptr %14, align 8 -// CHECK:STDOUT: call void @G(ptr %tuple7) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %b.var = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc12_6.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_6.2 = load i32, ptr %.loc12_6.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_6.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_6.4 = load i32, ptr %.loc12_6.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_6.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc12_6.6 = load i32, ptr %.loc12_6.5.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_6.7.tuple = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc12_6.7 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_6.7.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc12_6.2, ptr %.loc12_6.7, align 4 +// CHECK:STDOUT: %.loc12_6.71 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_6.7.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc12_6.4, ptr %.loc12_6.71, align 4 +// CHECK:STDOUT: %.loc12_6.72 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_6.7.tuple, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc12_6.6, ptr %.loc12_6.72, align 4 +// CHECK:STDOUT: %.loc12_9.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_9.2 = load i32, ptr %.loc12_9.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_9.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_9.4 = load i32, ptr %.loc12_9.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_9.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc12_9.6 = load i32, ptr %.loc12_9.5.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_9.7.tuple = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %.loc12_9.7 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_9.7.tuple, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc12_9.2, ptr %.loc12_9.7, align 4 +// CHECK:STDOUT: %.loc12_9.73 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_9.7.tuple, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc12_9.4, ptr %.loc12_9.73, align 4 +// CHECK:STDOUT: %.loc12_9.74 = getelementptr inbounds { i32, i32, i32 }, ptr %.loc12_9.7.tuple, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc12_9.6, ptr %.loc12_9.74, align 4 +// CHECK:STDOUT: %.loc12_10.4.tuple = alloca { ptr, ptr }, align 8 +// CHECK:STDOUT: %.loc12_10.4 = getelementptr inbounds { ptr, ptr }, ptr %.loc12_10.4.tuple, i32 0, i32 0 +// CHECK:STDOUT: store ptr %.loc12_6.7.tuple, ptr %.loc12_10.4, align 8 +// CHECK:STDOUT: %.loc12_10.45 = getelementptr inbounds { ptr, ptr }, ptr %.loc12_10.4.tuple, i32 0, i32 1 +// CHECK:STDOUT: store ptr %.loc12_9.7.tuple, ptr %.loc12_10.45, align 8 +// CHECK:STDOUT: call void @G(ptr %.loc12_10.4.tuple) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/value_forwarding.carbon b/toolchain/lower/testdata/tuple/value_forwarding.carbon index 1e6a79924b02..c3a3d1c5eb0c 100644 --- a/toolchain/lower/testdata/tuple/value_forwarding.carbon +++ b/toolchain/lower/testdata/tuple/value_forwarding.carbon @@ -16,11 +16,12 @@ fn F(a: (i32, i32, i32), b: (i32, i32, i32)) { // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr %a, ptr %b) { -// CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %1 = getelementptr inbounds { ptr, ptr }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store ptr %a, ptr %1, align 8 -// CHECK:STDOUT: %2 = getelementptr inbounds { ptr, ptr }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store ptr %b, ptr %2, align 8 -// CHECK:STDOUT: call void @G(ptr %tuple) +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc10_10.2.tuple = alloca { ptr, ptr }, align 8 +// CHECK:STDOUT: %.loc10_10.2 = getelementptr inbounds { ptr, ptr }, ptr %.loc10_10.2.tuple, i32 0, i32 0 +// CHECK:STDOUT: store ptr %a, ptr %.loc10_10.2, align 8 +// CHECK:STDOUT: %.loc10_10.21 = getelementptr inbounds { ptr, ptr }, ptr %.loc10_10.2.tuple, i32 0, i32 1 +// CHECK:STDOUT: store ptr %b, ptr %.loc10_10.21, align 8 +// CHECK:STDOUT: call void @G(ptr %.loc10_10.2.tuple) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/var/local.carbon b/toolchain/lower/testdata/var/local.carbon index d3c137eb6898..5f618cabae8d 100644 --- a/toolchain/lower/testdata/var/local.carbon +++ b/toolchain/lower/testdata/var/local.carbon @@ -13,8 +13,9 @@ fn Run() -> i32 { // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { -// CHECK:STDOUT: %x = alloca i32, align 4 -// CHECK:STDOUT: store i32 1, ptr %x, align 4 -// CHECK:STDOUT: %1 = load i32, ptr %x, align 4 -// CHECK:STDOUT: ret i32 %1 +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca i32, align 4 +// CHECK:STDOUT: store i32 1, ptr %x.var, align 4 +// CHECK:STDOUT: %.loc9 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc9 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/break_continue.carbon b/toolchain/lower/testdata/while/break_continue.carbon index ab18c2a5e969..a1f5c1d35b50 100644 --- a/toolchain/lower/testdata/while/break_continue.carbon +++ b/toolchain/lower/testdata/while/break_continue.carbon @@ -26,32 +26,32 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: define void @While() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br label %0 +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 0: ; preds = %entry, %5, %2 -// CHECK:STDOUT: %A = call i1 @A() -// CHECK:STDOUT: br i1 %A, label %1, label %6 +// CHECK:STDOUT: while.cond: ; preds = %entry, %if.else.loc14, %if.then.loc13 +// CHECK:STDOUT: %A.call = call i1 @A() +// CHECK:STDOUT: br i1 %A.call, label %while.body, label %while.done // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: %B = call i1 @B() -// CHECK:STDOUT: br i1 %B, label %2, label %3 +// CHECK:STDOUT: while.body: ; preds = %while.cond +// CHECK:STDOUT: %B.call = call i1 @B() +// CHECK:STDOUT: br i1 %B.call, label %if.then.loc13, label %if.else.loc13 // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1 -// CHECK:STDOUT: br label %0 +// CHECK:STDOUT: if.then.loc13: ; preds = %while.body +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %1 -// CHECK:STDOUT: %C = call i1 @C() -// CHECK:STDOUT: br i1 %C, label %4, label %5 +// CHECK:STDOUT: if.else.loc13: ; preds = %while.body +// CHECK:STDOUT: %C.call = call i1 @C() +// CHECK:STDOUT: br i1 %C.call, label %if.then.loc14, label %if.else.loc14 // CHECK:STDOUT: -// CHECK:STDOUT: 4: ; preds = %3 -// CHECK:STDOUT: br label %6 +// CHECK:STDOUT: if.then.loc14: ; preds = %if.else.loc13 +// CHECK:STDOUT: br label %while.done // CHECK:STDOUT: -// CHECK:STDOUT: 5: ; preds = %3 -// CHECK:STDOUT: br label %0 +// CHECK:STDOUT: if.else.loc14: ; preds = %if.else.loc13 +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 6: ; preds = %4, %0 +// CHECK:STDOUT: while.done: ; preds = %if.then.loc14, %while.cond // CHECK:STDOUT: ret void // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder label %0, { 1, 2, 0 } +// CHECK:STDOUT: uselistorder label %while.cond, { 1, 2, 0 } // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/preheader.carbon b/toolchain/lower/testdata/while/preheader.carbon index 9bf43324ddfc..39be6a3abc5d 100644 --- a/toolchain/lower/testdata/while/preheader.carbon +++ b/toolchain/lower/testdata/while/preheader.carbon @@ -35,34 +35,34 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: define void @While() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br label %0 +// CHECK:STDOUT: br label %while.cond.loc16 // CHECK:STDOUT: -// CHECK:STDOUT: 0: ; preds = %entry, %1 -// CHECK:STDOUT: %Cond = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond, label %1, label %2 +// CHECK:STDOUT: while.cond.loc16: ; preds = %entry, %while.body.loc16 +// CHECK:STDOUT: %Cond.call.loc16 = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call.loc16, label %while.body.loc16, label %while.done.loc16 // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 +// CHECK:STDOUT: while.body.loc16: ; preds = %while.cond.loc16 // CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %0 +// CHECK:STDOUT: br label %while.cond.loc16 // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %0 -// CHECK:STDOUT: %Cond1 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond1, label %3, label %6 +// CHECK:STDOUT: while.done.loc16: ; preds = %while.cond.loc16 +// CHECK:STDOUT: %Cond.call.loc20 = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call.loc20, label %while.cond.loc21, label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %4, %2 -// CHECK:STDOUT: %Cond2 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond2, label %4, label %5 +// CHECK:STDOUT: while.cond.loc21: ; preds = %while.body.loc21, %while.done.loc16 +// CHECK:STDOUT: %Cond.call.loc21 = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call.loc21, label %while.body.loc21, label %while.done.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: 4: ; preds = %3 +// CHECK:STDOUT: while.body.loc21: ; preds = %while.cond.loc21 // CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %3 +// CHECK:STDOUT: br label %while.cond.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: 5: ; preds = %3 -// CHECK:STDOUT: br label %6 +// CHECK:STDOUT: while.done.loc21: ; preds = %while.cond.loc21 +// CHECK:STDOUT: br label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: 6: ; preds = %5, %2 +// CHECK:STDOUT: if.else: ; preds = %while.done.loc21, %while.done.loc16 // CHECK:STDOUT: ret void // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder label %0, { 1, 0 } +// CHECK:STDOUT: uselistorder label %while.cond.loc16, { 1, 0 } // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/unreachable_end.carbon b/toolchain/lower/testdata/while/unreachable_end.carbon index 8f8ded4aeac9..e6302316096f 100644 --- a/toolchain/lower/testdata/while/unreachable_end.carbon +++ b/toolchain/lower/testdata/while/unreachable_end.carbon @@ -31,18 +31,19 @@ fn While() { // CHECK:STDOUT: declare void @H() // CHECK:STDOUT: // CHECK:STDOUT: define void @While() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %1 +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %0 -// CHECK:STDOUT: %Cond = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond, label %2, label %3 +// CHECK:STDOUT: while.cond: ; preds = %entry +// CHECK:STDOUT: %Cond.call = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call, label %while.body, label %while.done // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1 +// CHECK:STDOUT: while.body: ; preds = %while.cond // CHECK:STDOUT: call void @G() // CHECK:STDOUT: ret void // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %1 +// CHECK:STDOUT: while.done: ; preds = %while.cond // CHECK:STDOUT: call void @H() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/while.carbon b/toolchain/lower/testdata/while/while.carbon index 021b493f6736..2e2dde0a5e8f 100644 --- a/toolchain/lower/testdata/while/while.carbon +++ b/toolchain/lower/testdata/while/while.carbon @@ -30,18 +30,19 @@ fn While() { // CHECK:STDOUT: declare void @H() // CHECK:STDOUT: // CHECK:STDOUT: define void @While() { +// CHECK:STDOUT: entry: // CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %1 +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 1: ; preds = %2, %0 -// CHECK:STDOUT: %Cond = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond, label %2, label %3 +// CHECK:STDOUT: while.cond: ; preds = %while.body, %entry +// CHECK:STDOUT: %Cond.call = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call, label %while.body, label %while.done // CHECK:STDOUT: -// CHECK:STDOUT: 2: ; preds = %1 +// CHECK:STDOUT: while.body: ; preds = %while.cond // CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %1 +// CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: 3: ; preds = %1 +// CHECK:STDOUT: while.done: ; preds = %while.cond // CHECK:STDOUT: call void @H() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/sem_ir/BUILD b/toolchain/sem_ir/BUILD index 41ba12a3900f..9877bf720c47 100644 --- a/toolchain/sem_ir/BUILD +++ b/toolchain/sem_ir/BUILD @@ -121,6 +121,23 @@ cc_library( ], ) +cc_library( + name = "inst_namer", + srcs = ["inst_namer.cpp"], + hdrs = ["inst_namer.h"], + deps = [ + ":file", + ":ids", + ":inst_kind", + "//common:ostream", + "//toolchain/base:kind_switch", + "//toolchain/base:value_store", + "//toolchain/lex:tokenized_buffer", + "//toolchain/parse:tree", + "@llvm-project//llvm:Support", + ], +) + cc_library( name = "formatter", srcs = ["formatter.cpp"], @@ -129,6 +146,7 @@ cc_library( ":file", ":ids", ":inst_kind", + ":inst_namer", "//common:ostream", "//toolchain/base:kind_switch", "//toolchain/base:value_store", diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 6f75d6da1572..f1090d6f1398 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -7,7 +7,6 @@ #include "common/ostream.h" #include "llvm/ADT/Sequence.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringMap.h" #include "llvm/Support/SaveAndRestore.h" #include "toolchain/base/kind_switch.h" #include "toolchain/base/value_store.h" @@ -16,557 +15,11 @@ #include "toolchain/sem_ir/builtin_function_kind.h" #include "toolchain/sem_ir/function.h" #include "toolchain/sem_ir/ids.h" +#include "toolchain/sem_ir/inst_namer.h" #include "toolchain/sem_ir/typed_insts.h" namespace Carbon::SemIR { -namespace { -// Assigns names to instructions, blocks, and scopes in the Semantics IR. -// -// TODOs / future work ideas: -// - Add a documentation file for the textual format and link to the -// naming section here. -// - Consider representing literals as just `literal` in the IR and using the -// type to distinguish. -class InstNamer { - public: - // int32_t matches the input value size. - // NOLINTNEXTLINE(performance-enum-size) - enum class ScopeId : int32_t { - None = -1, - File = 0, - ImportRef = 1, - Constants = 2, - FirstFunction = 3, - }; - static_assert(sizeof(ScopeId) == sizeof(FunctionId)); - - struct NumberOfScopesTag {}; - - InstNamer(const Lex::TokenizedBuffer& tokenized_buffer, - const Parse::Tree& parse_tree, const File& sem_ir) - : tokenized_buffer_(tokenized_buffer), - parse_tree_(parse_tree), - sem_ir_(sem_ir) { - insts.resize(sem_ir.insts().size()); - labels.resize(sem_ir.inst_blocks().size()); - scopes.resize(static_cast(GetScopeFor(NumberOfScopesTag()))); - - // Build the constants scope. - GetScopeInfo(ScopeId::Constants).name = - globals.AddNameUnchecked("constants"); - CollectNamesInBlock(ScopeId::Constants, sem_ir.constants().GetAsVector()); - - // Build the file scope. - GetScopeInfo(ScopeId::File).name = globals.AddNameUnchecked("file"); - CollectNamesInBlock(ScopeId::File, sem_ir.top_inst_block_id()); - - // Build the imports scope, used only by import-related instructions without - // a block. - // TODO: Consider other approaches for ImportRef constant formatting, as the - // actual source of these remains unclear even though they're referenced in - // constants. - GetScopeInfo(ScopeId::ImportRef).name = globals.AddNameUnchecked("imports"); - - // Build each function scope. - for (auto [i, fn] : llvm::enumerate(sem_ir.functions().array_ref())) { - auto fn_id = FunctionId(i); - auto fn_scope = GetScopeFor(fn_id); - // TODO: Provide a location for the function for use as a - // disambiguator. - auto fn_loc = Parse::NodeId::Invalid; - GetScopeInfo(fn_scope).name = globals.AllocateName( - *this, fn_loc, sem_ir.names().GetIRBaseName(fn.name_id).str()); - CollectNamesInBlock(fn_scope, fn.implicit_param_refs_id); - CollectNamesInBlock(fn_scope, fn.param_refs_id); - if (fn.return_storage_id.is_valid()) { - insts[fn.return_storage_id.index] = { - fn_scope, GetScopeInfo(fn_scope).insts.AllocateName( - *this, sem_ir.insts().GetLocId(fn.return_storage_id), - "return")}; - } - if (!fn.body_block_ids.empty()) { - AddBlockLabel(fn_scope, fn.body_block_ids.front(), "entry", fn_loc); - } - for (auto block_id : fn.body_block_ids) { - CollectNamesInBlock(fn_scope, block_id); - } - for (auto block_id : fn.body_block_ids) { - AddBlockLabel(fn_scope, block_id); - } - } - - // Build each class scope. - for (auto [i, class_info] : llvm::enumerate(sem_ir.classes().array_ref())) { - auto class_id = ClassId(i); - auto class_scope = GetScopeFor(class_id); - // TODO: Provide a location for the class for use as a disambiguator. - auto class_loc = Parse::NodeId::Invalid; - GetScopeInfo(class_scope).name = globals.AllocateName( - *this, class_loc, - sem_ir.names().GetIRBaseName(class_info.name_id).str()); - AddBlockLabel(class_scope, class_info.body_block_id, "class", class_loc); - CollectNamesInBlock(class_scope, class_info.body_block_id); - } - - // Build each interface scope. - for (auto [i, interface_info] : - llvm::enumerate(sem_ir.interfaces().array_ref())) { - auto interface_id = InterfaceId(i); - auto interface_scope = GetScopeFor(interface_id); - // TODO: Provide a location for the interface for use as a disambiguator. - auto interface_loc = Parse::NodeId::Invalid; - GetScopeInfo(interface_scope).name = globals.AllocateName( - *this, interface_loc, - sem_ir.names().GetIRBaseName(interface_info.name_id).str()); - AddBlockLabel(interface_scope, interface_info.body_block_id, "interface", - interface_loc); - CollectNamesInBlock(interface_scope, interface_info.body_block_id); - } - - // Build each impl scope. - for (auto [i, impl_info] : llvm::enumerate(sem_ir.impls().array_ref())) { - auto impl_id = ImplId(i); - auto impl_scope = GetScopeFor(impl_id); - // TODO: Provide a location for the impl for use as a disambiguator. - auto impl_loc = Parse::NodeId::Invalid; - // TODO: Invent a name based on the self and constraint types. - GetScopeInfo(impl_scope).name = - globals.AllocateName(*this, impl_loc, "impl"); - AddBlockLabel(impl_scope, impl_info.body_block_id, "impl", impl_loc); - CollectNamesInBlock(impl_scope, impl_info.body_block_id); - } - } - - // Returns the scope ID corresponding to an ID of a function, class, or - // interface. - template - auto GetScopeFor(IdT id) -> ScopeId { - auto index = static_cast(ScopeId::FirstFunction); - - if constexpr (!std::same_as) { - index += sem_ir_.functions().size(); - if constexpr (!std::same_as) { - index += sem_ir_.classes().size(); - if constexpr (!std::same_as) { - index += sem_ir_.interfaces().size(); - if constexpr (!std::same_as) { - index += sem_ir_.impls().size(); - static_assert(std::same_as, - "Unknown ID kind for scope"); - } - } - } - } - if constexpr (!std::same_as) { - index += id.index; - } - return static_cast(index); - } - - // Returns the IR name to use for a function, class, or interface. - template - auto GetNameFor(IdT id) -> llvm::StringRef { - if (!id.is_valid()) { - return "invalid"; - } - return GetScopeInfo(GetScopeFor(id)).name.str(); - } - - // Returns the IR name to use for an instruction, when referenced from a given - // scope. - auto GetNameFor(ScopeId scope_id, InstId inst_id) -> std::string { - if (!inst_id.is_valid()) { - return "invalid"; - } - - // Check for a builtin. - if (inst_id.is_builtin()) { - return inst_id.builtin_kind().label().str(); - } - - if (inst_id == InstId::PackageNamespace) { - return "package"; - } - - auto& [inst_scope, inst_name] = insts[inst_id.index]; - if (!inst_name) { - // This should not happen in valid IR. - std::string str; - llvm::raw_string_ostream(str) << ""; - return str; - } - if (inst_scope == scope_id) { - return inst_name.str().str(); - } - return (GetScopeInfo(inst_scope).name.str() + "." + inst_name.str()).str(); - } - - // Returns the IR name to use for a label, when referenced from a given scope. - auto GetLabelFor(ScopeId scope_id, InstBlockId block_id) -> std::string { - if (!block_id.is_valid()) { - return "!invalid"; - } - - auto& [label_scope, label_name] = labels[block_id.index]; - if (!label_name) { - // This should not happen in valid IR. - std::string str; - llvm::raw_string_ostream(str) - << ""; - return str; - } - if (label_scope == scope_id) { - return label_name.str().str(); - } - return (GetScopeInfo(label_scope).name.str() + "." + label_name.str()) - .str(); - } - - private: - // A space in which unique names can be allocated. - struct Namespace { - // A result of a name lookup. - struct NameResult; - - // A name in a namespace, which might be redirected to refer to another name - // for disambiguation purposes. - class Name { - public: - Name() : value_(nullptr) {} - explicit Name(llvm::StringMapIterator it) : value_(&*it) {} - - explicit operator bool() const { return value_; } - - auto str() const -> llvm::StringRef { - llvm::StringMapEntry* value = value_; - CARBON_CHECK(value) << "cannot print a null name"; - while (value->second.ambiguous && value->second.fallback) { - value = value->second.fallback.value_; - } - return value->first(); - } - - auto SetFallback(Name name) -> void { value_->second.fallback = name; } - - auto SetAmbiguous() -> void { value_->second.ambiguous = true; } - - private: - llvm::StringMapEntry* value_ = nullptr; - }; - - struct NameResult { - bool ambiguous = false; - Name fallback = Name(); - }; - - llvm::StringRef prefix; - llvm::StringMap allocated = {}; - int unnamed_count = 0; - - auto AddNameUnchecked(llvm::StringRef name) -> Name { - return Name(allocated.insert({name, NameResult()}).first); - } - - auto AllocateName(const InstNamer& namer, SemIR::LocId loc_id, - std::string name) -> Name { - // The best (shortest) name for this instruction so far, and the current - // name for it. - Name best; - Name current; - - // Add `name` as a name for this entity. - auto add_name = [&](bool mark_ambiguous = true) { - auto [it, added] = allocated.insert({name, NameResult()}); - Name new_name = Name(it); - - if (!added) { - if (mark_ambiguous) { - // This name was allocated for a different instruction. Mark it as - // ambiguous and keep looking for a name for this instruction. - new_name.SetAmbiguous(); - } - } else { - if (!best) { - best = new_name; - } else { - CARBON_CHECK(current); - current.SetFallback(new_name); - } - current = new_name; - } - return added; - }; - - // All names start with the prefix. - name.insert(0, prefix); - - // Use the given name if it's available and not just the prefix. - if (name.size() > prefix.size()) { - add_name(); - } - - // Append location information to try to disambiguate. - // TODO: Consider handling inst_id cases. - if (loc_id.is_node_id()) { - auto token = namer.parse_tree_.node_token(loc_id.node_id()); - llvm::raw_string_ostream(name) - << ".loc" << namer.tokenized_buffer_.GetLineNumber(token); - add_name(); - - llvm::raw_string_ostream(name) - << "_" << namer.tokenized_buffer_.GetColumnNumber(token); - add_name(); - } - - // Append numbers until we find an available name. - name += "."; - auto name_size_without_counter = name.size(); - for (int counter = 1;; ++counter) { - name.resize(name_size_without_counter); - llvm::raw_string_ostream(name) << counter; - if (add_name(/*mark_ambiguous=*/false)) { - return best; - } - } - } - }; - - // A named scope that contains named entities. - struct Scope { - Namespace::Name name; - Namespace insts = {.prefix = "%"}; - Namespace labels = {.prefix = "!"}; - }; - - auto GetScopeInfo(ScopeId scope_id) -> Scope& { - return scopes[static_cast(scope_id)]; - } - - auto AddBlockLabel(ScopeId scope_id, InstBlockId block_id, - std::string name = "", - SemIR::LocId loc_id = SemIR::LocId::Invalid) -> void { - if (!block_id.is_valid() || labels[block_id.index].second) { - return; - } - - if (!loc_id.is_valid()) { - if (const auto& block = sem_ir_.inst_blocks().Get(block_id); - !block.empty()) { - loc_id = sem_ir_.insts().GetLocId(block.front()); - } - } - - labels[block_id.index] = { - scope_id, GetScopeInfo(scope_id).labels.AllocateName(*this, loc_id, - std::move(name))}; - } - - // Finds and adds a suitable block label for the given SemIR instruction that - // represents some kind of branch. - auto AddBlockLabel(ScopeId scope_id, SemIR::LocId loc_id, AnyBranch branch) - -> void { - llvm::StringRef name; - switch (parse_tree_.node_kind(loc_id.node_id())) { - case Parse::NodeKind::IfExprIf: - switch (branch.kind) { - case BranchIf::Kind: - name = "if.expr.then"; - break; - case Branch::Kind: - name = "if.expr.else"; - break; - case BranchWithArg::Kind: - name = "if.expr.result"; - break; - default: - break; - } - break; - - case Parse::NodeKind::IfCondition: - switch (branch.kind) { - case BranchIf::Kind: - name = "if.then"; - break; - case Branch::Kind: - name = "if.else"; - break; - default: - break; - } - break; - - case Parse::NodeKind::IfStatement: - name = "if.done"; - break; - - case Parse::NodeKind::ShortCircuitOperandAnd: - name = branch.kind == BranchIf::Kind ? "and.rhs" : "and.result"; - break; - case Parse::NodeKind::ShortCircuitOperandOr: - name = branch.kind == BranchIf::Kind ? "or.rhs" : "or.result"; - break; - - case Parse::NodeKind::WhileConditionStart: - name = "while.cond"; - break; - - case Parse::NodeKind::WhileCondition: - switch (branch.kind) { - case BranchIf::Kind: - name = "while.body"; - break; - case Branch::Kind: - name = "while.done"; - break; - default: - break; - } - break; - - default: - break; - } - - AddBlockLabel(scope_id, branch.target_id, name.str(), loc_id); - } - - auto CollectNamesInBlock(ScopeId scope_id, InstBlockId block_id) -> void { - if (block_id.is_valid()) { - CollectNamesInBlock(scope_id, sem_ir_.inst_blocks().Get(block_id)); - } - } - - auto CollectNamesInBlock(ScopeId scope_id, llvm::ArrayRef block) - -> void { - Scope& scope = GetScopeInfo(scope_id); - - // Use bound names where available. Otherwise, assign a backup name. - for (auto inst_id : block) { - if (!inst_id.is_valid()) { - continue; - } - - auto untyped_inst = sem_ir_.insts().Get(inst_id); - auto add_inst_name = [&](std::string name) { - insts[inst_id.index] = { - scope_id, scope.insts.AllocateName( - *this, sem_ir_.insts().GetLocId(inst_id), name)}; - }; - auto add_inst_name_id = [&](NameId name_id, llvm::StringRef suffix = "") { - add_inst_name( - (sem_ir_.names().GetIRBaseName(name_id).str() + suffix).str()); - }; - - if (auto branch = untyped_inst.TryAs()) { - AddBlockLabel(scope_id, sem_ir_.insts().GetLocId(inst_id), *branch); - } - - CARBON_KIND_SWITCH(untyped_inst) { - case CARBON_KIND(AddrPattern inst): { - // TODO: We need to assign names to parameters that appear in - // function declarations, which may be nested within a pattern. For - // now, just look through `addr`, but we should find a better way to - // visit parameters. - CollectNamesInBlock(scope_id, inst.inner_id); - break; - } - case CARBON_KIND(AssociatedConstantDecl inst): { - add_inst_name_id(inst.name_id); - continue; - } - case BindAlias::Kind: - case BindName::Kind: - case BindSymbolicName::Kind: { - auto inst = untyped_inst.As(); - add_inst_name_id(sem_ir_.bind_names().Get(inst.bind_name_id).name_id); - continue; - } - case CARBON_KIND(ClassDecl inst): { - add_inst_name_id(sem_ir_.classes().Get(inst.class_id).name_id, - ".decl"); - CollectNamesInBlock(scope_id, inst.decl_block_id); - continue; - } - case CARBON_KIND(ClassType inst): { - add_inst_name_id(sem_ir_.classes().Get(inst.class_id).name_id); - continue; - } - case CARBON_KIND(FunctionDecl inst): { - add_inst_name_id(sem_ir_.functions().Get(inst.function_id).name_id); - CollectNamesInBlock(scope_id, inst.decl_block_id); - continue; - } - case CARBON_KIND(ImplDecl inst): { - CollectNamesInBlock(scope_id, inst.decl_block_id); - break; - } - case ImportRefUnloaded::Kind: - case ImportRefLoaded::Kind: - case ImportRefUsed::Kind: { - add_inst_name("import_ref"); - // When building import refs, we frequently add instructions without - // a block. Constants that refer to them need to be separately - // named. - auto const_id = sem_ir_.constant_values().Get(inst_id); - if (const_id.is_valid() && const_id.is_template() && - !insts[const_id.inst_id().index].second) { - CollectNamesInBlock(ScopeId::ImportRef, const_id.inst_id()); - } - continue; - } - case CARBON_KIND(InterfaceDecl inst): { - add_inst_name_id(sem_ir_.interfaces().Get(inst.interface_id).name_id, - ".decl"); - CollectNamesInBlock(scope_id, inst.decl_block_id); - continue; - } - case CARBON_KIND(NameRef inst): { - add_inst_name_id(inst.name_id, ".ref"); - continue; - } - // The namespace is specified here due to the name conflict. - case CARBON_KIND(SemIR::Namespace inst): { - add_inst_name_id( - sem_ir_.name_scopes().Get(inst.name_scope_id).name_id); - continue; - } - case CARBON_KIND(Param inst): { - add_inst_name_id(inst.name_id); - continue; - } - case CARBON_KIND(SpliceBlock inst): { - CollectNamesInBlock(scope_id, inst.block_id); - break; - } - case CARBON_KIND(VarStorage inst): { - add_inst_name_id(inst.name_id, ".var"); - continue; - } - default: { - break; - } - } - - // Sequentially number all remaining values. - if (untyped_inst.kind().value_kind() != InstValueKind::None) { - add_inst_name(""); - } - } - } - - const Lex::TokenizedBuffer& tokenized_buffer_; - const Parse::Tree& parse_tree_; - const File& sem_ir_; - - Namespace globals = {.prefix = "@"}; - std::vector> insts; - std::vector> labels; - std::vector scopes; -}; -} // namespace - // Formatter for printing textual Semantics IR. class Formatter { public: @@ -589,7 +42,7 @@ class Formatter { FormatConstants(); - out_ << "file "; + out_ << inst_namer_.GetScopeName(InstNamer::ScopeId::File) << " "; OpenBrace(); // TODO: Handle the case where there are multiple top-level instruction @@ -672,7 +125,7 @@ class Formatter { } llvm::SaveAndRestore constants_scope(scope_, InstNamer::ScopeId::Constants); - out_ << "constants "; + out_ << inst_namer_.GetScopeName(InstNamer::ScopeId::Constants) << " "; OpenBrace(); FormatCodeBlock(sem_ir_.constants().GetAsVector()); CloseBrace(); diff --git a/toolchain/sem_ir/inst_namer.cpp b/toolchain/sem_ir/inst_namer.cpp new file mode 100644 index 000000000000..40aac72f3f13 --- /dev/null +++ b/toolchain/sem_ir/inst_namer.cpp @@ -0,0 +1,493 @@ +// 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 + +#include "toolchain/sem_ir/inst_namer.h" + +#include "common/ostream.h" +#include "toolchain/base/kind_switch.h" +#include "toolchain/base/value_store.h" +#include "toolchain/lex/tokenized_buffer.h" +#include "toolchain/parse/tree.h" +#include "toolchain/sem_ir/builtin_function_kind.h" +#include "toolchain/sem_ir/function.h" +#include "toolchain/sem_ir/ids.h" +#include "toolchain/sem_ir/typed_insts.h" + +namespace Carbon::SemIR { + +InstNamer::InstNamer(const Lex::TokenizedBuffer& tokenized_buffer, + const Parse::Tree& parse_tree, const File& sem_ir) + : tokenized_buffer_(tokenized_buffer), + parse_tree_(parse_tree), + sem_ir_(sem_ir) { + insts.resize(sem_ir.insts().size()); + labels.resize(sem_ir.inst_blocks().size()); + scopes.resize(static_cast(GetScopeFor(NumberOfScopesTag()))); + + // Build the constants scope. + CollectNamesInBlock(ScopeId::Constants, sem_ir.constants().GetAsVector()); + + // Build the file scope. + CollectNamesInBlock(ScopeId::File, sem_ir.top_inst_block_id()); + + // Build each function scope. + for (auto [i, fn] : llvm::enumerate(sem_ir.functions().array_ref())) { + auto fn_id = FunctionId(i); + auto fn_scope = GetScopeFor(fn_id); + // TODO: Provide a location for the function for use as a + // disambiguator. + auto fn_loc = Parse::NodeId::Invalid; + GetScopeInfo(fn_scope).name = globals.AllocateName( + *this, fn_loc, sem_ir.names().GetIRBaseName(fn.name_id).str()); + CollectNamesInBlock(fn_scope, fn.implicit_param_refs_id); + CollectNamesInBlock(fn_scope, fn.param_refs_id); + if (fn.return_storage_id.is_valid()) { + insts[fn.return_storage_id.index] = { + fn_scope, + GetScopeInfo(fn_scope).insts.AllocateName( + *this, sem_ir.insts().GetLocId(fn.return_storage_id), "return")}; + } + if (!fn.body_block_ids.empty()) { + AddBlockLabel(fn_scope, fn.body_block_ids.front(), "entry", fn_loc); + } + for (auto block_id : fn.body_block_ids) { + CollectNamesInBlock(fn_scope, block_id); + } + for (auto block_id : fn.body_block_ids) { + AddBlockLabel(fn_scope, block_id); + } + } + + // Build each class scope. + for (auto [i, class_info] : llvm::enumerate(sem_ir.classes().array_ref())) { + auto class_id = ClassId(i); + auto class_scope = GetScopeFor(class_id); + // TODO: Provide a location for the class for use as a disambiguator. + auto class_loc = Parse::NodeId::Invalid; + GetScopeInfo(class_scope).name = globals.AllocateName( + *this, class_loc, + sem_ir.names().GetIRBaseName(class_info.name_id).str()); + AddBlockLabel(class_scope, class_info.body_block_id, "class", class_loc); + CollectNamesInBlock(class_scope, class_info.body_block_id); + } + + // Build each interface scope. + for (auto [i, interface_info] : + llvm::enumerate(sem_ir.interfaces().array_ref())) { + auto interface_id = InterfaceId(i); + auto interface_scope = GetScopeFor(interface_id); + // TODO: Provide a location for the interface for use as a disambiguator. + auto interface_loc = Parse::NodeId::Invalid; + GetScopeInfo(interface_scope).name = globals.AllocateName( + *this, interface_loc, + sem_ir.names().GetIRBaseName(interface_info.name_id).str()); + AddBlockLabel(interface_scope, interface_info.body_block_id, "interface", + interface_loc); + CollectNamesInBlock(interface_scope, interface_info.body_block_id); + } + + // Build each impl scope. + for (auto [i, impl_info] : llvm::enumerate(sem_ir.impls().array_ref())) { + auto impl_id = ImplId(i); + auto impl_scope = GetScopeFor(impl_id); + // TODO: Provide a location for the impl for use as a disambiguator. + auto impl_loc = Parse::NodeId::Invalid; + // TODO: Invent a name based on the self and constraint types. + GetScopeInfo(impl_scope).name = + globals.AllocateName(*this, impl_loc, "impl"); + AddBlockLabel(impl_scope, impl_info.body_block_id, "impl", impl_loc); + CollectNamesInBlock(impl_scope, impl_info.body_block_id); + } +} + +auto InstNamer::GetScopeName(ScopeId scope) const -> std::string { + switch (scope) { + case ScopeId::None: + return ""; + + // These are treated as SemIR keywords. + case ScopeId::File: + return "file"; + case ScopeId::ImportRef: + return "imports"; + case ScopeId::Constants: + return "constants"; + + // For everything else, use an @ prefix. + default: + return ("@" + GetScopeInfo(scope).name.str()).str(); + } +} + +auto InstNamer::GetUnscopedNameFor(InstId inst_id) const -> llvm::StringRef { + if (!inst_id.is_valid()) { + return ""; + } + const auto& inst_name = insts[inst_id.index].second; + return inst_name ? inst_name.str() : ""; +} + +auto InstNamer::GetNameFor(ScopeId scope_id, InstId inst_id) const + -> std::string { + if (!inst_id.is_valid()) { + return "invalid"; + } + + // Check for a builtin. + if (inst_id.is_builtin()) { + return inst_id.builtin_kind().label().str(); + } + + if (inst_id == InstId::PackageNamespace) { + return "package"; + } + + const auto& [inst_scope, inst_name] = insts[inst_id.index]; + if (!inst_name) { + // This should not happen in valid IR. + std::string str; + llvm::raw_string_ostream(str) << ""; + return str; + } + if (inst_scope == scope_id) { + return ("%" + inst_name.str()).str(); + } + return (GetScopeName(inst_scope) + ".%" + inst_name.str()).str(); +} + +auto InstNamer::GetUnscopedLabelFor(InstBlockId block_id) const + -> llvm::StringRef { + if (!block_id.is_valid()) { + return ""; + } + const auto& label_name = labels[block_id.index].second; + return label_name ? label_name.str() : ""; +} + +// Returns the IR name to use for a label, when referenced from a given scope. +auto InstNamer::GetLabelFor(ScopeId scope_id, InstBlockId block_id) const + -> std::string { + if (!block_id.is_valid()) { + return "!invalid"; + } + + const auto& [label_scope, label_name] = labels[block_id.index]; + if (!label_name) { + // This should not happen in valid IR. + std::string str; + llvm::raw_string_ostream(str) + << ""; + return str; + } + if (label_scope == scope_id) { + return ("!" + label_name.str()).str(); + } + return (GetScopeName(label_scope) + ".!" + label_name.str()).str(); +} + +auto InstNamer::Namespace::Name::str() const -> llvm::StringRef { + llvm::StringMapEntry* value = value_; + CARBON_CHECK(value) << "cannot print a null name"; + while (value->second.ambiguous && value->second.fallback) { + value = value->second.fallback.value_; + } + return value->first(); +} + +auto InstNamer::Namespace::AllocateName(const InstNamer& inst_namer, + SemIR::LocId loc_id, std::string name) + -> Name { + // The best (shortest) name for this instruction so far, and the current + // name for it. + Name best; + Name current; + + // Add `name` as a name for this entity. + auto add_name = [&](bool mark_ambiguous = true) { + auto [it, added] = allocated.insert({name, NameResult()}); + Name new_name = Name(it); + + if (!added) { + if (mark_ambiguous) { + // This name was allocated for a different instruction. Mark it as + // ambiguous and keep looking for a name for this instruction. + new_name.SetAmbiguous(); + } + } else { + if (!best) { + best = new_name; + } else { + CARBON_CHECK(current); + current.SetFallback(new_name); + } + current = new_name; + } + return added; + }; + + // Use the given name if it's available. + if (!name.empty()) { + add_name(); + } + + // Append location information to try to disambiguate. + // TODO: Consider handling inst_id cases. + if (loc_id.is_node_id()) { + auto token = inst_namer.parse_tree_.node_token(loc_id.node_id()); + llvm::raw_string_ostream(name) + << ".loc" << inst_namer.tokenized_buffer_.GetLineNumber(token); + add_name(); + + llvm::raw_string_ostream(name) + << "_" << inst_namer.tokenized_buffer_.GetColumnNumber(token); + add_name(); + } + + // Append numbers until we find an available name. + name += "."; + auto name_size_without_counter = name.size(); + for (int counter = 1;; ++counter) { + name.resize(name_size_without_counter); + llvm::raw_string_ostream(name) << counter; + if (add_name(/*mark_ambiguous=*/false)) { + return best; + } + } +} + +auto InstNamer::AddBlockLabel(ScopeId scope_id, InstBlockId block_id, + std::string name, SemIR::LocId loc_id) -> void { + if (!block_id.is_valid() || labels[block_id.index].second) { + return; + } + + if (!loc_id.is_valid()) { + if (const auto& block = sem_ir_.inst_blocks().Get(block_id); + !block.empty()) { + loc_id = sem_ir_.insts().GetLocId(block.front()); + } + } + + labels[block_id.index] = { + scope_id, GetScopeInfo(scope_id).labels.AllocateName(*this, loc_id, + std::move(name))}; +} + +// Finds and adds a suitable block label for the given SemIR instruction that +// represents some kind of branch. +auto InstNamer::AddBlockLabel(ScopeId scope_id, SemIR::LocId loc_id, + AnyBranch branch) -> void { + llvm::StringRef name; + switch (parse_tree_.node_kind(loc_id.node_id())) { + case Parse::NodeKind::IfExprIf: + switch (branch.kind) { + case BranchIf::Kind: + name = "if.expr.then"; + break; + case Branch::Kind: + name = "if.expr.else"; + break; + case BranchWithArg::Kind: + name = "if.expr.result"; + break; + default: + break; + } + break; + + case Parse::NodeKind::IfCondition: + switch (branch.kind) { + case BranchIf::Kind: + name = "if.then"; + break; + case Branch::Kind: + name = "if.else"; + break; + default: + break; + } + break; + + case Parse::NodeKind::IfStatement: + name = "if.done"; + break; + + case Parse::NodeKind::ShortCircuitOperandAnd: + name = branch.kind == BranchIf::Kind ? "and.rhs" : "and.result"; + break; + case Parse::NodeKind::ShortCircuitOperandOr: + name = branch.kind == BranchIf::Kind ? "or.rhs" : "or.result"; + break; + + case Parse::NodeKind::WhileConditionStart: + name = "while.cond"; + break; + + case Parse::NodeKind::WhileCondition: + switch (branch.kind) { + case BranchIf::Kind: + name = "while.body"; + break; + case Branch::Kind: + name = "while.done"; + break; + default: + break; + } + break; + + default: + break; + } + + AddBlockLabel(scope_id, branch.target_id, name.str(), loc_id); +} + +auto InstNamer::CollectNamesInBlock(ScopeId scope_id, InstBlockId block_id) + -> void { + if (block_id.is_valid()) { + CollectNamesInBlock(scope_id, sem_ir_.inst_blocks().Get(block_id)); + } +} + +auto InstNamer::CollectNamesInBlock(ScopeId scope_id, + llvm::ArrayRef block) -> void { + Scope& scope = GetScopeInfo(scope_id); + + // Use bound names where available. Otherwise, assign a backup name. + for (auto inst_id : block) { + if (!inst_id.is_valid()) { + continue; + } + + auto untyped_inst = sem_ir_.insts().Get(inst_id); + auto add_inst_name = [&](std::string name) { + insts[inst_id.index] = { + scope_id, scope.insts.AllocateName( + *this, sem_ir_.insts().GetLocId(inst_id), name)}; + }; + auto add_inst_name_id = [&](NameId name_id, llvm::StringRef suffix = "") { + add_inst_name( + (sem_ir_.names().GetIRBaseName(name_id).str() + suffix).str()); + }; + + if (auto branch = untyped_inst.TryAs()) { + AddBlockLabel(scope_id, sem_ir_.insts().GetLocId(inst_id), *branch); + } + + CARBON_KIND_SWITCH(untyped_inst) { + case CARBON_KIND(AddrPattern inst): { + // TODO: We need to assign names to parameters that appear in + // function declarations, which may be nested within a pattern. For + // now, just look through `addr`, but we should find a better way to + // visit parameters. + CollectNamesInBlock(scope_id, inst.inner_id); + break; + } + case CARBON_KIND(AssociatedConstantDecl inst): { + add_inst_name_id(inst.name_id); + continue; + } + case BindAlias::Kind: + case BindName::Kind: + case BindSymbolicName::Kind: { + auto inst = untyped_inst.As(); + add_inst_name_id(sem_ir_.bind_names().Get(inst.bind_name_id).name_id); + continue; + } + case CARBON_KIND(Call inst): { + // Name the call's result based on the callee. + if (auto builtin_kind = + SemIR::BuiltinFunctionKind::ForCallee(sem_ir_, inst.callee_id); + builtin_kind != SemIR::BuiltinFunctionKind::None) { + // For a builtin, use the builtin name. Otherwise, we'd typically pick + // the name `Op` below, which is probably not very useful. + add_inst_name(builtin_kind.name().str()); + continue; + } else if (auto const_callee_id = + sem_ir_.constant_values().Get(inst.callee_id); + const_callee_id.is_constant()) { + // For a direct function call, use the leaf function name. + if (auto callee_fn = sem_ir_.insts().TryGetAs( + const_callee_id.inst_id())) { + add_inst_name_id( + sem_ir_.functions().Get(callee_fn->function_id).name_id, + ".call"); + continue; + } + } + break; + } + case CARBON_KIND(ClassDecl inst): { + add_inst_name_id(sem_ir_.classes().Get(inst.class_id).name_id, ".decl"); + CollectNamesInBlock(scope_id, inst.decl_block_id); + continue; + } + case CARBON_KIND(ClassType inst): { + add_inst_name_id(sem_ir_.classes().Get(inst.class_id).name_id); + continue; + } + case CARBON_KIND(FunctionDecl inst): { + add_inst_name_id(sem_ir_.functions().Get(inst.function_id).name_id); + CollectNamesInBlock(scope_id, inst.decl_block_id); + continue; + } + case CARBON_KIND(ImplDecl inst): { + CollectNamesInBlock(scope_id, inst.decl_block_id); + break; + } + case ImportRefUnloaded::Kind: + case ImportRefLoaded::Kind: + case ImportRefUsed::Kind: { + add_inst_name("import_ref"); + // When building import refs, we frequently add instructions without + // a block. Constants that refer to them need to be separately + // named. + auto const_id = sem_ir_.constant_values().Get(inst_id); + if (const_id.is_valid() && const_id.is_template() && + !insts[const_id.inst_id().index].second) { + CollectNamesInBlock(ScopeId::ImportRef, const_id.inst_id()); + } + continue; + } + case CARBON_KIND(InterfaceDecl inst): { + add_inst_name_id(sem_ir_.interfaces().Get(inst.interface_id).name_id, + ".decl"); + CollectNamesInBlock(scope_id, inst.decl_block_id); + continue; + } + case CARBON_KIND(NameRef inst): { + add_inst_name_id(inst.name_id, ".ref"); + continue; + } + // The namespace is specified here due to the name conflict. + case CARBON_KIND(SemIR::Namespace inst): { + add_inst_name_id(sem_ir_.name_scopes().Get(inst.name_scope_id).name_id); + continue; + } + case CARBON_KIND(Param inst): { + add_inst_name_id(inst.name_id); + continue; + } + case CARBON_KIND(SpliceBlock inst): { + CollectNamesInBlock(scope_id, inst.block_id); + break; + } + case CARBON_KIND(VarStorage inst): { + add_inst_name_id(inst.name_id, ".var"); + continue; + } + default: { + break; + } + } + + // Sequentially number all remaining values. + if (untyped_inst.kind().value_kind() != InstValueKind::None) { + add_inst_name(""); + } + } +} + +} // namespace Carbon::SemIR diff --git a/toolchain/sem_ir/inst_namer.h b/toolchain/sem_ir/inst_namer.h new file mode 100644 index 000000000000..f486588eebc7 --- /dev/null +++ b/toolchain/sem_ir/inst_namer.h @@ -0,0 +1,171 @@ +// 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 + +#ifndef CARBON_TOOLCHAIN_SEM_IR_INST_NAMER_H_ +#define CARBON_TOOLCHAIN_SEM_IR_INST_NAMER_H_ + +#include "llvm/Support/raw_ostream.h" +#include "toolchain/lex/tokenized_buffer.h" +#include "toolchain/parse/tree.h" +#include "toolchain/sem_ir/file.h" + +namespace Carbon::SemIR { + +// Assigns names to instructions, blocks, and scopes in the Semantics IR. +class InstNamer { + public: + // int32_t matches the input value size. + // NOLINTNEXTLINE(performance-enum-size) + enum class ScopeId : int32_t { + None = -1, + File = 0, + ImportRef = 1, + Constants = 2, + FirstFunction = 3, + }; + static_assert(sizeof(ScopeId) == sizeof(FunctionId)); + + struct NumberOfScopesTag {}; + + // Construct the instruction namer, and assign names to all instructions in + // the provided file. + InstNamer(const Lex::TokenizedBuffer& tokenized_buffer, + const Parse::Tree& parse_tree, const File& sem_ir); + + // Returns the scope ID corresponding to an ID of a function, class, or + // interface. + template + auto GetScopeFor(IdT id) const -> ScopeId { + auto index = static_cast(ScopeId::FirstFunction); + + if constexpr (!std::same_as) { + index += sem_ir_.functions().size(); + if constexpr (!std::same_as) { + index += sem_ir_.classes().size(); + if constexpr (!std::same_as) { + index += sem_ir_.interfaces().size(); + if constexpr (!std::same_as) { + index += sem_ir_.impls().size(); + static_assert(std::same_as, + "Unknown ID kind for scope"); + } + } + } + } + if constexpr (!std::same_as) { + index += id.index; + } + return static_cast(index); + } + + // Returns the IR name for the specified scope. + auto GetScopeName(ScopeId scope) const -> std::string; + + // Returns the IR name to use for a function, class, or interface. + template + auto GetNameFor(IdT id) const -> std::string { + if (!id.is_valid()) { + return "invalid"; + } + return GetScopeName(GetScopeFor(id)); + } + + // Returns the IR name to use for an instruction within its own scope, without + // any prefix. Returns an empty string if there isn't a good name. + auto GetUnscopedNameFor(InstId inst_id) const -> llvm::StringRef; + + // Returns the IR name to use for an instruction, when referenced from a given + // scope. + auto GetNameFor(ScopeId scope_id, InstId inst_id) const -> std::string; + + // Returns the IR name to use for a label within its own scope, without any + // prefix. Returns an empty string if there isn't a good name. + auto GetUnscopedLabelFor(InstBlockId block_id) const -> llvm::StringRef; + + // Returns the IR name to use for a label, when referenced from a given scope. + auto GetLabelFor(ScopeId scope_id, InstBlockId block_id) const -> std::string; + + private: + // A space in which unique names can be allocated. + struct Namespace { + // A result of a name lookup. + struct NameResult; + + // A name in a namespace, which might be redirected to refer to another name + // for disambiguation purposes. + class Name { + public: + Name() : value_(nullptr) {} + explicit Name(llvm::StringMapIterator it) : value_(&*it) {} + + explicit operator bool() const { return value_; } + + auto str() const -> llvm::StringRef; + + auto SetFallback(Name name) -> void { value_->second.fallback = name; } + + auto SetAmbiguous() -> void { value_->second.ambiguous = true; } + + private: + llvm::StringMapEntry* value_ = nullptr; + }; + + struct NameResult { + bool ambiguous = false; + Name fallback = Name(); + }; + + llvm::StringMap allocated = {}; + int unnamed_count = 0; + + auto AddNameUnchecked(llvm::StringRef name) -> Name { + return Name(allocated.insert({name, NameResult()}).first); + } + + auto AllocateName(const InstNamer& inst_namer, SemIR::LocId loc_id, + std::string name) -> Name; + }; + + // A named scope that contains named entities. + struct Scope { + Namespace::Name name; + Namespace insts; + Namespace labels; + }; + + auto GetScopeInfo(ScopeId scope_id) -> Scope& { + return scopes[static_cast(scope_id)]; + } + + auto GetScopeInfo(ScopeId scope_id) const -> const Scope& { + return scopes[static_cast(scope_id)]; + } + + auto AddBlockLabel(ScopeId scope_id, InstBlockId block_id, + std::string name = "", + SemIR::LocId loc_id = SemIR::LocId::Invalid) -> void; + + // Finds and adds a suitable block label for the given SemIR instruction that + // represents some kind of branch. + auto AddBlockLabel(ScopeId scope_id, SemIR::LocId loc_id, AnyBranch branch) + -> void; + + auto CollectNamesInBlock(ScopeId scope_id, InstBlockId block_id) -> void; + + auto CollectNamesInBlock(ScopeId scope_id, llvm::ArrayRef block) + -> void; + + const Lex::TokenizedBuffer& tokenized_buffer_; + const Parse::Tree& parse_tree_; + const File& sem_ir_; + + Namespace globals; + std::vector> insts; + std::vector> labels; + std::vector scopes; +}; + +} // namespace Carbon::SemIR + +#endif // CARBON_TOOLCHAIN_SEM_IR_INST_NAMER_H_