|
| 1 | +; Check that call site entries are emitted correctly when using split-dwarf |
| 2 | +; together with some form of LTO. |
| 3 | + |
| 4 | +; Original C source: |
| 5 | +; |
| 6 | +; // cu1.c |
| 7 | +; extern void callee(void); |
| 8 | +; void caller(void) { |
| 9 | +; callee(); |
| 10 | +; } |
| 11 | +; |
| 12 | +; // cu2.c |
| 13 | +; __attribute__((optnone)) void callee(void) {} |
| 14 | +; |
| 15 | +; Steps to reproduce: |
| 16 | +; |
| 17 | +; (The -O1 here is needed to trigger call site entry emission, as these tags are |
| 18 | +; generally not emitted at -O0.) |
| 19 | +; |
| 20 | +; clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -O1 ~/tmp/cu1.c -S -emit-llvm -o ~/tmp/cu1.ll |
| 21 | +; clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -O1 ~/tmp/cu2.c -S -emit-llvm -o ~/tmp/cu2.ll |
| 22 | +; llvm-link -o ~/tmp/cu-merged.bc ~/tmp/cu1.ll ~/tmp/cu2.ll |
| 23 | +; llc -split-dwarf-file=foo.dwo -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o - ~/tmp/cu-merged.bc |
| 24 | + |
| 25 | +; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t |
| 26 | +; RUN: llvm-dwarfdump %t | FileCheck %s |
| 27 | + |
| 28 | +; CHECK: DW_TAG_GNU_call_site |
| 29 | +; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "callee" |
| 30 | + |
| 31 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 32 | +target triple = "x86_64-unknown-linux-gnu" |
| 33 | + |
| 34 | +define dso_local void @caller() local_unnamed_addr !dbg !14 { |
| 35 | +entry: |
| 36 | + call void @callee(), !dbg !15 |
| 37 | + ret void, !dbg !16 |
| 38 | +} |
| 39 | + |
| 40 | +define dso_local void @callee() local_unnamed_addr noinline optnone !dbg !17 { |
| 41 | +entry: |
| 42 | + ret void, !dbg !19 |
| 43 | +} |
| 44 | + |
| 45 | +!llvm.dbg.cu = !{!0, !8} |
| 46 | +!llvm.ident = !{!10, !10} |
| 47 | +!llvm.module.flags = !{!11, !12, !13} |
| 48 | + |
| 49 | +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ([email protected]:llvm/llvm-project.git 170f4b972e7bcf1f2af98bdd7145954efd16e038)", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "cu1.dwo", emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: GNU) |
| 50 | +!1 = !DIFile(filename: "/Users/vsk/tmp/cu1.c", directory: "/Users/vsk/src/builds/llvm-project-master-RA") |
| 51 | +!2 = !{} |
| 52 | +!3 = !{!4} |
| 53 | +!4 = !DISubprogram(name: "callee", scope: !5, file: !5, line: 1, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) |
| 54 | +!5 = !DIFile(filename: "tmp/cu1.c", directory: "/Users/vsk") |
| 55 | +!6 = !DISubroutineType(types: !7) |
| 56 | +!7 = !{null} |
| 57 | +!8 = distinct !DICompileUnit(language: DW_LANG_C99, file: !9, producer: "clang version 11.0.0 ([email protected]:llvm/llvm-project.git 170f4b972e7bcf1f2af98bdd7145954efd16e038)", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "cu2.dwo", emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: GNU) |
| 58 | +!9 = !DIFile(filename: "/Users/vsk/tmp/cu2.c", directory: "/Users/vsk/src/builds/llvm-project-master-RA") |
| 59 | +!10 = !{! "clang version 11.0.0 ([email protected]:llvm/llvm-project.git 170f4b972e7bcf1f2af98bdd7145954efd16e038)"} |
| 60 | +!11 = !{i32 7, !"Dwarf Version", i32 4} |
| 61 | +!12 = !{i32 2, !"Debug Info Version", i32 3} |
| 62 | +!13 = !{i32 1, !"wchar_size", i32 4} |
| 63 | +!14 = distinct !DISubprogram(name: "caller", scope: !5, file: !5, line: 2, type: !6, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 64 | +!15 = !DILocation(line: 3, column: 3, scope: !14) |
| 65 | +!16 = !DILocation(line: 4, column: 1, scope: !14) |
| 66 | +!17 = distinct !DISubprogram(name: "callee", scope: !18, file: !18, line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !8, retainedNodes: !2) |
| 67 | +!18 = !DIFile(filename: "tmp/cu2.c", directory: "/Users/vsk") |
| 68 | +!19 = !DILocation(line: 1, column: 45, scope: !17) |
0 commit comments