[Mlir-commits] [mlir] [mlir][IR] Add builtin `TokenType` (PR #195640)

Mehdi Amini llvmlistbot at llvm.org
Sun May 24 06:48:28 PDT 2026


================
@@ -740,6 +740,14 @@ The [builtin dialect](Dialects/Builtin.md) defines a set of types that are
 directly usable by any other dialect in MLIR. These types cover a range from
 primitive integer and floating-point types, function types, and more.
 
+A *token* is an SSA value of the builtin parameterless, opaque `token` type.
+It carries no runtime data. Intuitively, a token is a pointer to an operation
+(via its result) or to a region (via an entry block argument). Unlike regular
+SSA values, a token cannot be forwarded: its def-use chain cannot be obscured
+by ops with forwarding semantics such as `arith.select` or `cf.br`, so you can
+always walk back from any use of a token to *the* specific operation or region
+that produced it. See [Tokens](Tokens.md) for more details.
----------------
joker-eph wrote:

I think we should open a section here on token and be more descriptive. LangRef should be less about "intuitively" and "rationale" but more about the specific rules surrounding tokens.

Basically at least the whole "Structural Contract" should move from Tokens.md here (and Tokens.md) should also point to this section here as authoritative.



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


More information about the Mlir-commits mailing list