1 ; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
2 ; RUN: opt -passes='strip-dead-debug-info,verify' %s -S | FileCheck %s
4 ; CHECK: ModuleID = '{{.*}}'
12 source_filename = "test/Transforms/StripSymbols/strip-dead-debug-info.ll"
14 @xyz = global i32 2, !dbg !0
16 ; Function Attrs: nounwind readnone
17 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
19 ; Function Attrs: nounwind readnone ssp
20 define i32 @fn() #1 !dbg !10 {
25 ; Function Attrs: nounwind readonly ssp
26 define i32 @foo(i32 %i) #2 !dbg !15 {
28 tail call void @llvm.dbg.value(metadata i32 %i, metadata !18, metadata !19), !dbg !20
29 %.0 = load i32, i32* @xyz, align 4, !dbg !30
33 attributes #0 = { nounwind readnone }
34 attributes #1 = { nounwind readnone ssp }
35 attributes #2 = { nounwind readonly ssp }
37 !llvm.dbg.cu = !{!4, !23, !24, !28}
38 !llvm.module.flags = !{!9}
40 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
41 !1 = !DIGlobalVariable(name: "xyz", scope: !2, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true)
42 !2 = !DIFile(filename: "g.c", directory: "/tmp/")
43 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
44 !4 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6)
47 !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression())
48 !8 = !DIGlobalVariable(name: "abcd", scope: !2, file: !2, line: 2, type: !3, isLocal: true, isDefinition: true)
49 !9 = !{i32 1, !"Debug Info Version", i32 3}
50 !10 = distinct !DISubprogram(name: "fn", linkageName: "fn", scope: null, file: !2, line: 6, type: !11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4)
51 !11 = !DISubroutineType(types: !12)
53 !13 = !DILocation(line: 6, scope: !14)
54 !14 = distinct !DILexicalBlock(scope: !10, file: !2, line: 6)
55 !15 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !2, line: 7, type: !16, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4)
56 !16 = !DISubroutineType(types: !17)
58 !18 = !DILocalVariable(name: "i", arg: 1, scope: !15, file: !2, line: 7, type: !3)
60 !20 = !DILocation(line: 7, scope: !15)
61 !21 = !DILocation(line: 10, scope: !22)
62 !22 = distinct !DILexicalBlock(scope: !15, file: !2, line: 7)
63 !23 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "GCC", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !5)
64 !24 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "Globals", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !25)
66 !26 = !DIGlobalVariableExpression(var: !27, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value))
67 !27 = !DIGlobalVariable(name: "abcd2", scope: !2, file: !2, line: 2, type: !3, isLocal: true, isDefinition: true)
68 !28 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "InlineTest", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !5)
69 !29 = distinct !DISubprogram(name: "inlinefunc", linkageName: "inlinefunc", scope: null, file: !2, line: 7, type: !16, isLocal: false, isDefinition: true, isOptimized: true, unit: !28)
70 !30 = !DILocation(line: 100, scope: !29, inlinedAt: !21)
71 !31 = !DIGlobalVariableExpression(var: !32, expr: !DIExpression(DW_OP_consts, 18446744073709551615, DW_OP_stack_value))
72 !32 = !DIGlobalVariable(name: "abcd3", scope: !2, file: !2, line: 3, type: !3, isLocal: true, isDefinition: true)