Skip to content

Swift Optimizer: add EscapeInfo, a new utility for escape analysis (2nd try) #42571

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 6 commits into from
Apr 22, 2022

Conversation

eeckstein
Copy link
Contributor

Reinstate #42242 with some fixes, after it was reverted by #42562

And make DestructureStructInst and DestructureTupleInst a UnaryInstruction
* rename `matchesAllValueFields` -> `topMatchesAnyValueField`
* add `hasSingleClassIndirection` and `hasClassProjection`
* add `popLastClassAndValuesFromTail`
…RawPointer

This is needed for the new escape analysis
It’s a replacement for the old `EscapeAnalysis`, implemented in Swift (instead of C++) and with a much simple design and implementation.
While the old EscapeAnalysis builds a connection graph, the new EscapeInfo just performs a simple def-use and use-def walk in the SIL.
The EscapeInfo does not need to analyze the whole function (like the EscapeAnalysis does), but just the relevant value which is inspected. Therefore EscapeInfo is not an `Analysis` which caches its result across optimization passes - it’s not needed.
And add test files which uses the passes for verification of EscapeInfo
The ComputeEffects pass derives escape information for function arguments and adds those effects in the function.
This needs a lot of changes in check-lines in the tests, because the effects are printed in SIL
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit 1b8c430 into swiftlang:main Apr 22, 2022
@eeckstein eeckstein deleted the escapeinfo-2nd-try branch April 22, 2022 12:28
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.

1 participant