[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
Tue May 28 13:15:20 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:
No, `Int8PtrTy` is (now, after the change in the other thread) whatever LangAS::Default ends up mapping to. The idea being that the target would pick / reflect a contextually sane mapping. The one worry I have re: doing Unqual (just 0) here is that I suspect (but would have to check) that we'll then have to deal with invalid casts, where you have the target's 0 being e.g. `private`, and this line would try to ASCast from a `Constant` that'd be in `global` (for e.g. the SPIRV target this'd actually happen, `global` is 1 and `private` is 0). Or are you thinking we'd populate these differently, somehow?
https://github.com/llvm/llvm-project/pull/93601
More information about the cfe-commits
mailing list