[PATCH] Allow sret on the second parameter as well as the first

Reid Kleckner rnk at google.com
Fri May 9 14:32:07 PDT 2014

I think emails from rnk at google.com are getting dropped somewhere along the
way from phab to llvm-commits, so here's what I tried to send.  There's an
updated patch.

On Fri, May 9, 2014 at 2:31 PM, Reid Kleckner <rnk at google.com> wrote:

> I looked for other backends that return sret parameters and found that
> mips and sparc do this.  Mips can be updated to handle sret on parameters
> other than the first, but sparc has more assumptions about sret, so I stuck
> in a report_fatal_error call.
> ================
> Comment at: lib/Target/X86/X86ISelLowering.cpp:2307
> @@ +2306,3 @@
> +    AttributeSet Attrs = MF.getFunction()->getAttributes();
> +    for (; I != E; ++I)
> +      if (Attrs.hasAttribute(I + 1, Attribute::StructRet))
> ----------------
> Rafael Ávila de Espíndola wrote:
> > Why the loop? If the rest of the code assumes that it is the first or
> second, it seems better to check only those too, or at least assert that I
> is 0 or 1.
> >
> I realized this loop was wrong anyway if codegen split the first parameter
> into multiple EVTs, like i64 to 2 i32s on a 32-bit platform.  I moved it up
> into the loop producing InVals and added a test for it.
> http://reviews.llvm.org/D3617
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140509/c014db2a/attachment.html>

More information about the llvm-commits mailing list