Created attachment 1911 [details] IR file that will crash lli I've been using the new first-class aggregate support quite a bit, and I ran into a crash bug. I've isolated a small test case which I will attach. This is on the latest trunk from August 10.
This is due to a limitation in CodeGen. Currently, for aggregate return values, it only supports aggregates that fit in the return value registers designated by the ABI. It's likely that you're working with an ABI that defines only 2 registers for returning integer values, while the Vector type in your example requires 3, at least according to the way aggregate return values are currently lowered. The general fix is to add support in CodeGen for rewriting the code to return the value in memory. For this particular testcase on targets like x86-64, the C ABI may have the return value packed in registers, so teaching CodeGen to follow the ABI more closely for aggregate return values would also allow this test to work, on those targets. Alternatively, you can work around this in your front-end by using the sret mechanism for returning Vector values.
Dan, do we have a bugzilla for "codegen doesn't support arbitrary aggregate result types" yet? If not, please repurpose this one, otherwise please close this as a dupe, thanks!
Re-title this bugzilla entry.
*** Bug 2319 has been marked as a duplicate of this bug. ***
*** Bug 2212 has been marked as a duplicate of this bug. ***
*** Bug 1565 has been marked as a duplicate of this bug. ***
*** Bug 1672 has been marked as a duplicate of this bug. ***
*** Bug 3318 has been marked as a duplicate of this bug. ***
The 2.4 release notes claim "full support" for first-class aggregates, so perhaps they should be amended. It's frustrating to learn about limitations this way. It might also be helpful to mention this limitation in the section on function types in the language reference manual, which gives an example of a two-word aggregate return value.
I added a note about this to LangRef.html. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090112/072053.html
*** Bug 3388 has been marked as a duplicate of this bug. ***
*** Bug 3397 has been marked as a duplicate of this bug. ***
*** Bug 3736 has been marked as a duplicate of this bug. ***
*** Bug 4110 has been marked as a duplicate of this bug. ***
*** Bug 4773 has been marked as a duplicate of this bug. ***
*** Bug 5070 has been marked as a duplicate of this bug. ***
*** Bug 6439 has been marked as a duplicate of this bug. ***
Kenneth Uildriks implemented target-independent infrastructure, and x86/x86-64 support for this.
*** Bug 6547 has been marked as a duplicate of this bug. ***