From 7efd01f8a2127e1493b60e2b516f359cd8605754 Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Mon, 24 Nov 2025 15:31:44 +0200 Subject: [PATCH 1/3] [CIR][OpenCL] Support lowering of OCL opaque types Implement handling for zero-initialization casts to OpenCL opaque types in CIR. This covers cases like `event_t e = async_work_group_copy(..., 0)`. - `VisitCastExpr`: CK_ZeroToOCLOpaqueType now returns a null pointer of the appropriate opaque type instead of `llvm_unreachable`. - `CIRGenTypes::convertType`: Added proper CIR type conversions for OpenCL opaque types including event, queue, and reserve_id types. - Provides consistent CIR representation for OpenCL opaque objects. --- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 14 ++++++++++++-- clang/lib/CIR/CodeGen/CIRGenTypes.cpp | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index 5b1f9c447293..61a14c009cef 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -2123,8 +2123,18 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { return emitComplexToScalarConversion(CGF.getLoc(CE->getExprLoc()), V, Kind, DestTy); } - case CK_ZeroToOCLOpaqueType: - llvm_unreachable("NYI"); + case CK_ZeroToOCLOpaqueType: { + // OpenCL: event_t e = async_work_group_copy(..., 0); + // The source is an integer constant zero; the destination is an OpenCL + // opaque type + mlir::Type destTy = CGF.convertType(DestTy); + auto PtrTy = + cir::PointerType::get(destTy, cir::AddressSpace::OffloadPrivate); + auto constNullPtrAttr = Builder.getConstNullPtrAttr(PtrTy); + auto nullVal = + Builder.getConstant(CGF.getLoc(E->getExprLoc()), constNullPtrAttr); + return nullVal; + } case CK_IntToOCLSampler: llvm_unreachable("NYI"); diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index 4de89fc7081a..8d2068b4e9fd 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -516,8 +516,13 @@ mlir::Type CIRGenTypes::convertType(QualType T) { case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: case BuiltinType::OCLQueue: + ResultType = Builder.getVoidPtrTy(); + break; case BuiltinType::OCLReserveID: - assert(0 && "not implemented"); + ResultType = cir::RecordType::get( + &getMLIRContext(), {}, + mlir::StringAttr::get(&getMLIRContext(), "ocl_reserve_id"), false, + false, cir::RecordType::Struct); break; case BuiltinType::SveInt8: case BuiltinType::SveUint8: From f3a8198dfb62d2abcd84548fd25124613e9bd5cb Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Tue, 25 Nov 2025 13:12:31 +0200 Subject: [PATCH 2/3] adding test --- clang/test/CIR/CodeGen/OpenCL/async_copy.cl | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 clang/test/CIR/CodeGen/OpenCL/async_copy.cl diff --git a/clang/test/CIR/CodeGen/OpenCL/async_copy.cl b/clang/test/CIR/CodeGen/OpenCL/async_copy.cl new file mode 100644 index 000000000000..256d28f1fd3f --- /dev/null +++ b/clang/test/CIR/CodeGen/OpenCL/async_copy.cl @@ -0,0 +1,25 @@ +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-cir -o - %s -fclangir | FileCheck %s --check-prefix=CIR +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s -fclangir | FileCheck %s --check-prefix=LLVM +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s | FileCheck %s --check-prefix=OG-LLVM + +// Simple kernel using async_work_group_copy + wait_group_events + +__kernel void test_async_copy(__global int *g_in, __local int *l_in, int size) { + // int gid = get_global_id(0); + + // Trigger async copy: global to local + // event_t e_in = + async_work_group_copy( + l_in, // local destination + g_in,// + gid * size, // global source + size, // number of elements + (event_t)0 // no dependency + ); + + // Wait for the async operation to complete + // wait_group_events(1, &e_in); +} + +// CIR: cir.call @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.ptr, !cir.ptr, !u64i, !cir.ptr) -> !cir.ptr +// LLVM: call spir_func ptr @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) %{{.*}}, ptr addrspace(1) %{{.*}}, i64 %{{.*}}, ptr null) +// OG-LLVM: call spir_func target("spirv.Event") @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}}, i64 noundef %{{.*}}, target("spirv.Event") zeroinitializer \ No newline at end of file From 05d5831cbf767dd4d8c9bd85910e8e1686836580 Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Mon, 1 Dec 2025 15:41:25 +0200 Subject: [PATCH 3/3] Support general and minimal ocl opaque type --- .../CIR/Dialect/Builder/CIRBaseBuilder.h | 5 ++- .../include/clang/CIR/Dialect/IR/CIRTypes.td | 44 ++++++++++++++++++- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 11 +---- clang/lib/CIR/CodeGen/CIRGenTypes.cpp | 11 +++-- clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 2 +- .../TargetLowering/TargetLoweringInfo.h | 4 ++ .../TargetLowering/Targets/AMDGPU.cpp | 6 +++ .../TargetLowering/Targets/SPIR.cpp | 12 +++++ .../CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 44 +++++++++++++++++++ .../Lowering/ThroughMLIR/LowerCIRToMLIR.cpp | 2 + clang/test/CIR/CodeGen/OpenCL/async_copy.cl | 21 ++++++--- 11 files changed, 140 insertions(+), 22 deletions(-) diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index 512e33c567e2..a41194ea131a 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -168,9 +168,10 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return cir::ZeroAttr::get(RecordTy); if (auto methodTy = mlir::dyn_cast(ty)) return getNullMethodAttr(methodTy); - if (mlir::isa(ty)) { + if (mlir::isa(ty)) return getFalseAttr(); - } + if (mlir::isa(ty)) + return cir::ZeroAttr::get(ty); llvm_unreachable("Zero initializer for given type is NYI"); } diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td index 6c0eaf919a8b..daeedff25691 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td @@ -752,6 +752,48 @@ def CIR_RecordType : CIR_Type<"Record", "record", [ def CIRRecordType : Type< CPred<"::mlir::isa<::cir::RecordType>($_self)">, "CIR record type">; +//===----------------------------------------------------------------------===// +// Minimal opaque type (used for OpenCL opaque builtin types) +//===----------------------------------------------------------------------===// + +def CIR_OCLOpaqueType : CIR_Type<"Opaque", "opaque"> { + let summary = "Named opaque type for OpenCL-style builtin opaque objects"; + + let description = [{ + Represents a target-independent opaque type used for OpenCL opaque + builtin types such as `event_t`, `sampler_t`, `clk_event_t` and `queue_t`. + + The type has no defined size or layout. CIR carries it through + lowering and delegates the final representation to the target codegen + (e.g. SPIR/SPIR-V lowering), which maps the logical opaque kind to + the correct LLVM type. + + The `tag` attribute identifies the opaque category (e.g. `"event"`). + Values of this type typically appear only through pointer types. + + Example: + !cir.ptr, addrspace(1)> + }]; + + let parameters = (ins "mlir::StringAttr":$tag); + + let builders = [ + TypeBuilder<(ins "mlir::StringAttr":$tag), [{ + return $_get($_ctxt, tag); + }]> + ]; + + let extraClassDeclaration = [{ + static llvm::StringRef getEventTag() { return "event"; } + }]; + + let assemblyFormat = [{ + `<` $tag `>` + }]; + + let skipDefaultBuilders = 1; +} + //===----------------------------------------------------------------------===// // Global type constraints //===----------------------------------------------------------------------===// @@ -760,7 +802,7 @@ def CIR_AnyType : AnyTypeOf<[ CIR_IntType, CIR_PointerType, CIR_DataMemberType, CIR_MethodType, CIR_BoolType, CIR_ArrayType, CIR_VectorType, CIR_FuncType, CIR_VoidType, CIR_RecordType, CIR_ExceptionType, CIR_AnyFloatType, CIR_ComplexType, - CIR_VPtrType + CIR_VPtrType, CIR_OCLOpaqueType ]>; #endif // MLIR_CIR_DIALECT_CIR_TYPES diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index 61a14c009cef..23ac383acd43 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -2123,18 +2123,11 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { return emitComplexToScalarConversion(CGF.getLoc(CE->getExprLoc()), V, Kind, DestTy); } - case CK_ZeroToOCLOpaqueType: { + case CK_ZeroToOCLOpaqueType: // OpenCL: event_t e = async_work_group_copy(..., 0); // The source is an integer constant zero; the destination is an OpenCL // opaque type - mlir::Type destTy = CGF.convertType(DestTy); - auto PtrTy = - cir::PointerType::get(destTy, cir::AddressSpace::OffloadPrivate); - auto constNullPtrAttr = Builder.getConstNullPtrAttr(PtrTy); - auto nullVal = - Builder.getConstant(CGF.getLoc(E->getExprLoc()), constNullPtrAttr); - return nullVal; - } + return emitNullValue(DestTy, CGF.getLoc(E->getExprLoc())); case CK_IntToOCLSampler: llvm_unreachable("NYI"); diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index 8d2068b4e9fd..a2be3ce73c41 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -512,18 +512,23 @@ mlir::Type CIRGenTypes::convertType(QualType T) { #include "clang/Basic/OpenCLImageTypes.def" #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id: #include "clang/Basic/OpenCLExtensionTypes.def" - case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + ResultType = cir::OpaqueType::get( + Builder.getContext(), + mlir::StringAttr::get(Builder.getContext(), + cir::OpaqueType::getEventTag())); + break; + case BuiltinType::OCLSampler: case BuiltinType::OCLClkEvent: case BuiltinType::OCLQueue: - ResultType = Builder.getVoidPtrTy(); + llvm_unreachable("NYI"); break; case BuiltinType::OCLReserveID: ResultType = cir::RecordType::get( &getMLIRContext(), {}, mlir::StringAttr::get(&getMLIRContext(), "ocl_reserve_id"), false, false, cir::RecordType::Struct); - break; + case BuiltinType::SveInt8: case BuiltinType::SveUint8: case BuiltinType::SveInt8x2: diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index 8a472617c7e2..8dcf6793f318 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -439,7 +439,7 @@ static LogicalResult checkConstantTypes(mlir::Operation *op, mlir::Type opType, if (isa(attrType)) { if (::mlir::isa(opType)) + cir::VectorType, cir::OpaqueType>(opType)) return success(); return op->emitOpError("zero expects record or array type"); } diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/TargetLoweringInfo.h b/clang/lib/CIR/Dialect/Transforms/TargetLowering/TargetLoweringInfo.h index 99e464c6bbd6..d886b2f1ee3d 100644 --- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/TargetLoweringInfo.h +++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/TargetLoweringInfo.h @@ -35,6 +35,10 @@ class TargetLoweringInfo { virtual unsigned getTargetAddrSpaceFromCIRAddrSpace(cir::LangAddressSpace addrSpace) const = 0; + + virtual mlir::Type getOpaqueType(cir::OpaqueType type) const { + llvm_unreachable("NYI"); + } }; } // namespace cir diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/AMDGPU.cpp b/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/AMDGPU.cpp index 76d457f1607b..8aa8bc576af2 100644 --- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/AMDGPU.cpp +++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/AMDGPU.cpp @@ -11,6 +11,7 @@ #include "LowerTypes.h" #include "TargetInfo.h" #include "TargetLoweringInfo.h" +#include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "clang/CIR/ABIArgInfo.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" @@ -61,6 +62,11 @@ class AMDGPUTargetLoweringInfo : public TargetLoweringInfo { cir_cconv_unreachable("Unknown CIR address space for this target"); } } + + mlir::Type getOpaqueType(cir::OpaqueType type) const override { + assert(!cir::MissingFeatures::addressSpace()); + return mlir::LLVM::LLVMPointerType::get(type.getContext()); + } }; } // namespace diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/SPIR.cpp b/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/SPIR.cpp index 2497e6768094..7f745f811ce3 100644 --- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/SPIR.cpp +++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/SPIR.cpp @@ -11,8 +11,10 @@ #include "LowerTypes.h" #include "TargetInfo.h" #include "TargetLoweringInfo.h" +#include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "clang/CIR/ABIArgInfo.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" +#include "clang/CIR/Dialect/IR/CIRTypes.h" #include "clang/CIR/MissingFeatures.h" #include "llvm/Support/ErrorHandling.h" @@ -59,6 +61,16 @@ class SPIRVTargetLoweringInfo : public TargetLoweringInfo { cir_cconv_unreachable("Unknown CIR address space for this target"); } } + + mlir::Type getOpaqueType(cir::OpaqueType type) const override { + if (type.getTag() != cir::OpaqueType::getEventTag()) + llvm_unreachable("NYI"); + + return mlir::LLVM::LLVMTargetExtType::get(type.getContext(), + /*extTypeName=*/"spirv.Event", + /*typeParams=*/{}, + /*intParams=*/{}); + } }; } // namespace diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index 3e4da37cff92..509bdfbec732 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -2136,6 +2136,45 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite( rewriter.replaceOp(op, lowerCirAttrAsValue(op, op.getValue(), rewriter, getTypeConverter(), dataLayout)); return mlir::success(); + } else if (mlir::isa(op.getType())) { + mlir::Attribute valAttr = op.getValue(); + mlir::Type llvmTy = getTypeConverter()->convertType(op.getType()); + // If the attribute is ZeroAttr or UndefAttr, handle it: + if (mlir::isa(valAttr)) { + // Handle target-ext type + if (auto tgtExtTy = + llvm::dyn_cast_or_null(llvmTy)) { + // Produce a real zero constant if the target-ext type allows it + if (tgtExtTy.hasProperty(mlir::LLVM::LLVMTargetExtType::HasZeroInit)) { + if (mlir::isa(valAttr)) { + auto zero = + mlir::LLVM::ZeroOp::create(rewriter, op.getLoc(), llvmTy); + rewriter.replaceOp(op, zero.getResult()); + return mlir::success(); + } + // Fallback: emit an undef of that exact llvm type so users have + // matching types. + auto undef = + mlir::LLVM::UndefOp::create(rewriter, op.getLoc(), llvmTy); + rewriter.replaceOp(op, undef.getResult()); + return mlir::success(); + } + } else { + // Target ext type does not support zero init — use `ptr null` of + // the target-ext type (so users still have the expected type). + auto ptrTy = mlir::LLVM::LLVMPointerType::get(getContext()); + auto nullPtr = mlir::LLVM::ZeroOp::create(rewriter, op.getLoc(), ptrTy); + + rewriter.replaceOp(op, nullPtr.getResult()); + return mlir::success(); + } + } + + // If the attr is a non-zero concrete value, we must decide if the target + // expects an encoded representation. Most target-ext types for OpenCL + // do not accept arbitrary non-zero constants; reject them. + return op.emitError() << "non-zero constant for target extension type " + << llvmTy << " is unsupported"; } else return op.emitError() << "unsupported constant type " << op.getType(); @@ -5190,6 +5229,11 @@ void prepareTypeConverter(mlir::LLVMTypeConverter &converter, converter.addConversion([&](cir::VoidType type) -> mlir::Type { return mlir::LLVM::LLVMVoidType::get(type.getContext()); }); + + converter.addConversion([&, lowerModule](cir::OpaqueType type) -> mlir::Type { + assert(lowerModule && "LowerModule is not available"); + return lowerModule->getTargetLoweringInfo().getOpaqueType(type); + }); } void buildCtorDtorList( diff --git a/clang/lib/CIR/Lowering/ThroughMLIR/LowerCIRToMLIR.cpp b/clang/lib/CIR/Lowering/ThroughMLIR/LowerCIRToMLIR.cpp index 275656a7f934..68cf856ecbc1 100644 --- a/clang/lib/CIR/Lowering/ThroughMLIR/LowerCIRToMLIR.cpp +++ b/clang/lib/CIR/Lowering/ThroughMLIR/LowerCIRToMLIR.cpp @@ -1861,6 +1861,8 @@ static mlir::TypeConverter prepareTypeConverter() { return nullptr; return mlir::VectorType::get(2, elemTy); }); + converter.addConversion( + [&](cir::OpaqueType type) -> mlir::Type { llvm_unreachable("NYI"); }); return converter; } diff --git a/clang/test/CIR/CodeGen/OpenCL/async_copy.cl b/clang/test/CIR/CodeGen/OpenCL/async_copy.cl index 256d28f1fd3f..53f39484559a 100644 --- a/clang/test/CIR/CodeGen/OpenCL/async_copy.cl +++ b/clang/test/CIR/CodeGen/OpenCL/async_copy.cl @@ -1,6 +1,11 @@ -// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-cir -o - %s -fclangir | FileCheck %s --check-prefix=CIR -// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s -fclangir | FileCheck %s --check-prefix=LLVM -// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s | FileCheck %s --check-prefix=OG-LLVM +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-cir -o - %s -fclangir | FileCheck %s --check-prefix=CIR-SPIR +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s -fclangir | FileCheck %s --check-prefix=LLVM-SPIR +// RUN: %clang -cc1 -triple spirv64-unknown-unknown -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s | FileCheck %s --check-prefix=OG-LLVM-SPIR + +// RUN: %clang -cc1 -triple amdgcn-amd-amdhsa -cl-std=CL2.0 -finclude-default-header -emit-cir -o - %s -fclangir | FileCheck %s --check-prefix=CIR-AMDGCN +// RUN: %clang -cc1 -triple amdgcn-amd-amdhsa -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s -fclangir | FileCheck %s --check-prefix=LLVM-AMDGCN +// RUN: %clang -cc1 -triple amdgcn-amd-amdhsa -cl-std=CL2.0 -finclude-default-header -emit-llvm -o - %s | FileCheck %s --check-prefix=OG-LLVM-AMDGCN + // Simple kernel using async_work_group_copy + wait_group_events @@ -20,6 +25,10 @@ __kernel void test_async_copy(__global int *g_in, __local int *l_in, int size) { // wait_group_events(1, &e_in); } -// CIR: cir.call @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.ptr, !cir.ptr, !u64i, !cir.ptr) -> !cir.ptr -// LLVM: call spir_func ptr @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) %{{.*}}, ptr addrspace(1) %{{.*}}, i64 %{{.*}}, ptr null) -// OG-LLVM: call spir_func target("spirv.Event") @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}}, i64 noundef %{{.*}}, target("spirv.Event") zeroinitializer \ No newline at end of file +// CIR-SPIR: cir.call @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.ptr, !cir.ptr, !u64i, !cir.opaque<"event">) -> !cir.opaque<"event"> +// LLVM-SPIR: call spir_func target("spirv.Event") @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) %{{.*}}, ptr addrspace(1) %{{.*}}, i64 %{{.*}}, target("spirv.Event") zeroinitializer) +// OG-LLVM-SPIR: call spir_func target("spirv.Event") @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}}, i64 noundef %{{.*}}, target("spirv.Event") zeroinitializer + +// CIR-AMDGCN: cir.call @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!cir.ptr, !cir.ptr, !u64i, !cir.opaque<"event">) -> !cir.opaque<"event"> +// LLVM-AMDGCN: call ptr @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) %{{.*}}, ptr addrspace(1) %{{.*}}, i64 %{{.*}}, ptr null) +// OG-LLVM-AMDGCN: call ptr @_Z21async_work_group_copyPU3AS3iPU3AS1Kim9ocl_event(ptr addrspace(3) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}}, i64 noundef %{{.*}}, ptr null) \ No newline at end of file