@@ -655,15 +655,15 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) {
655655 }
656656
657657 // Next handle DAG leaf: operand or attribute
658- if (isa <NamedTypeConstraint *>(opArg )) {
658+ if (opArg. is <NamedTypeConstraint *>()) {
659659 auto operandName =
660660 formatv (" {0}.getODSOperands({1})" , castedName, nextOperand);
661661 emitOperandMatch (tree, castedName, operandName.str (), opArgIdx,
662662 /* operandMatcher=*/ tree.getArgAsLeaf (i),
663663 /* argName=*/ tree.getArgName (i), opArgIdx,
664664 /* variadicSubIndex=*/ std::nullopt );
665665 ++nextOperand;
666- } else if (isa <NamedAttribute *>(opArg )) {
666+ } else if (opArg. is <NamedAttribute *>()) {
667667 emitAttributeMatch (tree, opName, opArgIdx, depth);
668668 } else {
669669 PrintFatalError (loc, " unhandled case when matching op" );
@@ -680,7 +680,7 @@ void PatternEmitter::emitOperandMatch(DagNode tree, StringRef opName,
680680 int argIndex,
681681 std::optional<int > variadicSubIndex) {
682682 Operator &op = tree.getDialectOp (opMap);
683- auto *operand = cast<NamedTypeConstraint *>( op.getArg (operandIndex));
683+ auto *operand = op.getArg (operandIndex). get <NamedTypeConstraint *>( );
684684
685685 // If a constraint is specified, we need to generate C++ statements to
686686 // check the constraint.
@@ -770,7 +770,7 @@ void PatternEmitter::emitEitherOperandMatch(DagNode tree, DagNode eitherArgTree,
770770 // need to queue the operation only if the matching success. Thus we emit
771771 // the code at the end.
772772 tblgenOps << formatv (" tblgen_ops.push_back({0});\n " , argName);
773- } else if (isa<NamedTypeConstraint *>( op.getArg (argIndex))) {
773+ } else if (op.getArg (argIndex). is <NamedTypeConstraint *>( )) {
774774 emitOperandMatch (tree, opName, /* operandName=*/ formatv (" v{0}" , i).str (),
775775 operandIndex,
776776 /* operandMatcher=*/ eitherArgTree.getArgAsLeaf (i),
@@ -851,7 +851,7 @@ void PatternEmitter::emitVariadicOperandMatch(DagNode tree,
851851 os << formatv (" tblgen_ops.push_back({0});\n " , argName);
852852
853853 os.unindent () << " }\n " ;
854- } else if (isa<NamedTypeConstraint *>( op.getArg (argIndex))) {
854+ } else if (op.getArg (argIndex). is <NamedTypeConstraint *>( )) {
855855 auto operandName = formatv (" variadic_operand_range.slice({0}, 1)" , i);
856856 emitOperandMatch (tree, opName, operandName.str (), operandIndex,
857857 /* operandMatcher=*/ variadicArgTree.getArgAsLeaf (i),
@@ -867,7 +867,7 @@ void PatternEmitter::emitVariadicOperandMatch(DagNode tree,
867867void PatternEmitter::emitAttributeMatch (DagNode tree, StringRef opName,
868868 int argIndex, int depth) {
869869 Operator &op = tree.getDialectOp (opMap);
870- auto *namedAttr = cast<NamedAttribute *>( op.getArg (argIndex));
870+ auto *namedAttr = op.getArg (argIndex). get <NamedAttribute *>( );
871871 const auto &attr = namedAttr->attr ;
872872
873873 os << " {\n " ;
@@ -1775,7 +1775,7 @@ void PatternEmitter::supplyValuesForOpArgs(
17751775 auto patArgName = node.getArgName (argIndex);
17761776 if (leaf.isConstantAttr () || leaf.isEnumAttrCase ()) {
17771777 // TODO: Refactor out into map to avoid recomputing these.
1778- if (!isa <NamedAttribute *>(opArg ))
1778+ if (!opArg. is <NamedAttribute *>())
17791779 PrintFatalError (loc, Twine (" expected attribute " ) + Twine (argIndex));
17801780 if (!patArgName.empty ())
17811781 os << " /*" << patArgName << " =*/" ;
@@ -1805,7 +1805,7 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
18051805 bool hasOperandSegmentSizes = false ;
18061806 std::vector<std::string> sizes;
18071807 for (int argIndex = 0 , e = resultOp.getNumArgs (); argIndex < e; ++argIndex) {
1808- if (isa<NamedAttribute *>( resultOp.getArg (argIndex))) {
1808+ if (resultOp.getArg (argIndex). is <NamedAttribute *>( )) {
18091809 // The argument in the op definition.
18101810 auto opArgName = resultOp.getArgName (argIndex);
18111811 hasOperandSegmentSizes =
@@ -1826,7 +1826,7 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
18261826 }
18271827
18281828 const auto *operand =
1829- cast<NamedTypeConstraint *>( resultOp.getArg (argIndex));
1829+ resultOp.getArg (argIndex). get <NamedTypeConstraint *>( );
18301830 std::string varName;
18311831 if (operand->isVariadic ()) {
18321832 ++numVariadic;
0 commit comments