[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 03:21:48 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:
Ok, I'm still struggling to see why it is best create (possibly) broken IR, super heroic "but let us build an even more complicated devices like multiple intrinsics per AS, and also redo how ASCasts work etc." and rely on implicit knowledge about what happens with `used` and `compiler.used` (ah, because these are never CodeGen-ed, it's fine to do whatever). What's the actual benefit here? Why not make it a special global that uses AS 42, since that'd actually signal it's special, as opposed to Unqual/0, which do the exact contrary. I'm also struggling to see the backwards compat angle since we do not guarantee IR-level compat between LLVM versions (yes it frequently works but it's not guaranteed to).
https://github.com/llvm/llvm-project/pull/93601
More information about the cfe-commits
mailing list