[llvm-branch-commits] [clang] [AllocToken, Clang] Implement TypeHashPointerSplit mode (PR #156840)

Marco Elver via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Oct 6 05:30:39 PDT 2025


================
@@ -69,19 +69,30 @@ enum class TokenMode : unsigned {
 
   /// Token ID based on allocated type hash.
   TypeHash = 2,
+
+  /// Token ID based on allocated type hash, where the top half ID-space is
+  /// reserved for types that contain pointers and the bottom half for types
+  /// that do not contain pointers.
+  TypeHashPointerSplit = 3,
 };
 
 //===--- Command-line options ---------------------------------------------===//
 
-cl::opt<TokenMode>
-    ClMode("alloc-token-mode", cl::Hidden, cl::desc("Token assignment mode"),
-           cl::init(TokenMode::TypeHash),
-           cl::values(clEnumValN(TokenMode::Increment, "increment",
-                                 "Incrementally increasing token ID"),
-                      clEnumValN(TokenMode::Random, "random",
-                                 "Statically-assigned random token ID"),
-                      clEnumValN(TokenMode::TypeHash, "typehash",
-                                 "Token ID based on allocated type hash")));
+cl::opt<TokenMode> ClMode(
+    "alloc-token-mode", cl::Hidden, cl::desc("Token assignment mode"),
+    cl::init(TokenMode::TypeHashPointerSplit),
+    cl::values(
----------------
melver wrote:

They are experimental. The default one is the current supported and recommended mode. Anything else is experimental (as also mentioned in the documentation).

I recall that @ojhunt might want to make the "default mode" dependent on the target triple, so that on Apple targets it'll switch to what they are currently already shipping with TMO.

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


More information about the llvm-branch-commits mailing list