[llvm-branch-commits] [llvm] [AllocToken, Clang] Implement __builtin_alloc_token_infer() and llvm.alloc.token.id (PR #156842)

Oliver Hunt via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 9 22:54:25 PDT 2025


https://github.com/ojhunt requested changes to this pull request.

I would really prefer the codegen changes to be separate from the inference pass.

What I _really_ want is a __builtin_infer_allocation_type(expr) that somehow produces a human readable output - for the purpose of testing mostly as it's of questionable real world use. You could imagine a hypothetical case where it returns a human readable description of the inferred type information, and a developer _could_ have a custom type descriptor that was "hash the string". Though I remain on the "this would still be of questionable value outside of test" side of the fence.

Regardless, I'd then expect both `__builtin_infer_allocation_type` and `__builtin_infer_allocation_token` to call the same underlying inference routine, and just convert the output differently.

`__builtin_infer_allocation*` also need to be able to be constant evaluated so the can be used in consteval contexts, though that should just be a matter of calling the method that does the inference, and then wrapping that in the appropriate CE container

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


More information about the llvm-branch-commits mailing list