[clang] [CIR] Cast global addresses to their declared address space (PR #226649)
Konstantinos Parasyris via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 15:51:55 PDT 2026
https://github.com/koparasy approved this pull request.
> > Don't we need similar handling [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/CIR/CodeGen/CIRGenDecl.cpp#L717) ?
>
> As discussed I Took a closer look. It does drop the AS, but nothing ever reaches the branch you point out to. I instrumented that branch and ran the CIR suite plus ~7.8k clang CodeGen tests through CIR on amdgcn: and found zero hits. CIR's constant emitter always types static-local initializers as the declared type (even for unions, FAMs, and SSO-style cases where OG narrows), so the retype never triggers. The PR that adds that was #143980 but only tests scalar statics.
Thanks, I checked as well: static-local initializers always keep the declared type (unions with a non-first member, anonymous unions, FAMs, large zero-tail arrays), so the retype branch is unreachable today, and it already carries the `MissingFeatures::addressSpace()` marker. Fine as is.
https://github.com/llvm/llvm-project/pull/226649
More information about the cfe-commits
mailing list