xref: /llvm-project/llvm/test/Transforms/StripSymbols/strip-cu-with-dangling-subprogram.ll (revision 2bb5535b58edb04358e58495b302c9613b101227)
1; This test checks that strip-dead-debug-info pass deletes debug compile units
2; if functions from those units are absent in that module.
3
4; RUN: opt -passes='strip-dead-debug-info,verify' %s -S | FileCheck %s
5
6; CHECK: !llvm.dbg.cu = !{!{{[0-9]+}}, !{{[0-9]+}}}
7; CHECK-COUNT-2: !DICompileUnit
8
9;target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
10;target triple = "spir64-unknown-unknown"
11
12; Function Attrs: nounwind
13define void @dev_func1() #0 !dbg !13 {
14  ret void, !dbg !14
15}
16
17; Function Attrs: nounwind
18define void @dev_func2() #0 !dbg !15 {
19  ret void, !dbg !16
20}
21
22attributes #0 = { nounwind }
23
24!llvm.dbg.cu = !{!0, !3, !5}
25!llvm.module.flags = !{!12}
26
27!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !2, splitDebugInlining: false, nameTableKind: None)
28!1 = !DIFile(filename: "dev_func1.cpp", directory: "/home/user/test")
29!2 = !{}
30!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !4, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !2, splitDebugInlining: false, nameTableKind: None)
31!4 = !DIFile(filename: "dev_func2.cpp", directory: "/home/user/test")
32!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !6, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, imports: !7, splitDebugInlining: false, nameTableKind: None)
33!6 = !DIFile(filename: "dev_func3.cpp", directory: "/home/user/test")
34!7 = !{!8}
35!8 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !6, entity: !9, file: !6, line: 129)
36!9 = distinct !DISubprogram(name: "dev_func3", linkageName: "dev_func3", scope: !6, file: !6, line: 96, type: !10, scopeLine: 96, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !2)
37!10 = !DISubroutineType(types: !11)
38!11 = !{null}
39!12 = !{i32 2, !"Debug Info Version", i32 3}
40!13 = distinct !DISubprogram(name: "dev_func1", linkageName: "dev_func1", scope: !1, file: !1, line: 22, type: !10, scopeLine: 22, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
41!14 = !DILocation(line: 29, column: 5, scope: !13)
42!15 = distinct !DISubprogram(name: "dev_func2", linkageName: "dev_func2", scope: !4, file: !4, line: 22, type: !10, scopeLine: 22, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !3, retainedNodes: !2)
43!16 = !DILocation(line: 29, column: 5, scope: !15)
44