Skip to content

Escape analysis fix (3.0) #4917

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

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Sep 22, 2016

  • Description: Escape analysis could return inconsistent results when queried multiple times about local allocations which nevertheless escape. Alias analysis in turn relies on escape analysis so a lot of downstream passes were potentially affected, but in particular this came up with ARC code motion.
  • Scope of the issue: This could affect anyone, and since it can manifest as a miscompile it is particularly nasty. However, the workaround is simple -- build without optimization.
  • Risk: Low, the fix is "obviously correct".
  • Tested: I'm still working on a reduced test case. This bug triggers in the form of existing tests failing with some other changes I have for master, but the underlying issue should exist in 3.0 also.
  • Radar: rdar://problem/28435907

We weren't clearing the worklist flags if returning true here. Oops!

This would manifest as alias analysis returning different results
for the same operands over time, which confused ARC code motion
into dropping release instructions.
@slavapestov slavapestov added this to the Swift 3.0 milestone Sep 22, 2016
@slavapestov
Copy link
Contributor Author

@eeckstein and @swiftix Here's just the escape analysis fix from #4913 cherry-picked for 3.0. Do you mind reviewing this?

I'll try to come up with a reasonable test case tomorrow.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@eeckstein
Copy link
Contributor

LGTM!

@tkremenek tkremenek merged commit c46c70e into swiftlang:swift-3.0-branch Sep 22, 2016
aaditya-chandrasekhar pushed a commit to val-verde/swift that referenced this pull request Sep 30, 2022
[pull] swiftwasm-release/5.7 from release/5.7
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.

3 participants