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

Amir Bishara llvmlistbot at llvm.org
Fri Jun 20 06:32: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);
----------------
amirBish wrote:

Could you please mention which information about the block arguments we can miss without this generic parsing/printing?

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


More information about the Mlir-commits mailing list