Add separators between files in LLVM IR dumps (#7463)

Each file dump now starts with a `; ---` comment and ends with a blank
line. This makes it easier to visually scan the dump for a file of
interest. The comment format is somewhat arbitrary; I chose `---` to
align with the `--- filename.carbon` separator in SemIR dumps, but
without the filename, because that appears on each of the next two lines
already.
This commit is contained in:
Geoff Romer
2026-07-07 16:31:24 +00:00
committed by GitHub
parent e1cf833c45
commit ae3c4266d4
240 changed files with 778 additions and 0 deletions
@@ -62,6 +62,7 @@ inline void G2() {
fn H() { Cpp.G2(); }
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'other.carbon'
// CHECK:STDOUT: source_filename = "other.carbon"
// CHECK:STDOUT:
@@ -130,6 +131,8 @@ fn H() { Cpp.G2(); }
// CHECK:STDOUT: !27 = !DISubroutineType(types: !28)
// CHECK:STDOUT: !28 = !{!18}
// CHECK:STDOUT: !29 = !DILocation(line: 13, column: 3, scope: !26)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'function.carbon'
// CHECK:STDOUT: source_filename = "function.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -290,6 +293,8 @@ fn H() { Cpp.G2(); }
// CHECK:STDOUT: !39 = !{!40}
// CHECK:STDOUT: !40 = !DILocalVariable(arg: 1, scope: !38, type: !30)
// CHECK:STDOUT: !41 = !DILocation(line: 12, column: 1, scope: !38)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'single_file.carbon'
// CHECK:STDOUT: source_filename = "single_file.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -368,3 +373,4 @@ fn H() { Cpp.G2(); }
// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main", scope: null, file: !1, line: 20, type: !12, spFlags: DISPFlagDefinition, unit: !0)
// CHECK:STDOUT: !18 = !DILocation(line: 20, column: 10, scope: !17)
// CHECK:STDOUT: !19 = !DILocation(line: 20, column: 1, scope: !17)
// CHECK:STDOUT:
@@ -22,6 +22,7 @@ fn Run() {
Cpp.N.Run();
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'carbon_run.carbon'
// CHECK:STDOUT: source_filename = "carbon_run.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -64,3 +65,4 @@ fn Run() {
// CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK:STDOUT: !15 = !DILocation(line: 9, column: 3, scope: !11)
// CHECK:STDOUT: !16 = !DILocation(line: 8, column: 1, scope: !11)
// CHECK:STDOUT:
@@ -132,6 +132,7 @@ fn MyF() -> i32 {
return value;
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_function_decl.carbon'
// CHECK:STDOUT: source_filename = "import_function_decl.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -169,6 +170,8 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !13 = !{null}
// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11)
// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_inline_function_decl.carbon'
// CHECK:STDOUT: source_filename = "import_inline_function_decl.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -212,6 +215,8 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !13 = !{null}
// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11)
// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_inline_used_function_decl.carbon'
// CHECK:STDOUT: source_filename = "import_inline_used_function_decl.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -260,6 +265,8 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !13 = !{null}
// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11)
// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_multiple_inline_function_decls.carbon'
// CHECK:STDOUT: source_filename = "import_multiple_inline_function_decls.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -323,6 +330,8 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !15 = !DILocation(line: 8, column: 3, scope: !11)
// CHECK:STDOUT: !16 = !DILocation(line: 9, column: 3, scope: !11)
// CHECK:STDOUT: !17 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_inline_recursive_function_decl.carbon'
// CHECK:STDOUT: source_filename = "import_inline_recursive_function_decl.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -376,6 +385,8 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !13 = !{null}
// CHECK:STDOUT: !14 = !DILocation(line: 8, column: 3, scope: !11)
// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'call_with_default_args.carbon'
// CHECK:STDOUT: source_filename = "call_with_default_args.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -492,3 +503,4 @@ fn MyF() -> i32 {
// CHECK:STDOUT: !29 = !{!30}
// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !26, type: !14)
// CHECK:STDOUT: !31 = !DILocation(line: 11, column: 3, scope: !26)
// CHECK:STDOUT:
@@ -30,6 +30,7 @@ fn F() {
//@dump-sem-ir-end
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'use_class_template.carbon'
// CHECK:STDOUT: source_filename = "use_class_template.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -75,3 +76,4 @@ fn F() {
// CHECK:STDOUT: !13 = !{null}
// CHECK:STDOUT: !14 = !DILocation(line: 8, column: 3, scope: !11)
// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11)
// CHECK:STDOUT:
@@ -24,6 +24,7 @@ fn Call() -> i32 {
return n;
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_inline.carbon'
// CHECK:STDOUT: source_filename = "import_inline.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -96,3 +97,4 @@ fn Call() -> i32 {
// CHECK:STDOUT: !25 = !{!26}
// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !22, type: !17)
// CHECK:STDOUT: !27 = !DILocation(line: 22, column: 3, scope: !22)
// CHECK:STDOUT:
@@ -108,6 +108,7 @@ fn PassValueExpr(y: Cpp.Y) {
Cpp.pass_struct(y);
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_ints.carbon'
// CHECK:STDOUT: source_filename = "import_ints.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -355,6 +356,8 @@ fn PassValueExpr(y: Cpp.Y) {
// CHECK:STDOUT: !75 = distinct !DISubprogram(name: "__global_init", linkageName: "_C__global_init.Main", scope: null, file: !1, type: !12, spFlags: DISPFlagDefinition, unit: !0)
// CHECK:STDOUT: !76 = !DILocation(line: 14, column: 1, scope: !75)
// CHECK:STDOUT: !77 = !DILocation(line: 0, scope: !75)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_struct.carbon'
// CHECK:STDOUT: source_filename = "import_struct.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -474,6 +477,8 @@ fn PassValueExpr(y: Cpp.Y) {
// CHECK:STDOUT: !31 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "")
// CHECK:STDOUT: !32 = !DILocation(line: 9, column: 28, scope: !30)
// CHECK:STDOUT: !33 = !DILocation(line: 9, column: 21, scope: !30)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_class_with_nontrivial_copy.carbon'
// CHECK:STDOUT: source_filename = "import_class_with_nontrivial_copy.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -581,3 +586,4 @@ fn PassValueExpr(y: Cpp.Y) {
// CHECK:STDOUT: !32 = !DILocalVariable(arg: 1, scope: !27, type: !30)
// CHECK:STDOUT: !33 = !DILocation(line: 21, column: 3, scope: !27)
// CHECK:STDOUT: !34 = !DILocation(line: 20, column: 1, scope: !27)
// CHECK:STDOUT:
@@ -112,6 +112,7 @@ fn Call(x: Cpp.D) -> Cpp.C {
return Cpp.f(x);
}
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_ints.carbon'
// CHECK:STDOUT: source_filename = "import_ints.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -547,6 +548,8 @@ fn Call(x: Cpp.D) -> Cpp.C {
// CHECK:STDOUT: !152 = !{!153}
// CHECK:STDOUT: !153 = !DILocalVariable(arg: 1, scope: !149, type: !34)
// CHECK:STDOUT: !154 = !DILocation(line: 35, column: 3, scope: !149)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'import_class.carbon'
// CHECK:STDOUT: source_filename = "import_class.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -641,6 +644,8 @@ fn Call(x: Cpp.D) -> Cpp.C {
// CHECK:STDOUT: !26 = !DILocation(line: 13, column: 3, scope: !25)
// CHECK:STDOUT: !27 = !DILocation(line: 13, column: 18, scope: !25)
// CHECK:STDOUT: !28 = !DILocation(line: 12, column: 1, scope: !25)
// CHECK:STDOUT:
// CHECK:STDOUT: ; ---
// CHECK:STDOUT: ; ModuleID = 'indirect_return_with_args.carbon'
// CHECK:STDOUT: source_filename = "indirect_return_with_args.carbon"
// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -705,3 +710,4 @@ fn Call(x: Cpp.D) -> Cpp.C {
// CHECK:STDOUT: !21 = !{!"any pointer", !9, i64 0}
// CHECK:STDOUT: !22 = !{!23, !23, i64 0}
// CHECK:STDOUT: !23 = !{!"p1 _ZTS1C", !21, i64 0}
// CHECK:STDOUT: