[Mlir-commits] [mlir] c870f20 - [mlir] Remove assert from RegionBranchOpInterface verifier

Jeff Niu llvmlistbot at llvm.org
Mon Oct 17 09:23:42 PDT 2022


Author: Jeff Niu
Date: 2022-10-17T09:23:35-07:00
New Revision: c870f2067a3bffbb06a5b549321564b5dfbd5481

URL: https://github.com/llvm/llvm-project/commit/c870f2067a3bffbb06a5b549321564b5dfbd5481
DIFF: https://github.com/llvm/llvm-project/commit/c870f2067a3bffbb06a5b549321564b5dfbd5481.diff

LOG: [mlir] Remove assert from RegionBranchOpInterface verifier

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

Added: 
    

Modified: 
    mlir/lib/Interfaces/ControlFlowInterfaces.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
index d84218c19551..900617c3f15f 100644
--- a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
+++ b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
@@ -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;


        


More information about the Mlir-commits mailing list