Skip to content

[AddressLowering] Fix partial_apply argument indexing. #67947

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

Conversation

nate-chandler
Copy link
Contributor

When rewriting arguments, the index used is into the callee's argument list. For full applies, that is identical to the index into the instruction's argument list. For partial applies, it is not.

Previously, though, the index was used as if it were an index into the instruction's argument list to get an argument ref. Here, use instead the newly added convenience to get the argument ref using the index into the callee's arguments.

Added convenience functions to ApplySite to access argument and argument
operand by index into the callee's argument list (rather than by index
into the arguments used by the apply instruction).
Full apply instructions have the same number of arguments as the callee
has parameters.  Partial apply instructions have some number less than
or equal to the number of callee parameters.
When rewriting arguments, the index used is into the callee's argument
list.  For full applies, that is identical to the index into the
instruction's argument list.  For partial applies, it is not.

Previously, though, the index was used as if it were an index into the
instruction's argument list to get an argument ref.  Here, use instead
the newly added convenience to get the argument ref using the index into
the callee's arguments.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler changed the title [AddressLowering] Fix partial_apply arg indexing. [AddressLowering] Fix partial_apply argument indexing. Aug 15, 2023
@nate-chandler nate-chandler merged commit 9e21bd5 into swiftlang:main Aug 16, 2023
@nate-chandler nate-chandler deleted the opaque-values/20230815/1/partial-apply-indexing branch August 16, 2023 14:01
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

LGTM. I don't have any better ideas 😔

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