[Mlir-commits] [mlir] [mlir] Added `Convergent` trait that matches LLVM's semantics (PR #152358)

Nikolay Panchenko llvmlistbot at llvm.org
Thu Aug 7 07:35:57 PDT 2025


================
@@ -337,8 +337,12 @@ struct ReturnLike : public TraitBase<ConcreteType, ReturnLike> {
     return success();
   }
 };
-} // namespace OpTrait
 
+// The Operation may not be made control-dependent on any additional values.
+// See https://llvm.org/docs/ConvergentOperations.html for more details.
+template <typename ConcreteType>
+struct Convergent : public TraitBase<ConcreteType, Convergent> {};
----------------
npanchen wrote:

> @npanchen : when mapping a structured control-flow to a CFG, just annotating things as "convergent" isn't enough I believe. See this example: https://youtu.be/_Z5DuiVCFAw?t=434 ; basically structured control-flow needs to say "something" about the reconvergence property and the management of anchors (the video is amazing for explaining all this I think!)

Thanks, that's quite interesting video. I actually was unable to find when `convergence.loop`/`convergence.entry`/`convergence.anchor` are generated. Are they even still in use ?
If they are, yeah, that might be more interesting from design point of view.  As of know I can only think about adding `RecursivelyConvergent` trait. But not sure that's a good idea for functions.

completely side note: there's also `noduplicate` property, which seems not to be used a lot, but it's not supported by MLIR and it does directly impact inliner.

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


More information about the Mlir-commits mailing list