Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/varargs.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=%triple -O0 -filetype=obj %t.ll -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s
8
9 ; Test debug info for variadic function arguments.
10 ; Created from tools/clang/tests/CodeGenCXX/debug-info-varargs.cpp with the
11 ; function pointer removed.
12 ;
13 ; The ... parameter of variadic should be emitted as
14 ; DW_TAG_unspecified_parameters.
15 ;
16 ; Normal variadic function.
17 ; void b(int c, ...);
18 ;
19 ; CHECK: DW_TAG_subprogram
20 ; CHECK-NOT: DW_TAG
21 ; CHECK: DW_AT_name {{.*}} "b"
22 ; CHECK-NOT: DW_TAG
23 ; CHECK: DW_TAG_formal_parameter
24 ; CHECK-NOT: DW_TAG
25 ; CHECK: DW_TAG_variable
26 ; CHECK-NOT: DW_TAG
27 ; CHECK: DW_TAG_unspecified_parameters
28 ;
29 ; CHECK: DW_TAG_subprogram
30 ; CHECK-NOT: DW_TAG
31 ; CHECK: DW_AT_name {{.*}} "a"
32 ; CHECK-NOT: DW_TAG
33 ; CHECK: DW_TAG_formal_parameter
34 ; CHECK-NOT: DW_TAG
35 ; CHECK: DW_TAG_formal_parameter
36 ; CHECK-NOT: DW_TAG
37 ; CHECK: DW_TAG_unspecified_parameters
38 ;
39 ; Variadic C++ member function.
40 ; struct A { void a(int c, ...); }
41 ;
42 ; ModuleID = 'debug-info-varargs.cpp'
43 source_filename = "debug-info-varargs.cpp"
44 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
45 target triple = "spir64-unknown-unknown"
46
47 %struct.A = type { i8 }
48
49 ; Function Attrs: noinline nounwind optnone
50 define spir_func void @_Z1biz(i32 %c, ...) #0 !dbg !6 {
51 entry:
52 %c.addr = alloca i32, align 4
53 %a = alloca %struct.A, align 1
54 store i32 %c, i32* %c.addr, align 4
55 call void @llvm.dbg.declare(metadata i32* %c.addr, metadata !11, metadata !DIExpression()), !dbg !12
56 call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !13, metadata !DIExpression()), !dbg !20
57 ret void, !dbg !21
58 }
59
60 ; Function Attrs: nounwind readnone speculatable
61 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
62
63 attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
64 attributes #1 = { nounwind readnone speculatable }
65
66 !llvm.dbg.cu = !{!0}
67 !llvm.module.flags = !{!3, !4}
68 !opencl.used.extensions = !{!2}
69 !opencl.used.optional.core.features = !{!2}
70 !opencl.compiler.options = !{!2}
71 !llvm.ident = !{!5}
72
73 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
74 !1 = !DIFile(filename: "<stdin>", directory: "/tmp")
75 !2 = !{}
76 !3 = !{i32 2, !"Debug Info Version", i32 3}
77 !4 = !{i32 1, !"wchar_size", i32 4}
78 !5 = !{!"clang version 8.0.0 "}
79 !6 = distinct !DISubprogram(name: "b", linkageName: "_Z1biz", scope: !7, file: !7, line: 11, type: !8, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
80 !7 = !DIFile(filename: "debug-info-varargs.cpp", directory: "/tmp")
81 !8 = !DISubroutineType(cc: DW_CC_LLVM_SpirFunction, types: !9)
82 !9 = !{null, !10, null}
83 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
84 !11 = !DILocalVariable(name: "c", arg: 1, scope: !6, file: !7, line: 11, type: !10)
85 !12 = !DILocation(line: 11, scope: !6)
86 !13 = !DILocalVariable(name: "a", scope: !6, file: !7, line: 23, type: !14)
87 !14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !7, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !15, identifier: "_ZTS1A")
88 !15 = !{!16}
89 !16 = !DISubprogram(name: "a", linkageName: "_ZN1A1aEiz", scope: !14, file: !7, line: 5, type: !17, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
90 !17 = !DISubroutineType(types: !18)
91 !18 = !{null, !19, !10, null}
92 !19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
93 !20 = !DILocation(line: 23, scope: !6)
94 !21 = !DILocation(line: 29, scope: !6)