Skip to content

Commit 272ba9e

Browse files
MrSidimssys-ce-bb
authored andcommitted
Prepare for non-instrinsic debug info (#2362)
For now just convert BB with convertFromNewDbgValues, will figure out something smarter a bit later. I've updated several tests with dbg.declare intrinsic adding --experimental-debuginfo-iterators=1 to check if it works. Signed-off-by: Sidorov, Dmitry <[email protected]> Original commit: KhronosGroup/SPIRV-LLVM-Translator@0e87aefecf7c500
1 parent d18a70f commit 272ba9e

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5589,6 +5589,7 @@ void LLVMToSPIRVBase::transFunction(Function *I) {
55895589
// is used to ensure blocks are written in the right order.
55905590
const DominatorTree DT(*I);
55915591
for (BasicBlock &FI : stablePreDominatorTraversal(*I, DT)) {
5592+
FI.convertFromNewDbgValues();
55925593
transValue(&FI, nullptr);
55935594
}
55945595
for (auto &FI : *I) {

llvm-spirv/test/DebugInfo/DebugDeclareUnused.cl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
66
// RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM
77

8+
// RUN: %clang_cc1 %s -triple spir -disable-llvm-passes -debug-info-kind=standalone -emit-llvm-bc -o - | llvm-spirv -spirv-mem2reg -o %t.spv
9+
// RUN: llvm-spirv --experimental-debuginfo-iterators=1 %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
10+
// RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM
11+
812

913
void foo() {
1014
int a;

llvm-spirv/test/DebugInfo/DebugInfoLLVMArg.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
1616
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-200
1717

18+
; RUN: llvm-as %s -o %t.bc
19+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-allow-extra-diexpressions --experimental-debuginfo-iterators=1
20+
; RUN: llvm-spirv %t.spv -to-text -o %t.spt --experimental-debuginfo-iterators=1
21+
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV-OCL
22+
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o %t.rev.bc
23+
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-OCL
24+
25+
; RUN: llvm-as %s -o %t.bc
26+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200 --experimental-debuginfo-iterators=1
27+
; RUN: llvm-spirv %t.spv -to-text -o %t.spt --experimental-debuginfo-iterators=1
28+
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV-200
29+
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o %t.rev.bc
30+
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-200
31+
1832
; CHECK-SPIRV-200-DAG: TypeInt [[#INT32:]] 32 0
1933
; CHECK-SPIRV-200-DAG: Constant [[#INT32:]] [[#CONST1:]] 1 {{$}}
2034
; CHECK-SPIRV-200-DAG: Constant [[#INT32]] [[#CONST0:]] 0

llvm-spirv/test/DebugInfo/DebugInfoTypeInheritance.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
1414
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM
1515

16+
; RUN: llvm-as %s -o %t.bc
17+
; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt --experimental-debuginfo-iterators=1
18+
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-OCL
19+
; RUN: llvm-spirv %t.bc -o %t.spv --experimental-debuginfo-iterators=1
20+
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc --experimental-debuginfo-iterators=1
21+
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
22+
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM
23+
24+
; RUN: llvm-spirv %t.bc -spirv-text --spirv-debug-info-version=nonsemantic-shader-100 -o %t.spt --experimental-debuginfo-iterators=1
25+
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NONSEM
26+
; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-100 -o %t.spv --experimental-debuginfo-iterators=1
27+
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc --experimental-debuginfo-iterators=1
28+
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
29+
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM
30+
1631
; CHECK-SPIRV: String [[#Str_C:]] "C"
1732
; CHECK-SPIRV: String [[#Str_B:]] "B"
1833
; CHECK-SPIRV: String [[#Str_A:]] "A"

llvm-spirv/test/DebugInfo/DebugInfoWithUnknownIntrinsics.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
; RUN: llvm-dis %t.bc -o %t.ll
55
; RUN: FileCheck %s --input-file %t.ll -check-prefix=LLVM
66

7+
; RUN: llvm-as %s -o %t.bc
8+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+all --spirv-allow-unknown-intrinsics --experimental-debuginfo-iterators=1
9+
; RUN: llvm-spirv -r %t.spv -o %t.bc --experimental-debuginfo-iterators=1
10+
; RUN: llvm-dis %t.bc -o %t.ll
11+
; RUN: FileCheck %s --input-file %t.ll -check-prefix=LLVM
12+
713
; ModuleID = 'test.bc'
814
source_filename = "test.cl"
915
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

llvm-spirv/test/DebugInfo/expr-opcode.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
1414
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll
1515

16+
; RUN: llvm-as < %s -o %t.bc
17+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-allow-extra-diexpressions --experimental-debuginfo-iterators=1
18+
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o - | llvm-dis -o %t.rev.ll
19+
; RUN: FileCheck %s --input-file %t.rev.ll
20+
21+
; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
22+
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll
23+
24+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200 --experimental-debuginfo-iterators=1
25+
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o - | llvm-dis -o %t.rev.ll
26+
; RUN: FileCheck %s --input-file %t.rev.ll
27+
28+
; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
29+
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll
30+
1631
; CHECK: DW_OP_constu, 42
1732
; CHECK: DW_OP_plus_uconst, 42
1833
; CHECK: DW_OP_plus

0 commit comments

Comments
 (0)