[clang] [Clang] Allow all address spaces to be converted to the default (PR #112248)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 09:06:16 PDT 2024
jhuber6 wrote:
> > They should not "just work" if you're compiling for vanilla C/C++ (so not CUDA C++, or SYCL, or OpenCL C/C++ etc.) because neither of those defines such a notion.
>
> [a6a237f](https://github.com/llvm/llvm-project/commit/a6a237f2046ad8993db30481c8b61aeb2f73a5ad) added an explicit addrspace_cast operator. It would be better to use something like this rather than just freely enabling any implicit cast
That's only enabled in OpenCLC++ I think? We could probably make a patch to enable it in C++. (Guessing we'd need to call it `__addrspace_cast` or `__builtin_addrspace_cast`. However it's still a huge pain to work with.
I tried adding an option to relax the rules but it's much more difficult than I anticipated because it requires forwarding the language options to every 100 or so places that Sema wants to check if the types are legal. OpenCL3.0 lets you enable it for convenience so I'd like that kind of behavior (We probably also do want addrspace cast in general). But it seems like it might be really, really annoying to enable that without becoming beholden to OpenCL rules. The only way I could thing to change these rules optionally would be to introduce a ton of new addrspace rules which are basically just OpenCL but not.
https://github.com/llvm/llvm-project/pull/112248
More information about the cfe-commits
mailing list