Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 12 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1945,8 +1945,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");

Expand Down
7 changes: 6 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down