[Mlir-commits] [mlir] [mlir] Added `Convergent` trait that matches LLVM's semantics (PR #152358)
Mehdi Amini
llvmlistbot at llvm.org
Mon Aug 11 09:40:14 PDT 2025
joker-eph wrote:
> Ok, let me reiterate previous comments: the MLIR pseudo-code I provided as-is leads to invalid optimization done by jump threading, because callee is not marked with convergent attribute
There is no jump threading in MLIR and your patch does not show any tests: so that's not a clear answer to "I'm not sure what is the actual issue in MLIR and how this patch solves it right now".
> I'm not sure I follow you. What exactly is not defined in added trait ? The added trait is [defined](https://github.com/llvm/llvm-project/pull/152358/files) in [LLVM's term](https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/Intrinsics.td#L172-L173) with a[ LLVM's link to convergent semantics](https://llvm.org/docs/ConvergentOperations.html). Is there anything else you want me to clarify/add to the doc ?
As mentioned before: LLVM does not have structured control-flow, so all the definitions from LLVM need to be revisited.
> But if you do have some other ideas in mind that will be more generic and still cover LLVM's convergent, I'll be glad to hear them.
As mentioned before when I pointed what clang does: making it more generic requires new definitions and looking into the semantics we want for structured control-flow structure.
> IMO defining it "as LLVM" is totally fine first step.
That means you need to move all this away from `mlir/include/mlir/Interfaces/ControlFlowInterfaces.h` into the LLVM dialect.
https://github.com/llvm/llvm-project/pull/152358
More information about the Mlir-commits
mailing list