Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFCI] Prepare for non-instrinsic debug info #2362

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading