xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/inlined-formal-parameter.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -filetype=obj -o %t.o %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Testcase generated using 'clang -g -O2 -S -emit-llvm' from the following:
5*9880d681SAndroid Build Coastguard Worker;; void sink(void);
6*9880d681SAndroid Build Coastguard Worker;; static __attribute__((always_inline)) void bar(int a) { sink(); }
7*9880d681SAndroid Build Coastguard Worker;; void foo(void) {
8*9880d681SAndroid Build Coastguard Worker;;   bar(0);
9*9880d681SAndroid Build Coastguard Worker;;   bar(0);
10*9880d681SAndroid Build Coastguard Worker;; }
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; Check that we have formal parameters for 'a' in both inlined subroutines.
13*9880d681SAndroid Build Coastguard Worker; CHECK:       DW_TAG_inlined_subroutine
14*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    DW_AT_abstract_origin {{.*}} "bar"
15*9880d681SAndroid Build Coastguard Worker; CHECK:         DW_TAG_formal_parameter
16*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:      DW_AT_const_value
17*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:      DW_AT_abstract_origin {{.*}} "a"
18*9880d681SAndroid Build Coastguard Worker; CHECK:       DW_TAG_inlined_subroutine
19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    DW_AT_abstract_origin {{.*}} "bar"
20*9880d681SAndroid Build Coastguard Worker; CHECK:         DW_TAG_formal_parameter
21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:      DW_AT_const_value
22*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:      DW_AT_abstract_origin {{.*}} "a"
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
25*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-darwin"
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp uwtable
28*9880d681SAndroid Build Coastguard Workerdefine void @foo() #0 !dbg !4 {
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !17) #3, !dbg !18
31*9880d681SAndroid Build Coastguard Worker  tail call void @sink() #3, !dbg !20
32*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !17) #3, !dbg !21
33*9880d681SAndroid Build Coastguard Worker  tail call void @sink() #3, !dbg !23
34*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !24
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdeclare void @sink() #1
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
40*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "unsafe-fp-math"="false" "use-soft-float"="false" }
43*9880d681SAndroid Build Coastguard Workerattributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "unsafe-fp-math"="false" "use-soft-float"="false" }
44*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
45*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind }
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
48*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!13, !14, !15}
49*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!16}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
52*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "t.c", directory: "/path/to/dir")
53*9880d681SAndroid Build Coastguard Worker!2 = !{}
54*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
55*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6)
56*9880d681SAndroid Build Coastguard Worker!6 = !{null}
57*9880d681SAndroid Build Coastguard Worker!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !11)
58*9880d681SAndroid Build Coastguard Worker!8 = !DISubroutineType(types: !9)
59*9880d681SAndroid Build Coastguard Worker!9 = !{null, !10}
60*9880d681SAndroid Build Coastguard Worker!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
61*9880d681SAndroid Build Coastguard Worker!11 = !{!12}
62*9880d681SAndroid Build Coastguard Worker!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
63*9880d681SAndroid Build Coastguard Worker!13 = !{i32 2, !"Dwarf Version", i32 2}
64*9880d681SAndroid Build Coastguard Worker!14 = !{i32 2, !"Debug Info Version", i32 3}
65*9880d681SAndroid Build Coastguard Worker!15 = !{i32 1, !"PIC Level", i32 2}
66*9880d681SAndroid Build Coastguard Worker!16 = !{!"clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)"}
67*9880d681SAndroid Build Coastguard Worker!17 = !DIExpression()
68*9880d681SAndroid Build Coastguard Worker!18 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !19)
69*9880d681SAndroid Build Coastguard Worker!19 = distinct !DILocation(line: 4, column: 3, scope: !4)
70*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !19)
71*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !22)
72*9880d681SAndroid Build Coastguard Worker!22 = distinct !DILocation(line: 5, column: 3, scope: !4)
73*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !22)
74*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 6, column: 1, scope: !4)
75