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

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 19:25: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();
----------------
arsenm wrote:

I would expect this to come from the ABIArgInfo/retAI, for the specific value and not a new side hook. Actually, is the address space already correct in retAI.getIndirectAddrSpace? 

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


More information about the cfe-commits mailing list