Author: Matt Arsenault Date: 2025-05-09T14:19:00+02:00 New Revision: e8898a6275965a5277d4d3ee852b34507e81a77f
URL: https://github.com/llvm/llvm-project/commit/e8898a6275965a5277d4d3ee852b34507e81a77f DIFF: https://github.com/llvm/llvm-project/commit/e8898a6275965a5277d4d3ee852b34507e81a77f.diff LOG: clang: Read the address space from the ABIArgInfo (#138865) Do not assume it's the alloca address space, we have an explicit address space to use for the argument already. Also use the original value's type instead of assuming DefaultAS. Added: Modified: clang/lib/CodeGen/CGCall.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 76f3dafc8b2bd..1e25de06c89b9 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -5387,16 +5387,16 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, if (!NeedCopy) { // Skip the extra memcpy call. llvm::Value *V = getAsNaturalPointerTo(Addr, I->Ty); - auto *T = llvm::PointerType::get( - CGM.getLLVMContext(), CGM.getDataLayout().getAllocaAddrSpace()); + auto *T = llvm::PointerType::get(CGM.getLLVMContext(), + ArgInfo.getIndirectAddrSpace()); // FIXME: This should not depend on the language address spaces, and // only the contextual values. If the address space mismatches, see if // we can look through a cast to a compatible address space value, // otherwise emit a copy. llvm::Value *Val = getTargetHooks().performAddrSpaceCast( - *this, V, LangAS::Default, CGM.getASTAllocaAddressSpace(), T, - true); + *this, V, I->Ty.getAddressSpace(), CGM.getASTAllocaAddressSpace(), + T, true); if (ArgHasMaybeUndefAttr) Val = Builder.CreateFreeze(Val); IRCallArgs[FirstIRArg] = Val; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits