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

[AsmParser] Add missing globals declarations in incomplete IR mode #79855

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 29, 2024

If -allow-incomplete-ir is enabled, automatically insert declarations for missing globals.

If a global is only used in calls with the same function type, insert a function declaration with that type.

Otherwise, insert a dummy i8 global. The fallback case could be extended with various heuristics (e.g. we could look at load/store types), but I've chosen to keep it simple for now, because I'm unsure to what degree this would really useful without more experience. I expect that in most cases the declaration type doesn't really matter (note that the type of an external global specifies a minimum size only, not a precise size).

This is a followup to #78421.

If `-allow-incomplete-ir` is enabled, automatically insert
declarations for missing globals.

If a global is only used in calls with the same function type,
insert a function declaration with that type.

Otherwise, insert a dummy i8 global. The fallback case could be
extended with various heuristics (e.g. we could look at load/store
types), but I've chosen to keep it simple for now, because I'm
unsure to what degree this would really useful without more
experience (I expect that in most cases the declaration type doesn't
really matter).
Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nikic nikic merged commit 5cc87b4 into llvm:main Jan 31, 2024
3 of 4 checks passed
@nikic nikic deleted the incomplete-ir-2 branch January 31, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants