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

Matthias Springer llvmlistbot at llvm.org
Sat Jan 31 12:13:49 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; }]
+    >
----------------
matthias-springer wrote:

What would you call this new interface? Are there any other op properties that fall under the same umbrella and should be part of that interface eventually? (There are various [LLVM function attributes](https://llvm.org/docs/LangRef.html#function-attributes) next to `mustprogress` and I'm wondering if any of those should be part of the interface in the future.)

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


More information about the Mlir-commits mailing list