Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/inlined-locations.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
4
5 ; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-200 -o %t.spv
6 ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefixes=CHECK,CHECK-200
7
8 ; Check that the "inlinedAt" attribute of a DILocation references another
9 ; DILocation that is marked as distinct. Note that the checks for distinct
10 ; DILocations do not include the column number as SPIR-V does not allow for
11 ; representing this info (except for NonSemantic.Shader.DebugInfo.200). For
12 ; this specification we check that the column number is preserved during
13 ; translation.
14
15 ; Built with clang -O -g from the source:
16 ; bool f();
17 ; inline __attribute__((always_inline)) int f1() {
18 ; if (bool b = f())
19 ; return 1;
20 ; return 0;
21 ; }
22 ;
23 ; inline __attribute__((always_inline)) int f2() {
24 ; if (int i = f1())
25 ; return 3;
26 ; return 4;
27 ; }
28 ;
29 ; int main() {
30 ; f2();
31 ; }
32
33 source_filename = "test/DebugInfo/Generic/inlined-locations.ll"
34 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
35 target triple = "spir64-unknown-unknown"
36
37 ; Function Attrs: norecurse
38 define dso_local i32 @main() local_unnamed_addr #0 !dbg !7 {
39 %1 = tail call spir_func zeroext i1 @_Z1fv(), !dbg !11
40 call void @llvm.dbg.value(metadata i8 undef, metadata !16, metadata !DIExpression()), !dbg !24
41 ret i32 0, !dbg !25
42 }
43
44 declare dso_local spir_func zeroext i1 @_Z1fv() local_unnamed_addr #1
45
46 ; Function Attrs: nounwind readnone speculatable
47 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
48
49 attributes #0 = { norecurse "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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" }
50 attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "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" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
51 attributes #2 = { nounwind readnone speculatable }
52
53 !llvm.dbg.cu = !{!0}
54 !llvm.module.flags = !{!3, !4, !5}
55 !llvm.ident = !{!6}
56
57 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 9.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
58 !1 = !DIFile(filename: "inlined-locations.cpp", directory: "/tmp/dbginfo")
59 !2 = !{}
60 !3 = !{i32 2, !"Dwarf Version", i32 4}
61 !4 = !{i32 2, !"Debug Info Version", i32 3}
62 !5 = !{i32 1, !"wchar_size", i32 4}
63 !6 = !{!"clang version 9.0.0 "}
64 !7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 14, type: !8, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
65 !8 = !DISubroutineType(types: !9)
66 !9 = !{!10}
67 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
68 !11 = !DILocation(line: 3, column: 16, scope: !12, inlinedAt: !18)
69 ; CHECK: !{{.*}} = !DILocation(line: 3, column: 16, scope: !{{.*}}, inlinedAt: ![[loc1:[0-9]+]])
70 !12 = distinct !DILexicalBlock(scope: !13, file: !1, line: 3, column: 12)
71 !13 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
72 !14 = !DISubroutineType(cc: DW_CC_LLVM_SpirFunction, types: !9)
73 !15 = !{!16}
74 !16 = !DILocalVariable(name: "b", scope: !12, file: !1, line: 3, type: !17)
75 !17 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
76 !18 = distinct !DILocation(line: 9, column: 15, scope: !19, inlinedAt: !23)
77 ; CHECK-DEFAULT: ![[loc1]] = distinct !DILocation(line: 9, scope: !{{.*}}, inlinedAt: ![[loc2:[0-9]+]])
78 ; CHECK-200: ![[loc1]] = distinct !DILocation(line: 9, column: 15, scope: !{{.*}}, inlinedAt: ![[loc2:[0-9]+]])
79 !19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 9, column: 11)
80 !20 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 8, type: !14, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21)
81 !21 = !{!22}
82 !22 = !DILocalVariable(name: "i", scope: !19, file: !1, line: 9, type: !10)
83 !23 = distinct !DILocation(line: 15, column: 3, scope: !7)
84 ; CHECK-DEFAULT: ![[loc2]] = distinct !DILocation(line: 15, scope: !{{.*}})
85 ; CHECK-200: ![[loc2]] = distinct !DILocation(line: 15, column: 3, scope: !{{.*}})
86 !24 = !DILocation(line: 3, column: 12, scope: !12, inlinedAt: !18)
87 ; CHECK: !{{.*}} = !DILocation(line: 3, column: 12, scope: !{{.*}}, inlinedAt: ![[loc1]])
88 !25 = !DILocation(line: 16, column: 1, scope: !7)