Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeGen should support arbitrary return types #3032

Closed
llvmbot opened this issue Aug 10, 2008 · 29 comments
Closed

CodeGen should support arbitrary return types #3032

llvmbot opened this issue Aug 10, 2008 · 29 comments
Labels
bugzilla Issues migrated from bugzilla llvm:codegen

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 10, 2008

Bugzilla Link 2660
Version unspecified
OS All
Attachments IR file that will crash lli
Reporter LLVM Bugzilla Contributor
CC @lattner,@isanbard,@sunfishcode,@nlewycky

Extended Description

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.

@sunfishcode
Copy link
Member

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.

@lattner
Copy link
Collaborator

lattner commented Aug 11, 2008

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!

@sunfishcode
Copy link
Member

Re-title this bugzilla entry.

@sunfishcode
Copy link
Member

*** Bug #2691 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

*** Bug #2584 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

*** Bug #1937 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

*** Bug #2044 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

*** Bug llvm/llvm-bugzilla-archive#3318 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 13, 2009

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.

@sunfishcode
Copy link
Member

I added a note about this to LangRef.html.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090112/072053.html

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 24, 2009

*** Bug llvm/llvm-bugzilla-archive#3388 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 25, 2009

*** Bug llvm/llvm-bugzilla-archive#3397 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Mar 5, 2009

*** Bug llvm/llvm-bugzilla-archive#3736 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 30, 2009

*** Bug llvm/llvm-bugzilla-archive#4110 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Aug 25, 2009

*** Bug llvm/llvm-bugzilla-archive#4773 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Sep 27, 2009

*** Bug llvm/llvm-bugzilla-archive#5070 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Feb 28, 2010

*** Bug llvm/llvm-bugzilla-archive#6439 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

Kenneth Uildriks implemented target-independent infrastructure, and x86/x86-64 support for this.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Mar 8, 2010

*** Bug llvm/llvm-bugzilla-archive#6547 has been marked as a duplicate of this bug. ***

@sunfishcode
Copy link
Member

mentioned in issue llvm/llvm-bugzilla-archive#3318

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#3388

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#3397

@lattner
Copy link
Collaborator

lattner commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#3736

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#4110

@lattner
Copy link
Collaborator

lattner commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#4773

@lattner
Copy link
Collaborator

lattner commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#5070

@lattner
Copy link
Collaborator

lattner commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#6439

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#6547

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
cyndyishida pushed a commit to cyndyishida/llvm-project that referenced this issue Jun 17, 2022
Conditionally disable SVE extension support in LLDB's NativeRegisterC…
@arsenm
Copy link
Contributor

arsenm commented Aug 6, 2023

This already works by implicitly converting types that don't fit in registers to sret

@arsenm arsenm closed this as completed Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm:codegen
Projects
None yet
Development

No branches or pull requests

4 participants