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

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 09:09:14 PST 2024


================
@@ -1780,6 +1780,14 @@ class TargetInfo : public TransferrableTargetInfo,
     return 0;
   }
 
+  /// \returns Target specific address space for indirect (e.g. sret) arguments.
+  /// If such an address space exists, it must be convertible to and from the
+  /// alloca address space. If it does not, std::nullopt is returned and the
+  /// alloca address space will be used.
+  virtual std::optional<unsigned> getIndirectArgAddressSpace() const {
----------------
rjmccall wrote:

I would expect this to be a `LangAS`, since that's what our address-space conversion lowerings are generally expressed in terms of.  This also has the advantage of avoiding a *lot* of heartache with implicit conversions around `ABIInfo::getIndirect`, since `LangAS` is a scoped enum.  And `LangAS::Default` is a much more reasonable default argument for things like `ABIArgInfo::getIndirect` than IR addrspace 0.

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


More information about the cfe-commits mailing list