================ @@ -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); ---------------- arsenm wrote:
For the purpose of used/compiler_used, I think it's best to ignore the language address space map (reiterating that the IR address space has little to do with the language). Just treat it as a special global that always uses addrspace(0). The required addrspacecasts will be inserted to 0, so it just leaves this as the status quo. It doesn't really matter if the target considers the casts valid or not, the used variables never codegened. If we really had to go out of our way to avoid illegal constant expression casts, we'd probably have to have multiple used intrinsic variables per address space. In a better future we wouldn't allow constantexpr addrspacecasts, and then we'd also need to come up with another solution https://github.com/llvm/llvm-project/pull/93601 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits