[Mlir-commits] [mlir] [mlir][IR] Add builtin `TokenType` (PR #195640)
Mehdi Amini
llvmlistbot at llvm.org
Mon Jun 1 02:12:23 PDT 2026
================
@@ -165,8 +165,24 @@ class SameBuildabilityAs<Type type, code builder> {
code builderCall = !if(!empty(type.builderCall), "", builder);
}
-// Any type at all.
-def AnyType : Type<CPred<"true">, "any type">;
+// Whether a type is the builtin `TokenType`.
+def IsTokenTypePred : CPred<"::llvm::isa<::mlir::TokenType>($_self)">;
----------------
joker-eph wrote:
> : why not let AnyType still be AnyType and allow any type? E.g., if you have AnyType then Token is still only allowed if TokenProducer/TokenConsumer is set
That is because updating an operation that has `let operands = [{ AnyType value }]` to `let operands = [{ AnyType value, TokenType token }]` would implicitly start allowing tokens for the first operand.
If we want to optimize this check, the suggestion I made at the beginning of this thread would turn it into a simple pointer comparison.
https://github.com/llvm/llvm-project/pull/195640
More information about the Mlir-commits
mailing list