Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/arguments.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-unknown-unknown -O0 -filetype=obj < %t.ll > %t
8 ; RUN: llvm-dwarfdump %t | FileCheck %s
9
10 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"
11 target triple = "spir64-unknown-unknown"
12
13 ; IR generated from clang -g with the following source:
14 ; struct foo {
15 ; foo(const foo&);
16 ; int i;
17 ; };
18 ;
19 ; void func(foo f, foo g) {
20 ; f.i++;
21 ; }
22
23 ; CHECK: debug_info contents
24 ; CHECK: DW_TAG_subprogram
25 ; CHECK-NOT: DW_TAG
26 ; CHECK: DW_AT_linkage_name{{.*}}"_Z4func3fooS_"
27 ; CHECK-NOT: NULL
28 ; CHECK: DW_TAG_formal_parameter
29 ; CHECK-NOT: DW_TAG
30 ; CHECK: DW_AT_name{{.*}}"f"
31 ; CHECK-NOT: NULL
32 ; CHECK: DW_TAG_formal_parameter
33 ; CHECK-NOT: DW_TAG
34 ; CHECK: DW_AT_name{{.*}}"g"
35
36 %struct.foo = type { i32 }
37
38 ; Function Attrs: nounwind uwtable
39 define void @_Z4func3fooS_(%struct.foo* %f, %struct.foo* %g) #0 !dbg !4 {
40 entry:
41 call void @llvm.dbg.declare(metadata %struct.foo* %f, metadata !19, metadata !DIExpression()), !dbg !20
42 call void @llvm.dbg.declare(metadata %struct.foo* %g, metadata !21, metadata !DIExpression()), !dbg !20
43 %i = getelementptr inbounds %struct.foo, %struct.foo* %f, i32 0, i32 0, !dbg !22
44 %0 = load i32, i32* %i, align 4, !dbg !22
45 %inc = add nsw i32 %0, 1, !dbg !22
46 store i32 %inc, i32* %i, align 4, !dbg !22
47 ret void, !dbg !23
48 }
49
50 ; Function Attrs: nounwind readnone
51 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
52
53 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
54 attributes #1 = { nounwind readnone }
55
56 !llvm.dbg.cu = !{!0}
57 !llvm.module.flags = !{!24}
58
59 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
60 !1 = !DIFile(filename: "scratch.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
61 !2 = !{}
62 !4 = distinct !DISubprogram(name: "func", linkageName: "_Z4func3fooS_", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !6, retainedNodes: !2)
63 !5 = !DIFile(filename: "scratch.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
64 !6 = !DISubroutineType(types: !7)
65 !7 = !{null, !8, !8}
66 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 32, align: 32, file: !1, elements: !9)
67 !9 = !{!10, !12}
68 !10 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 3, size: 32, align: 32, file: !1, scope: !8, baseType: !11)
69 !11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
70 !12 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !8, type: !13)
71 !13 = !DISubroutineType(types: !14)
72 !14 = !{null, !15, !16}
73 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
74 !16 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !17)
75 !17 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
76 !19 = !DILocalVariable(name: "f", line: 6, arg: 1, scope: !4, file: !5, type: !8)
77 !20 = !DILocation(line: 6, scope: !4)
78 !21 = !DILocalVariable(name: "g", line: 6, arg: 2, scope: !4, file: !5, type: !8)
79 !22 = !DILocation(line: 7, scope: !4)
80 !23 = !DILocation(line: 8, scope: !4)
81 !24 = !{i32 1, !"Debug Info Version", i32 3}