Skip to content

[5.9] AllocStackHoisting: fix a quadratic complexity bug when merging stack locations. #68141

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

eeckstein
Copy link
Contributor

@eeckstein eeckstein commented Aug 25, 2023

  • Explanation: This fixes a compile time problem which shows up if there are many stack locations in a large basic block. In the inner loop of the optimization the check for overlapping stack regions was done by iterating over all instructions of the basic block. The fix is to use consecutive instruction indices (which are stored in a map) to check for overlapping.

  • Issue: rdar://113207176

  • Risk: Low. The new overlapping check is done by 2 conditions which are 100% covered by the regression test.

  • Testing: With a regression test. Also, this optimization is so basic that it will be tested in nearly every program which is compiled.

  • Reviewer: @atrick

  • Main branch PR: AllocStackHoisting: fix a quadratic complexity bug when merging stack locations. #68139

… locations.

Use consecutive instruction numbers to check for overlapping instead of iterating over the instruction list.

This fixes a compile time problem which shows up if there are many stack locations in a large basic block.

rdar://113207176
@eeckstein eeckstein requested a review from a team as a code owner August 25, 2023 15:09
@eeckstein eeckstein requested a review from atrick August 25, 2023 15:11
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit a129287 into swiftlang:release/5.9 Aug 25, 2023
@eeckstein eeckstein deleted the fix-alloc-stack-hoisting-5.9 branch August 25, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants