|
| 1 | +;; Ensure that DIExpressions are preserved in DIGlobalVariableExpressions |
| 2 | +;; when a Static Member Declaration is also needed. |
| 3 | +;; This utilizes SPIRV DebugGlobalVariable's Variable field to hold the |
| 4 | +;; DIExpression. |
| 5 | + |
| 6 | +;; Declaration generated from: |
| 7 | +;; |
| 8 | +;; struct A { |
| 9 | +;; static int fully_specified; |
| 10 | +;; }; |
| 11 | +;; |
| 12 | +;; int A::fully_specified; |
| 13 | + |
| 14 | +; RUN: llvm-as %s -o %t.bc |
| 15 | + |
| 16 | +; RUN: llvm-spirv -o %t.100.spt %t.bc --spirv-debug-info-version=nonsemantic-shader-100 -spirv-text |
| 17 | +; RUN: FileCheck %s --input-file %t.100.spt --check-prefix CHECK-SPIRV |
| 18 | +; RUN: llvm-spirv -o %t.100.spv %t.bc --spirv-debug-info-version=nonsemantic-shader-100 |
| 19 | +; RUN: llvm-spirv -r -o %t.100.rev.bc %t.100.spv |
| 20 | +; RUN: llvm-dis %t.100.rev.bc -o %t.100.rev.ll |
| 21 | +; RUN: FileCheck %s --input-file %t.100.rev.ll --check-prefix CHECK-LLVM |
| 22 | + |
| 23 | +; RUN: llvm-spirv -o %t.200.spt %t.bc --spirv-debug-info-version=nonsemantic-shader-200 -spirv-text |
| 24 | +; RUN: FileCheck %s --input-file %t.200.spt --check-prefix CHECK-SPIRV |
| 25 | +; RUN: llvm-spirv -o %t.200.spv %t.bc --spirv-debug-info-version=nonsemantic-shader-200 |
| 26 | +; RUN: llvm-spirv -r -o %t.200.rev.bc %t.200.spv |
| 27 | +; RUN: llvm-dis %t.200.rev.bc -o %t.200.rev.ll |
| 28 | +; RUN: FileCheck %s --input-file %t.200.rev.ll --check-prefix CHECK-LLVM |
| 29 | + |
| 30 | +; CHECK-SPIRV-DAG: [[TYPE_MEMBER:[0-9]+]] [[#]] DebugTypeMember [[#]] [[#]] [[#]] [[#]] |
| 31 | +; CHECK-SPIRV-DAG: [[EXPRESSION:[0-9]+]] [[#]] DebugExpression [[#]] [[#]] |
| 32 | +; CHECK-SPIRV: [[#]] [[#]] DebugGlobalVariable [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[EXPRESSION]] [[#]] [[TYPE_MEMBER]] {{$}} |
| 33 | + |
| 34 | +; CHECK-LLVM: ![[#]] = !DIGlobalVariableExpression(var: ![[#GV:]], expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value)) |
| 35 | +; CHECK-LLVM: ![[#GV]] = distinct !DIGlobalVariable(name: "true", scope: ![[#]], file: ![[#]], line: 3777, type: ![[#]], isLocal: true, isDefinition: true, declaration: ![[#DECLARATION:]]) |
| 36 | +; CHECK-LLVM: ![[#DECLARATION]] = !DIDerivedType(tag: DW_TAG_member, name: "fully_specified", scope: ![[#SCOPE:]], file: ![[#]], line: 2, baseType: ![[#BASETYPE:]], flags: DIFlagPublic | DIFlagStaticMember) |
| 37 | +; CHECK-LLVM: ![[#SCOPE]] = {{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "A", file: ![[#]], line: 1, size: 8, flags: DIFlagTypePassByValue, elements: ![[#ELEMENTS:]], identifier: "_ZTS1A") |
| 38 | +; CHECK-LLVM: ![[#ELEMENTS]] = !{![[#DECLARATION]]} |
| 39 | +; CHECK-LLVM: ![[#BASETYPE]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 40 | + |
| 41 | +!llvm.module.flags = !{!0, !1} |
| 42 | +!llvm.dbg.cu = !{!2} |
| 43 | + |
| 44 | +!0 = !{i32 7, !"Dwarf Version", i32 4} |
| 45 | +!1 = !{i32 2, !"Debug Info Version", i32 3} |
| 46 | +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang", emissionKind: FullDebug, globals: !4) |
| 47 | +!3 = !DIFile(filename: "test.cpp", directory: "/path/to") |
| 48 | +!4 = !{!5} |
| 49 | +!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value)) |
| 50 | +!6 = distinct !DIGlobalVariable(name: "true", scope: !2, file: !3, line: 3777, type: !7, isLocal: true, isDefinition: true, declaration: !10) |
| 51 | +!7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8) |
| 52 | +!8 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) |
| 53 | +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 54 | +!10 = !DIDerivedType(tag: DW_TAG_member, name: "fully_specified", scope: !11, file: !3, line: 2, baseType: !9, flags: DIFlagStaticMember) |
| 55 | +!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !12, identifier: "_ZTS1A") |
| 56 | +!12 = !{!10} |
0 commit comments