[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 13:44:57 PDT 2024


================
@@ -2928,12 +2928,13 @@ static void emitUsed(CodeGenModule &CGM, StringRef Name,
   for (unsigned i = 0, e = List.size(); i != e; ++i) {
     UsedArray[i] =
         llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
-            cast<llvm::Constant>(&*List[i]), CGM.Int8PtrTy);
----------------
AlexVlx wrote:

Apologies, I still don't see the actual benefit being spelled out, I might be missing the obvious. I'll try again: I'm the FE (this is in Clang). I am emitting a global. Why would I do anything special here, versus emitting any other global, what am I gaining by not doing just that/losing by actually doing that. Surely it's straightforward to explain?

https://github.com/llvm/llvm-project/pull/93601


More information about the cfe-commits mailing list