Skip to content

[simplify-cfg] Add a visitedBlocks set to hasSameUltimateSuccessor to prevent infinite loops. #27468

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

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Oct 1, 2019

[simplify-cfg] Add a visitedBlocks set to hasSameUltimateSuccessor to prevent infinite loops.

Previously, we were not handling properly blocks that we could visit multiple
times. In this commit, I added a SmallPtrSet to ensure that we handle all of the
same cases that we handled previously.

The key reason that we want to follow this approach rather than something else
is that the previous algorithm on purpose allowed for side-entrances from other
checks since often times when we have multiple checks, all of the .none branches
funnel together into a single ultimate block.

This can be seen by the need of this code to support the test two_chained_calls
in simplify_switch_enum_objc.sil.

rdar://55861081
(cherry picked from commit aa00865)

…nches for testing purposes

I am going to use this in a subsequent commit to make sure we do not infinite
loop upon a test case.

rdar://55861081
(cherry picked from commit fab7752)
… prevent infinite loops.

Previously, we were not handling properly blocks that we could visit multiple
times. In this commit, I added a SmallPtrSet to ensure that we handle all of the
same cases that we handled previously.

The key reason that we want to follow this approach rather than something else
is that the previous algorithm on purpose allowed for side-entrances from other
checks since often times when we have multiple checks, all of the .none branches
funnel together into a single ultimate block.

This can be seen by the need of this code to support the test two_chained_calls
in simplify_switch_enum_objc.sil.

rdar://55861081
(cherry picked from commit aa00865)
@gottesmm gottesmm requested a review from eeckstein October 1, 2019 20:00
@gottesmm gottesmm requested a review from a team as a code owner October 1, 2019 20:00
@gottesmm
Copy link
Contributor Author

gottesmm commented Oct 1, 2019

@swift-ci test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@gottesmm
Copy link
Contributor Author

gottesmm commented Oct 3, 2019

@airspeedswift can I get a +1 here?

@gottesmm
Copy link
Contributor Author

gottesmm commented Oct 3, 2019

Thanks!

@gottesmm gottesmm merged commit 1d38d61 into swiftlang:swift-5.1-branch Oct 3, 2019
@gottesmm gottesmm deleted the swift-5.1-branch-rdar55861081 branch October 3, 2019 17:19
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