[clang] [CIR] Upstream `AddressSpace` support for `PointerType` (PR #161028)
Fabian Mora via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 30 12:27:27 PDT 2025
fabianmcg wrote:
Finally, leaving a small comment/suggestion on the PR.
I don't think it is recommended to do what this PR is doing with `target<n>`, as it's abusing of the enum storage.
Instead, you likely want 2 address space attributes:
- `!cir.ptr<!s32i, clang_addrspace(offload_private)>`
- `!cir.ptr<!s32i, target_addresspace(0)>`
Where the second attribute takes an int as a parameter.
It's also worth saying that in general numeric memory spaces are somewhat discouraged except when they appear in the LLVM dialect. That's why in `ptr` you have `!ptr.ptr<#ptr.generic_space>` instead of `!ptr.ptr<0>`
So unless, clang is using the numeric representation in the AST for some memory spaces, and there's no way of providing a name for those, I would discourage `target<n>` all together.
https://github.com/llvm/llvm-project/pull/161028
More information about the cfe-commits
mailing list