[PATCH] D157452: [RFC][Clang][Codegen] `std::type_info` needs special care with explicit address spaces

Alex Voicu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 15 07:03:55 PDT 2023


AlexVlx added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:5237-5238
+
+          if (VTy->isPointerTy() &&
+              VTy->getPointerAddressSpace() != IRTy->getPointerAddressSpace()) {
+            // In the case of targets that use a non-default address space for
----------------
arsenm wrote:
> you can also just unconditionally call CreateAddrSpaceCast and let it no-op if the types match
I would've if I could've:) Sadly, CastIsValid returns false for address space casts between the same AS: https://github.com/llvm/llvm-project/blob/ca68a7f956f24aa3882134c5d8e72659355292dc/llvm/lib/IR/Instructions.cpp#L3895, and this makes `assert`s flare. I'm not sure if that is vestigial or just overly cautious behaviour.


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

https://reviews.llvm.org/D157452



More information about the cfe-commits mailing list