LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2660 - CodeGen should support arbitrary return types
Summary: CodeGen should support arbitrary return types
Status: NEW
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: All All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
: 1565 1672 2212 2319 3318 3388 3397 3736 4110 4773 5070 6439 6547 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-10 11:56 PDT by Talin
Modified: 2016-01-05 01:50 PST (History)
16 users (show)

See Also:
Fixed By Commit(s):


Attachments
IR file that will crash lli (1.25 KB, text/plain)
2008-08-10 11:56 PDT, Talin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Talin 2008-08-10 11:56:40 PDT
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.
Comment 1 Dan Gohman 2008-08-11 09:58:15 PDT
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.
Comment 2 Chris Lattner 2008-08-11 16:11:53 PDT
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!
Comment 3 Dan Gohman 2008-08-13 16:30:38 PDT
Re-title this bugzilla entry.
Comment 4 Dan Gohman 2008-08-14 09:58:14 PDT
*** Bug 2319 has been marked as a duplicate of this bug. ***
Comment 5 Dan Gohman 2008-08-14 10:01:59 PDT
*** Bug 2212 has been marked as a duplicate of this bug. ***
Comment 6 Dan Gohman 2008-09-08 10:22:02 PDT
*** Bug 1565 has been marked as a duplicate of this bug. ***
Comment 7 Dan Gohman 2008-09-08 10:28:41 PDT
*** Bug 1672 has been marked as a duplicate of this bug. ***
Comment 8 Dan Gohman 2009-01-12 16:20:46 PST
*** Bug 3318 has been marked as a duplicate of this bug. ***
Comment 9 Mark Leone 2009-01-12 16:48:37 PST
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.  
Comment 10 Dan Gohman 2009-01-12 17:21:04 PST
I added a note about this to LangRef.html.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090112/072053.html
Comment 11 Duncan Sands 2009-01-24 07:25:59 PST
*** Bug 3388 has been marked as a duplicate of this bug. ***
Comment 12 Duncan Sands 2009-01-25 03:43:19 PST
*** Bug 3397 has been marked as a duplicate of this bug. ***
Comment 13 Chris Lattner 2009-03-05 11:49:27 PST
*** Bug 3736 has been marked as a duplicate of this bug. ***
Comment 14 Duncan Sands 2009-04-30 02:59:54 PDT
*** Bug 4110 has been marked as a duplicate of this bug. ***
Comment 15 Chris Lattner 2009-08-25 11:34:33 PDT
*** Bug 4773 has been marked as a duplicate of this bug. ***
Comment 16 Chris Lattner 2009-09-27 13:37:55 PDT
*** Bug 5070 has been marked as a duplicate of this bug. ***
Comment 17 Chris Lattner 2010-02-28 12:56:35 PST
*** Bug 6439 has been marked as a duplicate of this bug. ***
Comment 18 Dan Gohman 2010-03-01 20:25:46 PST
Kenneth Uildriks implemented target-independent infrastructure, and x86/x86-64 support for this.
Comment 19 Kalle Raiskila 2010-03-08 14:24:11 PST
*** Bug 6547 has been marked as a duplicate of this bug. ***