Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/inline-member-function.ll

raw
1 ; REQUIRES: object-emission
2
3 ; RUN: llvm-as < %s -o %t.bc
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
6
7 ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck %s
8
9 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
10 target triple = "spir64-unknown-unknown"
11
12 ; From source:
13 ; struct foo {
14 ; int __attribute__((always_inline)) func(int x) { return x + 2; }
15 ; };
16
17 ; int i;
18
19 ; int main() {
20 ; return foo().func(i);
21 ; }
22
23 ; CHECK: DW_TAG_structure_type
24 ; CHECK: DW_TAG_subprogram
25
26 ; But make sure we emit DW_AT_object_pointer on the abstract definition.
27 ; CHECK: [[ABSTRACT_ORIGIN:.*]]: DW_TAG_subprogram
28 ; CHECK-NOT: {{NULL|TAG}}
29 ; CHECK: DW_AT_specification {{.*}} "_ZN3foo4funcEi"
30 ; CHECK-NOT: {{NULL|TAG}}
31 ; CHECK: DW_AT_object_pointer
32
33 ; Ensure we omit DW_AT_object_pointer on inlined subroutines.
34 ; CHECK: DW_TAG_inlined_subroutine
35 ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[ABSTRACT_ORIGIN]]} "_ZN3foo4funcEi"
36 ; CHECK-NOT: NULL
37 ; CHECK-NOT: DW_AT_object_pointer
38 ; CHECK: DW_TAG_formal_parameter
39 ; CHECK-NOT: DW_AT_artificial
40 ; CHECK: DW_TAG
41
42 source_filename = "test/DebugInfo/X86/inline-member-function.ll"
43
44 %struct.foo = type { i8 }
45
46 @i = global i32 0, align 4, !dbg !0
47
48 ; Function Attrs: uwtable
49 define i32 @main() #0 !dbg !17 {
50 entry:
51 %this.addr.i = alloca %struct.foo*, align 8
52 %x.addr.i = alloca i32, align 4
53 %retval = alloca i32, align 4
54 %tmp = alloca %struct.foo, align 1
55 store i32 0, i32* %retval
56 %0 = load i32, i32* @i, align 4, !dbg !20
57 store %struct.foo* %tmp, %struct.foo** %this.addr.i, align 8
58 call void @llvm.dbg.declare(metadata %struct.foo** %this.addr.i, metadata !21, metadata !24), !dbg !25
59 store i32 %0, i32* %x.addr.i, align 4
60 call void @llvm.dbg.declare(metadata i32* %x.addr.i, metadata !26, metadata !24), !dbg !27
61 %this1.i = load %struct.foo*, %struct.foo** %this.addr.i
62 %1 = load i32, i32* %x.addr.i, align 4, !dbg !27
63 %add.i = add nsw i32 %1, 2, !dbg !27
64 ret i32 %add.i, !dbg !20
65 }
66
67 ; Function Attrs: nounwind readnone
68
69 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
70
71 attributes #0 = { 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" "unsafe-fp-math"="false" "use-soft-float"="false" }
72 attributes #1 = { nounwind readnone }
73
74 !llvm.dbg.cu = !{!4}
75 !llvm.module.flags = !{!14, !15}
76 !llvm.ident = !{!16}
77
78 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
79 !1 = !DIGlobalVariable(name: "i", scope: null, file: !2, line: 5, type: !3, isLocal: false, isDefinition: true)
80 !2 = !DIFile(filename: "inline.cpp", directory: "/tmp/dbginfo")
81 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
82 !4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.5.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !6, globals: !13, imports: !5)
83 !5 = !{}
84 !6 = !{!7}
85 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !2, line: 1, size: 8, align: 8, elements: !8, identifier: "_ZTS3foo")
86 !8 = !{!9}
87 !9 = !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEi", scope: !7, file: !2, line: 2, type: !10, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false)
88 !10 = !DISubroutineType(types: !11)
89 !11 = !{!3, !12, !3}
90 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
91 !13 = !{!0}
92 !14 = !{i32 2, !"Dwarf Version", i32 4}
93 !15 = !{i32 1, !"Debug Info Version", i32 3}
94 !16 = !{!"clang version 3.5.0 "}
95 !17 = distinct !DISubprogram(name: "main", scope: !2, file: !2, line: 7, type: !18, isLocal: false, isDefinition: true, scopeLine: 7, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !4, retainedNodes: !5)
96 !18 = !DISubroutineType(types: !19)
97 !19 = !{!3}
98 !20 = !DILocation(line: 8, scope: !17)
99 !21 = !DILocalVariable(name: "this", arg: 1, scope: !22, type: !23, flags: DIFlagArtificial | DIFlagObjectPointer)
100 !22 = distinct !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEi", scope: !7, file: !2, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !4, declaration: !9, retainedNodes: !5)
101 !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)
102 !24 = !DIExpression()
103 !25 = !DILocation(line: 0, scope: !22, inlinedAt: !20)
104 !26 = !DILocalVariable(name: "x", arg: 2, scope: !22, file: !2, line: 2, type: !3)
105 !27 = !DILocation(line: 2, scope: !22, inlinedAt: !20)
106