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] Implicitly declare intrinsics #78251

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 16, 2024

We currently require that all referenced globals have an explicit declaration or definition in the IR. For intrinsics, this requirement is redundant, because they cannot be called indirectly (including "direct" calls with mismatched function type). The function type used in the call directly determines the function type of the intrinsic declaration.

Relax this requirement, and implicitly declare any intrinsics that do not have an explicit declaration. This will remove a common annoyance when writing tests and alive2 proofs.

(I also plan to introduce a mode where declarations for all missing symbols will be automatically added, to make working with incomplete IR easier -- but that will be behind a default-disabled flag.)

We currently require that all referenced globals have an explicit
declaration or definition in the IR. For intrinsics, this
requirement is redundant, because they cannot be called indirectly
(including "direct" calls with mismatched function type). The
function type used in the call directly determines the function type
of the intrinsic declaration.

Relax this requirement, and implicitly declare any intrinsics that
do not have an explicit declaration. This will remove a common
annoyance when writing tests and alive2 proofs.

(I also plan to introduce a mode where declarations for all missing
symbols will be automatically added, to make working with incomplete
IR easier -- but that will be behind a default-disabled flag.)
To show that intrisincs IDs are correctly detected.
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 34b1067 into llvm:main Jan 17, 2024
4 checks passed
jayfoad added a commit to jayfoad/llvm-project that referenced this pull request Mar 19, 2024
These are no longer needed after llvm#78251.

This was done automatically with:
$ perl -i -0pe 's/\n(\n* *declare[^\n]* \@llvm\.[^\n]*\n)+/\n/gms' $(find test/CodeGen/AMDGPU -type f)
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