-
Notifications
You must be signed in to change notification settings - Fork 13.5k
clang: Read the address space from the ABIArgInfo #138865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang: Read the address space from the ABIArgInfo #138865
Conversation
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Matt Arsenault (arsenm) ChangesDo not assume it's the alloca address space, we have an explicit Full diff: https://github.com/llvm/llvm-project/pull/138865.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 1404bdfd69647..db8820a8c517e 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5384,16 +5384,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;
|
2e920e9
to
d1a11ed
Compare
e48afb5
to
8593287
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ a comment nit.
8593287
to
f0dd54a
Compare
d1a11ed
to
4a1cda9
Compare
f0dd54a
to
4a054e4
Compare
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.
4a1cda9
to
d7d6cf5
Compare
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.