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

Lower a single specific for a type. #5218

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

alinas
Copy link
Contributor

@alinas alinas commented Mar 29, 2025

Currently for functions only:
A specific_id is created for each new type (use) found for a generic. If the function's LLVM types are the same with another previously found specific of the same generic, do not create a new LLVM function and use the previously created one.

Currently for functions only:
A specific_id is created for each new type (use) found for a generic.
If the function's LLVM types are the same with another previously found
specific of the same generic, do not create a new LLVM function and use
the previously created one.
Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's sufficient to compare the function_type_info here. Two specifics for the same generic function might differ in ways that aren't part of the lowered function signature, for example because they use two different implementations of the same interface. See https://godbolt.org/z/vqcaKdb99 for instance.

I think we can do this if all the information that lowering gathers from the specific (all types and constant values that are used while lowering) are the same for multiple specifics of the same generic function, though.

@mohamedTbarka

This comment was marked as duplicate.

@alinas alinas marked this pull request as draft April 7, 2025 17:15
@alinas
Copy link
Contributor Author

alinas commented Apr 7, 2025

Switched PR to draft, more details on resolution and path forward in the open discussion doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants