; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-100 -spirv-text -o %t.spt
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-100
; RUN: llvm-spirv %t.bc  --spirv-debug-info-version=nonsemantic-shader-100 -o %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM

; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-200 -spirv-text -o %t.spt
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-200
; RUN: llvm-spirv %t.bc  --spirv-debug-info-version=nonsemantic-shader-200 -o %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM

; CHECK-LLVM: !DIFile(filename: "t.c", directory: "/test", source: "A
; CHECK-LLVM-SAME-COUNT-200000: A
; CHECK-LLVM-SAME: MayThe4thBeWithYou
; CHECK-LLVM-SAME-COUNT-330000: A

; CHECK-SPIRV: String [[#Str:]] "A
; CHECK-SPIRV-SAME-COUNT-19999: A
; CHECK-SPIRV-SAME: MayThe4thBeWithYou
; CHECK-SPIRV-SAME-COUNT-62113: A
; CHECK-SPIRV: String [[#Str2:]] "A
; CHECK-SPIRV-SAME-COUNT-262130: A
; CHECK-SPIRV: String [[#Str3:]] "A
; CHECK-SPIRV-SAME-COUNT-5755: A
; CHECK-SPIRV-100: DebugSource [[#]] [[#Str]]
; CHECK-SPIRV-200: [[#NONE:]] [[#]] DebugInfoNone
; CHECK-SPIRV-200: DebugSource [[#]] [[#NONE]] [[#NONE]] [[#Str]]
; CHECK-SPIRV: DebugSourceContinued [[#Str2]]
; CHECK-SPIRV: DebugSourceContinued [[#Str3]]

; ModuleID = 't.c'
source_filename = "t.c"
;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"
target triple = "spir64"

@t1 = global i32 1, align 4, !dbg !0
@t2 = global i32 0, align 4, !dbg !6

!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!11, !12, !13}
!llvm.ident = !{!14}

!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "t1", scope: !2, file: !10, line: 1, type: !9, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 322159)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
!3 = !DIFile(filename: "t.c", directory: "/test", source: "[encoded data, 530018 characters]")
!4 = !{}
!5 = !{!0, !6}
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
!7 = distinct !DIGlobalVariable(name: "t2", scope: !2, file: !8, line: 1, type: !9, isLocal: false, isDefinition: true)
!8 = !DIFile(filename: "t2.h", directory: "/test", source: "22222222222222222222222222222222")
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!10 = !DIFile(filename: "t1.h", directory: "/test", source: "11111111111111111111111111111111")
!11 = !{i32 2, !"Dwarf Version", i32 4}
!12 = !{i32 2, !"Debug Info Version", i32 3}
!13 = !{i32 1, !"wchar_size", i32 4}
!14 = !{!"clang version 7.0.0 (trunk 322159)"}
