Skip to content

Commit 6cbbd33

Browse files
authored
[CIR][Test][NFC] Fix invalid testcases involving kernel calls in OpenCL kernels (#1830)
Fix #1814.
1 parent 45a26c0 commit 6cbbd33

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
// RUN: %clang_cc1 -fclangir %s -O0 -triple "spirv64-unknown-unknown" -emit-cir -o %t.cir
22
// RUN: FileCheck %s --input-file=%t.cir --check-prefix=CIR
3-
// RUN-DISABLE: %clang_cc1 -fclangir %s -O0 -triple "spirv64-unknown-unknown" -emit-llvm -fno-clangir-call-conv-lowering -o %t.ll
4-
// RUN-DISABLE: FileCheck %s --input-file=%t.ll --check-prefix=LLVM
3+
// RUN: %clang_cc1 -fclangir %s -O0 -triple "spirv64-unknown-unknown" -emit-llvm -fno-clangir-call-conv-lowering -o %t.ll
4+
// RUN: FileCheck %s --input-file=%t.ll --check-prefix=LLVM
55

66
// CIR: cir.func {{.*}}@get_dummy_id{{.*}} cc(spir_function)
77
// LLVM-DAG: declare{{.*}} spir_func i32 @get_dummy_id(
88
int get_dummy_id(int D);
99

10-
// CIR: cir.func {{.*}}@bar{{.*}} cc(spir_kernel)
11-
// LLVM-DAG: declare{{.*}} spir_kernel void @bar(
12-
kernel void bar(global int *A);
13-
1410
// CIR: cir.func {{.*}}@foo{{.*}} cc(spir_kernel)
1511
// LLVM-DAG: define{{.*}} spir_kernel void @foo(
1612
kernel void foo(global int *A) {
1713
int id = get_dummy_id(0);
1814
// CIR: %{{[0-9]+}} = cir.call @get_dummy_id(%2) : (!s32i) -> !s32i cc(spir_function)
1915
// LLVM: %{{[a-z0-9_]+}} = call spir_func i32 @get_dummy_id(
20-
A[id] = id;
21-
bar(A);
22-
// CIR: cir.call @bar(%8) : (!cir.ptr<!s32i, addrspace(offload_global)>) -> () cc(spir_kernel)
23-
// LLVM: call spir_kernel void @bar(ptr addrspace(1)
2416
}

clang/test/CIR/Lowering/call-op-call-conv.cir

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ module {
88
cir.func private @my_add(%a: !s32i, %b: !s32i) -> !s32i cc(spir_function)
99

1010
cir.func @ind(%fnptr: !fnptr, %a : !s32i) {
11-
// https://github.com/llvm/clangir/issues/1814
12-
// %1 = cir.call %fnptr(%a) : (!fnptr, !s32i) -> !s32i cc(spir_kernel)
13-
// LLVM-DISABLE: %{{[0-9]+}} = call spir_kernel i32 %{{[0-9]+}}(i32 %{{[0-9]+}})
14-
15-
%2 = cir.call %fnptr(%a) : (!fnptr, !s32i) -> !s32i cc(spir_function)
11+
%1 = cir.call %fnptr(%a) : (!fnptr, !s32i) -> !s32i cc(spir_function)
1612
// LLVM: %{{[0-9]+}} = call spir_func i32 %{{[0-9]+}}(i32 %{{[0-9]+}})
1713

18-
%3 = cir.call @my_add(%2, %2) : (!s32i, !s32i) -> !s32i cc(spir_function)
14+
%2 = cir.call @my_add(%1, %1) : (!s32i, !s32i) -> !s32i cc(spir_function)
1915
// LLVM: %{{[0-9]+}} = call spir_func i32 @my_add(i32 %{{[0-9]+}}, i32 %{{[0-9]+}})
2016

2117
cir.return

0 commit comments

Comments
 (0)