Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/DebugFunction.cl

raw
1 // Check for 2 things:
2 // - After round trip translation function definition has !dbg metadata attached
3 // specifically if -gline-tables-only was used for Clang
4 // - Parent operand of DebugFunction is DebugCompilationUnit, not an OpString,
5 // even if in LLVM IR it points to a DIFile instead of DICompileUnit.
6
7 // 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
8 // RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
9 // RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM
10
11 float foo(int i) {
12 return i * 3.14;
13 }
14 void kernel k() {
15 float a = foo(2);
16 }
17
18 // CHECK-SPIRV: String [[foo:[0-9]+]] "foo"
19 // CHECK-SPIRV: String [[k:[0-9]+]] "k"
20 // CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompilationUnit
21 // CHECK-SPIRV: DebugFunction [[foo]] {{.*}} [[CU]] {{.*}} [[foo_id:[0-9]+]] {{[0-9]+}} {{$}}
22 // CHECK-SPIRV: DebugFunction [[k]] {{.*}} [[CU]] {{.*}} [[k_id:[0-9]+]] {{[0-9]+}} {{$}}
23
24 // CHECK-SPIRV: Function {{[0-9]+}} [[foo_id]]
25 // CHECK-LLVM: define spir_func float @_Z3fooi(i32 %i) #{{[0-9]+}} !dbg !{{[0-9]+}} {
26
27 // CHECK-SPIRV: Function {{[0-9]+}} [[k_id]]
28 // CHECK-LLVM: define spir_kernel void @k() #{{[0-9]+}} !dbg !{{[0-9]+}}