[PATCH] D143472: [clang] Cast the pointer to right type with different address space

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 12 12:55:31 PST 2023


Anastasia added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:12412
   // Cast the pointer to right type.
-  Value *Ptr = CGF.Builder.CreateBitCast(Ops[0],
-                               llvm::PointerType::getUnqual(Ops[1]->getType()));
+  Value *Ptr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
+      Ops[0], llvm::PointerType::getUnqual(Ops[1]->getType()));
----------------
I think the semantics of builtin functions is that they accept any address space. So you should preserve the address space from Ops[1].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143472



More information about the cfe-commits mailing list