Skip to content

[semantic-arc-opts] Eliminate dead trivial instructions /after/ the m… #27094

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

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Sep 9, 2019

…ain loop to avoid issues around adding/removing things from the worklist.

rdar://55127027

…ain loop to avoid issues around adding/removing things from the worklist.

rdar://55127027
@gottesmm
Copy link
Contributor Author

gottesmm commented Sep 9, 2019

@swift-ci smoke test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

LGTM

if (!val)
continue;
recursivelyDeleteTriviallyDeadInstructions(
*val, true /*force*/,
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why is force=true appropriate here? Also, why was it previously necessary to add operands and results to the worklist but is no longer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why I put force here is b/c if I don't put force it just does the isTriviallyDead check again.

The reason why I removed the operand/result thing is I find with the test case in question that recursivelyDeleteTriviallyDeadInstructions can re-add the struct_extract from the test case to the worklist as a result of an instruction.

I just avoided all of the problems by doing it later.

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason why I put force here is b/c if I don't put force it just does the isTriviallyDead check again.

Anytime we violate the spirit of the API like this there should be a comment explaining the cleverness.

@gottesmm gottesmm merged commit 9ffb35c into swiftlang:master Sep 10, 2019
@gottesmm gottesmm deleted the pr-399ba0e079dfa48cb9aba436c0a62bd4087c2304 branch September 10, 2019 02:21
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