Skip to content

[sil-mandatory-inliner] Decrease the compile time #4635

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

swiftix
Copy link
Contributor

@swiftix swiftix commented Sep 6, 2016

––– CCC Information –––
• Explanation: It is a compile-time speed improvement.
• Scope of Issue: Get rid of O(N^2) behavior in the mandatory inliner
• Origination: rdar://problem/27301540
• Risk: Very low. The patch has been on the master for a week without any regressions or correctness issues.
• Reviewed By: Bob Wilson
• Testing: Verified locally and using a CI @please test
• Directions for QA: Check that test files reported in the radar are now compiled rather quickly instead of taking many hours.

Detailed description

The inlining algorithm was rescanning the whole basic block after inlining a call, which resulted in O(N^2) time complexity. In some pathological cases like e.g. huge basic blocks with many thousands of calls this would lead to very long compile times which could takes hours to finish.

This change improves compile times by avoiding the rescanning of basic blocks containing the call which was inlined.

rdar://27818830

The inlining algorithm was rescanning the whole basic block after inlining a call, which resulted in O(N^2) time complexity. In some pathological cases like e.g. huge basic blocks with many thousands of calls this would lead to very long compile times which could takes hours to finish.

This change improves compile times by avoiding the rescanning of basic blocks containing the call which was inlined.

rdar://27818830
@swiftix
Copy link
Contributor Author

swiftix commented Sep 6, 2016

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2016

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 59a8acd
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Sep 6, 2016

I think that the Linux failure is unrelated. It seems to be related to multi-threading.

@lattner
Copy link
Contributor

lattner commented Sep 6, 2016

It is. This has been hitting other patches as well.

@lattner lattner merged commit 9722df4 into swiftlang:swift-3.0-branch Sep 6, 2016
@tkremenek tkremenek self-assigned this Sep 6, 2016
kateinoigakukun added a commit that referenced this pull request Aug 31, 2022
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.

4 participants