[PATCH] D155870: [Clang][CodeGen] Another follow-up for `vtable`, `typeinfo` et al. are globals
Alex Voicu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 10:38:40 PDT 2023
AlexVlx added a comment.
In D155870#4535425 <https://reviews.llvm.org/D155870#4535425>, @yaxunl wrote:
> `__dynamic_cast` is part of standard C++ library. If we ever implement it for GPU, chances are we will use libc++abi with the same signature as other targets, i.e., the 2nd and 3rd arguments are generic pointers.
>
> I feel it is safer to do an address space cast when calling the function instead of changing its signature.
That's a fair point, and one I admit to not having considered (I'm not sure this would harm linking in practice though, since `__dynamic_cast` is extern "C" and thus unmangled; it might lead to broken IR depending on how we codegen the body). The concern I have with doing the cast at the callsite is that there might be many callsites, and it's going to make things a bit noisier than they need to be (IMHO). Also, this is an internal implementation detail of the standard library, and not the interface that users are expected to touch; I wonder if given the target specific nature of these bits it wouldn't be natural for our future implementation to carry the AS in the signature?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155870/new/
https://reviews.llvm.org/D155870
More information about the cfe-commits
mailing list