https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/138865
>From 4a1cda956b007b112584f60390162a1cf89f3587 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <matthew.arsena...@amd.com> Date: Wed, 7 May 2025 14:39:38 +0200 Subject: [PATCH] clang: Read the address space from the ABIArgInfo 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. --- clang/lib/CodeGen/CGCall.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits