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