Skip to content

[semantic-arc-opts] When performing load [copy] -> load_borrow on classes, do not ignore forwarding uses. #28989

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 Jan 3, 2020

Otherwise in cases like the test case attached, we will not properly look
through the destroy.

In a subsequent commit, I am going to do some more fixes here by adding memory
use verification around begin_borrow. I have wanted to enable this for a minute,
but this seems like a good time to do so given that would have caught this.

rdar://58289320


EDIT! I am doing a smaller cherry-picking fix. I am still using this PR to not confuse the automation. See message below in conversation!

@gottesmm gottesmm requested review from jckarter and atrick January 3, 2020 07:10
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 3, 2020

Build failed
Swift Test OS X Platform
Git Sha - eb0e96943779ca499166a906a613b17b291437ae

@mikeash
Copy link
Contributor

mikeash commented Jan 3, 2020

Thanks for tracking this down!

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test os x platform

Copy link
Contributor

@aschwaighofer aschwaighofer 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 Jan 3, 2020

I started to play with this a bit locally, and I found a smaller simpler change to cherry-pick. I am going to first commit that.

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

I tried to cherry-pick this change and I found it to be a bit difficult since the LiveRange infrastructure doesn't exist on 5.2. I am about to push an even smaller fix that only uses things in that older code to make it slightly easier to cherry-pick. In a subsequent PR, I am going to re-add the LiveRange code.

@gottesmm gottesmm force-pushed the pr-42b06814f186ae88911b84b21640d36b25c7a1cd branch from eb0e969 to 26af4ab Compare January 3, 2020 18:35
@gottesmm gottesmm changed the title [semantic-arc-opts] Use the LiveRange abstraction to find destroys instead of iterating over direct uses. [semantic-arc-opts] When performing load [copy] -> load_borrow on classes, do not ignore forwarding uses. Jan 3, 2020
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

4 similar comments
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

LGTM.

…sses, do not ignore forwarding uses.

This is the first of two commits. This commit is a very simple, easily
cherry-pickable fix but does not use the LiveRange infrastructure so that we
handle forwarding uses here. Instead, we just bail if all uses of our load
[copy] are not destroy_value.

In a subsequent commit, I am going to change this to use the LiveRange
infrastructure so we will handle these cases. Sadly doing so doesn't cherry-pick
well. = /.

rdar://58289320
@gottesmm gottesmm force-pushed the pr-42b06814f186ae88911b84b21640d36b25c7a1cd branch from 26af4ab to 23f36a0 Compare January 3, 2020 18:52
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

1 similar comment
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 3, 2020

Build failed
Swift Test OS X Platform
Git Sha - 23f36a0

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

Java failure...

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 3, 2020

@swift-ci test os x platform

@gottesmm gottesmm merged commit 750289e into swiftlang:master Jan 3, 2020
@gottesmm gottesmm deleted the pr-42b06814f186ae88911b84b21640d36b25c7a1cd branch January 3, 2020 22:47
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.

Fix looks good

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.

5 participants