Skip to content

Commit

Permalink
Add line-level debug info (#4247)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
dwblaikie authored Aug 26, 2024
1 parent 5d73743 commit 0ae2a39
Show file tree
Hide file tree
Showing 104 changed files with 1,586 additions and 1,009 deletions.
13 changes: 10 additions & 3 deletions toolchain/lower/file_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions toolchain/lower/file_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion toolchain/lower/function_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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* {
Expand Down Expand Up @@ -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) \
Expand All @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions toolchain/lower/function_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -149,6 +150,8 @@ class FunctionContext {

llvm::IRBuilder<llvm::ConstantFolder, Inserter> builder_;

llvm::DISubprogram* di_subprogram_;

// The optional vlog stream.
llvm::raw_ostream* vlog_stream_;

Expand Down
12 changes: 8 additions & 4 deletions toolchain/lower/testdata/alias/local.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
17 changes: 11 additions & 6 deletions toolchain/lower/testdata/array/array_in_place.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
41 changes: 23 additions & 18 deletions toolchain/lower/testdata/array/assign_return_value.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
81 changes: 48 additions & 33 deletions toolchain/lower/testdata/array/base.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Loading

0 comments on commit 0ae2a39

Please sign in to comment.