[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 2 06:54:59 PDT 2024


================
@@ -1672,10 +1672,11 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) {
 
   // Add type for sret argument.
   if (IRFunctionArgs.hasSRetArg()) {
-    QualType Ret = FI.getReturnType();
-    unsigned AddressSpace = CGM.getTypes().getTargetAddressSpace(Ret);
+    auto AddressSpace = CGM.getTarget().getIndirectArgAddressSpace();
----------------
AlexVlx wrote:

Sadly no, that's not usable here as is, that's only for `byref` args (IndirectAliased). I do wonder if we should extend Indirect to also carry an AS, maybe that's the natural solution here.

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


More information about the cfe-commits mailing list