Skip to content

[SIL Optimization] Improve dead-code in OSLogOptimization pass, fix a bug and add helper functions to the new InstructionDeleter utility #29447

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

Conversation

ravikandhadai
Copy link
Contributor

@ravikandhadai ravikandhadai commented Jan 25, 2020

This PR consists of two commits. The first one fixes a bug in the identification of dead constant evaluable calls in the new InstructionDeleter utility. The fix makes the check more conservative and assumes that calls with generic arguments are not dead, as generic functions with arbitrary side-effects can be invoked through them.

The second commit improves the OSLogOptimization pass so that it can remove alloc_stacks that are dead as a result of the optimization. This change is specific to the pass and exploits the constant-evaluableness of the calls evaluated in that pass. At this point, this cannot be generalized outside of this pass, as it relies on the fact that the constant_evaluable calls "have been" evaluated successfully, which means that they did not have any side-effects (in that calling context) and were only using constants supported by the constant evaluator (all of which have value semantics).

evaluable calls. The fix makes the check more conservative and
assumes that calls with generic arguments are not dead, as generic
functions with arbitrary side-effects can be invoked through them.

Also, add a few helper functions to the InstructionDeleter utility
that will enable deleting an instruction along with its users.
@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test

using the new InstructionDeleter utility. The elimination logic
exploits the fact that constant_evaluable function calls have
been evaluated and folded, in order to remove such calls that
may possibly take @inout parameters.
@ravikandhadai ravikandhadai force-pushed the oslog-dead-code-elim-alloc-stack branch from fc066f0 to 52f274a Compare January 25, 2020 03:36
@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fc066f096c94d149156505292e095c82f6bf0369

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - fc066f096c94d149156505292e095c82f6bf0369

@ravikandhadai ravikandhadai merged commit 23e2b70 into swiftlang:master Jan 25, 2020
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