Skip to content

LICM: handle memory dependency for store sinking correctly #81189

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 1 commit into from
Apr 30, 2025

Conversation

eeckstein
Copy link
Contributor

  • Explanation: LICM didn't handle dependences of store instructions to memory-reading instructions (other than load) in the same loop. This could result in SIL verifier crashes or - even worse - in mis-compiles. This fix disables store-sinking in such cases.
  • Risk: low: It's a simple change which just makes store-sinking in LICM more conservative
  • Testing: Tested by lit tests
  • Issue: rdar://150205299
  • Reviewer: @meg-gupta, @nate-chandler
  • Main branch PR: LICM: handle memory dependency for store sinking correctly #81167

Prevent sinking of stores if there are instructions other than `load` which may read from memory.
This kind of memory dependencies were ignored.
Fixes SIL verifier crashes or - in worst case - miscompiles.

rdar://150205299
@eeckstein eeckstein requested a review from a team as a code owner April 30, 2025 05:32
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit 62cfed6 into swiftlang:release/6.2 Apr 30, 2025
5 checks passed
@eeckstein eeckstein deleted the fix-licm-6.2 branch April 30, 2025 14:15
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