Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/NonSemantic/Shader200/FortranDynamicArrayVar.ll

raw
1 ;; DebugInfo/dwarfdump-dataLocationVar.ll from llvm.org is used as base for this test
2 ;; The test checks, that Fortran dynamic arrays are being correctly represented
3 ;; by SPIR-V debug information
4 ;; Unlike 'static' arrays dynamic can have following parameters of
5 ;; DICompositeType metadata with DW_TAG_array_type tag:
6 ;; Data Location, Associated, Allocated and Rank which can be represented
7 ;; by either DIExpression or DIVariable (both local and global).
8 ;; This test if for variable representation.
9 ;; FortranDynamicArrayVar.ll is for expression representation.
10
11 ; RUN: llvm-as %s -o %t.bc
12 ; RUN: llvm-spirv %t.bc -spirv-text --spirv-debug-info-version=nonsemantic-shader-200 -o - | FileCheck %s --check-prefix=CHECK-SPIRV
13 ; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200
14 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
15 ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
16
17 ;; Major SPIR-V checks are done in FortranDynamicArrayExpr.ll
18 ; CHECK-SPIRV: ExtInst [[#]] [[#DbgLVarId:]] [[#]] DebugLocalVariable [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] {{$}}
19 ; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#]] DebugTypeArrayDynamic [[#]] [[#DbgLVarId]] [[#]] [[#]] [[#]] [[#]]
20
21 ; CHECK-LLVM: %[[#Ptr:]] = alloca ptr
22 ; CHECK-LLVM: %[[#Array:]] = alloca [16 x i64]
23 ; CHECK-LLVM: call void @llvm.dbg.declare(metadata ptr %[[#Array]], metadata ![[#DbgLVarArray:]]
24 ; CHECK-LLVM: call void @llvm.dbg.declare(metadata ptr %[[#Ptr]], metadata ![[#DbgLVarPtr:]]
25
26 ; CHECK-LLVM: ![[#DbgLVarPtr:]] = !DILocalVariable(scope: ![[#]], file: ![[#]], type: ![[#DbgPtrT:]], flags: DIFlagArtificial)
27 ; CHECK-LLVM: ![[#DbgPtrT:]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[#DbgBasicT:]], size: 64)
28 ; CHECK-LLVM: ![[#DbgBasicT]] = !DIBasicType(name: "integer", size: 32, encoding: DW_ATE_signed)
29 ; CHECK-LLVM: ![[#DbgLVarArray]] = !DILocalVariable(name: "arr", scope: ![[#]], file: ![[#]], type: ![[#DbgArrayT:]])
30 ; CHECK-LLVM: ![[#DbgArrayT]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[#DbgBasicT]], size: 608, elements: ![[#Elements:]], dataLocation: ![[#DbgLVarPtr]])
31 ; CHECK-LLVM: ![[#Elements]] = !{![[#SubRange:]]}
32 ; CHECK-LLVM: ![[#SubRange]] = !DISubrange(count: 19, lowerBound: 2)
33
34 ; ModuleID = 'fortsubrange.ll'
35 source_filename = "fortsubrange.ll"
36 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37 target triple = "spir64-unknown-unknown"
38
39 define spir_func void @foo() !dbg !5 {
40 L.entry:
41 %0 = alloca ptr, align 8
42 %1 = alloca [16 x i64], align 8
43 call void @llvm.dbg.declare(metadata ptr %1, metadata !8, metadata !DIExpression()), !dbg !16
44 call void @llvm.dbg.declare(metadata ptr %0, metadata !14, metadata !DIExpression()), !dbg !16
45 ret void, !dbg !17
46 }
47
48 ; Function Attrs: nounwind readnone speculatable willreturn
49 declare void @llvm.dbg.declare(metadata, metadata, metadata)
50
51 ; Function Attrs: nounwind readnone speculatable willreturn
52 declare void @llvm.dbg.value(metadata, metadata, metadata)
53
54 !llvm.module.flags = !{!0, !1}
55 !llvm.dbg.cu = !{!2}
56
57 !0 = !{i32 2, !"Dwarf Version", i32 4}
58 !1 = !{i32 2, !"Debug Info Version", i32 3}
59 !2 = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: !3, producer: " F95 Flang - 1.5 2017-05-01", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !4, imports: !4)
60 !3 = !DIFile(filename: "fortsubrange.f90", directory: "/dir")
61 !4 = !{}
62 !5 = distinct !DISubprogram(name: "main", scope: !2, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !2)
63 !6 = !DISubroutineType(cc: DW_CC_program, types: !7)
64 !7 = !{null}
65 !8 = !DILocalVariable(name: "arr", scope: !9, file: !3, type: !10)
66 !9 = !DILexicalBlock(scope: !5, file: !3, line: 1, column: 1)
67 !10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 32, align: 32, elements: !12, dataLocation: !14)
68 !11 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
69 !12 = !{!13}
70 !13 = !DISubrange(count: 19, lowerBound: 2)
71 !14 = distinct !DILocalVariable(scope: !9, file: !3, type: !15, flags: DIFlagArtificial)
72 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 32, align: 32)
73 !16 = !DILocation(line: 0, scope: !9)
74 !17 = !DILocation(line: 6, column: 1, scope: !9)