[PATCH] D153092: [Clang][CodeGen]`vtable`, `typeinfo` et al. are globals

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 13:02:06 PDT 2023


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGVTables.cpp:836
+        fnPtr =
+            llvm::ConstantExpr::getAddrSpaceCast(fnPtr, CGM.GlobalsInt8PtrTy);
+      return builder.add(fnPtr);
----------------
If I follow correctly, the fnPtr is guaranteed to be in the global address-space, but GetAddrOfFunction returns a generic pointer.  So the vtable entries are in the global address-space for efficiency? Seems reasonable.

There isn't really much point to explicitly checking `FnAS != GVAS` before the call to getAddrSpaceCast; getAddrSpaceCast does the same check internally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153092



More information about the cfe-commits mailing list