[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 18:55: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);
----------------
yxsamliu wrote:
We have HIP apps which ship bitcode library which may contain llvm.compiler.used or llvm.global_ctors which use addr space 0. If we switch to use addr space 1, the new HIP app may not be able to link with the existing bitcode libraries.
My understanding is that the addr space used in llvm.compiler.used or llvm.global_ctors do not really have meanings since no one loads or stores to them. As long as they are the same for different TU's it is fine. It should be OK to use addr space 0.
https://github.com/llvm/llvm-project/pull/93601
More information about the cfe-commits
mailing list