xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/dbg-value-inlined-parameter.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-apple-darwin < %s -filetype=obj \
2*9880d681SAndroid Build Coastguard Worker; RUN:     | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-linux-gnu < %s -filetype=obj \
4*9880d681SAndroid Build Coastguard Worker; RUN:     | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK --check-prefix=LINUX %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-apple-darwin < %s -filetype=obj -regalloc=basic \
6*9880d681SAndroid Build Coastguard Worker; RUN:     | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
9*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_abstract_origin {{.*}} "foo"
10*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_formal_parameter
11*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
12*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_abstract_origin {{.*}} "sp"
13*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_formal_parameter
14*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
15*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_abstract_origin {{.*}} "nums"
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
19*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_name {{.*}} "foo"
20*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_formal_parameter
21*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
22*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_name {{.*}} "sp"
23*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_formal_parameter
24*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
25*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_name {{.*}} "nums"
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker;CHECK: DW_TAG_inlined_subroutine
28*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: DW_AT_abstract_origin {{.*}} "foo"
29*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]
30*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]
31*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: DW_AT_call_file
32*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: DW_AT_call_line
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker;CHECK: DW_TAG_formal_parameter
35*9880d681SAndroid Build Coastguard Worker;FIXME: Linux shouldn't drop this parameter either...
36*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: DW_TAG
37*9880d681SAndroid Build Coastguard Worker;DARWIN:   DW_AT_abstract_origin {{.*}} "sp"
38*9880d681SAndroid Build Coastguard Worker;DARWIN: DW_TAG_formal_parameter
39*9880d681SAndroid Build Coastguard Worker;CHECK: DW_AT_abstract_origin {{.*}} "nums"
40*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: DW_TAG_formal_parameter
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker%struct.S1 = type { float*, i32 }
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker@p = common global %struct.S1 zeroinitializer, align 8
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp !dbg !0 {
47*9880d681SAndroid Build Coastguard Workerentry:
48*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata %struct.S1* %sp, i64 0, metadata !9, metadata !DIExpression()), !dbg !20
49*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 %nums, i64 0, metadata !18, metadata !DIExpression()), !dbg !21
50*9880d681SAndroid Build Coastguard Worker  %tmp2 = getelementptr inbounds %struct.S1, %struct.S1* %sp, i64 0, i32 1, !dbg !22
51*9880d681SAndroid Build Coastguard Worker  store i32 %nums, i32* %tmp2, align 4, !dbg !22
52*9880d681SAndroid Build Coastguard Worker  %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27
53*9880d681SAndroid Build Coastguard Worker  %tmp5 = getelementptr inbounds %struct.S1, %struct.S1* %sp, i64 0, i32 0, !dbg !27
54*9880d681SAndroid Build Coastguard Worker  store float* %call, float** %tmp5, align 8, !dbg !27
55*9880d681SAndroid Build Coastguard Worker  %cmp = icmp ne float* %call, null, !dbg !29
56*9880d681SAndroid Build Coastguard Worker  %cond = zext i1 %cmp to i32, !dbg !29
57*9880d681SAndroid Build Coastguard Worker  ret i32 %cond, !dbg !29
58*9880d681SAndroid Build Coastguard Worker}
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Workerdeclare float* @bar(i32) optsize
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Workerdefine void @foobar() nounwind optsize ssp !dbg !6 {
63*9880d681SAndroid Build Coastguard Workerentry:
64*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata %struct.S1* @p, i64 0, metadata !9, metadata !DIExpression()) nounwind, !dbg !31
65*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 1, i64 0, metadata !18, metadata !DIExpression()) nounwind, !dbg !35
66*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* getelementptr inbounds (%struct.S1, %struct.S1* @p, i64 0, i32 1), align 8, !dbg !36
67*9880d681SAndroid Build Coastguard Worker  %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37
68*9880d681SAndroid Build Coastguard Worker  store float* %call.i, float** getelementptr inbounds (%struct.S1, %struct.S1* @p, i64 0, i32 0), align 8, !dbg !37
69*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !38
70*9880d681SAndroid Build Coastguard Worker}
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!2}
75*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!43}
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Worker!0 = distinct !DISubprogram(name: "foo", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, scopeLine: 8, file: !1, scope: !1, type: !3, variables: !41)
78*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "nm2.c", directory: "/private/tmp")
79*9880d681SAndroid Build Coastguard Worker!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 125693)", isOptimized: true, emissionKind: FullDebug, file: !42, enums: !{}, retainedTypes: !{}, globals: !40, imports:  !44)
80*9880d681SAndroid Build Coastguard Worker!3 = !DISubroutineType(types: !4)
81*9880d681SAndroid Build Coastguard Worker!4 = !{!5}
82*9880d681SAndroid Build Coastguard Worker!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
83*9880d681SAndroid Build Coastguard Worker!6 = distinct !DISubprogram(name: "foobar", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, file: !1, scope: !1, type: !7)
84*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8)
85*9880d681SAndroid Build Coastguard Worker!8 = !{null}
86*9880d681SAndroid Build Coastguard Worker!9 = !DILocalVariable(name: "sp", line: 7, arg: 1, scope: !0, file: !1, type: !10)
87*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !2, baseType: !11)
88*9880d681SAndroid Build Coastguard Worker!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", line: 4, file: !42, scope: !2, baseType: !12)
89*9880d681SAndroid Build Coastguard Worker!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "S1", line: 1, size: 128, align: 64, file: !42, scope: !2, elements: !13)
90*9880d681SAndroid Build Coastguard Worker!13 = !{!14, !17}
91*9880d681SAndroid Build Coastguard Worker!14 = !DIDerivedType(tag: DW_TAG_member, name: "m", line: 2, size: 64, align: 64, file: !42, scope: !1, baseType: !15)
92*9880d681SAndroid Build Coastguard Worker!15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !2, baseType: !16)
93*9880d681SAndroid Build Coastguard Worker!16 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
94*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_member, name: "nums", line: 3, size: 32, align: 32, offset: 64, file: !42, scope: !1, baseType: !5)
95*9880d681SAndroid Build Coastguard Worker!18 = !DILocalVariable(name: "nums", line: 7, arg: 2, scope: !0, file: !1, type: !5)
96*9880d681SAndroid Build Coastguard Worker!19 = !DIGlobalVariable(name: "p", line: 14, isLocal: false, isDefinition: true, scope: !2, file: !1, type: !11, variable: %struct.S1* @p)
97*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 7, column: 13, scope: !0)
98*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 7, column: 21, scope: !0)
99*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 9, column: 3, scope: !23)
100*9880d681SAndroid Build Coastguard Worker!23 = distinct !DILexicalBlock(line: 8, column: 1, file: !1, scope: !0)
101*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 10, column: 3, scope: !23)
102*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 11, column: 3, scope: !23)
103*9880d681SAndroid Build Coastguard Worker!30 = !{%struct.S1* @p}
104*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 7, column: 13, scope: !0, inlinedAt: !32)
105*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 16, column: 3, scope: !33)
106*9880d681SAndroid Build Coastguard Worker!33 = distinct !DILexicalBlock(line: 15, column: 15, file: !1, scope: !6)
107*9880d681SAndroid Build Coastguard Worker!34 = !{i32 1}
108*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 7, column: 21, scope: !0, inlinedAt: !32)
109*9880d681SAndroid Build Coastguard Worker!36 = !DILocation(line: 9, column: 3, scope: !23, inlinedAt: !32)
110*9880d681SAndroid Build Coastguard Worker!37 = !DILocation(line: 10, column: 3, scope: !23, inlinedAt: !32)
111*9880d681SAndroid Build Coastguard Worker!38 = !DILocation(line: 17, column: 1, scope: !33)
112*9880d681SAndroid Build Coastguard Worker!40 = !{!19}
113*9880d681SAndroid Build Coastguard Worker!41 = !{!9, !18}
114*9880d681SAndroid Build Coastguard Worker!42 = !DIFile(filename: "nm2.c", directory: "/private/tmp")
115*9880d681SAndroid Build Coastguard Worker!43 = !{i32 1, !"Debug Info Version", i32 3}
116*9880d681SAndroid Build Coastguard Worker!44 = !{}
117