File: DebugFunction.cl

package info (click to toggle)
spirv-llvm-translator-14 14.0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,640 kB
  • sloc: cpp: 47,664; lisp: 3,704; sh: 153; python: 43; makefile: 33
file content (28 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Check for 2 things:
// - After round trip translation function definition has !dbg metadata attached
//   specifically if -gline-tables-only was used for Clang
// - Parent operand of DebugFunction is DebugCompilationUnit, not an OpString,
//   even if in LLVM IR it points to a DIFile instead of DICompileUnit.

// RUN: %clang_cc1 %s -cl-std=clc++ -emit-llvm-bc -triple spir -debug-info-kind=line-tables-only -O0 -o - | llvm-spirv -o %t.spv
// 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

float foo(int i) {
    return i * 3.14;
}
void kernel k() {
    float a = foo(2);
}

// CHECK-SPIRV: String [[foo:[0-9]+]] "foo"
// CHECK-SPIRV: String [[k:[0-9]+]] "k"
// CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompilationUnit
// CHECK-SPIRV: DebugFunction [[foo]] {{.*}} [[CU]] {{.*}} [[foo_id:[0-9]+]] {{[0-9]+}} {{$}}
// CHECK-SPIRV: DebugFunction [[k]] {{.*}} [[CU]] {{.*}} [[k_id:[0-9]+]] {{[0-9]+}} {{$}}

// CHECK-SPIRV: Function {{[0-9]+}} [[foo_id]]
// CHECK-LLVM: define spir_func float @_Z3fooi(i32 %i) #{{[0-9]+}} !dbg !{{[0-9]+}} {

// CHECK-SPIRV: Function {{[0-9]+}} [[k_id]]
// CHECK-LLVM: define spir_kernel void @k() #{{[0-9]+}} !dbg !{{[0-9]+}}