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

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 11:02:57 PDT 2024


================
@@ -2047,9 +2047,9 @@ void CodeGenModule::EmitCtorList(CtorList &Fns, const char *GlobalName) {
   llvm::Type *CtorPFTy = llvm::PointerType::get(CtorFTy,
       TheModule.getDataLayout().getProgramAddressSpace());
 
-  // Get the type of a ctor entry, { i32, void ()*, i8* }.
+  // Get the type of a ctor entry, { i32, program void ()*, global i8* }.
   llvm::StructType *CtorStructTy = llvm::StructType::get(
-      Int32Ty, CtorPFTy, VoidPtrTy);
+      Int32Ty, CtorPFTy, GlobalsInt8PtrTy);
----------------
arichardson wrote:

The autoupgrade solution might be a bit cleaner since it would remove these address space casts for at least the globals. Function arguments could still require an AS cast, although in the CHERI backend case those are the same and we would be able to avoid all casts. As noted elsewhere the address space is somewhat irrelevant so also fine with keeping it as AS0.

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


More information about the llvm-commits mailing list