Skip to content

Commit 2dd8052

Browse files
committed
Unwrap/expand.
1 parent 5b186a3 commit 2dd8052

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5167,16 +5167,17 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
51675167
// chosen IndirectAS can happen e.g. when passing the this pointer through
51685168
// a chain involving stores to / loads from the DefaultAS; we address this
51695169
// here, symmetrically with the handling we have for normal pointer args.
5170-
if (SRetPtr.getAddressSpace() != RetAI.getIndirectAddrSpace())
5170+
if (SRetPtr.getAddressSpace() != RetAI.getIndirectAddrSpace()) {
5171+
llvm::Value *V = SRetPtr.getBasePointer();
5172+
LangAS SAS = getLangASFromTargetAS(SRetPtr.getAddressSpace());
5173+
LangAS DAS = getLangASFromTargetAS(RetAI.getIndirectAddrSpace());
5174+
llvm::Type *Ty = llvm::PointerType::get(getLLVMContext(),
5175+
RetAI.getIndirectAddrSpace());
5176+
51715177
SRetPtr = SRetPtr.withPointer(
5172-
getTargetHooks().performAddrSpaceCast(
5173-
*this, SRetPtr.getBasePointer(),
5174-
getLangASFromTargetAS(SRetPtr.getAddressSpace()),
5175-
getLangASFromTargetAS(RetAI.getIndirectAddrSpace()),
5176-
llvm::PointerType::get(getLLVMContext(),
5177-
RetAI.getIndirectAddrSpace()),
5178-
true),
5178+
getTargetHooks().performAddrSpaceCast(*this, V, SAS, DAS, Ty, true),
51795179
SRetPtr.isKnownNonNull());
5180+
}
51805181
IRCallArgs[IRFunctionArgs.getSRetArgNo()] =
51815182
getAsNaturalPointerTo(SRetPtr, RetTy);
51825183
} else if (RetAI.isInAlloca()) {

0 commit comments

Comments
 (0)