Skip to content

[5.0] Fix SILCombine metatype cast optimization to avoid extending lifetimes. #21501

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
Dec 21, 2018
Merged

[5.0] Fix SILCombine metatype cast optimization to avoid extending lifetimes. #21501

merged 1 commit into from
Dec 21, 2018

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Dec 21, 2018

This cannot be correctly done as a SILCombine because it must create
new instructions at a previous location. Move the optimization into
CastOptimizer. Insert the new metatype instructions in the correct
spot. And manually do the replaceAllUsesWith and eraseInstruction
steps.

Fixes rdar://problem/46746188 crash in swift_getObjCClassFromObject.

(cherry picked from commit 65c95dd)

This cannot be correctly done as a SILCombine because it must create
new instructions at a previous location. Move the optimization into
CastOptimizer. Insert the new metatype instructions in the correct
spot. And manually do the replaceAllUsesWith and eraseInstruction
steps.

Fixes <rdar://problem/46746188> crash in swift_getObjCClassFromObject.

(cherry picked from commit 65c95dd)
@atrick atrick requested a review from a team as a code owner December 21, 2018 19:28
@atrick
Copy link
Contributor Author

atrick commented Dec 21, 2018

Reviewed by @eeckstein .

@atrick
Copy link
Contributor Author

atrick commented Dec 21, 2018

@swift-ci test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 02939d1

@atrick
Copy link
Contributor Author

atrick commented Dec 21, 2018

@swift-ci test linux.

@eeckstein eeckstein changed the title Fix SILCombine metatype cast optimization to avoid extending lifetimes. [5.0] Fix SILCombine metatype cast optimization to avoid extending lifetimes. Dec 21, 2018
@eeckstein eeckstein merged commit cde5369 into swiftlang:swift-5.0-branch Dec 21, 2018
@atrick atrick deleted the 5.0-fix-getobjc-after-free branch February 22, 2019 17:25
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