Rephrasing last statement invariant check in ReturnOp::verify() to be more
elegant.

PiperOrigin-RevId: 209094070
diff --git a/lib/IR/StandardOps.cpp b/lib/IR/StandardOps.cpp
index 5bfa2d3..723dcc2 100644
--- a/lib/IR/StandardOps.cpp
+++ b/lib/IR/StandardOps.cpp
@@ -438,8 +438,8 @@
 const char *ReturnOp::verify() const {
   // ReturnOp must be part of an ML function.
   if (auto *stmt = dyn_cast<OperationStmt>(getOperation())) {
-    MLFunction *func = dyn_cast_or_null<MLFunction>(stmt->getBlock());
-    if (!func || &func->back() != stmt)
+    StmtBlock *block = stmt->getBlock();
+    if (!block || !isa<MLFunction>(block) || &block->back() != stmt)
       return "must be the last statement in the ML function";
 
     // Return success. Checking that operand types match those in the function