Skip to content

[sil-cse] Fix a bug in the CSE of open_existential_ref instructions #4606

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
Sep 3, 2016

Conversation

swiftix
Copy link
Contributor

@swiftix swiftix commented Sep 2, 2016

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves #45150

When performing a CSE of open_existential_ref instructions, we replace the new archetype by the old archetype by cloning the uses and re-mapping the archetypes. But we also need to consider that some of the uses of a open_existential_ref instruction (e.g. loads) may produce results depending on the opened archetype being replaced. Therefore, for every such use its own uses (and their uses) should be eventually recursively cloned and type-remapped as well if they depend on the opened archetype being replaced.

Fixes rdar://28136015

When performing a CSE of open_existential_ref instructions, we replace the new archetype by the old archetype by cloning the uses and re-mapping the archetypes. But we also need to consider that some of the uses of a open_existential_ref instruction (e.g. loads) may produce results depending on the opened archetype being replaced. Therefore, for every such use its own uses (and their uses) should be eventually recursively cloned and type-remapped as well if they depend on the opened archetype being replaced.

Fixes rdar://28136015 and https://bugs.swift.org/browse/SR-2545
@swiftix
Copy link
Contributor Author

swiftix commented Sep 2, 2016

@swift-ci Please smoke test

@swiftix
Copy link
Contributor Author

swiftix commented Sep 3, 2016

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 897de2c into swiftlang:master Sep 3, 2016
@swiftix
Copy link
Contributor Author

swiftix commented Sep 6, 2016

@eeckstein Erik, do you mind reviewing it for CCC?

return false;
});
if (ResultDependsOnOldOpenedArchetype) {
DependsOnOldOpenedArchetype |= ResultDependsOnOldOpenedArchetype;
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmetic: would be simpler to write
DependsOnOldOpenedArchetype = true

@eeckstein
Copy link
Contributor

LGTM

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