Skip to content

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).
@nikic nikic requested review from dtcxzyw, fhahn and nhaehnle January 29, 2024 16:13
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
@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.

2 participants