Rename Operation::getAs to Operation::dyn_cast

Also rename Operation::is to Operation::isa
Introduce Operation::cast

All of these are for consistency with global dyn_cast/cast/isa operators.

PiperOrigin-RevId: 217878786
diff --git a/lib/Analysis/AffineAnalysis.cpp b/lib/Analysis/AffineAnalysis.cpp
index ee1641b..a16997c 100644
--- a/lib/Analysis/AffineAnalysis.cpp
+++ b/lib/Analysis/AffineAnalysis.cpp
@@ -322,11 +322,11 @@
     auto *opStmt = state.value->getDefiningStmt();
     // Note: getDefiningStmt will return nullptr if the operand is not an
     // OperationStmt (i.e. ForStmt), which is a terminator for the search.
-    if (opStmt == nullptr || !opStmt->is<AffineApplyOp>()) {
+    if (opStmt == nullptr || !opStmt->isa<AffineApplyOp>()) {
       worklist.pop_back();
       continue;
     }
-    if (auto affineApplyOp = opStmt->getAs<AffineApplyOp>()) {
+    if (auto affineApplyOp = opStmt->dyn_cast<AffineApplyOp>()) {
       if (state.operandIndex == 0) {
         // Pre-Visit: Add 'opStmt' to reachable sequence.
         affineApplyOps.push_back(opStmt);
diff --git a/lib/Analysis/LoopAnalysis.cpp b/lib/Analysis/LoopAnalysis.cpp
index 9e65e7b..5f1b7f2 100644
--- a/lib/Analysis/LoopAnalysis.cpp
+++ b/lib/Analysis/LoopAnalysis.cpp
@@ -145,7 +145,7 @@
   assert(affineApplyOps.size() == 1 &&
          "CompositionAffineMapsPass must have "
          "been run: there should be at most one AffineApplyOp");
-  auto composeOp = affineApplyOps[0]->getAs<AffineApplyOp>();
+  auto composeOp = affineApplyOps[0]->cast<AffineApplyOp>();
   return !AffineValueMap(*composeOp).isFunctionOf(dim, input);
 }
 
@@ -186,8 +186,8 @@
   auto &matches = loadAndStores.match(forStmt);
   for (auto ls : matches) {
     auto *op = cast<OperationStmt>(ls.first);
-    auto load = op->getAs<LoadOp>();
-    auto store = op->getAs<StoreOp>();
+    auto load = op->dyn_cast<LoadOp>();
+    auto store = op->dyn_cast<StoreOp>();
     bool contiguous = load ? isContiguousAccess(forStmt, load)
                            : isContiguousAccess(forStmt, store);
     if (!contiguous) {
diff --git a/lib/Analysis/MLFunctionMatcher.cpp b/lib/Analysis/MLFunctionMatcher.cpp
index 8739edb..fdd1b01 100644
--- a/lib/Analysis/MLFunctionMatcher.cpp
+++ b/lib/Analysis/MLFunctionMatcher.cpp
@@ -250,7 +250,7 @@
 
 FilterFunctionType isLoadOrStore = [](Statement *stmt) {
   auto *opStmt = dyn_cast<OperationStmt>(stmt);
-  return opStmt && (opStmt->is<LoadOp>() || opStmt->is<StoreOp>());
+  return opStmt && (opStmt->isa<LoadOp>() || opStmt->isa<StoreOp>());
 };
 MLFunctionMatcher LoadStores() {
   return MLFunctionMatcher(Statement::Kind::Operation, {}, isLoadOrStore);