[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
Mon Oct 14 15:05:20 PDT 2024


jhuber6 wrote:

> Running into an observable situation where this is a concern means that either you've messed around with (non C/C++) attributes, or are linking in something exciting. Neither of which constitutes valid C/C++, and I'm leaning towards saying shouldn't be allowed to silently work - we probably should refrain from infecting C/C++ with explicit address spaces a la OpenCL. What are you actually running into @jhuber6 where this is a concern? More specifically, you are saying "we want to do X, in C++" -> why?

I'm trying to port the OpenMP device runtime to just use C/C++, we use a lot of `__local` variables there which this turns into a mess of C-style casts. It also interacts badly with the `this` pointer if you put a class inside of anything with an address space. C/C++ says nothing about address spaces, but these basically act as target specific attributes on certain types.

This is a case where it's actually harder to do something in C/C++ than OpenCL and I don't want it to be that way. See https://godbolt.org/z/1Gn71qqPT for an example of what I'm talking about.

TL;DR, every other language allows this and I want to be able to use classes or LDS variables without spamming `(int &)` everywhere.

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


More information about the cfe-commits mailing list