diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e1b2f0b766e1..2659471e7e38 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -3638,8 +3638,8 @@ class CIR_CallOp extra_traits = []> : void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) { if (auto calling = (*this)->getAttrOfType(getCalleeAttrName())) - (*this)->setAttr(getCalleeAttrName(), callee.get()); - setOperand(0, callee.get()); + (*this)->setAttr(getCalleeAttrName(), mlir::cast(callee)); + setOperand(0, mlir::cast(callee)); } bool isIndirect() { return !getCallee(); } diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp index c712a7ea27c4..851a2230bf30 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp @@ -1053,7 +1053,7 @@ void CIRGenFunction::emitCallArgs( const auto *MD = mlir::dyn_cast(Prototype.P); assert(!MD && "ObjCMethodDecl NYI"); - const auto *FPT = Prototype.P.get(); + const auto *FPT = mlir::cast(Prototype.P); IsVariadic = FPT->isVariadic(); ExplicitCC = FPT->getExtInfo().getCC(); ArgTypes.assign(FPT->param_type_begin() + ParamsToSkip, diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp index b15b7f3aaf2e..b886674b366f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp @@ -1456,8 +1456,8 @@ mlir::Attribute ConstantLValueEmitter::tryEmit() { // Convert to the appropriate type; this could be an lvalue for // an integer. FIXME: performAddrSpaceCast if (mlir::isa(destTy)) { - if (value.is()) - return value.get(); + if (auto attr = mlir::dyn_cast(value)) + return attr; llvm_unreachable("NYI"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenValue.h b/clang/lib/CIR/CodeGen/CIRGenValue.h index 6e26c8059a15..2d24018b9601 100644 --- a/clang/lib/CIR/CodeGen/CIRGenValue.h +++ b/clang/lib/CIR/CodeGen/CIRGenValue.h @@ -70,8 +70,9 @@ class RValue { /// Return the mlir::Value of the address of the aggregate. Address getAggregateAddress() const { assert(isAggregate() && "Not an aggregate!"); - auto align = reinterpret_cast(V2.getPointer().get()) >> - AggAlignShift; + auto align = + reinterpret_cast(mlir::cast(V2.getPointer())) >> + AggAlignShift; return Address(V1.getPointer(), ElementType, clang::CharUnits::fromQuantity(align)); } diff --git a/clang/lib/CIR/CodeGen/ConstantInitBuilder.cpp b/clang/lib/CIR/CodeGen/ConstantInitBuilder.cpp index 848189f852c4..b0b146e12e2c 100644 --- a/clang/lib/CIR/CodeGen/ConstantInitBuilder.cpp +++ b/clang/lib/CIR/CodeGen/ConstantInitBuilder.cpp @@ -23,10 +23,10 @@ ConstantInitBuilderBase::ConstantInitBuilderBase(CIRGenModule &CGM) mlir::Type ConstantInitFuture::getType() const { assert(Data && "dereferencing null future"); - if (Data.is()) { - auto attr = mlir::dyn_cast(Data.get()); - assert(attr && "expected typed attribute"); - return attr.getType(); + if (auto attr = mlir::dyn_cast(Data)) { + auto typedAttr = mlir::dyn_cast(attr); + assert(typedAttr && "expected typed attribute"); + return typedAttr.getType(); } else { llvm_unreachable("Only sypport typed attributes here"); } @@ -42,8 +42,8 @@ void ConstantInitFuture::abandon() { void ConstantInitFuture::installInGlobal(cir::GlobalOp GV) { assert(Data && "installing null future"); - if (Data.is()) { - CIRGenModule::setInitializer(GV, Data.get()); + if (auto attr = mlir::dyn_cast(Data)) { + CIRGenModule::setInitializer(GV, attr); } else { llvm_unreachable("NYI"); // auto &builder = *Data.get(); diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index b4228fa2dfc8..822af97ad6e4 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -784,8 +784,8 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) { // create a new attribute that's capable of representing the source. llvm::SmallVector foldResults; auto foldOrder = getSrc().getDefiningOp()->fold(foldResults); - if (foldOrder.succeeded() && foldResults[0].is()) - return foldResults[0].get(); + if (foldOrder.succeeded() && mlir::isa(foldResults[0])) + return mlir::cast(foldResults[0]); return {}; } case cir::CastKind::bitcast: diff --git a/clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp b/clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp index 08afedf804e3..323b8e4cd125 100644 --- a/clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp +++ b/clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp @@ -526,11 +526,11 @@ static Location getEndLocForHist(Region *R) { static Location getEndLocForHist(LifetimeCheckPass::LexicalScopeContext &lsc) { assert(!lsc.parent.isNull() && "shouldn't be null"); - if (lsc.parent.is()) - return getEndLocForHist(lsc.parent.get()); - assert(lsc.parent.is() && + if (auto r = mlir::dyn_cast(lsc.parent)) + return getEndLocForHist(r); + assert(mlir::isa(lsc.parent) && "Only support operation beyond this point"); - return getEndLocForHist(lsc.parent.get()); + return getEndLocForHist(mlir::cast(lsc.parent)); } void LifetimeCheckPass::killInPset(mlir::Value ptrKey, const State &s, diff --git a/clang/test/CodeGenOpenCL/printf.cl b/clang/test/CodeGenOpenCL/printf.cl index 012b7c822344..2e11b8889d23 100644 --- a/clang/test/CodeGenOpenCL/printf.cl +++ b/clang/test/CodeGenOpenCL/printf.cl @@ -4,7 +4,6 @@ // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=CL3.0 -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=clc++2021 -cl-ext=+__opencl_c_fp64,+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=clc++2021 -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s -// XFAIL: * typedef __attribute__((ext_vector_type(2))) float float2; typedef __attribute__((ext_vector_type(2))) half half2;