Skip to content

Commit

Permalink
[NFCI] Prepare for non-instrinsic debug info (#2362)
Browse files Browse the repository at this point in the history
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 <dmitry.sidorov@intel.com>
  • Loading branch information
MrSidims authored Feb 14, 2024
1 parent 7a37ea9 commit 0e87aef
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5525,6 +5525,7 @@ void LLVMToSPIRVBase::transFunction(Function *I) {
// is used to ensure blocks are written in the right order.
const DominatorTree DT(*I);
for (BasicBlock &FI : stablePreDominatorTraversal(*I, DT)) {
FI.convertFromNewDbgValues();
transValue(&FI, nullptr);
}
for (auto &FI : *I) {
Expand Down
4 changes: 4 additions & 0 deletions test/DebugInfo/DebugDeclareUnused.cl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
// RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM

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


void foo() {
int a;
Expand Down
14 changes: 14 additions & 0 deletions test/DebugInfo/DebugInfoLLVMArg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-200

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-allow-extra-diexpressions --experimental-debuginfo-iterators=1
; RUN: llvm-spirv %t.spv -to-text -o %t.spt --experimental-debuginfo-iterators=1
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV-OCL
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-OCL

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200 --experimental-debuginfo-iterators=1
; RUN: llvm-spirv %t.spv -to-text -o %t.spt --experimental-debuginfo-iterators=1
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV-200
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-200

; CHECK-SPIRV-200-DAG: TypeInt [[#INT32:]] 32 0
; CHECK-SPIRV-200-DAG: Constant [[#INT32:]] [[#CONST1:]] 1 {{$}}
; CHECK-SPIRV-200-DAG: Constant [[#INT32]] [[#CONST0:]] 0
Expand Down
15 changes: 15 additions & 0 deletions test/DebugInfo/DebugInfoTypeInheritance.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt --experimental-debuginfo-iterators=1
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-OCL
; RUN: llvm-spirv %t.bc -o %t.spv --experimental-debuginfo-iterators=1
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc --experimental-debuginfo-iterators=1
; 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-text --spirv-debug-info-version=nonsemantic-shader-100 -o %t.spt --experimental-debuginfo-iterators=1
; RUN: FileCheck %s --input-file %t.spt --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NONSEM
; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-100 -o %t.spv --experimental-debuginfo-iterators=1
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc --experimental-debuginfo-iterators=1
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM

; CHECK-SPIRV: String [[#Str_C:]] "C"
; CHECK-SPIRV: String [[#Str_B:]] "B"
; CHECK-SPIRV: String [[#Str_A:]] "A"
Expand Down
6 changes: 6 additions & 0 deletions test/DebugInfo/DebugInfoWithUnknownIntrinsics.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
; RUN: llvm-dis %t.bc -o %t.ll
; RUN: FileCheck %s --input-file %t.ll -check-prefix=LLVM

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+all --spirv-allow-unknown-intrinsics --experimental-debuginfo-iterators=1
; RUN: llvm-spirv -r %t.spv -o %t.bc --experimental-debuginfo-iterators=1
; RUN: llvm-dis %t.bc -o %t.ll
; RUN: FileCheck %s --input-file %t.ll -check-prefix=LLVM

; ModuleID = 'test.bc'
source_filename = "test.cl"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
15 changes: 15 additions & 0 deletions test/DebugInfo/expr-opcode.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll

; RUN: llvm-as < %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-allow-extra-diexpressions --experimental-debuginfo-iterators=1
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o - | llvm-dis -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll

; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll

; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200 --experimental-debuginfo-iterators=1
; RUN: llvm-spirv -r --experimental-debuginfo-iterators=1 %t.spv -o - | llvm-dis -o %t.rev.ll
; RUN: FileCheck %s --input-file %t.rev.ll

; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.rev.ll
; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.rev.ll

; CHECK: DW_OP_constu, 42
; CHECK: DW_OP_plus_uconst, 42
; CHECK: DW_OP_plus
Expand Down

0 comments on commit 0e87aef

Please sign in to comment.