Use LLVM dynamic dispatch to disambiguate between StmtBlock subclasses.

PiperOrigin-RevId: 204614520
diff --git a/include/mlir/IR/MLFunction.h b/include/mlir/IR/MLFunction.h
index c8388ee..731a191 100644
--- a/include/mlir/IR/MLFunction.h
+++ b/include/mlir/IR/MLFunction.h
@@ -36,9 +36,13 @@
   // TODO: add function arguments and return values once
   // SSA values are implemented
 
-  // Methods for support type inquiry through isa, cast, and dyn_cast
+  /// Methods for support type inquiry through isa, cast, and dyn_cast.
   static bool classof(const Function *func) {
-    return func->getKind() == Kind::MLFunc;
+    return func->getKind() == Function::Kind::MLFunc;
+  }
+
+  static bool classof(const StmtBlock *block) {
+    return block->getStmtBlockKind() == StmtBlockKind::MLFunc;
   }
 
   void print(raw_ostream &os) const;