Skip to content

Several fixes for performance diagnostics #59916

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 10 commits into from
Jul 7, 2022

Conversation

eeckstein
Copy link
Contributor

Fixes several cases of missing errors and false alarms.
The fixes are mostly in the MandatoryGenericSpecializer pass, so that the generated code avoids locks and allocations.
A few fixes are directly in the PerformanceDiagnostics pass - in cases where the generated code is okay, but just the (not) emitted errors were wrong.

For details see the commit messages.

rdar://94388453
rdar://94729207
rdar://94780620
rdar://94833845
rdar://94836837

@eeckstein eeckstein force-pushed the perf-annotation-fixes branch from 0965598 to 3ed2472 Compare July 6, 2022 15:14
@eeckstein
Copy link
Contributor Author

@swift-ci test

eeckstein added 10 commits July 7, 2022 08:34
Just comment out the failing test (which needs rdar://90495704)
To avoid phase ordering problems of the involved optimizations, iterate until we reach a fixed point.
For performance annotations we need the generic specializer to trop non-generic metatype argumentrs
(which we don't do in general). For this we need a separate mangling.
…unctions

And replace them with explicit `metatype` instruction in the entry block.
This allows such metatype instructions to be deleted if they are dead.

rdar://94388453
Co-routines (called by `begin_apply`) may allocate and therefore it’s important to always inline them.

Also, refactor the code a bit to fix the if-changed-then-return-true logic.

rdar://94833845
This is important for performance diagnostics: it’s assumed that (non-generic) MemoryLayout constants do not need to create metadata at runtime. At Onone this is only guaranteed if the TargetConstantFolding pass runs.

rdar://94836837
…bles

So far, initializers of global variables were ignored.
The fix is to visit the called initializer of the builtin `once`.

rdar://94780620
Check if no-escaping closures meet the performance constraints.
Do this already when passing a closure to a function.

rdar://94729207
@eeckstein eeckstein force-pushed the perf-annotation-fixes branch from 3ed2472 to abfa0a3 Compare July 7, 2022 06:35
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit 224cac5 into swiftlang:main Jul 7, 2022
@eeckstein eeckstein deleted the perf-annotation-fixes branch July 7, 2022 11:58
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