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

Mehdi Amini llvmlistbot at llvm.org
Thu Aug 7 06:59:30 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> {};
----------------
joker-eph wrote:

> For each Op that MLIR generates, LLVM sets convergency. 

Are you sure we would do it inter-procedurally and annotate the actual call here?
Or are we relying on some attribute propagation later?


@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!)

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


More information about the Mlir-commits mailing list