[llvm-branch-commits] [AllocToken] Refactor stateless token calculation into Support (PR #163633)

Marco Elver via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 15 14:28:50 PDT 2025


https://github.com/melver created https://github.com/llvm/llvm-project/pull/163633

This change refactors the stateless (hash-based) token calculation logic out of
the `AllocToken` pass and into `llvm/Support/AllocToken.h`.

This helps with making the token calculation logic available to other parts of
the codebase, which will be necessary for frontend implementation of
`__builtin_infer_alloc_token` to perform constexpr evaluation.

The `AllocTokenMode` enum and a new `AllocTokenMetadata` struct are moved into
a shared header. The `getAllocTokenHash()` function now provides the source of
truth for calculating token IDs for `TypeHash` and `TypeHashPointerSplit`
modes.





More information about the llvm-branch-commits mailing list