Skip to content

Swift SIL: Fix argument conventions for functions which have both, a direct and indirect result #81806

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

Merged
merged 1 commit into from
May 30, 2025

Conversation

eeckstein
Copy link
Contributor

The function convention for the first argument is not identified as indirect-out. This lets alias analysis assume that the memory pointed to by argument 0 cannot be written by the called function.

The problem is that subscripting a LazyFilterCollection (with the base index, e.g. Int) does not work as expected, because it returns the nth element of the base collection! The fix is to implement the subscript "manually".

Fixes a mis-compile.
rdar://152160748

…direct and indirect result.

The function convention for the first argument is not identified as indirect-out.
This lets alias analysis assume that the memory pointed to by argument 0 cannot be written by the called function.

The problem is that subscripting a LazyFilterCollection (with the base index, e.g. `Int`) does not work as expected, because it returns the nth element of the base collection!
The fix is to implement the subscript "manually".

Fixes a mis-compile.
rdar://152160748
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from atrick May 28, 2025 16:08
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.

Thanks for tracking this down.

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macos

@eeckstein eeckstein merged commit 0654dc7 into swiftlang:main May 30, 2025
4 of 5 checks passed
@eeckstein eeckstein deleted the fix-argument-convention branch May 30, 2025 10:30
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