Debian Codegraph @

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

raw
1 ;; The test checks, that Fortran dynamic arrays are being correctly represented
2 ;; by SPIR-V debug information
3 ;; Unlike 'static' arrays dynamic can have following parameters of
4 ;; DICompositeType metadata with DW_TAG_array_type tag:
5 ;; Data Location, Associated, Allocated and Rank which can be represented
6 ;; by either DIExpression or DIVariable (both local and global).
7 ;; This test if for expression representation.
8 ;; FortranDynamicArrayVar.ll is for variable representation.
9
10 ; RUN: llvm-as %s -o %t.bc
11 ; RUN: llvm-spirv %t.bc -spirv-text --spirv-debug-info-version=nonsemantic-shader-200 -o - | FileCheck %s --check-prefix=CHECK-SPIRV
12 ; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200
13 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
14 ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
15
16 ; CHECK-SPIRV-DAG: ExtInstImport [[#Import:]] "NonSemantic.Shader.DebugInfo.200"
17 ; CHECK-SPIRV-DAG: String [[#BasicTName:]] "INTEGER*4"
18 ; CHECK-SPIRV-DAG: TypeInt [[#Int32T:]] 32 0
19 ; CHECK-SPIRV-DAG: Constant [[#Int32T]] [[#IntConst:]] 32
20 ; CHECK-SPIRV-DAG: Constant [[#Int32T]] [[#Flag:]] 4
21 ; CHECK-SPIRV-DAG: TypeVoid [[#VoidT:]]
22 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgInfoNone:]] [[#Import]] DebugInfoNone
23 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#ArrayBasicT:]] [[#Import]] DebugTypeBasic [[#BasicTName]] [[#IntConst]] [[#Flag]]
24 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprLocation:]] [[#Import]] DebugExpression [[#]] [[#]] {{$}}
25 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprAssociated:]] [[#Import]] DebugExpression [[#]] [[#]] [[#]] [[#]] {{$}}
26 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprLowerBound:]] [[#Import]] DebugExpression [[#]] [[#]] [[#]] {{$}}
27 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprUpperBound:]] [[#Import]] DebugExpression [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] {{$}}
28 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprStride:]] [[#Import]] DebugExpression [[#]] [[#]] [[#]] {{$}}
29 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgSubRangeId:]] [[#Import]] DebugTypeSubrange [[#DbgExprLowerBound]] [[#DbgExprUpperBound]] [[#DbgInfoNone]] [[#DbgExprStride]]
30 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgArrayId:]] [[#Import]] DebugTypeArrayDynamic [[#ArrayBasicT]] [[#DbgExprLocation]] [[#DbgExprAssociated]] [[#DbgInfoNone]] [[#DbgInfoNone]] [[#DbgSubRangeId]]
31
32 ; CHECK-LLVM: %[[#Array:]] = alloca
33 ; CHECK-LLVM: call void @llvm.dbg.value(metadata ptr %[[#Array]], metadata ![[#DbgLVar:]]
34 ; CHECK-LLVM: ![[#DbgLVar]] = !DILocalVariable(name: "pint", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#DbgLVarT:]])
35 ; CHECK-LLVM: ![[#DbgLVarT]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[#DbgArrayT:]], size: 64)
36 ; CHECK-LLVM: ![[#DbgArrayT]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[#DbgArrayBaseT:]], size: 32, elements: ![[#Elements:]], dataLocation: !DIExpression(DW_OP_push_object_address, DW_OP_deref), associated: !DIExpression(DW_OP_push_object_address, DW_OP_deref, DW_OP_constu, 0, DW_OP_or))
37 ; CHECK-LLVM: ![[#DbgArrayBaseT]] = !DIBasicType(name: "INTEGER*4", size: 32, encoding: DW_ATE_signed)
38 ; CHECK-LLVM: ![[#Elements]] = !{![[#SubRange:]]}
39 ; CHECK-LLVM: ![[#SubRange]] = !DISubrange(lowerBound: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 64, DW_OP_deref), upperBound: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 64, DW_OP_deref, DW_OP_push_object_address, DW_OP_plus_uconst, 48, DW_OP_deref, DW_OP_plus, DW_OP_constu, 1, DW_OP_minus), stride: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 56, DW_OP_deref))
40
41
42 ; ModuleID = 'reproducer.ll'
43 source_filename = "test.f90"
44 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"
45 target triple = "spir64"
46
47 %qnca = type { i32 addrspace(4)*, i64, i64, i64, i64, i64, [1 x { i64, i64, i64 }] }
48
49 ; Function Attrs: noinline nounwind optnone
50 define weak dso_local spir_kernel void @TEST() #0 !dbg !5 {
51 newFuncRoot:
52 %0 = alloca %qnca, align 8
53 call void @llvm.dbg.value(metadata %qnca* %0, metadata !8, metadata !DIExpression()), !dbg !14
54 ret void
55 }
56
57 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
58 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
59
60 attributes #0 = { noinline nounwind optnone }
61 attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
62
63 !llvm.module.flags = !{!0, !1}
64 !llvm.dbg.cu = !{!2}
65 !spirv.Source = !{!4}
66
67 !0 = !{i32 2, !"Debug Info Version", i32 3}
68 !1 = !{i32 2, !"Dwarf Version", i32 4}
69 !2 = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: !3, producer: "fortran", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
70 !3 = !DIFile(filename: "test.f90", directory: "/path/to")
71 !4 = !{i32 4, i32 200000}
72 !5 = distinct !DISubprogram(name: "test", linkageName: "MAIN__", scope: !3, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !2)
73 !6 = !DISubroutineType(types: !7)
74 !7 = !{null}
75 !8 = !DILocalVariable(name: "pint", scope: !5, file: !3, line: 3, type: !9)
76 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
77 !10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, elements: !12, dataLocation: !DIExpression(DW_OP_push_object_address, DW_OP_deref), associated: !DIExpression(DW_OP_push_object_address, DW_OP_deref, DW_OP_constu, 0, DW_OP_or))
78 !11 = !DIBasicType(name: "INTEGER*4", size: 32, encoding: DW_ATE_signed)
79 !12 = !{!13}
80 !13 = !DISubrange(lowerBound: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 64, DW_OP_deref), upperBound: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 64, DW_OP_deref, DW_OP_push_object_address, DW_OP_plus_uconst, 48, DW_OP_deref, DW_OP_plus, DW_OP_constu, 1, DW_OP_minus), stride: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 56, DW_OP_deref))
81 !14 = !DILocation(line: 1, scope: !5)
82