diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td @@ -90,7 +90,7 @@ /*methodName=*/"getFlags", (ins), [{}], [{ if (Attribute flags = $_op->getAttr("omp.flags")) - return flags.dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(flags); return nullptr; }]>, InterfaceMethod< @@ -119,7 +119,7 @@ /*methodName=*/"getTarget", (ins), [{}], [{ if (Attribute flags = $_op->getAttr("omp.target")) - return flags.dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(flags); return nullptr; }]>, InterfaceMethod< diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td --- a/mlir/include/mlir/IR/BuiltinAttributes.td +++ b/mlir/include/mlir/IR/BuiltinAttributes.td @@ -562,8 +562,8 @@ /// `AttrClass`, null otherwise. template AttrClass getAs(NameClass &&name) const { - return get(std::forward(name)) - .template dyn_cast_or_null(); + return llvm::dyn_cast_or_null( + get(std::forward(name))); } private: diff --git a/mlir/include/mlir/IR/EnumAttr.td b/mlir/include/mlir/IR/EnumAttr.td --- a/mlir/include/mlir/IR/EnumAttr.td +++ b/mlir/include/mlir/IR/EnumAttr.td @@ -168,7 +168,7 @@ // Override Attr class fields for specialized class let predicate = !if(genSpecializedAttr, - CPred<"$_self.isa<" # cppNamespace # "::" # specializedAttrClassName # ">()">, + CPred<"::llvm::isa<" # cppNamespace # "::" # specializedAttrClassName # ">($_self)">, baseAttrClass.predicate); let storageType = !if(genSpecializedAttr, cppNamespace # "::" # specializedAttrClassName, diff --git a/mlir/include/mlir/IR/FunctionInterfaces.td b/mlir/include/mlir/IR/FunctionInterfaces.td --- a/mlir/include/mlir/IR/FunctionInterfaces.td +++ b/mlir/include/mlir/IR/FunctionInterfaces.td @@ -445,11 +445,11 @@ template AttrClass getArgAttrOfType(unsigned index, StringAttr name) { - return getArgAttr(index, name).template dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(getArgAttr(index, name)); } template AttrClass getArgAttrOfType(unsigned index, StringRef name) { - return getArgAttr(index, name).template dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(getArgAttr(index, name)); } /// Set the attributes held by the argument at 'index'. @@ -534,11 +534,11 @@ template AttrClass getResultAttrOfType(unsigned index, StringAttr name) { - return getResultAttr(index, name).template dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(getResultAttr(index, name)); } template AttrClass getResultAttrOfType(unsigned index, StringRef name) { - return getResultAttr(index, name).template dyn_cast_or_null(); + return ::llvm::dyn_cast_or_null(getResultAttr(index, name)); } /// Set the attributes held by the result at 'index'. diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -347,10 +347,10 @@ #define INT_AND_FLOAT_CASE(kind, iop, fop) \ case vector::CombiningKind::kind: \ - if (resultType.isa()) { \ + if (llvm::isa(resultType)) { \ result = rewriter.create(loc, resultType, result, next); \ } else { \ - assert(resultType.isa()); \ + assert(llvm::isa(resultType)); \ result = rewriter.create(loc, resultType, result, next); \ } \ break diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp --- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp +++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp @@ -100,7 +100,7 @@ // Args with elements of type ArrayAttr must have a type. } else if (llvm::isa( - arg) /*&& arg.getType().isa()*/) { + arg) /*&& llvm::isa(arg.getType())*/) { // FIXME: Array attributes never have types return emitOpError("array argument has no type"); } diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp --- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp @@ -826,7 +826,7 @@ #define REDUCE_FOLDER(OP) \ OpFoldResult OP::fold(FoldAdaptor adaptor) { \ - ShapedType inputTy = getInput().getType().cast(); \ + ShapedType inputTy = llvm::cast(getInput().getType()); \ if (!inputTy.hasRank()) \ return {}; \ if (inputTy.getDimSize(getAxis()) == 1) \ diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp --- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp @@ -969,10 +969,11 @@ OpaqueProperties properties, RegionRange regions, \ SmallVectorImpl &inferredReturnShapes) { \ Type inputType = \ - operands.getType()[0].cast().getElementType(); \ - return ReduceInferReturnTypes(operands.getShape(0), inputType, \ - attributes.get("axis").cast(), \ - inferredReturnShapes); \ + llvm::cast(operands.getType()[0]).getElementType(); \ + return ReduceInferReturnTypes( \ + operands.getShape(0), inputType, \ + llvm::cast(attributes.get("axis")), \ + inferredReturnShapes); \ } \ COMPATIBLE_RETURN_TYPES(OP) diff --git a/mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp b/mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp --- a/mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp +++ b/mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp @@ -104,9 +104,9 @@ } #define GET_UQTYPE(input_type) \ - ((input_type).getElementType().dyn_cast()) + (llvm::dyn_cast((input_type).getElementType())) #define GET_QTYPE(input_type) \ - ((input_type).getElementType().dyn_cast()) + (llvm::dyn_cast((input_type).getElementType())) /// Method to build ConvOpQuantizationAttr, called from /// ConvOpQuantInfoBuilder/TransConvOpQuantInfoBuilder: diff --git a/mlir/test/python/python_test_ops.td b/mlir/test/python/python_test_ops.td --- a/mlir/test/python/python_test_ops.td +++ b/mlir/test/python/python_test_ops.td @@ -105,7 +105,7 @@ ::mlir::ShapedTypeComponents>& inferredShapedTypeComponents) { $cppClass::Adaptor adaptor(operands, attributes, properties, regions); auto operandType = - adaptor.getOperand().getType().cast<::mlir::ShapedType>(); + ::llvm::cast<::mlir::ShapedType>(adaptor.getOperand().getType()); if (operandType.hasRank()) { inferredShapedTypeComponents.emplace_back(operandType.getShape(), operandType.getElementType());