[Mlir-commits] [mlir] [mlir][tosa] Print generic `cond_if` when block arguments are present (PR #144859)

Luke Hutton llvmlistbot at llvm.org
Mon Jun 23 01:21:18 PDT 2025


================
@@ -3681,6 +3686,17 @@ ParseResult IfOp::parse(OpAsmParser &parser, OperationState &result) {
 }
 
 void IfOp::print(OpAsmPrinter &p) {
+  // The simplified syntax drops block-level arguments
+  // to the then/else regions. Fallback to the generic
+  // parser if these are found
+  Region &thenRegion = getThenGraph();
+  Region &elseRegion = getElseGraph();
+  if (!thenRegion.empty() && thenRegion.front().getNumArguments() > 0 &&
+      !elseRegion.empty() && elseRegion.front().getNumArguments() > 0) {
+    p.printGenericOp(*this, false);
----------------
lhutton1 wrote:

I feel the commit message would have benefitted from an example, I've just added that

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


More information about the Mlir-commits mailing list