xref: /aosp_15_r20/external/llvm/test/Transforms/StripSymbols/strip-dead-debug-info.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; CHECK: ModuleID = '{{.*}}'
4*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: "bar"
5*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: "abcd"
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@xyz = global i32 2
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
10*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone ssp
13*9880d681SAndroid Build Coastguard Workerdefine i32 @fn() #1 !dbg !6 {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !18
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readonly ssp
19*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i32 %i) #2 !dbg !10 {
20*9880d681SAndroid Build Coastguard Workerentry:
21*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !DIExpression()), !dbg !20
22*9880d681SAndroid Build Coastguard Worker  %.0 = load i32, i32* @xyz, align 4
23*9880d681SAndroid Build Coastguard Worker  ret i32 %.0, !dbg !21
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone }
27*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone ssp }
28*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readonly ssp }
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
31*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!25}
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !{}, retainedTypes: !{}, globals: !24)
34*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "g.c", directory: "/tmp/")
35*9880d681SAndroid Build Coastguard Worker!2 = !{null}
36*9880d681SAndroid Build Coastguard Worker!3 = distinct !DISubprogram(name: "bar", line: 5, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !4)
37*9880d681SAndroid Build Coastguard Worker!4 = !DISubroutineType(types: !2)
38*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "g.c", directory: "/tmp/")
39*9880d681SAndroid Build Coastguard Worker!6 = distinct !DISubprogram(name: "fn", linkageName: "fn", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !7)
40*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8)
41*9880d681SAndroid Build Coastguard Worker!8 = !{!9}
42*9880d681SAndroid Build Coastguard Worker!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
43*9880d681SAndroid Build Coastguard Worker!10 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !11)
44*9880d681SAndroid Build Coastguard Worker!11 = !DISubroutineType(types: !12)
45*9880d681SAndroid Build Coastguard Worker!12 = !{!9, !9}
46*9880d681SAndroid Build Coastguard Worker!13 = !DILocalVariable(name: "bb", line: 5, scope: !14, file: !5, type: !9)
47*9880d681SAndroid Build Coastguard Worker!14 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !3)
48*9880d681SAndroid Build Coastguard Worker!15 = !DILocalVariable(name: "i", line: 7, arg: 1, scope: !10, file: !5, type: !9)
49*9880d681SAndroid Build Coastguard Worker!16 = !DIGlobalVariable(name: "abcd", line: 2, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !9)
50*9880d681SAndroid Build Coastguard Worker!17 = !DIGlobalVariable(name: "xyz", line: 3, isLocal: false, isDefinition: true, scope: !5, file: !5, type: !9, variable: i32* @xyz)
51*9880d681SAndroid Build Coastguard Worker!18 = !DILocation(line: 6, scope: !19)
52*9880d681SAndroid Build Coastguard Worker!19 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !6)
53*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 7, scope: !10)
54*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 10, scope: !22)
55*9880d681SAndroid Build Coastguard Worker!22 = distinct !DILexicalBlock(line: 7, column: 0, file: !1, scope: !10)
56*9880d681SAndroid Build Coastguard Worker!24 = !{!16, !17}
57*9880d681SAndroid Build Coastguard Worker!25 = !{i32 1, !"Debug Info Version", i32 3}
58