From 0ae2a3907e47f2db013853ea07139e622d441daa Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 26 Aug 2024 08:49:31 -0700 Subject: [PATCH] Add line-level debug info (#4247) Seems to work with lldb ( https://pastebin.com/igKkNECm ), though gdb has /some/ trouble with the paths (they aren't complete - just using the filename directly, not providing the working directory - might be some quick hacks that can help there). --- toolchain/lower/file_context.cpp | 13 +- toolchain/lower/file_context.h | 4 + toolchain/lower/function_context.cpp | 11 +- toolchain/lower/function_context.h | 3 + toolchain/lower/testdata/alias/local.carbon | 12 +- .../testdata/array/array_in_place.carbon | 17 +- .../testdata/array/assign_return_value.carbon | 41 ++-- toolchain/lower/testdata/array/base.carbon | 81 ++++---- .../testdata/array/function_param.carbon | 29 +-- .../lower/testdata/basics/false_true.carbon | 10 +- .../lower/testdata/basics/int_types.carbon | 24 ++- .../testdata/basics/numeric_literals.carbon | 37 ++-- .../lower/testdata/basics/type_values.carbon | 17 +- toolchain/lower/testdata/basics/zero.carbon | 3 +- .../lower/testdata/builtins/float.carbon | 106 ++++++----- toolchain/lower/testdata/builtins/int.carbon | 176 +++++++++++------- .../builtins/method_vs_nonmethod.carbon | 16 +- .../builtins/overloaded_operator.carbon | 14 +- .../lower/testdata/builtins/print.carbon | 6 +- .../lower/testdata/builtins/types.carbon | 21 ++- toolchain/lower/testdata/builtins/uint.carbon | 176 +++++++++++------- toolchain/lower/testdata/class/adapt.carbon | 51 +++-- toolchain/lower/testdata/class/base.carbon | 50 ++--- toolchain/lower/testdata/class/basic.carbon | 12 +- toolchain/lower/testdata/class/field.carbon | 36 ++-- toolchain/lower/testdata/class/method.carbon | 9 +- toolchain/lower/testdata/class/self.carbon | 20 +- .../lower/testdata/class/value_access.carbon | 36 ++-- .../function/call/empty_struct.carbon | 16 +- .../testdata/function/call/empty_tuple.carbon | 16 +- .../lower/testdata/function/call/i32.carbon | 19 +- .../call/implicit_empty_tuple_as_arg.carbon | 28 +-- .../testdata/function/call/params_one.carbon | 13 +- .../function/call/params_one_comma.carbon | 16 +- .../testdata/function/call/params_two.carbon | 13 +- .../function/call/params_two_comma.carbon | 16 +- .../testdata/function/call/params_zero.carbon | 13 +- .../function/call/return_implicit.carbon | 16 +- .../function/call/struct_param.carbon | 13 +- .../testdata/function/call/tuple_param.carbon | 13 +- .../call/tuple_param_with_return_slot.carbon | 41 ++-- .../testdata/function/call/var_param.carbon | 22 ++- .../function/declaration/simple.carbon | 6 +- .../function/definition/empty_struct.carbon | 3 +- .../function/definition/params_one.carbon | 3 +- .../function/definition/params_two.carbon | 3 +- .../function/definition/params_zero.carbon | 3 +- .../lower/testdata/global/class_obj.carbon | 6 +- .../testdata/global/class_with_fun.carbon | 15 +- .../lower/testdata/global/simple_init.carbon | 6 +- .../testdata/global/simple_with_fun.carbon | 16 +- toolchain/lower/testdata/if/else.carbon | 41 ++-- toolchain/lower/testdata/if/no_else.carbon | 29 +-- toolchain/lower/testdata/if_expr/basic.carbon | 30 +-- .../lower/testdata/if_expr/empty_block.carbon | 24 ++- .../lower/testdata/impl/assoc_fn_alias.carbon | 18 +- .../lower/testdata/impl/extend_impl.carbon | 23 ++- toolchain/lower/testdata/impl/impl.carbon | 18 +- .../testdata/impl/instance_method.carbon | 13 +- .../index/array_element_access.carbon | 90 +++++---- .../lower/testdata/interface/assoc.carbon | 3 +- .../lower/testdata/interface/basic.carbon | 10 +- toolchain/lower/testdata/let/local.carbon | 3 +- toolchain/lower/testdata/let/tuple.carbon | 93 +++++---- .../lower/testdata/namespace/function.carbon | 20 +- .../lower/testdata/namespace/nested.carbon | 13 +- toolchain/lower/testdata/operators/and.carbon | 27 +-- .../testdata/operators/and_empty_block.carbon | 8 +- .../testdata/operators/assignment.carbon | 23 ++- toolchain/lower/testdata/operators/not.carbon | 6 +- toolchain/lower/testdata/operators/or.carbon | 29 +-- .../testdata/operators/or_empty_block.carbon | 10 +- .../testdata/operators/overloaded.carbon | 83 +++++---- .../packages/cross_package_call.carbon | 9 +- .../testdata/pointer/address_of_field.carbon | 20 +- .../testdata/pointer/address_of_unused.carbon | 9 +- toolchain/lower/testdata/pointer/basic.carbon | 22 ++- .../pointer/pointer_to_pointer.carbon | 33 ++-- .../testdata/return/code_after_return.carbon | 10 +- .../lower/testdata/return/no_value.carbon | 3 +- .../lower/testdata/return/return_var.carbon | 10 +- .../testdata/return/return_var_byval.carbon | 11 +- toolchain/lower/testdata/return/value.carbon | 3 +- toolchain/lower/testdata/return/var.carbon | 12 +- toolchain/lower/testdata/struct/empty.carbon | 9 +- .../testdata/struct/member_access.carbon | 34 ++-- .../testdata/struct/nested_struct.carbon | 3 +- .../struct/nested_struct_in_place.carbon | 17 +- .../lower/testdata/struct/one_entry.carbon | 22 ++- .../lower/testdata/struct/two_entries.carbon | 34 ++-- .../tuple/access/element_access.carbon | 38 ++-- .../tuple/access/return_value_access.carbon | 32 ++-- toolchain/lower/testdata/tuple/empty.carbon | 9 +- .../lower/testdata/tuple/nested_tuple.carbon | 3 +- .../tuple/nested_tuple_in_place.carbon | 17 +- .../lower/testdata/tuple/one_entry.carbon | 22 ++- .../lower/testdata/tuple/two_entries.carbon | 34 ++-- .../testdata/tuple/value_formation.carbon | 77 ++++---- .../testdata/tuple/value_forwarding.carbon | 17 +- toolchain/lower/testdata/var/local.carbon | 12 +- .../testdata/while/break_continue.carbon | 30 ++- .../lower/testdata/while/preheader.carbon | 36 ++-- .../testdata/while/unreachable_end.carbon | 23 ++- toolchain/lower/testdata/while/while.carbon | 23 ++- 104 files changed, 1586 insertions(+), 1009 deletions(-) diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index d8be24a31ecf..d4de1fa798e0 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -291,9 +291,9 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id) return; } - llvm_function->setSubprogram(BuildDISubprogram(function, llvm_function)); - - FunctionContext function_lowering(*this, llvm_function, vlog_stream_); + FunctionContext function_lowering(*this, llvm_function, + BuildDISubprogram(function, llvm_function), + vlog_stream_); // TODO: Pass in a specific ID for generic functions. const auto specific_id = SemIR::SpecificId::Invalid; @@ -540,4 +540,11 @@ auto FileContext::BuildGlobalVariableDecl(SemIR::VarStorage var_storage) /*Initializer=*/nullptr, mangled_name); } +auto FileContext::GetDiagnosticLoc(SemIR::InstId inst_id) -> DiagnosticLoc { + return converter_.ConvertLoc( + inst_id, + [&](DiagnosticLoc /*context_loc*/, + const Internal::DiagnosticBase<>& /*context_diagnostic_base*/) {}); +} + } // namespace Carbon::Lower diff --git a/toolchain/lower/file_context.h b/toolchain/lower/file_context.h index b647b0b0a1da..d1d6779129c7 100644 --- a/toolchain/lower/file_context.h +++ b/toolchain/lower/file_context.h @@ -46,6 +46,9 @@ class FileContext { return types_[type_id.index]; } + // Returns the DiagnosticLoc associated with the specified inst_id. + auto GetDiagnosticLoc(SemIR::InstId inst_id) -> DiagnosticLoc; + // Returns a lowered value to use for a value of type `type`. auto GetTypeAsValue() -> llvm::Constant* { return llvm::ConstantStruct::get(GetTypeType()); @@ -104,6 +107,7 @@ class FileContext { // The DICompileUnit, if any - null implies debug info is not being emitted. llvm::DICompileUnit* di_compile_unit_; + // The source location converter. const Check::SemIRDiagnosticConverter& converter_; // The input SemIR. diff --git a/toolchain/lower/function_context.cpp b/toolchain/lower/function_context.cpp index 858c0b3a3cfe..2999fa77a8ff 100644 --- a/toolchain/lower/function_context.cpp +++ b/toolchain/lower/function_context.cpp @@ -12,12 +12,16 @@ namespace Carbon::Lower { FunctionContext::FunctionContext(FileContext& file_context, llvm::Function* function, + llvm::DISubprogram* di_subprogram, llvm::raw_ostream* vlog_stream) : file_context_(&file_context), function_(function), builder_(file_context.llvm_context(), llvm::ConstantFolder(), Inserter(file_context.inst_namer())), - vlog_stream_(vlog_stream) {} + di_subprogram_(di_subprogram), + vlog_stream_(vlog_stream) { + function_->setSubprogram(di_subprogram_); +} auto FunctionContext::GetBlock(SemIR::InstBlockId block_id) -> llvm::BasicBlock* { @@ -93,6 +97,10 @@ auto FunctionContext::LowerInst(SemIR::InstId inst_id) -> void { auto inst = sem_ir().insts().Get(inst_id); CARBON_VLOG() << "Lowering " << inst_id << ": " << inst << "\n"; builder_.getInserter().SetCurrentInstId(inst_id); + auto loc = file_context_->GetDiagnosticLoc(inst_id); + builder_.SetCurrentDebugLocation( + llvm::DILocation::get(builder_.getContext(), loc.line_number, + loc.column_number, di_subprogram_)); CARBON_KIND_SWITCH(inst) { #define CARBON_SEM_IR_INST_KIND(Name) \ @@ -104,6 +112,7 @@ auto FunctionContext::LowerInst(SemIR::InstId inst_id) -> void { } builder_.getInserter().SetCurrentInstId(SemIR::InstId::Invalid); + builder_.SetCurrentDebugLocation(llvm::DebugLoc()); } auto FunctionContext::GetBlockArg(SemIR::InstBlockId block_id, diff --git a/toolchain/lower/function_context.h b/toolchain/lower/function_context.h index 051b73ed67e5..0440ec0ee45c 100644 --- a/toolchain/lower/function_context.h +++ b/toolchain/lower/function_context.h @@ -19,6 +19,7 @@ namespace Carbon::Lower { class FunctionContext { public: explicit FunctionContext(FileContext& file_context, llvm::Function* function, + llvm::DISubprogram* di_subprogram, llvm::raw_ostream* vlog_stream); // Returns a basic block corresponding to the start of the given semantics @@ -149,6 +150,8 @@ class FunctionContext { llvm::IRBuilder builder_; + llvm::DISubprogram* di_subprogram_; + // The optional vlog stream. llvm::raw_ostream* vlog_stream_; diff --git a/toolchain/lower/testdata/alias/local.carbon b/toolchain/lower/testdata/alias/local.carbon index 9367af06edb7..61de086705c9 100644 --- a/toolchain/lower/testdata/alias/local.carbon +++ b/toolchain/lower/testdata/alias/local.carbon @@ -19,10 +19,10 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %a.var, align 4 -// CHECK:STDOUT: %.loc14 = load i32, ptr %a.var, align 4 -// CHECK:STDOUT: ret i32 %.loc14 +// CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 0, ptr %a.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc14 = load i32, ptr %a.var, align 4, !dbg !9 +// CHECK:STDOUT: ret i32 %.loc14, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -35,3 +35,7 @@ fn F() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 10, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/array/array_in_place.carbon b/toolchain/lower/testdata/array/array_in_place.carbon index 1a825f9abadf..4f8f78057973 100644 --- a/toolchain/lower/testdata/array/array_in_place.carbon +++ b/toolchain/lower/testdata/array/array_in_place.carbon @@ -21,12 +21,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: define void @G() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8 -// CHECK:STDOUT: %.loc14_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc14_42.2.array.index) -// CHECK:STDOUT: %.loc14_42.5.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc14_42.5.array.index) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8, !dbg !7 +// CHECK:STDOUT: %.loc14_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_42.2.array.index), !dbg !9 +// CHECK:STDOUT: %.loc14_42.5.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_42.5.array.index), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,3 +39,8 @@ fn G() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 33, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 34, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 39, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index f6e5c7a8e6da..d5d87bf8dba0 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -21,26 +21,26 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !7 { +// CHECK:STDOUT: define void @main() !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4 -// CHECK:STDOUT: %.loc14_22.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc14_22.1.temp) -// CHECK:STDOUT: %.loc14_22.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_22.4 = load i32, ptr %.loc14_22.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc14_22.6.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc14_22.4, ptr %.loc14_22.6.array.index, align 4 -// CHECK:STDOUT: %.loc14_22.8.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_22.9 = load i32, ptr %.loc14_22.8.tuple.elem, align 4 -// CHECK:STDOUT: %.loc14_22.11.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc14_22.9, ptr %.loc14_22.11.array.index, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4, !dbg !10 +// CHECK:STDOUT: %.loc14_22.1.temp = alloca { i32, i32 }, align 8, !dbg !11 +// CHECK:STDOUT: call void @F(ptr %.loc14_22.1.temp), !dbg !11 +// CHECK:STDOUT: %.loc14_22.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc14_22.4 = load i32, ptr %.loc14_22.3.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %.loc14_22.6.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store i32 %.loc14_22.4, ptr %.loc14_22.6.array.index, align 4, !dbg !11 +// CHECK:STDOUT: %.loc14_22.8.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc14_22.9 = load i32, ptr %.loc14_22.8.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %.loc14_22.11.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store i32 %.loc14_22.9, ptr %.loc14_22.11.array.index, align 4, !dbg !11 +// CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -58,4 +58,9 @@ fn Run() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 31, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 11, column: 24, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 7, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 14, column: 21, scope: !9) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 1, scope: !9) diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index 436429ef7389..15295cd0c6d9 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -26,39 +26,39 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca [1 x i32], align 4 -// CHECK:STDOUT: %.loc12_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.1.loc12_25, i64 4, i1 false) -// CHECK:STDOUT: %b.var = alloca [2 x double], align 8 -// CHECK:STDOUT: %.loc13_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_32.6.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.2.loc13_33, i64 16, i1 false) -// CHECK:STDOUT: %c.var = alloca [5 x {}], align 8 -// CHECK:STDOUT: %.loc14_40.3.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_40.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_40.9.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc14_40.12.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 3 -// CHECK:STDOUT: %.loc14_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.3.loc14_41, i64 0, i1 false) -// CHECK:STDOUT: %d.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc15_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.2.loc15_37, i64 12, i1 false) -// CHECK:STDOUT: %e.var = alloca [3 x i32], align 4 -// CHECK:STDOUT: %.loc16_21.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc16_21.2 = load i32, ptr %.loc16_21.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_21.4.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc16_21.2, ptr %.loc16_21.4.array.index, align 4 -// CHECK:STDOUT: %.loc16_21.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc16_21.7 = load i32, ptr %.loc16_21.6.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_21.9.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc16_21.7, ptr %.loc16_21.9.array.index, align 4 -// CHECK:STDOUT: %.loc16_21.11.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc16_21.12 = load i32, ptr %.loc16_21.11.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_21.14.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc16_21.12, ptr %.loc16_21.14.array.index, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %a.var = alloca [1 x i32], align 4, !dbg !7 +// CHECK:STDOUT: %.loc12_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.1.loc12_25, i64 4, i1 false), !dbg !9 +// CHECK:STDOUT: %b.var = alloca [2 x double], align 8, !dbg !10 +// CHECK:STDOUT: %.loc13_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_32.6.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.2.loc13_33, i64 16, i1 false), !dbg !12 +// CHECK:STDOUT: %c.var = alloca [5 x {}], align 8, !dbg !13 +// CHECK:STDOUT: %.loc14_40.3.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: %.loc14_40.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: %.loc14_40.9.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 2, !dbg !14 +// CHECK:STDOUT: %.loc14_40.12.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 3, !dbg !14 +// CHECK:STDOUT: %.loc14_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4, !dbg !14 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.3.loc14_41, i64 0, i1 false), !dbg !15 +// CHECK:STDOUT: %d.var = alloca { i32, i32, i32 }, align 8, !dbg !16 +// CHECK:STDOUT: %.loc15_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !17 +// CHECK:STDOUT: %.loc15_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !17 +// CHECK:STDOUT: %.loc15_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !17 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.2.loc15_37, i64 12, i1 false), !dbg !18 +// CHECK:STDOUT: %e.var = alloca [3 x i32], align 4, !dbg !19 +// CHECK:STDOUT: %.loc16_21.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !20 +// CHECK:STDOUT: %.loc16_21.2 = load i32, ptr %.loc16_21.1.tuple.elem, align 4, !dbg !20 +// CHECK:STDOUT: %.loc16_21.4.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 0, !dbg !20 +// CHECK:STDOUT: store i32 %.loc16_21.2, ptr %.loc16_21.4.array.index, align 4, !dbg !20 +// CHECK:STDOUT: %.loc16_21.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !20 +// CHECK:STDOUT: %.loc16_21.7 = load i32, ptr %.loc16_21.6.tuple.elem, align 4, !dbg !20 +// CHECK:STDOUT: %.loc16_21.9.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 1, !dbg !20 +// CHECK:STDOUT: store i32 %.loc16_21.7, ptr %.loc16_21.9.array.index, align 4, !dbg !20 +// CHECK:STDOUT: %.loc16_21.11.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !20 +// CHECK:STDOUT: %.loc16_21.12 = load i32, ptr %.loc16_21.11.tuple.elem, align 4, !dbg !20 +// CHECK:STDOUT: %.loc16_21.14.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 2, !dbg !20 +// CHECK:STDOUT: store i32 %.loc16_21.12, ptr %.loc16_21.14.array.index, align 4, !dbg !20 +// CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -79,3 +79,18 @@ fn Run() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 21, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 21, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 14, column: 20, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 7, scope: !4) +// CHECK:STDOUT: !17 = !DILocation(line: 15, column: 28, scope: !4) +// CHECK:STDOUT: !18 = !DILocation(line: 15, column: 3, scope: !4) +// CHECK:STDOUT: !19 = !DILocation(line: 16, column: 7, scope: !4) +// CHECK:STDOUT: !20 = !DILocation(line: 16, column: 21, scope: !4) +// CHECK:STDOUT: !21 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/array/function_param.carbon b/toolchain/lower/testdata/array/function_param.carbon index ad6a0e0e89f5..f92a9f73fc2b 100644 --- a/toolchain/lower/testdata/array/function_param.carbon +++ b/toolchain/lower/testdata/array/function_param.carbon @@ -23,20 +23,20 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i -// CHECK:STDOUT: %.loc12_15.3 = load i32, ptr %.loc12_15.2.array.index, align 4 -// CHECK:STDOUT: ret i32 %.loc12_15.3 +// CHECK:STDOUT: %.loc12_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !7 +// CHECK:STDOUT: %.loc12_15.3 = load i32, ptr %.loc12_15.2.array.index, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc12_15.3, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @G() !dbg !7 { +// CHECK:STDOUT: define i32 @G() !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc16_20.2.temp = alloca [3 x i32], align 4 -// CHECK:STDOUT: %.loc16_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc16_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc16_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc16_20.2.temp, ptr align 4 @array.loc16_11.1, i64 12, i1 false) -// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc16_20.2.temp, i32 1) -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %.loc16_20.2.temp = alloca [3 x i32], align 4, !dbg !10 +// CHECK:STDOUT: %.loc16_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc16_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %.loc16_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc16_20.2.temp, ptr align 4 @array.loc16_11.1, i64 12, i1 false), !dbg !11 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc16_20.2.temp, i32 1), !dbg !11 +// CHECK:STDOUT: ret i32 %F.call, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -54,4 +54,9 @@ fn G() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 12, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 10, scope: !9) +// CHECK:STDOUT: !12 = !DILocation(line: 16, column: 3, scope: !9) diff --git a/toolchain/lower/testdata/basics/false_true.carbon b/toolchain/lower/testdata/basics/false_true.carbon index 3e0545eebc5c..24061f904c4a 100644 --- a/toolchain/lower/testdata/basics/false_true.carbon +++ b/toolchain/lower/testdata/basics/false_true.carbon @@ -21,12 +21,12 @@ fn T() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 false +// CHECK:STDOUT: ret i1 false, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @T() !dbg !7 { +// CHECK:STDOUT: define i1 @T() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 true +// CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,4 +39,6 @@ fn T() -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "T", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "T", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 3, scope: !8) diff --git a/toolchain/lower/testdata/basics/int_types.carbon b/toolchain/lower/testdata/basics/int_types.carbon index f45fae2779db..0c32aeaff2ea 100644 --- a/toolchain/lower/testdata/basics/int_types.carbon +++ b/toolchain/lower/testdata/basics/int_types.carbon @@ -18,22 +18,22 @@ fn F_u65536(a: u65536) -> u65536 { return a; } // CHECK:STDOUT: // CHECK:STDOUT: define i8 @F_i8(i8 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i8 %a +// CHECK:STDOUT: ret i8 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @F_u16(i16 %a) !dbg !7 { +// CHECK:STDOUT: define i16 @F_u16(i16 %a) !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i16 %a +// CHECK:STDOUT: ret i16 %a, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @F_i64(i64 %a) !dbg !8 { +// CHECK:STDOUT: define i64 @F_i64(i64 %a) !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i64 %a +// CHECK:STDOUT: ret i64 %a, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i65536 @F_u65536(i65536 %a) !dbg !9 { +// CHECK:STDOUT: define i65536 @F_u65536(i65536 %a) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i65536 %a +// CHECK:STDOUT: ret i65536 %a, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -46,6 +46,10 @@ fn F_u65536(a: u65536) -> u65536 { return a; } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F_i8", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "F_u16", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "F_i64", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "F_u65536", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 24, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "F_u16", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 27, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "F_i64", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 27, scope: !10) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "F_u65536", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 36, scope: !12) diff --git a/toolchain/lower/testdata/basics/numeric_literals.carbon b/toolchain/lower/testdata/basics/numeric_literals.carbon index 1fd805387279..0f3e04b5b51a 100644 --- a/toolchain/lower/testdata/basics/numeric_literals.carbon +++ b/toolchain/lower/testdata/basics/numeric_literals.carbon @@ -35,21 +35,21 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4 -// CHECK:STDOUT: %.loc19_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc19_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc19_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.1.loc19_4, i64 16, i1 false) -// CHECK:STDOUT: %floats.var = alloca [6 x double], align 8 -// CHECK:STDOUT: %.loc27_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc27_3.6.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc27_3.9.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc27_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 3 -// CHECK:STDOUT: %.loc27_3.15.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 4 -// CHECK:STDOUT: %.loc27_3.18.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 5 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.2.loc27_4, i64 48, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4, !dbg !7 +// CHECK:STDOUT: %.loc19_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc19_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc19_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc19_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.1.loc19_4, i64 16, i1 false), !dbg !9 +// CHECK:STDOUT: %floats.var = alloca [6 x double], align 8, !dbg !10 +// CHECK:STDOUT: %.loc27_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc27_3.6.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc27_3.9.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 2, !dbg !11 +// CHECK:STDOUT: %.loc27_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 3, !dbg !11 +// CHECK:STDOUT: %.loc27_3.15.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 4, !dbg !11 +// CHECK:STDOUT: %.loc27_3.18.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 5, !dbg !11 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.2.loc27_4, i64 48, i1 false), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -70,3 +70,10 @@ fn F() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 24, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 20, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 20, column: 26, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 20, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/basics/type_values.carbon b/toolchain/lower/testdata/basics/type_values.carbon index 555d4f2ae2c2..4ae024e48969 100644 --- a/toolchain/lower/testdata/basics/type_values.carbon +++ b/toolchain/lower/testdata/basics/type_values.carbon @@ -30,17 +30,17 @@ fn F64() -> type { // CHECK:STDOUT: // CHECK:STDOUT: define %type @I32() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret %type zeroinitializer +// CHECK:STDOUT: ret %type zeroinitializer, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define %type @I48() !dbg !7 { +// CHECK:STDOUT: define %type @I48() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret %type zeroinitializer +// CHECK:STDOUT: ret %type zeroinitializer, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define %type @F64() !dbg !8 { +// CHECK:STDOUT: define %type @F64() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret %type zeroinitializer +// CHECK:STDOUT: ret %type zeroinitializer, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -53,5 +53,8 @@ fn F64() -> type { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "I32", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "I48", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "F64", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 15, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "I48", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 19, column: 3, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "F64", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 23, column: 3, scope: !10) diff --git a/toolchain/lower/testdata/basics/zero.carbon b/toolchain/lower/testdata/basics/zero.carbon index d685910e41f7..69befd861785 100644 --- a/toolchain/lower/testdata/basics/zero.carbon +++ b/toolchain/lower/testdata/basics/zero.carbon @@ -17,7 +17,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -30,3 +30,4 @@ fn Main() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/builtins/float.carbon b/toolchain/lower/testdata/builtins/float.carbon index 4269e7465046..975caf051929 100644 --- a/toolchain/lower/testdata/builtins/float.carbon +++ b/toolchain/lower/testdata/builtins/float.carbon @@ -46,68 +46,68 @@ fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: // CHECK:STDOUT: define double @TestNegate(double %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.negate = fneg double %a -// CHECK:STDOUT: ret double %float.negate +// CHECK:STDOUT: %float.negate = fneg double %a, !dbg !7 +// CHECK:STDOUT: ret double %float.negate, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @TestAdd(double %a, double %b) !dbg !7 { +// CHECK:STDOUT: define double @TestAdd(double %a, double %b) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.add = fadd double %a, %b -// CHECK:STDOUT: ret double %float.add +// CHECK:STDOUT: %float.add = fadd double %a, %b, !dbg !10 +// CHECK:STDOUT: ret double %float.add, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @TestSub(double %a, double %b) !dbg !8 { +// CHECK:STDOUT: define double @TestSub(double %a, double %b) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.sub = fsub double %a, %b -// CHECK:STDOUT: ret double %float.sub +// CHECK:STDOUT: %float.sub = fsub double %a, %b, !dbg !13 +// CHECK:STDOUT: ret double %float.sub, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @TestMul(double %a, double %b) !dbg !9 { +// CHECK:STDOUT: define double @TestMul(double %a, double %b) !dbg !15 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.mul = fmul double %a, %b -// CHECK:STDOUT: ret double %float.mul +// CHECK:STDOUT: %float.mul = fmul double %a, %b, !dbg !16 +// CHECK:STDOUT: ret double %float.mul, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @TestDiv(double %a, double %b) !dbg !10 { +// CHECK:STDOUT: define double @TestDiv(double %a, double %b) !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.div = fdiv double %a, %b -// CHECK:STDOUT: ret double %float.div +// CHECK:STDOUT: %float.div = fdiv double %a, %b, !dbg !19 +// CHECK:STDOUT: ret double %float.div, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestEq(double %a, double %b) !dbg !11 { +// CHECK:STDOUT: define i1 @TestEq(double %a, double %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.eq = fcmp oeq double %a, %b -// CHECK:STDOUT: ret i1 %float.eq +// CHECK:STDOUT: %float.eq = fcmp oeq double %a, %b, !dbg !22 +// CHECK:STDOUT: ret i1 %float.eq, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestNeq(double %a, double %b) !dbg !12 { +// CHECK:STDOUT: define i1 @TestNeq(double %a, double %b) !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.neq = fcmp one double %a, %b -// CHECK:STDOUT: ret i1 %float.neq +// CHECK:STDOUT: %float.neq = fcmp one double %a, %b, !dbg !25 +// CHECK:STDOUT: ret i1 %float.neq, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLess(double %a, double %b) !dbg !13 { +// CHECK:STDOUT: define i1 @TestLess(double %a, double %b) !dbg !27 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.less = fcmp olt double %a, %b -// CHECK:STDOUT: ret i1 %float.less +// CHECK:STDOUT: %float.less = fcmp olt double %a, %b, !dbg !28 +// CHECK:STDOUT: ret i1 %float.less, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLessEq(double %a, double %b) !dbg !14 { +// CHECK:STDOUT: define i1 @TestLessEq(double %a, double %b) !dbg !30 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.less_eq = fcmp ole double %a, %b -// CHECK:STDOUT: ret i1 %float.less_eq +// CHECK:STDOUT: %float.less_eq = fcmp ole double %a, %b, !dbg !31 +// CHECK:STDOUT: ret i1 %float.less_eq, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreater(double %a, double %b) !dbg !15 { +// CHECK:STDOUT: define i1 @TestGreater(double %a, double %b) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.greater = fcmp ogt double %a, %b -// CHECK:STDOUT: ret i1 %float.greater +// CHECK:STDOUT: %float.greater = fcmp ogt double %a, %b, !dbg !34 +// CHECK:STDOUT: ret i1 %float.greater, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreaterEq(double %a, double %b) !dbg !16 { +// CHECK:STDOUT: define i1 @TestGreaterEq(double %a, double %b) !dbg !36 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %float.greater_eq = fcmp oge double %a, %b -// CHECK:STDOUT: ret i1 %float.greater_eq +// CHECK:STDOUT: %float.greater_eq = fcmp oge double %a, %b, !dbg !37 +// CHECK:STDOUT: ret i1 %float.greater_eq, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -120,13 +120,35 @@ fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 39, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 32, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 21, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 24, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 24, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 27, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 30, column: 45, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 30, column: 38, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 46, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 33, column: 39, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 48, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 36, column: 41, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 39, column: 49, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 39, column: 42, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 42, column: 51, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 42, column: 44, scope: !36) diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index 43868afb5665..bd81104f967a 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -67,110 +67,110 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestNegate(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.snegate = sub i32 0, %a -// CHECK:STDOUT: ret i32 %int.snegate +// CHECK:STDOUT: %int.snegate = sub i32 0, %a, !dbg !7 +// CHECK:STDOUT: ret i32 %int.snegate, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestAdd(i32 %a, i32 %b) !dbg !7 { +// CHECK:STDOUT: define i32 @TestAdd(i32 %a, i32 %b) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sadd = add i32 %a, %b -// CHECK:STDOUT: ret i32 %int.sadd +// CHECK:STDOUT: %int.sadd = add i32 %a, %b, !dbg !10 +// CHECK:STDOUT: ret i32 %int.sadd, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestSub(i32 %a, i32 %b) !dbg !8 { +// CHECK:STDOUT: define i32 @TestSub(i32 %a, i32 %b) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.ssub = sub i32 %a, %b -// CHECK:STDOUT: ret i32 %int.ssub +// CHECK:STDOUT: %int.ssub = sub i32 %a, %b, !dbg !13 +// CHECK:STDOUT: ret i32 %int.ssub, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestMul(i32 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: define i32 @TestMul(i32 %a, i32 %b) !dbg !15 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.smul = mul i32 %a, %b -// CHECK:STDOUT: ret i32 %int.smul +// CHECK:STDOUT: %int.smul = mul i32 %a, %b, !dbg !16 +// CHECK:STDOUT: ret i32 %int.smul, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestDiv(i32 %a, i32 %b) !dbg !10 { +// CHECK:STDOUT: define i32 @TestDiv(i32 %a, i32 %b) !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sdiv = sdiv i32 %a, %b -// CHECK:STDOUT: ret i32 %int.sdiv +// CHECK:STDOUT: %int.sdiv = sdiv i32 %a, %b, !dbg !19 +// CHECK:STDOUT: ret i32 %int.sdiv, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestMod(i32 %a, i32 %b) !dbg !11 { +// CHECK:STDOUT: define i32 @TestMod(i32 %a, i32 %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.smod = srem i32 %a, %b -// CHECK:STDOUT: ret i32 %int.smod +// CHECK:STDOUT: %int.smod = srem i32 %a, %b, !dbg !22 +// CHECK:STDOUT: ret i32 %int.smod, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestComplement(i32 %a) !dbg !12 { +// CHECK:STDOUT: define i32 @TestComplement(i32 %a) !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.complement = xor i32 -1, %a -// CHECK:STDOUT: ret i32 %int.complement +// CHECK:STDOUT: %int.complement = xor i32 -1, %a, !dbg !25 +// CHECK:STDOUT: ret i32 %int.complement, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestAnd(i32 %a, i32 %b) !dbg !13 { +// CHECK:STDOUT: define i32 @TestAnd(i32 %a, i32 %b) !dbg !27 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.and = and i32 %a, %b -// CHECK:STDOUT: ret i32 %int.and +// CHECK:STDOUT: %int.and = and i32 %a, %b, !dbg !28 +// CHECK:STDOUT: ret i32 %int.and, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestOr(i32 %a, i32 %b) !dbg !14 { +// CHECK:STDOUT: define i32 @TestOr(i32 %a, i32 %b) !dbg !30 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.or = or i32 %a, %b -// CHECK:STDOUT: ret i32 %int.or +// CHECK:STDOUT: %int.or = or i32 %a, %b, !dbg !31 +// CHECK:STDOUT: ret i32 %int.or, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestXor(i32 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: define i32 @TestXor(i32 %a, i32 %b) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.xor = xor i32 %a, %b -// CHECK:STDOUT: ret i32 %int.xor +// CHECK:STDOUT: %int.xor = xor i32 %a, %b, !dbg !34 +// CHECK:STDOUT: ret i32 %int.xor, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestLeftShift(i32 %a, i32 %b) !dbg !16 { +// CHECK:STDOUT: define i32 @TestLeftShift(i32 %a, i32 %b) !dbg !36 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.left_shift = shl i32 %a, %b -// CHECK:STDOUT: ret i32 %int.left_shift +// CHECK:STDOUT: %int.left_shift = shl i32 %a, %b, !dbg !37 +// CHECK:STDOUT: ret i32 %int.left_shift, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestRightShift(i32 %a, i32 %b) !dbg !17 { +// CHECK:STDOUT: define i32 @TestRightShift(i32 %a, i32 %b) !dbg !39 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b -// CHECK:STDOUT: ret i32 %int.right_shift +// CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b, !dbg !40 +// CHECK:STDOUT: ret i32 %int.right_shift, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestEq(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: define i1 @TestEq(i32 %a, i32 %b) !dbg !42 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b -// CHECK:STDOUT: ret i1 %int.eq +// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !43 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestNeq(i32 %a, i32 %b) !dbg !19 { +// CHECK:STDOUT: define i1 @TestNeq(i32 %a, i32 %b) !dbg !45 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b -// CHECK:STDOUT: ret i1 %int.neq +// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !46 +// CHECK:STDOUT: ret i1 %int.neq, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLess(i32 %a, i32 %b) !dbg !20 { +// CHECK:STDOUT: define i1 @TestLess(i32 %a, i32 %b) !dbg !48 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b -// CHECK:STDOUT: ret i1 %int.less +// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !49 +// CHECK:STDOUT: ret i1 %int.less, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLessEq(i32 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: define i1 @TestLessEq(i32 %a, i32 %b) !dbg !51 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b -// CHECK:STDOUT: ret i1 %int.less_eq +// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !52 +// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreater(i32 %a, i32 %b) !dbg !22 { +// CHECK:STDOUT: define i1 @TestGreater(i32 %a, i32 %b) !dbg !54 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b -// CHECK:STDOUT: ret i1 %int.greater +// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !55 +// CHECK:STDOUT: ret i1 %int.greater, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreaterEq(i32 %a, i32 %b) !dbg !23 { +// CHECK:STDOUT: define i1 @TestGreaterEq(i32 %a, i32 %b) !dbg !57 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b -// CHECK:STDOUT: ret i1 %int.greater_eq +// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !58 +// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -183,20 +183,56 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "TestMod", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestComplement", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "TestAnd", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestOr", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestXor", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "TestLeftShift", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "TestRightShift", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 39, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 32, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 21, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 24, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 24, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 27, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 30, column: 43, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 30, column: 36, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 44, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 33, column: 37, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 43, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 36, column: 36, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 39, column: 44, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 39, column: 37, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 42, column: 50, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 42, column: 43, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestRightShift", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 45, column: 51, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 45, column: 44, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 48, column: 44, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 48, column: 37, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 51, column: 45, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 51, column: 38, scope: !45) +// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !49 = !DILocation(line: 54, column: 46, scope: !48) +// CHECK:STDOUT: !50 = !DILocation(line: 54, column: 39, scope: !48) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 57, column: 48, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 57, column: 41, scope: !51) +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !55 = !DILocation(line: 60, column: 49, scope: !54) +// CHECK:STDOUT: !56 = !DILocation(line: 60, column: 42, scope: !54) +// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !58 = !DILocation(line: 63, column: 51, scope: !57) +// CHECK:STDOUT: !59 = !DILocation(line: 63, column: 44, scope: !57) diff --git a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon index 6d97a24534c1..9841f8ec47d0 100644 --- a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon +++ b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon @@ -19,14 +19,14 @@ fn TestAddMethod(a: i32, b: i32) -> i32 { return a.(AddMethod)(b); } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @TestAddNonmethod(i32 %a, i32 %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sadd = add i32 %a, %b -// CHECK:STDOUT: ret i32 %int.sadd +// CHECK:STDOUT: %int.sadd = add i32 %a, %b, !dbg !7 +// CHECK:STDOUT: ret i32 %int.sadd, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TestAddMethod(i32 %a, i32 %b) !dbg !7 { +// CHECK:STDOUT: define i32 @TestAddMethod(i32 %a, i32 %b) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sadd = add i32 %a, %b -// CHECK:STDOUT: ret i32 %int.sadd +// CHECK:STDOUT: %int.sadd = add i32 %a, %b, !dbg !10 +// CHECK:STDOUT: ret i32 %int.sadd, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,4 +39,8 @@ fn TestAddMethod(a: i32, b: i32) -> i32 { return a.(AddMethod)(b); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestAddNonmethod", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TestAddMethod", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 53, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 46, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAddMethod", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 50, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 43, scope: !9) diff --git a/toolchain/lower/testdata/builtins/overloaded_operator.carbon b/toolchain/lower/testdata/builtins/overloaded_operator.carbon index f4dc7a9bc4da..8d8db8d46e37 100644 --- a/toolchain/lower/testdata/builtins/overloaded_operator.carbon +++ b/toolchain/lower/testdata/builtins/overloaded_operator.carbon @@ -23,12 +23,12 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @AddThreeIntegers(i32 %a, i32 %b, i32 %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sadd.loc18_12 = add i32 %a, %b -// CHECK:STDOUT: %.loc18_12.2.temp = alloca i32, align 4 -// CHECK:STDOUT: store i32 %int.sadd.loc18_12, ptr %.loc18_12.2.temp, align 4 -// CHECK:STDOUT: %.loc18_12.4 = load i32, ptr %.loc18_12.2.temp, align 4 -// CHECK:STDOUT: %int.sadd.loc18_16 = add i32 %.loc18_12.4, %c -// CHECK:STDOUT: ret i32 %int.sadd.loc18_16 +// CHECK:STDOUT: %int.sadd.loc18_12 = add i32 %a, %b, !dbg !7 +// CHECK:STDOUT: %.loc18_12.2.temp = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 %int.sadd.loc18_12, ptr %.loc18_12.2.temp, align 4, !dbg !7 +// CHECK:STDOUT: %.loc18_12.4 = load i32, ptr %.loc18_12.2.temp, align 4, !dbg !7 +// CHECK:STDOUT: %int.sadd.loc18_16 = add i32 %.loc18_12.4, %c, !dbg !7 +// CHECK:STDOUT: ret i32 %int.sadd.loc18_16, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -41,3 +41,5 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "AddThreeIntegers", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 18, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/builtins/print.carbon b/toolchain/lower/testdata/builtins/print.carbon index 78699c944f3b..bdbf50950f6d 100644 --- a/toolchain/lower/testdata/builtins/print.carbon +++ b/toolchain/lower/testdata/builtins/print.carbon @@ -19,8 +19,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %print.int.printf = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %print.int.printf = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) @@ -35,3 +35,5 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/builtins/types.carbon b/toolchain/lower/testdata/builtins/types.carbon index 53f175e71d5c..14da2c494ea9 100644 --- a/toolchain/lower/testdata/builtins/types.carbon +++ b/toolchain/lower/testdata/builtins/types.carbon @@ -23,13 +23,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // 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: %i.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 0, ptr %i.var, align 4, !dbg !8 +// CHECK:STDOUT: %f.var = alloca double, align 8, !dbg !9 +// CHECK:STDOUT: store double 0.000000e+00, ptr %f.var, align 8, !dbg !10 +// CHECK:STDOUT: %b.var = alloca i1, align 1, !dbg !11 +// CHECK:STDOUT: store i1 false, ptr %b.var, align 1, !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -42,3 +42,10 @@ fn F() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 7, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 3, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 18, column: 7, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 18, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/builtins/uint.carbon b/toolchain/lower/testdata/builtins/uint.carbon index 963488ccd718..45d3e1c229ec 100644 --- a/toolchain/lower/testdata/builtins/uint.carbon +++ b/toolchain/lower/testdata/builtins/uint.carbon @@ -67,110 +67,110 @@ fn TestGreaterEq(a: u64, b: u64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: // CHECK:STDOUT: define i64 @TestNegate(i64 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.unegate = sub i64 0, %a -// CHECK:STDOUT: ret i64 %int.unegate +// CHECK:STDOUT: %int.unegate = sub i64 0, %a, !dbg !7 +// CHECK:STDOUT: ret i64 %int.unegate, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestAdd(i64 %a, i64 %b) !dbg !7 { +// CHECK:STDOUT: define i64 @TestAdd(i64 %a, i64 %b) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.uadd = add i64 %a, %b -// CHECK:STDOUT: ret i64 %int.uadd +// CHECK:STDOUT: %int.uadd = add i64 %a, %b, !dbg !10 +// CHECK:STDOUT: ret i64 %int.uadd, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestSub(i64 %a, i64 %b) !dbg !8 { +// CHECK:STDOUT: define i64 @TestSub(i64 %a, i64 %b) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.usub = sub i64 %a, %b -// CHECK:STDOUT: ret i64 %int.usub +// CHECK:STDOUT: %int.usub = sub i64 %a, %b, !dbg !13 +// CHECK:STDOUT: ret i64 %int.usub, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestMul(i64 %a, i64 %b) !dbg !9 { +// CHECK:STDOUT: define i64 @TestMul(i64 %a, i64 %b) !dbg !15 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.umul = mul i64 %a, %b -// CHECK:STDOUT: ret i64 %int.umul +// CHECK:STDOUT: %int.umul = mul i64 %a, %b, !dbg !16 +// CHECK:STDOUT: ret i64 %int.umul, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestDiv(i64 %a, i64 %b) !dbg !10 { +// CHECK:STDOUT: define i64 @TestDiv(i64 %a, i64 %b) !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.udiv = udiv i64 %a, %b -// CHECK:STDOUT: ret i64 %int.udiv +// CHECK:STDOUT: %int.udiv = udiv i64 %a, %b, !dbg !19 +// CHECK:STDOUT: ret i64 %int.udiv, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestMod(i64 %a, i64 %b) !dbg !11 { +// CHECK:STDOUT: define i64 @TestMod(i64 %a, i64 %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.umod = urem i64 %a, %b -// CHECK:STDOUT: ret i64 %int.umod +// CHECK:STDOUT: %int.umod = urem i64 %a, %b, !dbg !22 +// CHECK:STDOUT: ret i64 %int.umod, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestComplement(i64 %a) !dbg !12 { +// CHECK:STDOUT: define i64 @TestComplement(i64 %a) !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.complement = xor i64 -1, %a -// CHECK:STDOUT: ret i64 %int.complement +// CHECK:STDOUT: %int.complement = xor i64 -1, %a, !dbg !25 +// CHECK:STDOUT: ret i64 %int.complement, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestAnd(i64 %a, i64 %b) !dbg !13 { +// CHECK:STDOUT: define i64 @TestAnd(i64 %a, i64 %b) !dbg !27 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.and = and i64 %a, %b -// CHECK:STDOUT: ret i64 %int.and +// CHECK:STDOUT: %int.and = and i64 %a, %b, !dbg !28 +// CHECK:STDOUT: ret i64 %int.and, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestOr(i64 %a, i64 %b) !dbg !14 { +// CHECK:STDOUT: define i64 @TestOr(i64 %a, i64 %b) !dbg !30 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.or = or i64 %a, %b -// CHECK:STDOUT: ret i64 %int.or +// CHECK:STDOUT: %int.or = or i64 %a, %b, !dbg !31 +// CHECK:STDOUT: ret i64 %int.or, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestXor(i64 %a, i64 %b) !dbg !15 { +// CHECK:STDOUT: define i64 @TestXor(i64 %a, i64 %b) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.xor = xor i64 %a, %b -// CHECK:STDOUT: ret i64 %int.xor +// CHECK:STDOUT: %int.xor = xor i64 %a, %b, !dbg !34 +// CHECK:STDOUT: ret i64 %int.xor, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestLeftShift(i64 %a, i64 %b) !dbg !16 { +// CHECK:STDOUT: define i64 @TestLeftShift(i64 %a, i64 %b) !dbg !36 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.left_shift = shl i64 %a, %b -// CHECK:STDOUT: ret i64 %int.left_shift +// CHECK:STDOUT: %int.left_shift = shl i64 %a, %b, !dbg !37 +// CHECK:STDOUT: ret i64 %int.left_shift, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @TestRightShift(i64 %a, i64 %b) !dbg !17 { +// CHECK:STDOUT: define i64 @TestRightShift(i64 %a, i64 %b) !dbg !39 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.right_shift = lshr i64 %a, %b -// CHECK:STDOUT: ret i64 %int.right_shift +// CHECK:STDOUT: %int.right_shift = lshr i64 %a, %b, !dbg !40 +// CHECK:STDOUT: ret i64 %int.right_shift, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestEq(i64 %a, i64 %b) !dbg !18 { +// CHECK:STDOUT: define i1 @TestEq(i64 %a, i64 %b) !dbg !42 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.eq = icmp eq i64 %a, %b -// CHECK:STDOUT: ret i1 %int.eq +// CHECK:STDOUT: %int.eq = icmp eq i64 %a, %b, !dbg !43 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestNeq(i64 %a, i64 %b) !dbg !19 { +// CHECK:STDOUT: define i1 @TestNeq(i64 %a, i64 %b) !dbg !45 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.neq = icmp ne i64 %a, %b -// CHECK:STDOUT: ret i1 %int.neq +// CHECK:STDOUT: %int.neq = icmp ne i64 %a, %b, !dbg !46 +// CHECK:STDOUT: ret i1 %int.neq, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLess(i64 %a, i64 %b) !dbg !20 { +// CHECK:STDOUT: define i1 @TestLess(i64 %a, i64 %b) !dbg !48 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less = icmp ult i64 %a, %b -// CHECK:STDOUT: ret i1 %int.less +// CHECK:STDOUT: %int.less = icmp ult i64 %a, %b, !dbg !49 +// CHECK:STDOUT: ret i1 %int.less, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestLessEq(i64 %a, i64 %b) !dbg !21 { +// CHECK:STDOUT: define i1 @TestLessEq(i64 %a, i64 %b) !dbg !51 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less_eq = icmp ule i64 %a, %b -// CHECK:STDOUT: ret i1 %int.less_eq +// CHECK:STDOUT: %int.less_eq = icmp ule i64 %a, %b, !dbg !52 +// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreater(i64 %a, i64 %b) !dbg !22 { +// CHECK:STDOUT: define i1 @TestGreater(i64 %a, i64 %b) !dbg !54 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater = icmp ugt i64 %a, %b -// CHECK:STDOUT: ret i1 %int.greater +// CHECK:STDOUT: %int.greater = icmp ugt i64 %a, %b, !dbg !55 +// CHECK:STDOUT: ret i1 %int.greater, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @TestGreaterEq(i64 %a, i64 %b) !dbg !23 { +// CHECK:STDOUT: define i1 @TestGreaterEq(i64 %a, i64 %b) !dbg !57 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater_eq = icmp uge i64 %a, %b -// CHECK:STDOUT: ret i1 %int.greater_eq +// CHECK:STDOUT: %int.greater_eq = icmp uge i64 %a, %b, !dbg !58 +// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -183,20 +183,56 @@ fn TestGreaterEq(a: u64, b: u64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "TestMod", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestComplement", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "TestAnd", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestOr", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestXor", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "TestLeftShift", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "TestRightShift", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 39, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 32, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 21, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 24, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 24, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 27, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 30, column: 43, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 30, column: 36, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 44, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 33, column: 37, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 43, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 36, column: 36, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 39, column: 44, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 39, column: 37, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 42, column: 50, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 42, column: 43, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestRightShift", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 45, column: 51, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 45, column: 44, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestEq", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 48, column: 44, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 48, column: 37, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestNeq", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 51, column: 45, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 51, column: 38, scope: !45) +// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestLess", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !49 = !DILocation(line: 54, column: 46, scope: !48) +// CHECK:STDOUT: !50 = !DILocation(line: 54, column: 39, scope: !48) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLessEq", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 57, column: 48, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 57, column: 41, scope: !51) +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestGreater", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !55 = !DILocation(line: 60, column: 49, scope: !54) +// CHECK:STDOUT: !56 = !DILocation(line: 60, column: 42, scope: !54) +// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !58 = !DILocation(line: 63, column: 51, scope: !57) +// CHECK:STDOUT: !59 = !DILocation(line: 63, column: 44, scope: !57) diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 5cd0b38b4c9f..6970d9533224 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -58,31 +58,31 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.loc9_28, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.loc9_28, i64 8, i1 false), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Make.1(ptr sret({ i32, i32 }) %return) !dbg !7 { +// CHECK:STDOUT: define void @Make.1(ptr sret({ i32, i32 }) %return) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Make(ptr %return) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Make(ptr %return), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @GetB(ptr %self) !dbg !8 { +// CHECK:STDOUT: define i32 @GetB(ptr %self) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_14.1.b = getelementptr inbounds nuw { 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: %.loc22_14.1.b = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: %.loc22_14.2 = load i32, ptr %.loc22_14.1.b, align 4, !dbg !13 +// CHECK:STDOUT: ret i32 %.loc22_14.2, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @Use() !dbg !9 { +// CHECK:STDOUT: define i32 @Use() !dbg !15 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %pa.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @Make.1(ptr %pa.var) -// CHECK:STDOUT: %GetB.call = call i32 @GetB(ptr %pa.var) -// CHECK:STDOUT: ret i32 %GetB.call +// CHECK:STDOUT: %pa.var = alloca { i32, i32 }, align 8, !dbg !16 +// CHECK:STDOUT: call void @Make.1(ptr %pa.var), !dbg !17 +// CHECK:STDOUT: %GetB.call = call i32 @GetB(ptr %pa.var), !dbg !18 +// CHECK:STDOUT: ret i32 %GetB.call, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -100,15 +100,25 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Make", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Make.1", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "GetB", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Use", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 9, column: 12, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 9, column: 5, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Make.1", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 12, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 17, column: 5, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "GetB", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 22, column: 12, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 22, column: 5, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "Use", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 27, column: 7, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 27, column: 25, scope: !15) +// CHECK:STDOUT: !18 = !DILocation(line: 28, column: 10, scope: !15) +// CHECK:STDOUT: !19 = !DILocation(line: 28, column: 3, scope: !15) // CHECK:STDOUT: ; ModuleID = 'adapt_int.carbon' // CHECK:STDOUT: source_filename = "adapt_int.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @DoStuff(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 %a +// CHECK:STDOUT: ret i32 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -121,3 +131,4 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "DoStuff", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 9, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 8d46c69d775a..a4fa4f90e470 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -37,31 +37,31 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ { i32 }, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_35.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_26.2.b = getelementptr inbounds nuw { i32 }, ptr %.loc22_35.2.base, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_35.4.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc22_36, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc22_35.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc22_26.2.b = getelementptr inbounds nuw { i32 }, ptr %.loc22_35.2.base, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc22_35.4.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc22_36, i64 8, i1 false), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Access(ptr sret({ i32, i32 }) %return, ptr %d) !dbg !7 { +// CHECK:STDOUT: define void @Access(ptr sret({ i32, i32 }) %return, ptr %d) !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc26_12.1.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %d, i32 0, i32 1 -// CHECK:STDOUT: %.loc26_12.2 = load i32, ptr %.loc26_12.1.d, align 4 -// CHECK:STDOUT: %.loc26_17.1.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %d, i32 0, i32 0 -// CHECK:STDOUT: %.loc26_22.1.b = getelementptr inbounds nuw { i32 }, ptr %.loc26_17.1.base, i32 0, i32 0 -// CHECK:STDOUT: %.loc26_22.2 = load i32, ptr %.loc26_22.1.b, align 4 -// CHECK:STDOUT: %.loc26_24.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc26_12.2, ptr %.loc26_24.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc26_24.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc26_22.2, ptr %.loc26_24.4.tuple.elem, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc26_12.1.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %d, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc26_12.2 = load i32, ptr %.loc26_12.1.d, align 4, !dbg !11 +// CHECK:STDOUT: %.loc26_17.1.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %d, i32 0, i32 0, !dbg !12 +// CHECK:STDOUT: %.loc26_22.1.b = getelementptr inbounds nuw { i32 }, ptr %.loc26_17.1.base, i32 0, i32 0, !dbg !12 +// CHECK:STDOUT: %.loc26_22.2 = load i32, ptr %.loc26_22.1.b, align 4, !dbg !12 +// CHECK:STDOUT: %.loc26_24.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: store i32 %.loc26_12.2, ptr %.loc26_24.2.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %.loc26_24.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: store i32 %.loc26_22.2, ptr %.loc26_24.4.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @Convert(ptr %p) !dbg !8 { +// CHECK:STDOUT: define ptr @Convert(ptr %p) !dbg !15 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc30_11.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %p, i32 0, i32 0 -// CHECK:STDOUT: ret ptr %.loc30_11.2.base +// CHECK:STDOUT: %.loc30_11.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %p, i32 0, i32 0, !dbg !16 +// CHECK:STDOUT: ret ptr %.loc30_11.2.base, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -79,5 +79,13 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Make", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Access", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Convert", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 22, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 22, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 22, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Access", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 26, column: 11, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 26, column: 16, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 26, column: 10, scope: !10) +// CHECK:STDOUT: !14 = !DILocation(line: 26, column: 3, scope: !10) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "Convert", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 30, column: 3, scope: !15) diff --git a/toolchain/lower/testdata/class/basic.carbon b/toolchain/lower/testdata/class/basic.carbon index fec64a7ee55c..2e238f0f4c8a 100644 --- a/toolchain/lower/testdata/class/basic.carbon +++ b/toolchain/lower/testdata/class/basic.carbon @@ -27,10 +27,10 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @main() !dbg !4 { // 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: %c.var = alloca { i32, ptr }, align 8, !dbg !7 +// CHECK:STDOUT: %d.var = alloca { i32, ptr }, align 8, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %d.var, ptr %c.var), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -43,3 +43,7 @@ fn Run() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 19, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 20, column: 7, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 20, column: 14, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 18, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/class/field.carbon b/toolchain/lower/testdata/class/field.carbon index ae5a39aad3c1..634a758ec2a5 100644 --- a/toolchain/lower/testdata/class/field.carbon +++ b/toolchain/lower/testdata/class/field.carbon @@ -29,22 +29,22 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc17_13.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %.loc17_13.2 = load ptr, ptr %.loc17_13.1.b, align 8 -// CHECK:STDOUT: %.loc17_16.1.a = getelementptr inbounds nuw { i32, ptr }, ptr %.loc17_13.2, i32 0, i32 0 -// CHECK:STDOUT: %.loc17_16.2 = load i32, ptr %.loc17_16.1.a, align 4 -// CHECK:STDOUT: ret i32 %.loc17_16.2 +// CHECK:STDOUT: %.loc17_13.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %c, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc17_13.2 = load ptr, ptr %.loc17_13.1.b, align 8, !dbg !7 +// CHECK:STDOUT: %.loc17_16.1.a = getelementptr inbounds nuw { i32, ptr }, ptr %.loc17_13.2, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc17_16.2 = load i32, ptr %.loc17_16.1.a, align 4, !dbg !8 +// CHECK:STDOUT: ret i32 %.loc17_16.2, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !7 { +// CHECK:STDOUT: define i32 @main() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8 -// CHECK:STDOUT: %.loc22_4.a = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %.loc22_4.a, align 4 -// CHECK:STDOUT: %.loc23_4.b = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 1 -// CHECK:STDOUT: store ptr %c.var, ptr %.loc23_4.b, align 8 -// CHECK:STDOUT: %F.call = call i32 @F(ptr %c.var) -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8, !dbg !11 +// CHECK:STDOUT: %.loc22_4.a = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 0, !dbg !12 +// CHECK:STDOUT: store i32 1, ptr %.loc22_4.a, align 4, !dbg !12 +// CHECK:STDOUT: %.loc23_4.b = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: store ptr %c.var, ptr %.loc23_4.b, align 8, !dbg !13 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %c.var), !dbg !14 +// CHECK:STDOUT: ret i32 %F.call, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -57,4 +57,12 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 17, column: 12, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 17, column: 10, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 21, column: 7, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 22, column: 3, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 23, column: 3, scope: !10) +// CHECK:STDOUT: !14 = !DILocation(line: 24, column: 10, scope: !10) +// CHECK:STDOUT: !15 = !DILocation(line: 24, column: 3, scope: !10) diff --git a/toolchain/lower/testdata/class/method.carbon b/toolchain/lower/testdata/class/method.carbon index 492519f54c75..a2bd6ab20468 100644 --- a/toolchain/lower/testdata/class/method.carbon +++ b/toolchain/lower/testdata/class/method.carbon @@ -29,9 +29,9 @@ fn F(p: C*) { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr %p) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %Get.call = call i32 @Get(ptr %p) -// CHECK:STDOUT: call void @Set(ptr %p, i32 %Get.call) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %Get.call = call i32 @Get(ptr %p), !dbg !7 +// CHECK:STDOUT: call void @Set(ptr %p, i32 %Get.call), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -44,3 +44,6 @@ fn F(p: C*) { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 19, column: 16, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 20, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 18, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/class/self.carbon b/toolchain/lower/testdata/class/self.carbon index b029e7af6e25..0486e626769f 100644 --- a/toolchain/lower/testdata/class/self.carbon +++ b/toolchain/lower/testdata/class/self.carbon @@ -28,16 +28,16 @@ fn C.Set[addr self: C*]() { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Get(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc19_14.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_14.2 = load i32, ptr %.loc19_14.1.a, align 4 -// CHECK:STDOUT: ret i32 %.loc19_14.2 +// CHECK:STDOUT: %.loc19_14.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc19_14.2 = load i32, ptr %.loc19_14.1.a, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc19_14.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Set(ptr %self) !dbg !7 { +// CHECK:STDOUT: define void @Set(ptr %self) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc23_10.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %.loc23_10.a, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc23_10.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: store i32 1, ptr %.loc23_10.a, align 4, !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -50,4 +50,8 @@ fn C.Set[addr self: C*]() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Get", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Set", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 19, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 19, column: 3, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Set", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 23, column: 3, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 22, column: 1, scope: !9) diff --git a/toolchain/lower/testdata/class/value_access.carbon b/toolchain/lower/testdata/class/value_access.carbon index f5114ac111f5..6eb30ecc9ff3 100644 --- a/toolchain/lower/testdata/class/value_access.carbon +++ b/toolchain/lower/testdata/class/value_access.carbon @@ -24,23 +24,23 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc19_11.1.a = getelementptr inbounds nuw { { i32, i32, i32 } }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_11.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_11.3 = load i32, ptr %.loc19_11.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc19_11.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 1 -// CHECK:STDOUT: %.loc19_11.5 = load i32, ptr %.loc19_11.4.tuple.elem, align 4 -// CHECK:STDOUT: %.loc19_11.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 2 -// CHECK:STDOUT: %.loc19_11.7 = load i32, ptr %.loc19_11.6.tuple.elem, align 4 -// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc19_11.3, ptr %tuple1, align 4 -// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc19_11.5, ptr %tuple2, align 4 -// CHECK:STDOUT: %tuple3 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc19_11.7, ptr %tuple3, align 4 -// CHECK:STDOUT: %.loc19_13.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: %.loc19_13.tuple.index.load = load i32, ptr %.loc19_13.tuple.index, align 4 -// CHECK:STDOUT: ret i32 %.loc19_13.tuple.index.load +// CHECK:STDOUT: %.loc19_11.1.a = getelementptr inbounds nuw { { i32, i32, i32 } }, ptr %c, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc19_11.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc19_11.3 = load i32, ptr %.loc19_11.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %.loc19_11.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc19_11.5 = load i32, ptr %.loc19_11.4.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %.loc19_11.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc19_11.7 = load i32, ptr %.loc19_11.6.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc19_11.3, ptr %tuple1, align 4, !dbg !7 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc19_11.5, ptr %tuple2, align 4, !dbg !7 +// CHECK:STDOUT: %tuple3 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc19_11.7, ptr %tuple3, align 4, !dbg !7 +// CHECK:STDOUT: %.loc19_13.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc19_13.tuple.index.load = load i32, ptr %.loc19_13.tuple.index, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc19_13.tuple.index.load, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -53,3 +53,5 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 19, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 19, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/function/call/empty_struct.carbon b/toolchain/lower/testdata/function/call/empty_struct.carbon index dd21a92be32f..57f9505b3b88 100644 --- a/toolchain/lower/testdata/function/call/empty_struct.carbon +++ b/toolchain/lower/testdata/function/call/empty_struct.carbon @@ -21,14 +21,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %b.var = alloca {}, align 8 -// CHECK:STDOUT: call void @Echo() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 +// CHECK:STDOUT: call void @Echo(), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -41,4 +41,8 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Echo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 7, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 15, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/empty_tuple.carbon b/toolchain/lower/testdata/function/call/empty_tuple.carbon index f41afc8de24f..d2c71c3fe067 100644 --- a/toolchain/lower/testdata/function/call/empty_tuple.carbon +++ b/toolchain/lower/testdata/function/call/empty_tuple.carbon @@ -21,14 +21,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %b.var = alloca {}, align 8 -// CHECK:STDOUT: call void @Echo() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 +// CHECK:STDOUT: call void @Echo(), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -41,4 +41,8 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Echo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 7, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 15, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/i32.carbon b/toolchain/lower/testdata/function/call/i32.carbon index 0e6e2e65d63c..4ebde45a8864 100644 --- a/toolchain/lower/testdata/function/call/i32.carbon +++ b/toolchain/lower/testdata/function/call/i32.carbon @@ -21,15 +21,15 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Echo(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 %a +// CHECK:STDOUT: ret i32 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // 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: %b.var = alloca i32, align 4, !dbg !9 +// CHECK:STDOUT: %Echo.call = call i32 @Echo(i32 1), !dbg !10 +// CHECK:STDOUT: store i32 %Echo.call, ptr %b.var, align 4, !dbg !11 +// CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -42,4 +42,9 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Echo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 7, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 16, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 3, scope: !8) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 1, scope: !8) 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 34b1bca86156..d145e03edd0a 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 @@ -22,21 +22,21 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Bar() !dbg !7 { +// CHECK:STDOUT: define void @Bar() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !8 { +// CHECK:STDOUT: define void @Main() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca {}, align 8 -// CHECK:STDOUT: call void @Foo() -// CHECK:STDOUT: %.loc17_22.1.temp = alloca {}, align 8 -// CHECK:STDOUT: call void @Bar() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !11 +// CHECK:STDOUT: call void @Foo(), !dbg !12 +// CHECK:STDOUT: %.loc17_22.1.temp = alloca {}, align 8, !dbg !12 +// CHECK:STDOUT: call void @Bar(), !dbg !13 +// CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -49,5 +49,11 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Bar", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Bar", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 23, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 17, column: 7, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 17, column: 19, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 15, scope: !10) +// CHECK:STDOUT: !14 = !DILocation(line: 16, column: 1, scope: !10) diff --git a/toolchain/lower/testdata/function/call/params_one.carbon b/toolchain/lower/testdata/function/call/params_one.carbon index 49e14a4e7be3..e5d2541c3d12 100644 --- a/toolchain/lower/testdata/function/call/params_one.carbon +++ b/toolchain/lower/testdata/function/call/params_one.carbon @@ -19,13 +19,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Foo(i32 1) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Foo(i32 1), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -38,4 +38,7 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/params_one_comma.carbon b/toolchain/lower/testdata/function/call/params_one_comma.carbon index 4905f2aa63b8..a4a752326b12 100644 --- a/toolchain/lower/testdata/function/call/params_one_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_one_comma.carbon @@ -20,14 +20,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Foo(i32 1) -// CHECK:STDOUT: call void @Foo(i32 1) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Foo(i32 1), !dbg !9 +// CHECK:STDOUT: call void @Foo(i32 1), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,4 +40,8 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 3, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/params_two.carbon b/toolchain/lower/testdata/function/call/params_two.carbon index 2ffbba5f7564..deaef47197f7 100644 --- a/toolchain/lower/testdata/function/call/params_two.carbon +++ b/toolchain/lower/testdata/function/call/params_two.carbon @@ -19,13 +19,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Foo(i32 1, i32 2) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Foo(i32 1, i32 2), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -38,4 +38,7 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/params_two_comma.carbon b/toolchain/lower/testdata/function/call/params_two_comma.carbon index 059f3e2a3eab..844b9054d8a7 100644 --- a/toolchain/lower/testdata/function/call/params_two_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_two_comma.carbon @@ -20,14 +20,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // 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 +// CHECK:STDOUT: call void @Foo(i32 1, i32 2), !dbg !9 +// CHECK:STDOUT: call void @Foo(i32 1, i32 2), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,4 +40,8 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 3, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/params_zero.carbon b/toolchain/lower/testdata/function/call/params_zero.carbon index a86a0bd78d91..1b585b57f3b9 100644 --- a/toolchain/lower/testdata/function/call/params_zero.carbon +++ b/toolchain/lower/testdata/function/call/params_zero.carbon @@ -19,13 +19,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Foo() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Foo(), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -38,4 +38,7 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/return_implicit.carbon b/toolchain/lower/testdata/function/call/return_implicit.carbon index 2c69254091af..bd0243fc9f04 100644 --- a/toolchain/lower/testdata/function/call/return_implicit.carbon +++ b/toolchain/lower/testdata/function/call/return_implicit.carbon @@ -21,14 +21,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @MakeImplicitEmptyTuple() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %b.var = alloca {}, align 8 -// CHECK:STDOUT: call void @MakeImplicitEmptyTuple() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 +// CHECK:STDOUT: call void @MakeImplicitEmptyTuple(), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -41,4 +41,8 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "MakeImplicitEmptyTuple", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 7, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 15, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index ce810e71eb3d..b53aaf2766b9 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -21,13 +21,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.3.loc14_4.3) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.3.loc14_4.3), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,4 +40,7 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/call/tuple_param.carbon b/toolchain/lower/testdata/function/call/tuple_param.carbon index a87e45fe8cf6..191fa66a8624 100644 --- a/toolchain/lower/testdata/function/call/tuple_param.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param.carbon @@ -21,13 +21,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @tuple.3.loc14_4.3) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @tuple.3.loc14_4.3), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,4 +40,7 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 1, scope: !8) 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 969da0b6c947..082e7edad913 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 @@ -23,25 +23,25 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_12.tuple.index = extractvalue { i32 } %b, 0 -// CHECK:STDOUT: %.loc12_17.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_17.tuple.index.load = load i32, ptr %.loc12_17.tuple.index, align 4 -// CHECK:STDOUT: %.loc12_22.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_22.tuple.index.load = load i32, ptr %.loc12_22.tuple.index, align 4 -// CHECK:STDOUT: %.loc12_24.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc12_12.tuple.index, ptr %.loc12_24.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_24.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc12_17.tuple.index.load, ptr %.loc12_24.4.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_24.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc12_22.tuple.index.load, ptr %.loc12_24.6.tuple.elem, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc12_12.tuple.index = extractvalue { i32 } %b, 0, !dbg !7 +// CHECK:STDOUT: %.loc12_17.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %c, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_17.tuple.index.load = load i32, ptr %.loc12_17.tuple.index, align 4, !dbg !8 +// CHECK:STDOUT: %.loc12_22.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %c, i32 0, i32 1, !dbg !9 +// CHECK:STDOUT: %.loc12_22.tuple.index.load = load i32, ptr %.loc12_22.tuple.index, align 4, !dbg !9 +// CHECK:STDOUT: %.loc12_24.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: store i32 %.loc12_12.tuple.index, ptr %.loc12_24.2.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %.loc12_24.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: store i32 %.loc12_17.tuple.index.load, ptr %.loc12_24.4.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %.loc12_24.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: store i32 %.loc12_22.tuple.index.load, ptr %.loc12_24.6.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc16_4.1.temp = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc16_4.1.temp, { i32 } { i32 1 }, ptr @tuple.3.loc16_4.4) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc16_4.1.temp = alloca { i32, i32, i32 }, align 8, !dbg !13 +// CHECK:STDOUT: call void @F(ptr %.loc16_4.1.temp, { i32 } { i32 1 }, ptr @tuple.3.loc16_4.4), !dbg !13 +// CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives @@ -57,4 +57,11 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 11, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 16, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 21, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 12, column: 10, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 16, column: 3, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 1, scope: !12) diff --git a/toolchain/lower/testdata/function/call/var_param.carbon b/toolchain/lower/testdata/function/call/var_param.carbon index f0d3caf65825..b26ece86b3bc 100644 --- a/toolchain/lower/testdata/function/call/var_param.carbon +++ b/toolchain/lower/testdata/function/call/var_param.carbon @@ -20,16 +20,16 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @DoNothing(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %a.var, align 4 -// CHECK:STDOUT: %.loc15 = load i32, ptr %a.var, align 4 -// CHECK:STDOUT: call void @DoNothing(i32 %.loc15) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !9 +// CHECK:STDOUT: store i32 0, ptr %a.var, align 4, !dbg !10 +// CHECK:STDOUT: %.loc15 = load i32, ptr %a.var, align 4, !dbg !11 +// CHECK:STDOUT: call void @DoNothing(i32 %.loc15), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -42,4 +42,10 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "DoNothing", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 7, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 3, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 13, scope: !8) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 3, scope: !8) +// CHECK:STDOUT: !13 = !DILocation(line: 13, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/function/declaration/simple.carbon b/toolchain/lower/testdata/function/declaration/simple.carbon index 135bfc2e8d23..25a55f74660c 100644 --- a/toolchain/lower/testdata/function/declaration/simple.carbon +++ b/toolchain/lower/testdata/function/declaration/simple.carbon @@ -19,8 +19,8 @@ fn G(n: i32) { F(n); } // CHECK:STDOUT: // CHECK:STDOUT: define void @G(i32 %n) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F(i32 %n) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @F(i32 %n), !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -33,3 +33,5 @@ fn G(n: i32) { F(n); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 16, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/function/definition/empty_struct.carbon b/toolchain/lower/testdata/function/definition/empty_struct.carbon index 389e733d54e6..d2422d2c26ef 100644 --- a/toolchain/lower/testdata/function/definition/empty_struct.carbon +++ b/toolchain/lower/testdata/function/definition/empty_struct.carbon @@ -16,7 +16,7 @@ fn Echo(a: {}) { // CHECK:STDOUT: // CHECK:STDOUT: define void @Echo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -29,3 +29,4 @@ fn Echo(a: {}) { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Echo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/function/definition/params_one.carbon b/toolchain/lower/testdata/function/definition/params_one.carbon index afb087024b6c..d5c1b67cb47e 100644 --- a/toolchain/lower/testdata/function/definition/params_one.carbon +++ b/toolchain/lower/testdata/function/definition/params_one.carbon @@ -15,7 +15,7 @@ fn Foo(a: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -28,3 +28,4 @@ fn Foo(a: i32) {} // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/function/definition/params_two.carbon b/toolchain/lower/testdata/function/definition/params_two.carbon index cac3e34a5b47..1f76d9e94a1b 100644 --- a/toolchain/lower/testdata/function/definition/params_two.carbon +++ b/toolchain/lower/testdata/function/definition/params_two.carbon @@ -15,7 +15,7 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -28,3 +28,4 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/function/definition/params_zero.carbon b/toolchain/lower/testdata/function/definition/params_zero.carbon index 8299c4b4bdf8..4aa0a3fea095 100644 --- a/toolchain/lower/testdata/function/definition/params_zero.carbon +++ b/toolchain/lower/testdata/function/definition/params_zero.carbon @@ -15,7 +15,7 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: define void @Foo() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -28,3 +28,4 @@ fn Foo() {} // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Foo", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/global/class_obj.carbon b/toolchain/lower/testdata/global/class_obj.carbon index 4920f529683e..c7a6dfd80661 100644 --- a/toolchain/lower/testdata/global/class_obj.carbon +++ b/toolchain/lower/testdata/global/class_obj.carbon @@ -20,8 +20,8 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: define void @__global_init() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @a, ptr align 1 @struct.loc12_14, i64 0, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @a, ptr align 1 @struct.loc12_14, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -39,3 +39,5 @@ var a: A = {}; // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 1, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 4294967295, scope: !4) diff --git a/toolchain/lower/testdata/global/class_with_fun.carbon b/toolchain/lower/testdata/global/class_with_fun.carbon index 6e6d27c6e793..fe99388c5d26 100644 --- a/toolchain/lower/testdata/global/class_with_fun.carbon +++ b/toolchain/lower/testdata/global/class_with_fun.carbon @@ -25,14 +25,14 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: define void @ret_a(ptr sret({}) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @struct.loc13_12, i64 0, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @struct.loc13_12, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @__global_init() !dbg !7 { +// CHECK:STDOUT: define void @__global_init() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @a, ptr align 1 @struct.loc16_14, i64 0, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @a, ptr align 1 @struct.loc16_14, i64 0, i1 false), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -53,4 +53,7 @@ var a: A = {}; // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "ret_a", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 1, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 4294967295, scope: !8) diff --git a/toolchain/lower/testdata/global/simple_init.carbon b/toolchain/lower/testdata/global/simple_init.carbon index 3207047b310e..47bf76ae3bba 100644 --- a/toolchain/lower/testdata/global/simple_init.carbon +++ b/toolchain/lower/testdata/global/simple_init.carbon @@ -17,8 +17,8 @@ var a: i32 = 0; // CHECK:STDOUT: // CHECK:STDOUT: define void @__global_init() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: store i32 0, ptr @a, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: store i32 0, ptr @a, align 4, !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives @@ -34,3 +34,5 @@ var a: i32 = 0; // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 10, column: 1, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 4294967295, scope: !4) diff --git a/toolchain/lower/testdata/global/simple_with_fun.carbon b/toolchain/lower/testdata/global/simple_with_fun.carbon index 4ce63c19f784..ad14902f2dc2 100644 --- a/toolchain/lower/testdata/global/simple_with_fun.carbon +++ b/toolchain/lower/testdata/global/simple_with_fun.carbon @@ -22,14 +22,14 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: define i32 @test_a() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @__global_init() !dbg !7 { +// CHECK:STDOUT: define void @__global_init() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %test_a.call = call i32 @test_a() -// CHECK:STDOUT: store i32 %test_a.call, ptr @a, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %test_a.call = call i32 @test_a(), !dbg !9 +// CHECK:STDOUT: store i32 %test_a.call, ptr @a, align 4, !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives @@ -45,4 +45,8 @@ var a: i32 = test_a(); // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "test_a", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 15, column: 14, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 1, scope: !8) +// CHECK:STDOUT: !11 = !DILocation(line: 4294967295, scope: !8) diff --git a/toolchain/lower/testdata/if/else.carbon b/toolchain/lower/testdata/if/else.carbon index dcf4ce112a8f..d1d30f81f970 100644 --- a/toolchain/lower/testdata/if/else.carbon +++ b/toolchain/lower/testdata/if/else.carbon @@ -26,34 +26,34 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @G() !dbg !7 { +// CHECK:STDOUT: define void @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @H() !dbg !8 { +// CHECK:STDOUT: define void @H() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @If(i1 %b) !dbg !9 { +// CHECK:STDOUT: define void @If(i1 %b) !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else +// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else, !dbg !13 // CHECK:STDOUT: // CHECK:STDOUT: if.then: ; preds = %entry -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %if.done +// CHECK:STDOUT: call void @F(), !dbg !14 +// CHECK:STDOUT: br label %if.done, !dbg !15 // CHECK:STDOUT: // CHECK:STDOUT: if.else: ; preds = %entry -// CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %if.done +// CHECK:STDOUT: call void @G(), !dbg !16 +// CHECK:STDOUT: br label %if.done, !dbg !15 // CHECK:STDOUT: // CHECK:STDOUT: if.done: ; preds = %if.else, %if.then -// CHECK:STDOUT: call void @H() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @H(), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -66,6 +66,15 @@ fn If(b: bool) { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "H", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "If", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 1, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "H", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !10) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "If", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 16, column: 6, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 17, column: 5, scope: !12) +// CHECK:STDOUT: !15 = !DILocation(line: 16, column: 3, scope: !12) +// CHECK:STDOUT: !16 = !DILocation(line: 19, column: 5, scope: !12) +// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 3, scope: !12) +// CHECK:STDOUT: !18 = !DILocation(line: 15, column: 1, scope: !12) diff --git a/toolchain/lower/testdata/if/no_else.carbon b/toolchain/lower/testdata/if/no_else.carbon index d229b6409248..43d5c7aabaee 100644 --- a/toolchain/lower/testdata/if/no_else.carbon +++ b/toolchain/lower/testdata/if/no_else.carbon @@ -23,25 +23,25 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @G() !dbg !7 { +// CHECK:STDOUT: define void @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @If(i1 %b) !dbg !8 { +// CHECK:STDOUT: define void @If(i1 %b) !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else +// CHECK:STDOUT: br i1 %b, label %if.then, label %if.else, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: if.then: ; preds = %entry -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %if.else +// CHECK:STDOUT: call void @F(), !dbg !12 +// CHECK:STDOUT: br label %if.else, !dbg !13 // CHECK:STDOUT: // CHECK:STDOUT: if.else: ; preds = %if.then, %entry -// CHECK:STDOUT: call void @G() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @G(), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -54,5 +54,12 @@ fn If(b: bool) { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "If", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 1, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "If", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 6, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 16, column: 5, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 3, scope: !10) +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 3, scope: !10) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 1, scope: !10) diff --git a/toolchain/lower/testdata/if_expr/basic.carbon b/toolchain/lower/testdata/if_expr/basic.carbon index 4184104d81bd..92bc097a5c47 100644 --- a/toolchain/lower/testdata/if_expr/basic.carbon +++ b/toolchain/lower/testdata/if_expr/basic.carbon @@ -20,29 +20,29 @@ fn Select(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 1 +// CHECK:STDOUT: ret i32 1, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @G() !dbg !7 { +// CHECK:STDOUT: define i32 @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 2 +// CHECK:STDOUT: ret i32 2, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @Select(i1 %b) !dbg !8 { +// CHECK:STDOUT: define i32 @Select(i1 %b) !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %if.expr.then, label %if.expr.else +// CHECK:STDOUT: br i1 %b, label %if.expr.then, label %if.expr.else, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.then: ; preds = %entry -// CHECK:STDOUT: %F.call = call i32 @F() -// CHECK:STDOUT: br label %if.expr.result +// CHECK:STDOUT: %F.call = call i32 @F(), !dbg !12 +// CHECK:STDOUT: br label %if.expr.result, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.else: ; preds = %entry -// CHECK:STDOUT: %G.call = call i32 @G() -// CHECK:STDOUT: br label %if.expr.result +// CHECK:STDOUT: %G.call = call i32 @G(), !dbg !13 +// CHECK:STDOUT: br label %if.expr.result, !dbg !11 // CHECK:STDOUT: // 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: ret i32 %0, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -55,5 +55,11 @@ fn Select(b: bool) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Select", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 17, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 17, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Select", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 10, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 20, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 29, scope: !10) +// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 3, scope: !10) diff --git a/toolchain/lower/testdata/if_expr/empty_block.carbon b/toolchain/lower/testdata/if_expr/empty_block.carbon index 9f8de09c5158..d01138f7c14e 100644 --- a/toolchain/lower/testdata/if_expr/empty_block.carbon +++ b/toolchain/lower/testdata/if_expr/empty_block.carbon @@ -17,37 +17,37 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Select(i1 %b, i1 %c, i1 %d) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %if.expr.then.loc12_10, label %if.expr.else.loc12_10 +// CHECK:STDOUT: br i1 %b, label %if.expr.then.loc12_10, label %if.expr.else.loc12_10, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.then.loc12_10: ; preds = %entry -// CHECK:STDOUT: br i1 %c, label %if.expr.then.loc12_20, label %if.expr.else.loc12_20 +// CHECK:STDOUT: br i1 %c, label %if.expr.then.loc12_20, label %if.expr.else.loc12_20, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.then.loc12_20: ; preds = %if.expr.then.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_20 +// CHECK:STDOUT: br label %if.expr.result.loc12_20, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.else.loc12_20: ; preds = %if.expr.then.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_20 +// CHECK:STDOUT: br label %if.expr.result.loc12_20, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.result.loc12_20: ; preds = %if.expr.else.loc12_20, %if.expr.then.loc12_20 // CHECK:STDOUT: %0 = phi i32 [ 1, %if.expr.then.loc12_20 ], [ 2, %if.expr.else.loc12_20 ] -// CHECK:STDOUT: br label %if.expr.result.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_10, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.else.loc12_10: ; preds = %entry -// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc12_44, label %if.expr.else.loc12_44 +// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc12_44, label %if.expr.else.loc12_44, !dbg !9 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.then.loc12_44: ; preds = %if.expr.else.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_44 +// CHECK:STDOUT: br label %if.expr.result.loc12_44, !dbg !9 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.else.loc12_44: ; preds = %if.expr.else.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_44 +// CHECK:STDOUT: br label %if.expr.result.loc12_44, !dbg !9 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.result.loc12_44: ; preds = %if.expr.else.loc12_44, %if.expr.then.loc12_44 // CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc12_44 ], [ 4, %if.expr.else.loc12_44 ] -// CHECK:STDOUT: br label %if.expr.result.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_10, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.result.loc12_10: ; preds = %if.expr.result.loc12_44, %if.expr.result.loc12_20 // CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc12_20 ], [ %1, %if.expr.result.loc12_44 ] -// CHECK:STDOUT: ret i32 %2 +// CHECK:STDOUT: ret i32 %2, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -60,3 +60,7 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Select", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 20, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 44, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon index 8f3bfc769afe..0329104f7138 100644 --- a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon +++ b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon @@ -32,15 +32,15 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_16.2 = load i32, ptr %.loc22_16.1.n, align 4 -// CHECK:STDOUT: ret i32 %.loc22_16.2 +// CHECK:STDOUT: %.loc22_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc22_16.2 = load i32, ptr %.loc22_16.1.n, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc22_16.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !7 { +// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %F.call = call i32 @F(ptr %a), !dbg !10 +// CHECK:STDOUT: ret i32 %F.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -53,4 +53,8 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 22, column: 12, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 22, column: 5, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 27, column: 10, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 27, column: 3, scope: !9) diff --git a/toolchain/lower/testdata/impl/extend_impl.carbon b/toolchain/lower/testdata/impl/extend_impl.carbon index c59560b37423..e7f453a33714 100644 --- a/toolchain/lower/testdata/impl/extend_impl.carbon +++ b/toolchain/lower/testdata/impl/extend_impl.carbon @@ -33,19 +33,19 @@ fn InstanceAccess(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @TypeAccess() !dbg !7 { +// CHECK:STDOUT: define i32 @TypeAccess() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i32 @F() -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %F.call = call i32 @F(), !dbg !9 +// CHECK:STDOUT: ret i32 %F.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @InstanceAccess(ptr %a) !dbg !8 { +// CHECK:STDOUT: define i32 @InstanceAccess(ptr %a) !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i32 @F() -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %F.call = call i32 @F(), !dbg !12 +// CHECK:STDOUT: ret i32 %F.call, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -58,5 +58,10 @@ fn InstanceAccess(a: A) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TypeAccess", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "InstanceAccess", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 7, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TypeAccess", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 24, column: 10, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 24, column: 3, scope: !8) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "InstanceAccess", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !12 = !DILocation(line: 28, column: 10, scope: !11) +// CHECK:STDOUT: !13 = !DILocation(line: 28, column: 3, scope: !11) diff --git a/toolchain/lower/testdata/impl/impl.carbon b/toolchain/lower/testdata/impl/impl.carbon index 3eac77a1b8e9..c23571083a0e 100644 --- a/toolchain/lower/testdata/impl/impl.carbon +++ b/toolchain/lower/testdata/impl/impl.carbon @@ -31,15 +31,15 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc21_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc21_16.2 = load i32, ptr %.loc21_16.1.n, align 4 -// CHECK:STDOUT: ret i32 %.loc21_16.2 +// CHECK:STDOUT: %.loc21_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc21_16.2 = load i32, ptr %.loc21_16.1.n, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc21_16.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !7 { +// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %F.call +// CHECK:STDOUT: %F.call = call i32 @F(ptr %a), !dbg !10 +// CHECK:STDOUT: ret i32 %F.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -52,4 +52,8 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 21, column: 12, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 21, column: 5, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 26, column: 10, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 26, column: 3, scope: !9) diff --git a/toolchain/lower/testdata/impl/instance_method.carbon b/toolchain/lower/testdata/impl/instance_method.carbon index dcabf63ec2d6..bbcc5b6a7c29 100644 --- a/toolchain/lower/testdata/impl/instance_method.carbon +++ b/toolchain/lower/testdata/impl/instance_method.carbon @@ -31,13 +31,13 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Get(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret ptr %self +// CHECK:STDOUT: ret ptr %self, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @Call(ptr %a) !dbg !7 { +// CHECK:STDOUT: define ptr @Call(ptr %a) !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %Get.call = call ptr @Get(ptr %a) -// CHECK:STDOUT: ret ptr %Get.call +// CHECK:STDOUT: %Get.call = call ptr @Get(ptr %a), !dbg !9 +// CHECK:STDOUT: ret ptr %Get.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -50,4 +50,7 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Get", scope: null, file: !3, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 20, column: 7, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 26, column: 10, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 26, column: 3, scope: !8) diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index 9878cbd86c70..5b17d63bc05d 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -26,47 +26,47 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @A(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc10_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc10_37, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc10_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc10_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc10_37, i64 8, i1 false), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @B(ptr sret([2 x i32]) %return) !dbg !7 { +// CHECK:STDOUT: define void @B(ptr sret([2 x i32]) %return) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @array.loc12_35, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc12_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc12_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @array.loc12_35, i64 8, i1 false), !dbg !11 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !8 { +// CHECK:STDOUT: define void @main() !dbg !12 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca [2 x i32], align 4 -// CHECK:STDOUT: %.loc15_22.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @A(ptr %.loc15_22.1.temp) -// CHECK:STDOUT: %.loc15_22.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_22.4 = load i32, ptr %.loc15_22.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc15_22.6.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc15_22.4, ptr %.loc15_22.6.array.index, align 4 -// CHECK:STDOUT: %.loc15_22.8.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_22.9 = load i32, ptr %.loc15_22.8.tuple.elem, align 4 -// CHECK:STDOUT: %.loc15_22.11.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc15_22.9, ptr %.loc15_22.11.array.index, align 4 -// CHECK:STDOUT: %b.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 1, ptr %b.var, align 4 -// CHECK:STDOUT: %c.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc17_18 = load i32, ptr %b.var, align 4 -// CHECK:STDOUT: %.loc17_19.1.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 %.loc17_18 -// CHECK:STDOUT: %.loc17_19.2 = load i32, ptr %.loc17_19.1.array.index, align 4 -// CHECK:STDOUT: store i32 %.loc17_19.2, ptr %c.var, align 4 -// CHECK:STDOUT: %d.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc18_17.1.temp = alloca [2 x i32], align 4 -// CHECK:STDOUT: call void @B(ptr %.loc18_17.1.temp) -// CHECK:STDOUT: %.loc18_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc18_17.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc18_21.2 = load i32, ptr %.loc18_21.1.array.index, align 4 -// CHECK:STDOUT: store i32 %.loc18_21.2, ptr %d.var, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %a.var = alloca [2 x i32], align 4, !dbg !13 +// CHECK:STDOUT: %.loc15_22.1.temp = alloca { i32, i32 }, align 8, !dbg !14 +// CHECK:STDOUT: call void @A(ptr %.loc15_22.1.temp), !dbg !14 +// CHECK:STDOUT: %.loc15_22.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: %.loc15_22.4 = load i32, ptr %.loc15_22.3.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %.loc15_22.6.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: store i32 %.loc15_22.4, ptr %.loc15_22.6.array.index, align 4, !dbg !14 +// CHECK:STDOUT: %.loc15_22.8.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: %.loc15_22.9 = load i32, ptr %.loc15_22.8.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %.loc15_22.11.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: store i32 %.loc15_22.9, ptr %.loc15_22.11.array.index, align 4, !dbg !14 +// CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !15 +// CHECK:STDOUT: store i32 1, ptr %b.var, align 4, !dbg !16 +// CHECK:STDOUT: %c.var = alloca i32, align 4, !dbg !17 +// CHECK:STDOUT: %.loc17_18 = load i32, ptr %b.var, align 4, !dbg !18 +// CHECK:STDOUT: %.loc17_19.1.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 %.loc17_18, !dbg !19 +// CHECK:STDOUT: %.loc17_19.2 = load i32, ptr %.loc17_19.1.array.index, align 4, !dbg !19 +// CHECK:STDOUT: store i32 %.loc17_19.2, ptr %c.var, align 4, !dbg !20 +// CHECK:STDOUT: %d.var = alloca i32, align 4, !dbg !21 +// CHECK:STDOUT: %.loc18_17.1.temp = alloca [2 x i32], align 4, !dbg !22 +// CHECK:STDOUT: call void @B(ptr %.loc18_17.1.temp), !dbg !22 +// CHECK:STDOUT: %.loc18_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc18_17.1.temp, i32 0, i32 1, !dbg !22 +// CHECK:STDOUT: %.loc18_21.2 = load i32, ptr %.loc18_21.1.array.index, align 4, !dbg !22 +// CHECK:STDOUT: store i32 %.loc18_21.2, ptr %d.var, align 4, !dbg !23 +// CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -87,5 +87,21 @@ fn Run() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "A", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "B", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 10, column: 31, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 10, column: 24, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "B", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 12, column: 29, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 12, column: 22, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 7, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 21, scope: !12) +// CHECK:STDOUT: !15 = !DILocation(line: 16, column: 7, scope: !12) +// CHECK:STDOUT: !16 = !DILocation(line: 16, column: 3, scope: !12) +// CHECK:STDOUT: !17 = !DILocation(line: 17, column: 7, scope: !12) +// CHECK:STDOUT: !18 = !DILocation(line: 17, column: 18, scope: !12) +// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 16, scope: !12) +// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 3, scope: !12) +// CHECK:STDOUT: !21 = !DILocation(line: 18, column: 7, scope: !12) +// CHECK:STDOUT: !22 = !DILocation(line: 18, column: 16, scope: !12) +// CHECK:STDOUT: !23 = !DILocation(line: 18, column: 3, scope: !12) +// CHECK:STDOUT: !24 = !DILocation(line: 14, column: 1, scope: !12) diff --git a/toolchain/lower/testdata/interface/assoc.carbon b/toolchain/lower/testdata/interface/assoc.carbon index 92c7a6a12ab2..f06c7323889c 100644 --- a/toolchain/lower/testdata/interface/assoc.carbon +++ b/toolchain/lower/testdata/interface/assoc.carbon @@ -19,7 +19,7 @@ fn F() { I.Assoc; } // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -32,3 +32,4 @@ fn F() { I.Assoc; } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 15, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/interface/basic.carbon b/toolchain/lower/testdata/interface/basic.carbon index bdfabb15a664..de91482f7b02 100644 --- a/toolchain/lower/testdata/interface/basic.carbon +++ b/toolchain/lower/testdata/interface/basic.carbon @@ -26,12 +26,12 @@ fn G(T: J) {} // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @G() !dbg !7 { +// CHECK:STDOUT: define void @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -44,4 +44,6 @@ fn G(T: J) {} // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 17, column: 19, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 22, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/let/local.carbon b/toolchain/lower/testdata/let/local.carbon index ebad824289bd..95873f3df29f 100644 --- a/toolchain/lower/testdata/let/local.carbon +++ b/toolchain/lower/testdata/let/local.carbon @@ -19,7 +19,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 1 +// CHECK:STDOUT: ret i32 1, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -32,3 +32,4 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/let/tuple.carbon b/toolchain/lower/testdata/let/tuple.carbon index c8944f20c301..67e10118db06 100644 --- a/toolchain/lower/testdata/let/tuple.carbon +++ b/toolchain/lower/testdata/let/tuple.carbon @@ -23,47 +23,47 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.1.loc12_37, i64 12, i1 false) -// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc13_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_28.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.2.loc13_29, i64 8, i1 false) -// CHECK:STDOUT: %.loc14_43.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_43.2 = load i32, ptr %.loc14_43.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc14_43.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_43.4 = load i32, ptr %.loc14_43.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc14_43.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc14_43.6 = load i32, ptr %.loc14_43.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc14_43 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc14_431 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc14_43.2, ptr %tuple.loc14_431, align 4 -// CHECK:STDOUT: %tuple.loc14_432 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc14_43.4, ptr %tuple.loc14_432, align 4 -// CHECK:STDOUT: %tuple.loc14_433 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc14_43.6, ptr %tuple.loc14_433, align 4 -// CHECK:STDOUT: %.loc14_46.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_46.2 = load i32, ptr %.loc14_46.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc14_46.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_46.4 = load i32, ptr %.loc14_46.3.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc14_46 = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc14_464 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc14_46.2, ptr %tuple.loc14_464, align 4 -// CHECK:STDOUT: %tuple.loc14_465 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc14_46.4, ptr %tuple.loc14_465, align 4 -// CHECK:STDOUT: %tuple.loc14_47 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %tuple.loc14_476 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple.loc14_43, ptr %tuple.loc14_476, align 8 -// CHECK:STDOUT: %tuple.loc14_477 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple.loc14_46, ptr %tuple.loc14_477, align 8 -// CHECK:STDOUT: %.loc15_11.tuple.index = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_11.tuple.index.load = load ptr, ptr %.loc15_11.tuple.index, align 8 -// CHECK:STDOUT: %.loc15_13.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_11.tuple.index.load, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_13.tuple.index.load = load i32, ptr %.loc15_13.tuple.index, align 4 -// CHECK:STDOUT: ret i32 %.loc15_13.tuple.index.load +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.1.loc12_37, i64 12, i1 false), !dbg !9 +// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %.loc13_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_28.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.2.loc13_29, i64 8, i1 false), !dbg !12 +// CHECK:STDOUT: %.loc14_43.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: %.loc14_43.2 = load i32, ptr %.loc14_43.1.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %.loc14_43.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: %.loc14_43.4 = load i32, ptr %.loc14_43.3.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %.loc14_43.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !13 +// CHECK:STDOUT: %.loc14_43.6 = load i32, ptr %.loc14_43.5.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc14_43 = alloca { i32, i32, i32 }, align 8, !dbg !13 +// CHECK:STDOUT: %tuple.loc14_431 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: store i32 %.loc14_43.2, ptr %tuple.loc14_431, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc14_432 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: store i32 %.loc14_43.4, ptr %tuple.loc14_432, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc14_433 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 2, !dbg !13 +// CHECK:STDOUT: store i32 %.loc14_43.6, ptr %tuple.loc14_433, align 4, !dbg !13 +// CHECK:STDOUT: %.loc14_46.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: %.loc14_46.2 = load i32, ptr %.loc14_46.1.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %.loc14_46.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: %.loc14_46.4 = load i32, ptr %.loc14_46.3.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.loc14_46 = alloca { i32, i32 }, align 8, !dbg !14 +// CHECK:STDOUT: %tuple.loc14_464 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: store i32 %.loc14_46.2, ptr %tuple.loc14_464, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.loc14_465 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: store i32 %.loc14_46.4, ptr %tuple.loc14_465, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.loc14_47 = alloca { ptr, ptr }, align 8, !dbg !15 +// CHECK:STDOUT: %tuple.loc14_476 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 0, !dbg !15 +// CHECK:STDOUT: store ptr %tuple.loc14_43, ptr %tuple.loc14_476, align 8, !dbg !15 +// CHECK:STDOUT: %tuple.loc14_477 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1, !dbg !15 +// CHECK:STDOUT: store ptr %tuple.loc14_46, ptr %tuple.loc14_477, align 8, !dbg !15 +// CHECK:STDOUT: %.loc15_11.tuple.index = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1, !dbg !16 +// CHECK:STDOUT: %.loc15_11.tuple.index.load = load ptr, ptr %.loc15_11.tuple.index, align 8, !dbg !16 +// CHECK:STDOUT: %.loc15_13.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %.loc15_11.tuple.index.load, i32 0, i32 1, !dbg !16 +// CHECK:STDOUT: %.loc15_13.tuple.index.load = load i32, ptr %.loc15_13.tuple.index, align 4, !dbg !16 +// CHECK:STDOUT: ret i32 %.loc15_13.tuple.index.load, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -84,3 +84,14 @@ fn F() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 28, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 23, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 43, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 14, column: 46, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 42, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 10, scope: !4) +// CHECK:STDOUT: !17 = !DILocation(line: 15, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/namespace/function.carbon b/toolchain/lower/testdata/namespace/function.carbon index 654abfb35cb8..1aa9cd5c09cd 100644 --- a/toolchain/lower/testdata/namespace/function.carbon +++ b/toolchain/lower/testdata/namespace/function.carbon @@ -26,18 +26,18 @@ fn Bar() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Baz() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Baz.1() !dbg !7 { +// CHECK:STDOUT: define void @Baz.1() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Bar() !dbg !8 { +// CHECK:STDOUT: define void @Bar() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Baz.1() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Baz.1(), !dbg !11 +// CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -50,5 +50,9 @@ fn Bar() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Baz", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Baz.1", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Bar", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Baz.1", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 1, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Bar", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 21, column: 3, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 20, column: 1, scope: !10) diff --git a/toolchain/lower/testdata/namespace/nested.carbon b/toolchain/lower/testdata/namespace/nested.carbon index bb8be955c5e2..edb92a291046 100644 --- a/toolchain/lower/testdata/namespace/nested.carbon +++ b/toolchain/lower/testdata/namespace/nested.carbon @@ -23,13 +23,13 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Wiz() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Baz() !dbg !7 { +// CHECK:STDOUT: define void @Baz() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @Wiz() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @Wiz(), !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -42,4 +42,7 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Wiz", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Baz", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Baz", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 18, column: 3, scope: !8) +// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 1, scope: !8) diff --git a/toolchain/lower/testdata/operators/and.carbon b/toolchain/lower/testdata/operators/and.carbon index 7d5cbf3e6ce8..f12c7d552153 100644 --- a/toolchain/lower/testdata/operators/and.carbon +++ b/toolchain/lower/testdata/operators/and.carbon @@ -20,26 +20,26 @@ fn And() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 true +// CHECK:STDOUT: ret i1 true, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @G() !dbg !7 { +// CHECK:STDOUT: define i1 @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 true +// CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @And() !dbg !8 { +// CHECK:STDOUT: define i1 @And() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i1 @F() -// CHECK:STDOUT: br i1 %F.call, label %and.rhs, label %and.result +// CHECK:STDOUT: %F.call = call i1 @F(), !dbg !11 +// CHECK:STDOUT: br i1 %F.call, label %and.rhs, label %and.result, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: and.rhs: ; preds = %entry -// CHECK:STDOUT: %G.call = call i1 @G() -// CHECK:STDOUT: br label %and.result +// CHECK:STDOUT: %G.call = call i1 @G(), !dbg !12 +// CHECK:STDOUT: br label %and.result, !dbg !11 // CHECK:STDOUT: // 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: ret i1 %0, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -52,5 +52,10 @@ fn And() -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "And", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 18, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 18, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "And", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 10, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 18, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 3, scope: !10) diff --git a/toolchain/lower/testdata/operators/and_empty_block.carbon b/toolchain/lower/testdata/operators/and_empty_block.carbon index fdbd79bcd42e..625b8701b4ff 100644 --- a/toolchain/lower/testdata/operators/and_empty_block.carbon +++ b/toolchain/lower/testdata/operators/and_empty_block.carbon @@ -19,14 +19,14 @@ fn And(b: bool, c: bool) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @And(i1 %b, i1 %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %and.rhs, label %and.result +// CHECK:STDOUT: br i1 %b, label %and.rhs, label %and.result, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: and.rhs: ; preds = %entry -// CHECK:STDOUT: br label %and.result +// CHECK:STDOUT: br label %and.result, !dbg !7 // CHECK:STDOUT: // 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: ret i1 %0, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,3 +39,5 @@ fn And(b: bool, c: bool) -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "And", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index e2d7e6a92c51..9948bec18008 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -22,14 +22,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() !dbg !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: %.loc15_12.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_12.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc15_5, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 12, ptr %a.var, align 4, !dbg !8 +// CHECK:STDOUT: store i32 9, ptr %a.var, align 4, !dbg !9 +// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %.loc15_12.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc15_12.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc15_5, i64 8, i1 false), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -47,3 +47,10 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 7, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/operators/not.carbon b/toolchain/lower/testdata/operators/not.carbon index 2eeb4e380762..daa87aabd57f 100644 --- a/toolchain/lower/testdata/operators/not.carbon +++ b/toolchain/lower/testdata/operators/not.carbon @@ -17,8 +17,8 @@ fn Not(b: bool) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Not(i1 %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12 = xor i1 %b, true -// CHECK:STDOUT: ret i1 %.loc12 +// CHECK:STDOUT: %.loc12 = xor i1 %b, true, !dbg !7 +// CHECK:STDOUT: ret i1 %.loc12, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -31,3 +31,5 @@ fn Not(b: bool) -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Not", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/operators/or.carbon b/toolchain/lower/testdata/operators/or.carbon index 51a8f3b440ca..3155e4d16e09 100644 --- a/toolchain/lower/testdata/operators/or.carbon +++ b/toolchain/lower/testdata/operators/or.carbon @@ -20,27 +20,27 @@ fn Or() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 true +// CHECK:STDOUT: ret i1 true, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @G() !dbg !7 { +// CHECK:STDOUT: define i1 @G() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i1 true +// CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @Or() !dbg !8 { +// CHECK:STDOUT: define i1 @Or() !dbg !10 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %F.call = call i1 @F() -// CHECK:STDOUT: %.loc15_14.3 = xor i1 %F.call, true -// CHECK:STDOUT: br i1 %.loc15_14.3, label %or.rhs, label %or.result +// CHECK:STDOUT: %F.call = call i1 @F(), !dbg !11 +// CHECK:STDOUT: %.loc15_14.3 = xor i1 %F.call, true, !dbg !11 +// CHECK:STDOUT: br i1 %.loc15_14.3, label %or.rhs, label %or.result, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: or.rhs: ; preds = %entry -// CHECK:STDOUT: %G.call = call i1 @G() -// CHECK:STDOUT: br label %or.result +// CHECK:STDOUT: %G.call = call i1 @G(), !dbg !12 +// CHECK:STDOUT: br label %or.result, !dbg !11 // CHECK:STDOUT: // 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: ret i1 %0, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -53,5 +53,10 @@ fn Or() -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Or", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 18, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 18, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Or", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 10, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 17, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 3, scope: !10) diff --git a/toolchain/lower/testdata/operators/or_empty_block.carbon b/toolchain/lower/testdata/operators/or_empty_block.carbon index 817a2928c464..f795aba6e795 100644 --- a/toolchain/lower/testdata/operators/or_empty_block.carbon +++ b/toolchain/lower/testdata/operators/or_empty_block.carbon @@ -19,15 +19,15 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Or(i1 %b, i1 %c) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc14_12.1 = xor i1 %b, true -// CHECK:STDOUT: br i1 %.loc14_12.1, label %or.rhs, label %or.result +// CHECK:STDOUT: %.loc14_12.1 = xor i1 %b, true, !dbg !7 +// CHECK:STDOUT: br i1 %.loc14_12.1, label %or.rhs, label %or.result, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: or.rhs: ; preds = %entry -// CHECK:STDOUT: br label %or.result +// CHECK:STDOUT: br label %or.result, !dbg !7 // CHECK:STDOUT: // 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: ret i1 %0, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,3 +40,5 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Or", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/operators/overloaded.carbon b/toolchain/lower/testdata/operators/overloaded.carbon index a3dd06d47916..bd19cb71bae0 100644 --- a/toolchain/lower/testdata/operators/overloaded.carbon +++ b/toolchain/lower/testdata/operators/overloaded.carbon @@ -33,59 +33,59 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: // CHECK:STDOUT: define void @Op(ptr sret({ i1 }) %return, ptr %self) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc17_36.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc17_36.2 = load i1, ptr %.loc17_36.1.is_positive, align 1 -// CHECK:STDOUT: %.loc17_28 = xor i1 %.loc17_36.2, true -// CHECK:STDOUT: %.loc17_48.2.is_positive = getelementptr inbounds nuw { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %.loc17_28, ptr %.loc17_48.2.is_positive, align 1 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc17_36.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc17_36.2 = load i1, ptr %.loc17_36.1.is_positive, align 1, !dbg !7 +// CHECK:STDOUT: %.loc17_28 = xor i1 %.loc17_36.2, true, !dbg !8 +// CHECK:STDOUT: %.loc17_48.2.is_positive = getelementptr inbounds nuw { i1 }, ptr %return, i32 0, i32 0, !dbg !9 +// CHECK:STDOUT: store i1 %.loc17_28, ptr %.loc17_48.2.is_positive, align 1, !dbg !9 +// CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Op.1(ptr sret({ i1 }) %return, ptr %self, ptr %other) !dbg !7 { +// CHECK:STDOUT: define void @Op.1(ptr sret({ i1 }) %return, ptr %self, ptr %other) !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_33.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_33.2 = load i1, ptr %.loc22_33.1.is_positive, align 1 -// CHECK:STDOUT: br i1 %.loc22_33.2, label %and.rhs.loc22, label %and.result.loc22 +// CHECK:STDOUT: %.loc22_33.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !12 +// CHECK:STDOUT: %.loc22_33.2 = load i1, ptr %.loc22_33.1.is_positive, align 1, !dbg !12 +// CHECK:STDOUT: br i1 %.loc22_33.2, label %and.rhs.loc22, label %and.result.loc22, !dbg !12 // CHECK:STDOUT: // CHECK:STDOUT: and.rhs.loc22: ; preds = %entry -// CHECK:STDOUT: %.loc22_55.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_55.2 = load i1, ptr %.loc22_55.1.is_positive, align 1 -// CHECK:STDOUT: br label %and.result.loc22 +// CHECK:STDOUT: %.loc22_55.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %other, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: %.loc22_55.2 = load i1, ptr %.loc22_55.1.is_positive, align 1, !dbg !13 +// CHECK:STDOUT: br label %and.result.loc22, !dbg !12 // CHECK:STDOUT: // CHECK:STDOUT: and.result.loc22: ; preds = %and.rhs.loc22, %entry // CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %.loc22_55.2, %and.rhs.loc22 ] -// CHECK:STDOUT: %.loc22_69.1 = xor i1 %0, true -// CHECK:STDOUT: br i1 %.loc22_69.1, label %or.rhs, label %or.result +// CHECK:STDOUT: %.loc22_69.1 = xor i1 %0, true, !dbg !14 +// CHECK:STDOUT: br i1 %.loc22_69.1, label %or.rhs, label %or.result, !dbg !14 // CHECK:STDOUT: // CHECK:STDOUT: or.rhs: ; preds = %and.result.loc22 -// CHECK:STDOUT: %.loc23_38.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc23_38.2 = load i1, ptr %.loc23_38.1.is_positive, align 1 -// CHECK:STDOUT: %.loc23_30 = xor i1 %.loc23_38.2, true -// CHECK:STDOUT: br i1 %.loc23_30, label %and.rhs.loc23, label %and.result.loc23 +// CHECK:STDOUT: %.loc23_38.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !15 +// CHECK:STDOUT: %.loc23_38.2 = load i1, ptr %.loc23_38.1.is_positive, align 1, !dbg !15 +// CHECK:STDOUT: %.loc23_30 = xor i1 %.loc23_38.2, true, !dbg !16 +// CHECK:STDOUT: br i1 %.loc23_30, label %and.rhs.loc23, label %and.result.loc23, !dbg !16 // CHECK:STDOUT: // CHECK:STDOUT: and.rhs.loc23: ; preds = %or.rhs -// CHECK:STDOUT: %.loc23_64.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %.loc23_64.2 = load i1, ptr %.loc23_64.1.is_positive, align 1 -// CHECK:STDOUT: %.loc23_55 = xor i1 %.loc23_64.2, true -// CHECK:STDOUT: br label %and.result.loc23 +// CHECK:STDOUT: %.loc23_64.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %other, i32 0, i32 0, !dbg !17 +// CHECK:STDOUT: %.loc23_64.2 = load i1, ptr %.loc23_64.1.is_positive, align 1, !dbg !17 +// CHECK:STDOUT: %.loc23_55 = xor i1 %.loc23_64.2, true, !dbg !18 +// CHECK:STDOUT: br label %and.result.loc23, !dbg !16 // CHECK:STDOUT: // CHECK:STDOUT: and.result.loc23: ; preds = %and.rhs.loc23, %or.rhs // CHECK:STDOUT: %1 = phi i1 [ false, %or.rhs ], [ %.loc23_55, %and.rhs.loc23 ] -// CHECK:STDOUT: br label %or.result +// CHECK:STDOUT: br label %or.result, !dbg !14 // CHECK:STDOUT: // CHECK:STDOUT: or.result: ; preds = %and.result.loc23, %and.result.loc22 // CHECK:STDOUT: %2 = phi i1 [ true, %and.result.loc22 ], [ %1, %and.result.loc23 ] -// CHECK:STDOUT: %.loc23_77.2.is_positive = getelementptr inbounds nuw { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %2, ptr %.loc23_77.2.is_positive, align 1 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc23_77.2.is_positive = getelementptr inbounds nuw { i1 }, ptr %return, i32 0, i32 0, !dbg !19 +// CHECK:STDOUT: store i1 %2, ptr %.loc23_77.2.is_positive, align 1, !dbg !19 +// CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Calculate(ptr sret({ i1 }) %return, ptr %a, ptr %b) !dbg !8 { +// CHECK:STDOUT: define void @Calculate(ptr sret({ i1 }) %return, ptr %a, ptr %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc28_10.2.temp = alloca { i1 }, align 8 -// CHECK:STDOUT: call void @Op(ptr %.loc28_10.2.temp, ptr %a) -// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %.loc28_10.2.temp, ptr %b) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc28_10.2.temp = alloca { i1 }, align 8, !dbg !22 +// CHECK:STDOUT: call void @Op(ptr %.loc28_10.2.temp, ptr %a), !dbg !22 +// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %.loc28_10.2.temp, ptr %b), !dbg !22 +// CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives @@ -101,5 +101,20 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Op", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Op.1", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Calculate", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 17, column: 32, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 17, column: 28, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 12, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 5, scope: !4) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Op.1", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !12 = !DILocation(line: 22, column: 29, scope: !11) +// CHECK:STDOUT: !13 = !DILocation(line: 22, column: 50, scope: !11) +// CHECK:STDOUT: !14 = !DILocation(line: 22, column: 28, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 23, column: 34, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 23, column: 30, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 23, column: 59, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 23, column: 55, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 22, column: 12, scope: !11) +// CHECK:STDOUT: !20 = !DILocation(line: 22, column: 5, scope: !11) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "Calculate", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 28, column: 10, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 28, column: 3, scope: !21) diff --git a/toolchain/lower/testdata/packages/cross_package_call.carbon b/toolchain/lower/testdata/packages/cross_package_call.carbon index a40a45f75de5..6defae99e968 100644 --- a/toolchain/lower/testdata/packages/cross_package_call.carbon +++ b/toolchain/lower/testdata/packages/cross_package_call.carbon @@ -25,7 +25,7 @@ fn G() { A.F(); } // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -38,13 +38,14 @@ fn G() { A.F(); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 4, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 4, column: 1, scope: !4) // CHECK:STDOUT: ; ModuleID = 'b.carbon' // CHECK:STDOUT: source_filename = "b.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define void @G() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @F(), !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @F() @@ -59,3 +60,5 @@ fn G() { A.F(); } // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 4, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 4, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 4, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 191cc0d3ee74..457453dbddb2 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -24,13 +24,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false) -// CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @G(ptr %.loc15_7.b) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false), !dbg !9 +// CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: call void @G(ptr %.loc15_7.b), !dbg !11 +// CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -48,3 +48,9 @@ fn F() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 31, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 6, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 3, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/pointer/address_of_unused.carbon b/toolchain/lower/testdata/pointer/address_of_unused.carbon index c4949b3a257d..78339742758d 100644 --- a/toolchain/lower/testdata/pointer/address_of_unused.carbon +++ b/toolchain/lower/testdata/pointer/address_of_unused.carbon @@ -18,9 +18,9 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !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: %n.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !8 +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -33,3 +33,6 @@ fn F() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 11, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/pointer/basic.carbon b/toolchain/lower/testdata/pointer/basic.carbon index 171a403d48d9..ecaee0e24238 100644 --- a/toolchain/lower/testdata/pointer/basic.carbon +++ b/toolchain/lower/testdata/pointer/basic.carbon @@ -22,16 +22,16 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G(ptr %p) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_10.2 = load i32, ptr %p, align 4 -// CHECK:STDOUT: ret i32 %.loc12_10.2 +// CHECK:STDOUT: %.loc12_10.2 = load i32, ptr %p, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc12_10.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @F() !dbg !7 { +// CHECK:STDOUT: define i32 @F() !dbg !9 { // 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: %n.var = alloca i32, align 4, !dbg !10 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !11 +// CHECK:STDOUT: %G.call = call i32 @G(ptr %n.var), !dbg !12 +// CHECK:STDOUT: ret i32 %G.call, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -44,4 +44,10 @@ fn F() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 7, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 3, scope: !9) +// CHECK:STDOUT: !12 = !DILocation(line: 17, column: 10, scope: !9) +// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 3, scope: !9) diff --git a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon index db1298b0452d..1528ccd81f55 100644 --- a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon +++ b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon @@ -20,17 +20,17 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %p) !dbg !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: %.loc13_17.2 = load ptr, ptr %p, align 8 -// CHECK:STDOUT: store ptr %.loc13_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: %.loc15_12 = load ptr, ptr %c.var, align 8 -// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8 -// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4 -// CHECK:STDOUT: ret i32 %.loc15_10.2 +// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !7 +// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8, !dbg !8 +// CHECK:STDOUT: %b.var = alloca ptr, align 8, !dbg !9 +// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8, !dbg !10 +// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8, !dbg !11 +// CHECK:STDOUT: %c.var = alloca ptr, align 8, !dbg !12 +// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8, !dbg !13 +// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8, !dbg !14 +// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8, !dbg !15 +// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4, !dbg !16 +// CHECK:STDOUT: ret i32 %.loc15_10.2, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -43,3 +43,14 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 17, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 12, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 15, column: 11, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 10, scope: !4) +// CHECK:STDOUT: !17 = !DILocation(line: 15, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/return/code_after_return.carbon b/toolchain/lower/testdata/return/code_after_return.carbon index 28c0e4d155e9..5e6e3011932e 100644 --- a/toolchain/lower/testdata/return/code_after_return.carbon +++ b/toolchain/lower/testdata/return/code_after_return.carbon @@ -20,12 +20,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @Main() !dbg !7 { +// CHECK:STDOUT: define void @Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -38,4 +38,6 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 1, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !8) diff --git a/toolchain/lower/testdata/return/no_value.carbon b/toolchain/lower/testdata/return/no_value.carbon index 28a6bb73e767..dc5956fcb3d2 100644 --- a/toolchain/lower/testdata/return/no_value.carbon +++ b/toolchain/lower/testdata/return/no_value.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -30,3 +30,4 @@ fn Main() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/return/return_var.carbon b/toolchain/lower/testdata/return/return_var.carbon index 577a67efb740..11534473bcf9 100644 --- a/toolchain/lower/testdata/return/return_var.carbon +++ b/toolchain/lower/testdata/return/return_var.carbon @@ -24,10 +24,10 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, ptr }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc18_30.2.data = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_30.4.next = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store ptr %return, ptr %.loc18_30.4.next, align 8 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc18_30.2.data = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc18_30.4.next = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store ptr %return, ptr %.loc18_30.4.next, align 8, !dbg !7 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,3 +40,5 @@ fn Make() -> C { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Make", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 19, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/return/return_var_byval.carbon b/toolchain/lower/testdata/return/return_var_byval.carbon index ebd0896735ce..ebdd4f9fc89c 100644 --- a/toolchain/lower/testdata/return/return_var_byval.carbon +++ b/toolchain/lower/testdata/return/return_var_byval.carbon @@ -18,10 +18,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc12_16 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc12_16 +// CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 0, ptr %x.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc12_16 = load i32, ptr %x.var, align 4, !dbg !7 +// CHECK:STDOUT: ret i32 %.loc12_16, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -34,3 +34,6 @@ fn Main() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 16, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/return/value.carbon b/toolchain/lower/testdata/return/value.carbon index f86447d0265c..d73bfccad8c1 100644 --- a/toolchain/lower/testdata/return/value.carbon +++ b/toolchain/lower/testdata/return/value.carbon @@ -17,7 +17,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -30,3 +30,4 @@ fn Main() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/return/var.carbon b/toolchain/lower/testdata/return/var.carbon index 0525d4dee6b7..5e5b4d30d5c1 100644 --- a/toolchain/lower/testdata/return/var.carbon +++ b/toolchain/lower/testdata/return/var.carbon @@ -18,10 +18,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 0, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc13 +// CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 0, ptr %x.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4, !dbg !9 +// CHECK:STDOUT: ret i32 %.loc13, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -34,3 +34,7 @@ fn Main() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 10, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/struct/empty.carbon b/toolchain/lower/testdata/struct/empty.carbon index d6a786f3288b..012dfb2bfa08 100644 --- a/toolchain/lower/testdata/struct/empty.carbon +++ b/toolchain/lower/testdata/struct/empty.carbon @@ -19,9 +19,9 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca {}, align 8 -// CHECK:STDOUT: %y.var = alloca {}, align 8 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !7 +// CHECK:STDOUT: %y.var = alloca {}, align 8, !dbg !8 +// CHECK:STDOUT: ret i32 0, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -34,3 +34,6 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index b5fa1bb6c5be..730c5ba41829 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -22,18 +22,18 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8 -// CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc12_49, i64 16, i1 false) -// CHECK:STDOUT: %y.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.b, align 4 -// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %y.var, align 4 -// CHECK:STDOUT: %z.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc14_16 = load i32, ptr %y.var, align 4 -// CHECK:STDOUT: store i32 %.loc14_16, ptr %z.var, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc12_49, i64 16, i1 false), !dbg !9 +// CHECK:STDOUT: %y.var = alloca i32, align 4, !dbg !10 +// CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.b, align 4, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %y.var, align 4, !dbg !12 +// CHECK:STDOUT: %z.var = alloca i32, align 4, !dbg !13 +// CHECK:STDOUT: %.loc14_16 = load i32, ptr %y.var, align 4, !dbg !14 +// CHECK:STDOUT: store i32 %.loc14_16, ptr %z.var, align 4, !dbg !15 +// CHECK:STDOUT: ret i32 0, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -51,3 +51,13 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 31, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 16, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 14, column: 16, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/struct/nested_struct.carbon b/toolchain/lower/testdata/struct/nested_struct.carbon index 5d683a865efd..a0b61373089d 100644 --- a/toolchain/lower/testdata/struct/nested_struct.carbon +++ b/toolchain/lower/testdata/struct/nested_struct.carbon @@ -18,7 +18,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -31,3 +31,4 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon index 77024d7470db..6f0af8032057 100644 --- a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon @@ -21,12 +21,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: define void @G() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %.loc14_74.1.a = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc14_74.1.a) -// CHECK:STDOUT: %.loc14_74.2.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc14_74.2.b) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc14_74.1.a = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_74.1.a), !dbg !9 +// CHECK:STDOUT: %.loc14_74.2.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_74.2.b), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,3 +39,8 @@ fn G() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 55, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 61, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 71, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/struct/one_entry.carbon b/toolchain/lower/testdata/struct/one_entry.carbon index e5fd57122ca0..fe2bea180e21 100644 --- a/toolchain/lower/testdata/struct/one_entry.carbon +++ b/toolchain/lower/testdata/struct/one_entry.carbon @@ -19,14 +19,14 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !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: %.loc13_22.1.a = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_22.2 = load i32, ptr %.loc13_22.1.a, align 4 -// CHECK:STDOUT: %.loc13_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc13_22.2, 0 -// CHECK:STDOUT: store { i32 } %.loc13_22.3.struct.init, ptr %y.var, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7 +// CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x.var, align 4, !dbg !8 +// CHECK:STDOUT: %y.var = alloca { i32 }, align 8, !dbg !9 +// CHECK:STDOUT: %.loc13_22.1.a = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc13_22.2 = load i32, ptr %.loc13_22.1.a, align 4, !dbg !10 +// CHECK:STDOUT: %.loc13_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc13_22.2, 0, !dbg !10 +// CHECK:STDOUT: store { i32 } %.loc13_22.3.struct.init, ptr %y.var, align 4, !dbg !11 +// CHECK:STDOUT: ret i32 0, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,3 +39,9 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 22, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index acc5cfe2e9bf..3da1a1c3aa3b 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -21,20 +21,20 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc12_47, i64 8, i1 false) -// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_31.2 = load i32, ptr %.loc13_31.1.a, align 4 -// CHECK:STDOUT: %.loc13_31.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc13_31.2, ptr %.loc13_31.3.a, align 4 -// CHECK:STDOUT: %.loc13_31.5.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc13_31.6 = load i32, ptr %.loc13_31.5.b, align 4 -// CHECK:STDOUT: %.loc13_31.7.b = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc13_31.6, ptr %.loc13_31.7.b, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc12_47, i64 8, i1 false), !dbg !9 +// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_31.2 = load i32, ptr %.loc13_31.1.a, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_31.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_31.2, ptr %.loc13_31.3.a, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_31.5.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc13_31.6 = load i32, ptr %.loc13_31.5.b, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_31.7.b = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_31.6, ptr %.loc13_31.7.b, align 4, !dbg !11 +// CHECK:STDOUT: ret i32 0, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -52,3 +52,9 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 31, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 31, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/access/element_access.carbon b/toolchain/lower/testdata/tuple/access/element_access.carbon index c2d639d94be7..f4acdce8a32c 100644 --- a/toolchain/lower/testdata/tuple/access/element_access.carbon +++ b/toolchain/lower/testdata/tuple/access/element_access.carbon @@ -22,20 +22,20 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.loc12_37, i64 12, i1 false) -// CHECK:STDOUT: %b.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc13_17.1.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %b.var, align 4 -// CHECK:STDOUT: %c.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc14_17.1.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc14_17.2 = load i32, ptr %.loc14_17.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc14_17.2, ptr %c.var, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.loc12_37, i64 12, i1 false), !dbg !9 +// CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !10 +// CHECK:STDOUT: %.loc13_17.1.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.tuple.index, align 4, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %b.var, align 4, !dbg !12 +// CHECK:STDOUT: %c.var = alloca i32, align 4, !dbg !13 +// CHECK:STDOUT: %.loc14_17.1.tuple.index = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !14 +// CHECK:STDOUT: %.loc14_17.2 = load i32, ptr %.loc14_17.1.tuple.index, align 4, !dbg !14 +// CHECK:STDOUT: store i32 %.loc14_17.2, ptr %c.var, align 4, !dbg !15 +// CHECK:STDOUT: ret i32 0, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -53,3 +53,13 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 28, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 16, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 14, column: 16, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/access/return_value_access.carbon b/toolchain/lower/testdata/tuple/access/return_value_access.carbon index bbfd2e68c70b..62718e8dbe1e 100644 --- a/toolchain/lower/testdata/tuple/access/return_value_access.carbon +++ b/toolchain/lower/testdata/tuple/access/return_value_access.carbon @@ -21,21 +21,21 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !7 { +// CHECK:STDOUT: define void @main() !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %t.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc14_17.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc14_17.1.temp) -// CHECK:STDOUT: %.loc14_19.1.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_17.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_19.2 = load i32, ptr %.loc14_19.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc14_19.2, ptr %t.var, align 4 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %t.var = alloca i32, align 4, !dbg !10 +// CHECK:STDOUT: %.loc14_17.1.temp = alloca { i32, i32 }, align 8, !dbg !11 +// CHECK:STDOUT: call void @F(ptr %.loc14_17.1.temp), !dbg !11 +// CHECK:STDOUT: %.loc14_19.1.tuple.index = getelementptr inbounds nuw { i32, i32 }, ptr %.loc14_17.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc14_19.2 = load i32, ptr %.loc14_19.1.tuple.index, align 4, !dbg !11 +// CHECK:STDOUT: store i32 %.loc14_19.2, ptr %t.var, align 4, !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -53,4 +53,10 @@ fn Run() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !7 = !DILocation(line: 11, column: 31, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 11, column: 24, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 7, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 14, column: 16, scope: !9) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !9) +// CHECK:STDOUT: !13 = !DILocation(line: 13, column: 1, scope: !9) diff --git a/toolchain/lower/testdata/tuple/empty.carbon b/toolchain/lower/testdata/tuple/empty.carbon index 79d354919707..824b9076ddfe 100644 --- a/toolchain/lower/testdata/tuple/empty.carbon +++ b/toolchain/lower/testdata/tuple/empty.carbon @@ -19,9 +19,9 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca {}, align 8 -// CHECK:STDOUT: %y.var = alloca {}, align 8 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !7 +// CHECK:STDOUT: %y.var = alloca {}, align 8, !dbg !8 +// CHECK:STDOUT: ret i32 0, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -34,3 +34,6 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/nested_tuple.carbon b/toolchain/lower/testdata/tuple/nested_tuple.carbon index 4ad02cfccd19..323b35aa51b7 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple.carbon @@ -18,7 +18,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -31,3 +31,4 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon index caf8eb6b85f7..e71eaaaa0eb8 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon @@ -21,12 +21,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: define void @G() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %.loc14_56.1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc14_56.1.tuple.elem) -// CHECK:STDOUT: %.loc14_56.2.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc14_56.2.tuple.elem) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc14_56.1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_56.1.tuple.elem), !dbg !9 +// CHECK:STDOUT: %.loc14_56.2.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @F(ptr %.loc14_56.2.tuple.elem), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -39,3 +39,8 @@ fn G() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 47, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 48, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 53, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/tuple/one_entry.carbon b/toolchain/lower/testdata/tuple/one_entry.carbon index bb76d863bd92..099c941b4eba 100644 --- a/toolchain/lower/testdata/tuple/one_entry.carbon +++ b/toolchain/lower/testdata/tuple/one_entry.carbon @@ -19,14 +19,14 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !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: %.loc13_20.1.tuple.elem = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_20.2 = load i32, ptr %.loc13_20.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc13_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc13_20.2, 0 -// CHECK:STDOUT: store { i32 } %.loc13_20.3.tuple.init, ptr %y.var, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7 +// CHECK:STDOUT: store { i32 } { i32 1 }, ptr %x.var, align 4, !dbg !8 +// CHECK:STDOUT: %y.var = alloca { i32 }, align 8, !dbg !9 +// CHECK:STDOUT: %.loc13_20.1.tuple.elem = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc13_20.2 = load i32, ptr %.loc13_20.1.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %.loc13_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc13_20.2, 0, !dbg !10 +// CHECK:STDOUT: store { i32 } %.loc13_20.3.tuple.init, ptr %y.var, align 4, !dbg !11 +// CHECK:STDOUT: ret i32 0, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives @@ -42,3 +42,9 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 20, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/two_entries.carbon b/toolchain/lower/testdata/tuple/two_entries.carbon index 8305c169bd8d..c6fce943783e 100644 --- a/toolchain/lower/testdata/tuple/two_entries.carbon +++ b/toolchain/lower/testdata/tuple/two_entries.carbon @@ -21,20 +21,20 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc12_29.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_29.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @tuple.loc12_30, i64 8, i1 false) -// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc13_23.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_23.2 = load i32, ptr %.loc13_23.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc13_23.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc13_23.2, ptr %.loc13_23.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc13_23.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc13_23.6 = load i32, ptr %.loc13_23.5.tuple.elem, align 4 -// CHECK:STDOUT: %.loc13_23.7.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc13_23.6, ptr %.loc13_23.7.tuple.elem, align 4 -// CHECK:STDOUT: ret i32 0 +// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %.loc12_29.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_29.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @tuple.loc12_30, i64 8, i1 false), !dbg !9 +// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %.loc13_23.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_23.2 = load i32, ptr %.loc13_23.1.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_23.3.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_23.2, ptr %.loc13_23.3.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_23.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc13_23.6 = load i32, ptr %.loc13_23.5.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %.loc13_23.7.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store i32 %.loc13_23.6, ptr %.loc13_23.7.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: ret i32 0, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) @@ -52,3 +52,9 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 23, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 23, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/tuple/value_formation.carbon b/toolchain/lower/testdata/tuple/value_formation.carbon index 6d37943ef8db..7306d80099f1 100644 --- a/toolchain/lower/testdata/tuple/value_formation.carbon +++ b/toolchain/lower/testdata/tuple/value_formation.carbon @@ -23,41 +23,41 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: define void @F() !dbg !4 { // 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: %.loc16_6.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc16_6.2 = load i32, ptr %.loc16_6.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_6.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc16_6.4 = load i32, ptr %.loc16_6.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_6.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc16_6.6 = load i32, ptr %.loc16_6.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc16_6 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc16_61 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc16_6.2, ptr %tuple.loc16_61, align 4 -// CHECK:STDOUT: %tuple.loc16_62 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc16_6.4, ptr %tuple.loc16_62, align 4 -// CHECK:STDOUT: %tuple.loc16_63 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc16_6.6, ptr %tuple.loc16_63, align 4 -// CHECK:STDOUT: %.loc16_9.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc16_9.2 = load i32, ptr %.loc16_9.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_9.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc16_9.4 = load i32, ptr %.loc16_9.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc16_9.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc16_9.6 = load i32, ptr %.loc16_9.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc16_9 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc16_94 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc16_9.2, ptr %tuple.loc16_94, align 4 -// CHECK:STDOUT: %tuple.loc16_95 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc16_9.4, ptr %tuple.loc16_95, align 4 -// CHECK:STDOUT: %tuple.loc16_96 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc16_9.6, ptr %tuple.loc16_96, align 4 -// CHECK:STDOUT: %tuple.loc16_10 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %tuple.loc16_107 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple.loc16_6, ptr %tuple.loc16_107, align 8 -// CHECK:STDOUT: %tuple.loc16_108 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple.loc16_9, ptr %tuple.loc16_108, align 8 -// CHECK:STDOUT: call void @G(ptr %tuple.loc16_10) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %b.var = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %.loc16_6.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !9 +// CHECK:STDOUT: %.loc16_6.2 = load i32, ptr %.loc16_6.1.tuple.elem, align 4, !dbg !9 +// CHECK:STDOUT: %.loc16_6.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !9 +// CHECK:STDOUT: %.loc16_6.4 = load i32, ptr %.loc16_6.3.tuple.elem, align 4, !dbg !9 +// CHECK:STDOUT: %.loc16_6.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !9 +// CHECK:STDOUT: %.loc16_6.6 = load i32, ptr %.loc16_6.5.tuple.elem, align 4, !dbg !9 +// CHECK:STDOUT: %tuple.loc16_6 = alloca { i32, i32, i32 }, align 8, !dbg !9 +// CHECK:STDOUT: %tuple.loc16_61 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 0, !dbg !9 +// CHECK:STDOUT: store i32 %.loc16_6.2, ptr %tuple.loc16_61, align 4, !dbg !9 +// CHECK:STDOUT: %tuple.loc16_62 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 1, !dbg !9 +// CHECK:STDOUT: store i32 %.loc16_6.4, ptr %tuple.loc16_62, align 4, !dbg !9 +// CHECK:STDOUT: %tuple.loc16_63 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 2, !dbg !9 +// CHECK:STDOUT: store i32 %.loc16_6.6, ptr %tuple.loc16_63, align 4, !dbg !9 +// CHECK:STDOUT: %.loc16_9.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc16_9.2 = load i32, ptr %.loc16_9.1.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %.loc16_9.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %.loc16_9.4 = load i32, ptr %.loc16_9.3.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %.loc16_9.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: %.loc16_9.6 = load i32, ptr %.loc16_9.5.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.loc16_9 = alloca { i32, i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %tuple.loc16_94 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: store i32 %.loc16_9.2, ptr %tuple.loc16_94, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.loc16_95 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: store i32 %.loc16_9.4, ptr %tuple.loc16_95, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.loc16_96 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: store i32 %.loc16_9.6, ptr %tuple.loc16_96, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.loc16_10 = alloca { ptr, ptr }, align 8, !dbg !11 +// CHECK:STDOUT: %tuple.loc16_107 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store ptr %tuple.loc16_6, ptr %tuple.loc16_107, align 8, !dbg !11 +// CHECK:STDOUT: %tuple.loc16_108 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store ptr %tuple.loc16_9, ptr %tuple.loc16_108, align 8, !dbg !11 +// CHECK:STDOUT: call void @G(ptr %tuple.loc16_10), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -70,3 +70,10 @@ fn F() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 15, column: 7, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 6, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 9, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 5, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 16, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/tuple/value_forwarding.carbon b/toolchain/lower/testdata/tuple/value_forwarding.carbon index a0409adc7e9a..11df9e654251 100644 --- a/toolchain/lower/testdata/tuple/value_forwarding.carbon +++ b/toolchain/lower/testdata/tuple/value_forwarding.carbon @@ -21,13 +21,13 @@ fn F(a: (i32, i32, i32), b: (i32, i32, i32)) { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr %a, ptr %b) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store ptr %a, ptr %tuple1, align 8 -// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store ptr %b, ptr %tuple2, align 8 -// CHECK:STDOUT: call void @G(ptr %tuple) -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store ptr %a, ptr %tuple1, align 8, !dbg !7 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store ptr %b, ptr %tuple2, align 8, !dbg !7 +// CHECK:STDOUT: call void @G(ptr %tuple), !dbg !8 +// CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -40,3 +40,6 @@ fn F(a: (i32, i32, i32), b: (i32, i32, i32)) { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 5, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/var/local.carbon b/toolchain/lower/testdata/var/local.carbon index 36f78c30b0b5..51da2872a987 100644 --- a/toolchain/lower/testdata/var/local.carbon +++ b/toolchain/lower/testdata/var/local.carbon @@ -18,10 +18,10 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca i32, align 4 -// CHECK:STDOUT: store i32 1, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc13 +// CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 +// CHECK:STDOUT: store i32 1, ptr %x.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4, !dbg !9 +// CHECK:STDOUT: ret i32 %.loc13, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -34,3 +34,7 @@ fn Run() -> i32 { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 10, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/while/break_continue.carbon b/toolchain/lower/testdata/while/break_continue.carbon index d50ba2502633..f895e23ff4a4 100644 --- a/toolchain/lower/testdata/while/break_continue.carbon +++ b/toolchain/lower/testdata/while/break_continue.carbon @@ -33,28 +33,28 @@ fn While() { // CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: // CHECK:STDOUT: while.cond: ; preds = %entry, %if.else.loc18, %if.then.loc17 -// CHECK:STDOUT: %A.call = call i1 @A() -// CHECK:STDOUT: br i1 %A.call, label %while.body, label %while.done +// CHECK:STDOUT: %A.call = call i1 @A(), !dbg !7 +// CHECK:STDOUT: br i1 %A.call, label %while.body, label %while.done, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: while.body: ; preds = %while.cond -// CHECK:STDOUT: %B.call = call i1 @B() -// CHECK:STDOUT: br i1 %B.call, label %if.then.loc17, label %if.else.loc17 +// CHECK:STDOUT: %B.call = call i1 @B(), !dbg !9 +// CHECK:STDOUT: br i1 %B.call, label %if.then.loc17, label %if.else.loc17, !dbg !10 // CHECK:STDOUT: // CHECK:STDOUT: if.then.loc17: ; preds = %while.body -// CHECK:STDOUT: br label %while.cond +// CHECK:STDOUT: br label %while.cond, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: if.else.loc17: ; preds = %while.body -// CHECK:STDOUT: %C.call = call i1 @C() -// CHECK:STDOUT: br i1 %C.call, label %if.then.loc18, label %if.else.loc18 +// CHECK:STDOUT: %C.call = call i1 @C(), !dbg !12 +// CHECK:STDOUT: br i1 %C.call, label %if.then.loc18, label %if.else.loc18, !dbg !13 // CHECK:STDOUT: // CHECK:STDOUT: if.then.loc18: ; preds = %if.else.loc17 -// CHECK:STDOUT: br label %while.done +// CHECK:STDOUT: br label %while.done, !dbg !14 // CHECK:STDOUT: // CHECK:STDOUT: if.else.loc18: ; preds = %if.else.loc17 -// CHECK:STDOUT: br label %while.cond +// CHECK:STDOUT: br label %while.cond, !dbg !15 // CHECK:STDOUT: // CHECK:STDOUT: while.done: ; preds = %if.then.loc18, %while.cond -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder label %while.cond, { 1, 2, 0 } @@ -70,3 +70,13 @@ fn While() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "While", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 9, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 9, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 8, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 17, column: 16, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 18, column: 9, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 8, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 16, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 16, column: 3, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/while/preheader.carbon b/toolchain/lower/testdata/while/preheader.carbon index 5bee1c9d75bf..5685f67ada90 100644 --- a/toolchain/lower/testdata/while/preheader.carbon +++ b/toolchain/lower/testdata/while/preheader.carbon @@ -42,30 +42,30 @@ fn While() { // CHECK:STDOUT: br label %while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: while.cond.loc20: ; preds = %entry, %while.body.loc20 -// CHECK:STDOUT: %Cond.call.loc20 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc20, label %while.body.loc20, label %while.done.loc20 +// CHECK:STDOUT: %Cond.call.loc20 = call i1 @Cond(), !dbg !7 +// CHECK:STDOUT: br i1 %Cond.call.loc20, label %while.body.loc20, label %while.done.loc20, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: while.body.loc20: ; preds = %while.cond.loc20 -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %while.cond.loc20 +// CHECK:STDOUT: call void @F(), !dbg !9 +// CHECK:STDOUT: br label %while.cond.loc20, !dbg !10 // CHECK:STDOUT: // CHECK:STDOUT: while.done.loc20: ; preds = %while.cond.loc20 -// CHECK:STDOUT: %Cond.call.loc24 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc24, label %while.cond.loc25, label %if.else +// CHECK:STDOUT: %Cond.call.loc24 = call i1 @Cond(), !dbg !11 +// CHECK:STDOUT: br i1 %Cond.call.loc24, label %while.cond.loc25, label %if.else, !dbg !12 // CHECK:STDOUT: // CHECK:STDOUT: while.cond.loc25: ; preds = %while.body.loc25, %while.done.loc20 -// CHECK:STDOUT: %Cond.call.loc25 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc25, label %while.body.loc25, label %while.done.loc25 +// CHECK:STDOUT: %Cond.call.loc25 = call i1 @Cond(), !dbg !13 +// CHECK:STDOUT: br i1 %Cond.call.loc25, label %while.body.loc25, label %while.done.loc25, !dbg !14 // CHECK:STDOUT: // CHECK:STDOUT: while.body.loc25: ; preds = %while.cond.loc25 -// CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %while.cond.loc25 +// CHECK:STDOUT: call void @G(), !dbg !15 +// CHECK:STDOUT: br label %while.cond.loc25, !dbg !16 // CHECK:STDOUT: // CHECK:STDOUT: while.done.loc25: ; preds = %while.cond.loc25 -// CHECK:STDOUT: br label %if.else +// CHECK:STDOUT: br label %if.else, !dbg !17 // CHECK:STDOUT: // CHECK:STDOUT: if.else: ; preds = %while.done.loc25, %while.done.loc20 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder label %while.cond.loc20, { 1, 0 } @@ -81,3 +81,15 @@ fn While() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "While", scope: null, file: !3, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 20, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 20, column: 9, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 21, column: 5, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 20, column: 3, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 24, column: 7, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 24, column: 6, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 25, column: 12, scope: !4) +// CHECK:STDOUT: !14 = !DILocation(line: 25, column: 11, scope: !4) +// CHECK:STDOUT: !15 = !DILocation(line: 26, column: 7, scope: !4) +// CHECK:STDOUT: !16 = !DILocation(line: 25, column: 5, scope: !4) +// CHECK:STDOUT: !17 = !DILocation(line: 24, column: 3, scope: !4) +// CHECK:STDOUT: !18 = !DILocation(line: 19, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/while/unreachable_end.carbon b/toolchain/lower/testdata/while/unreachable_end.carbon index dceb4400d8a1..ed09fa84516f 100644 --- a/toolchain/lower/testdata/while/unreachable_end.carbon +++ b/toolchain/lower/testdata/while/unreachable_end.carbon @@ -36,20 +36,20 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: define void @While() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %while.cond +// CHECK:STDOUT: call void @F(), !dbg !7 +// CHECK:STDOUT: br label %while.cond, !dbg !8 // CHECK:STDOUT: // 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: %Cond.call = call i1 @Cond(), !dbg !9 +// CHECK:STDOUT: br i1 %Cond.call, label %while.body, label %while.done, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: while.body: ; preds = %while.cond -// CHECK:STDOUT: call void @G() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @G(), !dbg !10 +// CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: while.done: ; preds = %while.cond -// CHECK:STDOUT: call void @H() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @H(), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -62,3 +62,10 @@ fn While() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "While", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 3, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 19, column: 9, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 19, column: 10, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 20, column: 5, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 21, column: 5, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 23, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/while/while.carbon b/toolchain/lower/testdata/while/while.carbon index 0828ced9e792..ddb102008f18 100644 --- a/toolchain/lower/testdata/while/while.carbon +++ b/toolchain/lower/testdata/while/while.carbon @@ -35,20 +35,20 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: define void @While() !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %while.cond +// CHECK:STDOUT: call void @F(), !dbg !7 +// CHECK:STDOUT: br label %while.cond, !dbg !8 // CHECK:STDOUT: // 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: %Cond.call = call i1 @Cond(), !dbg !9 +// CHECK:STDOUT: br i1 %Cond.call, label %while.body, label %while.done, !dbg !8 // CHECK:STDOUT: // CHECK:STDOUT: while.body: ; preds = %while.cond -// CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %while.cond +// CHECK:STDOUT: call void @G(), !dbg !10 +// CHECK:STDOUT: br label %while.cond, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: while.done: ; preds = %while.cond -// CHECK:STDOUT: call void @H() -// CHECK:STDOUT: ret void +// CHECK:STDOUT: call void @H(), !dbg !12 +// CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -61,3 +61,10 @@ fn While() { // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "While", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 3, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 19, column: 9, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 19, column: 10, scope: !4) +// CHECK:STDOUT: !10 = !DILocation(line: 20, column: 5, scope: !4) +// CHECK:STDOUT: !11 = !DILocation(line: 19, column: 3, scope: !4) +// CHECK:STDOUT: !12 = !DILocation(line: 22, column: 3, scope: !4) +// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 1, scope: !4)