[Mlir-commits] [mlir] [mlir][Interfaces] Add `mustProgress` interface method + folding pattern (PR #179039)

Mehdi Amini llvmlistbot at llvm.org
Sun Feb 1 02:05:30 PST 2026


================
@@ -351,6 +351,18 @@ def RegionBranchOpInterface : OpInterface<"RegionBranchOpInterface"> {
       (ins "::mlir::Type":$lhs, "::mlir::Type":$rhs), [{}],
       /*defaultImplementation=*/[{ return lhs == rhs; }]
     >,
+    InterfaceMethod<[{
+        Region branch ops that "must progress" are required to terminate (i.e.,
+        not loop infinitely between their regions) or interact with the
+        environment in an observable way. If a "must progress" op is found to
+        loop infinitely without interacting with the environment, it may be
+        erased. See "llvm.loop.mustprogress" for more details.
+
+        Region branch ops must progress by default.
+      }],
+      "bool", "mustProgress", (ins), [{}],
+      /*defaultImplementation=*/[{ return true; }]
+    >
----------------
joker-eph wrote:

I thought about a trait, but you may want to be able to query a property of the operation (a SCF operation tagged with `mustprogress` for example), I don't think the trait can support that?

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


More information about the Mlir-commits mailing list