[mlir] Remove assert from RegionBranchOpInterface verifier
authorJeff Niu <jeff@modular.com>
Mon, 17 Oct 2022 04:27:20 +0000 (21:27 -0700)
committerJeff Niu <jeff@modular.com>
Mon, 17 Oct 2022 16:23:35 +0000 (09:23 -0700)
This assert is erroneous because an op implementing
`RegionBranchOpInterface` can have variadic regions and in some cases
have zero regions, in which case the only possible control flow is
branching from the parent op to itself.

Reviewed By: rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D136052

mlir/lib/Interfaces/ControlFlowInterfaces.cpp

index d84218c..900617c 100644 (file)
@@ -159,10 +159,6 @@ LogicalResult detail::verifyTypesAlongControlFlowEdges(Operation *op) {
   if (failed(verifyTypesAlongAllEdges(op, llvm::None, inputTypesFromParent)))
     return failure();
 
-  // RegionBranchOpInterface should not be implemented by Ops that do not have
-  // attached regions.
-  assert(op->getNumRegions() != 0);
-
   auto areTypesCompatible = [&](TypeRange lhs, TypeRange rhs) {
     if (lhs.size() != rhs.size())
       return false;