| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv -spirv-text %t.bc -o %t.spt --spirv-debug-info-version=nonsemantic-shader-200 |
| 3 |
; RUN: FileCheck < %t.spt %s -check-prefix=CHECK-SPIRV |
| 4 |
; RUN: llvm-spirv -to-binary %t.spt -o %t.spv |
| 5 |
|
| 6 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 |
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll |
| 8 |
; RUN: FileCheck < %t.rev.ll %s -check-prefix=CHECK-LLVM |
| 9 |
|
| 10 |
; Source: |
| 11 |
; -- inline-namespace.cxx ----------------------------------------------------- |
| 12 |
; 1 inline namespace Outer { |
| 13 |
; 2 namespace Inner { |
| 14 |
; 3 int global; |
| 15 |
; 4 } |
| 16 |
; 5 } |
| 17 |
; 6 |
| 18 |
; 7 void foo() { |
| 19 |
; 8 Inner::global++; |
| 20 |
; 9 } |
| 21 |
; -- inline-namespace.cxx ----------------------------------------------------- |
| 22 |
|
| 23 |
; CHECK-SPIRV: String [[#StrOuter:]] "Outer" |
| 24 |
; CHECK-SPIRV: String [[#StrInner:]] "Inner" |
| 25 |
; CHECK-SPIRV: TypeBool [[#TypeBool:]] |
| 26 |
; CHECK-SPIRV: ConstantTrue [[#TypeBool]] [[#ConstTrue:]] |
| 27 |
; CHECK-SPIRV: ConstantFalse [[#TypeBool]] [[#ConstFalse:]] |
| 28 |
; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#]] DebugLexicalBlock [[#]] [[#]] [[#]] [[#]] [[#StrOuter]] [[#ConstTrue]] |
| 29 |
; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#]] DebugLexicalBlock [[#]] [[#]] [[#]] [[#]] [[#StrInner]] [[#ConstFalse]] |
| 30 |
|
| 31 |
; CHECK-LLVM: !DINamespace(name: "Inner", scope: ![[#OuterSpace:]]) |
| 32 |
; CHECK-LLVM: ![[#OuterSpace]] = !DINamespace(name: "Outer", scope: null, exportSymbols: true) |
| 33 |
|
| 34 |
; ModuleID = 'inline-namespace.cxx' |
| 35 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 36 |
target triple = "spir64-unknown-unknown" |
| 37 |
|
| 38 |
@_ZN5Outer5Inner6globalE = dso_local global i32 0, align 4, !dbg !0 |
| 39 |
|
| 40 |
; Function Attrs: noinline nounwind optnone uwtable mustprogress |
| 41 |
define dso_local void @_Z3foov() #0 !dbg !11 { |
| 42 |
entry: |
| 43 |
%0 = load i32, i32* @_ZN5Outer5Inner6globalE, align 4, !dbg !14 |
| 44 |
%inc = add nsw i32 %0, 1, !dbg !14 |
| 45 |
store i32 %inc, i32* @_ZN5Outer5Inner6globalE, align 4, !dbg !14 |
| 46 |
ret void, !dbg !15 |
| 47 |
} |
| 48 |
|
| 49 |
attributes #0 = { noinline nounwind optnone uwtable mustprogress } |
| 50 |
|
| 51 |
!llvm.dbg.cu = !{!6} |
| 52 |
!llvm.module.flags = !{!9, !10} |
| 53 |
|
| 54 |
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 55 |
!1 = distinct !DIGlobalVariable(name: "global", linkageName: "_ZN5Outer5Inner6globalE", scope: !2, file: !4, line: 3, type: !5, isLocal: false, isDefinition: true) |
| 56 |
!2 = !DINamespace(name: "Inner", scope: !3) |
| 57 |
!3 = !DINamespace(name: "Outer", scope: null, exportSymbols: true) |
| 58 |
!4 = !DIFile(filename: "inlined-namespace.cxx", directory: "/path/to") |
| 59 |
!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 60 |
!6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !4, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !7, globals: !8, splitDebugInlining: false, nameTableKind: None) |
| 61 |
!7 = !{} |
| 62 |
!8 = !{!0} |
| 63 |
!9 = !{i32 7, !"Dwarf Version", i32 4} |
| 64 |
!10 = !{i32 2, !"Debug Info Version", i32 3} |
| 65 |
!11 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !4, file: !4, line: 7, type: !12, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !7) |
| 66 |
!12 = !DISubroutineType(types: !13) |
| 67 |
!13 = !{null} |
| 68 |
!14 = !DILocation(line: 8, column: 16, scope: !11) |
| 69 |
!15 = !DILocation(line: 9, column: 1, scope: !11) |