aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-05-09 14:24:54 +0200
committerGitHub <noreply@github.com>2025-05-09 14:24:54 +0200
commit5ae2aed218470783e6c7a2d255c7946f4549cb46 (patch)
treed3b2eaa76f766e1712cf3d26bc419907f7d047a9 /clang/lib/CodeGen/CGCall.cpp
parentc64c64db7b4b30dc5c5fad3b854f567254d1a615 (diff)
downloadllvm-5ae2aed218470783e6c7a2d255c7946f4549cb46.zip
llvm-5ae2aed218470783e6c7a2d255c7946f4549cb46.tar.gz
llvm-5ae2aed218470783e6c7a2d255c7946f4549cb46.tar.bz2
clang: Remove dest LangAS argument from performAddrSpaceCast (#138866)
It isn't used and is redundant with the result pointer type argument. A more reasonable API would only have LangAS parameters, or IR parameters, not both. Not all values have a meaningful value for this. I'm also not sure why we have this at all, it's not overridden by any targets and further simplification is possible.
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 1e25de0..65970fc 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5245,12 +5245,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
if (SRetPtr.getAddressSpace() != RetAI.getIndirectAddrSpace()) {
llvm::Value *V = SRetPtr.getBasePointer();
LangAS SAS = getLangASFromTargetAS(SRetPtr.getAddressSpace());
- LangAS DAS = getLangASFromTargetAS(RetAI.getIndirectAddrSpace());
llvm::Type *Ty = llvm::PointerType::get(getLLVMContext(),
RetAI.getIndirectAddrSpace());
SRetPtr = SRetPtr.withPointer(
- getTargetHooks().performAddrSpaceCast(*this, V, SAS, DAS, Ty, true),
+ getTargetHooks().performAddrSpaceCast(*this, V, SAS, Ty, true),
SRetPtr.isKnownNonNull());
}
IRCallArgs[IRFunctionArgs.getSRetArgNo()] =
@@ -5395,8 +5394,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// we can look through a cast to a compatible address space value,
// otherwise emit a copy.
llvm::Value *Val = getTargetHooks().performAddrSpaceCast(
- *this, V, I->Ty.getAddressSpace(), CGM.getASTAllocaAddressSpace(),
- T, true);
+ *this, V, I->Ty.getAddressSpace(), T, true);
if (ArgHasMaybeUndefAttr)
Val = Builder.CreateFreeze(Val);
IRCallArgs[FirstIRArg] = Val;
@@ -5485,12 +5483,9 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
if (FirstIRArg < IRFuncTy->getNumParams() &&
V->getType() != IRFuncTy->getParamType(FirstIRArg)) {
assert(V->getType()->isPointerTy() && "Only pointers can mismatch!");
- auto FormalAS = CallInfo.arguments()[ArgNo]
- .type.getQualifiers()
- .getAddressSpace();
auto ActualAS = I->Ty.getAddressSpace();
V = getTargetHooks().performAddrSpaceCast(
- *this, V, ActualAS, FormalAS, IRFuncTy->getParamType(FirstIRArg));
+ *this, V, ActualAS, IRFuncTy->getParamType(FirstIRArg));
}
if (ArgHasMaybeUndefAttr)