[clang] [clang-tools-extra] [Clang] Use TargetInfo when deciding is an address space is compatible (PR #115777)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 07:34:34 PST 2024


AlexVlx wrote:

> I could see only applying these rules to the target specific (i.e. non-language AS's) so `AS(3) *` would convert to `*` but not `__shared__ *`. The above example doesn't work because we consider `cuda_shared` and `AS(3)` distinct even though they lower to the same thing for the target.

Which is the gist of what I am saying: linguistic constructs carry semantics (meaning), we should not work back from their disembodied lowering into a target specific quantity to generalise the latter into a linguistic construct beyond the initial one. CUDA made language design choices, it is an AS agnostic language, cuda_shared doesn't work like an address space in the OCL / Clang sense, even though it ends up lowered through the same mechanism / leads to a numbered AS being CodeGen-ed. TL;DR: this doesn't work by design, not by accident = those ARE distinct from a language perspective.


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


More information about the cfe-commits mailing list