Skip to content

SILDebugScopes: Don't ignore ConditionalClauseInitializerScope #66734

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 3 commits into from
Jun 20, 2023

Conversation

adrian-prantl
Copy link
Contributor

This cherry-picks 2 changes to SILDebugScope generation that fix an LLVM verification error when compiling at -Onone.

ConditionalClauseInitializerScope often create redundant scopes, however, they are needed to correctly represent the scopes in an expression such as:

if case .something(let foo), let foo = foo.

This patch changes SILGen to lower them 1:1 from ASTScopes.

Compute VarDeclScopeMap up front.
The previous lazy discovery did not always work because sometimes a debug_value
is emitted before the first SIL instruction in the variable's scope.

rdar://110841130

@adrian-prantl adrian-prantl requested a review from a team as a code owner June 17, 2023 17:37
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

ConditionalClauseInitializerScope often create redundant scopes, however, they
are needed to correctly represent the scopes in an expression such as:

  if case .something(let foo), let foo = foo.

This patch changes SILGen to lower them 1:1 from ASTScopes.

rdar://110841130
(cherry picked from commit 874ba08)
The previous lazy discovery did not always work because sometimes a debug_value
is emitted before the first SIL instruction in the variable's scope.

rdar://110841130
(cherry picked from commit 329e428)
(cherry picked from commit fef3578)
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl
Copy link
Contributor Author

Explanation: Fix an LLVM IR verification failure when compiling case-let statements that rebind names.
Radar: rdar://110841130
Scope: Code compiled at -Onone that introduces new variables that shadow others.
Risk: Low.
Testing: Regression test

@adrian-prantl adrian-prantl merged commit 787e0fc into swiftlang:release/5.9 Jun 20, 2023
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.

2 participants