[PATCH] D151087: [Clang] Permit address space casts with 'reinterpret_cast' in C++

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 07:37:14 PDT 2023


jhuber6 added a comment.

In D151087#4360729 <https://reviews.llvm.org/D151087#4360729>, @ebevhan wrote:

> That's fair. I would like clang to improve and formalize the semantics for generic address space behavior a bit, which was part of the point with D62574 <https://reviews.llvm.org/D62574>.  But there don't seem to be enough people who need something like it to make it happen.
>
> Honestly, looking at the patch again does suggest to me that your use case would be covered. It just wouldn't be done with a reinterpret_cast, but an addrspace_cast. Since every target by default would permit explicit casts with isExplicitAddrSpaceConversionLegal, your desired behavior should work.

The problem is we don't have `addrspace_cast` in freestanding C++, so as it stands we currently have no way to perform this operation in C++ which is preventing me from implementing things in the LLVM LibC port for GPUs I'm working on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151087/new/

https://reviews.llvm.org/D151087



More information about the cfe-commits mailing list