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
7@xyz = global i32 2
8
9; Function Attrs: nounwind readnone
10declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
11
12; Function Attrs: nounwind readnone ssp
13define i32 @fn() #1 !dbg !6 {
14entry:
15  ret i32 0, !dbg !18
16}
17
18; Function Attrs: nounwind readonly ssp
19define i32 @foo(i32 %i) #2 !dbg !10 {
20entry:
21  tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !DIExpression()), !dbg !20
22  %.0 = load i32, i32* @xyz, align 4
23  ret i32 %.0, !dbg !21
24}
25
26attributes #0 = { nounwind readnone }
27attributes #1 = { nounwind readnone ssp }
28attributes #2 = { nounwind readonly ssp }
29
30!llvm.dbg.cu = !{!0}
31!llvm.module.flags = !{!25}
32
33!0 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 1, file: !1, enums: !{}, retainedTypes: !{}, subprograms: !23, globals: !24)
34!1 = !DIFile(filename: "g.c", directory: "/tmp/")
35!2 = !{null}
36!3 = distinct !DISubprogram(name: "bar", line: 5, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !1, scope: null, type: !4)
37!4 = !DISubroutineType(types: !2)
38!5 = !DIFile(filename: "g.c", directory: "/tmp/")
39!6 = distinct !DISubprogram(name: "fn", linkageName: "fn", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !1, scope: null, type: !7)
40!7 = !DISubroutineType(types: !8)
41!8 = !{!9}
42!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
43!10 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !1, scope: null, type: !11)
44!11 = !DISubroutineType(types: !12)
45!12 = !{!9, !9}
46!13 = !DILocalVariable(name: "bb", line: 5, scope: !14, file: !5, type: !9)
47!14 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !3)
48!15 = !DILocalVariable(name: "i", line: 7, arg: 1, scope: !10, file: !5, type: !9)
49!16 = !DIGlobalVariable(name: "abcd", line: 2, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !9)
50!17 = !DIGlobalVariable(name: "xyz", line: 3, isLocal: false, isDefinition: true, scope: !5, file: !5, type: !9, variable: i32* @xyz)
51!18 = !DILocation(line: 6, scope: !19)
52!19 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !6)
53!20 = !DILocation(line: 7, scope: !10)
54!21 = !DILocation(line: 10, scope: !22)
55!22 = distinct !DILexicalBlock(line: 7, column: 0, file: !1, scope: !10)
56!23 = !{!3, !6, !10}
57!24 = !{!16, !17}
58!25 = !{i32 1, !"Debug Info Version", i32 3}
59