[clang] [clang][CodeGen] cast addr space of ReturnValue if needed (PR #154380)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 21 02:13:54 PDT 2025


================
@@ -1563,11 +1563,10 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
       // The named return value optimization: allocate this variable in the
       // return slot, so that we can elide the copy when returning this
       // variable (C++0x [class.copy]p34).
-      address = ReturnValue;
       AllocaAddr =
           RawAddress(ReturnValue.emitRawPointer(*this),
                      ReturnValue.getElementType(), ReturnValue.getAlignment());
-      ;
+      address = MaybeCastAllocaAddressSpace(AllocaAddr, Ty.getAddressSpace());
----------------
macurtis-amd wrote:

I went ahead and changed it. Thanks for the review!

https://github.com/llvm/llvm-project/pull/154380


More information about the cfe-commits mailing list