aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-05-09 14:19:00 +0200
committerGitHub <noreply@github.com>2025-05-09 14:19:00 +0200
commite8898a6275965a5277d4d3ee852b34507e81a77f (patch)
tree0372ed82aa0c59ec40efba2b4e1c1388de85ad64 /clang
parent416cdcf3aa75ea6a6dd4fe6f76a8d7251e06e0b3 (diff)
downloadllvm-e8898a6275965a5277d4d3ee852b34507e81a77f.zip
llvm-e8898a6275965a5277d4d3ee852b34507e81a77f.tar.gz
llvm-e8898a6275965a5277d4d3ee852b34507e81a77f.tar.bz2
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.
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 76f3daf..1e25de0 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;