[PATCH] Allow sret on the second parameter as well as the first
rnk at google.com
Fri May 9 14:31:13 PDT 2014
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.
More information about the llvm-commits