[Mlir-commits] [mlir] [mlir][tosa] Fix validation check on controlflow operators (PR #159754)

Luke Hutton llvmlistbot at llvm.org
Mon Sep 22 01:38:22 PDT 2025


================
@@ -1257,17 +1257,17 @@ bool checkErrorIfCondIf(Operation *op) {
   //   tosa.yield %arg4
   // }
 
-  return failed(checkIsolatedRegion(op, ifOp.getThenGraph(), "then")) ||
-         failed(checkIsolatedRegion(op, ifOp.getElseGraph(), "else"));
+  return succeeded(checkIsolatedRegion(op, ifOp.getThenGraph(), "then")) &&
+         succeeded(checkIsolatedRegion(op, ifOp.getElseGraph(), "else"));
 }
 
 bool checkErrorIfWhileLoop(Operation *op) {
   auto whileOp = dyn_cast<tosa::WhileOp>(op);
   if (!whileOp)
     return true;
 
-  return failed(checkIsolatedRegion(op, whileOp.getCondGraph(), "cond")) ||
-         failed(checkIsolatedRegion(op, whileOp.getBodyGraph(), "body"));
+  return succeeded(checkIsolatedRegion(op, whileOp.getCondGraph(), "cond")) &&
+         succeeded(checkIsolatedRegion(op, whileOp.getBodyGraph(), "body"));
----------------
lhutton1 wrote:

Makes sense, thanks! I've uploaded a PR on top of this one to address this: https://github.com/llvm/llvm-project/pull/160052

https://github.com/llvm/llvm-project/pull/159754


More information about the Mlir-commits mailing list