-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[🍒][6.1] Pass correct SubExpr as source location when emitting Load of LValue #79584
Open
rastogishubham
wants to merge
2
commits into
swiftlang:release/6.1
Choose a base branch
from
rastogishubham:FixASANBug6.1
base: release/6.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[🍒][6.1] Pass correct SubExpr as source location when emitting Load of LValue #79584
rastogishubham
wants to merge
2
commits into
swiftlang:release/6.1
from
rastogishubham:FixASANBug6.1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please test |
adrian-prantl
approved these changes
Feb 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support taking this change.
Also tracked as rdar://143924559. |
The option -sil-print-debuginfo-verbose will print the values of the fields, implicit, and autoGenerated for a SILLocation, as well as whether the SILLocation is considered hidden from debug information by calling SILLocation::isHiddenFromDebugInfo() (cherry picked from commit 1567386)
When emitting an LValue of a LoadExpr during SILGen, the Expression passed as a SILLocation for the LValue was the parent LoadExpr instead of the SubExpr that contains the LValue for the load. This leads to the SILLocation to be marked as implicit, because a LoadExpr is always an implicit expression. An implicit SILLocation is not emitted when doing IRGen as it is considered to be hidden from debug info and thus we lose the debug location for the LValue of a LoadExpr. This patch fixes this issue. (cherry picked from commit 52a5ed8)
40301a6
to
e225a80
Compare
@swift-ci please test |
@swift-ci please test macOS |
1 similar comment
@swift-ci please test macOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR cherry-picks from #79524 to the 6.1 release branch. It fixes an issue where a LoadExpr, which is implicit in SIL, is passed in as the SILLocation when emitting the LValue of the LoadExpr, as opposed to the SubExpr contained within the LoadExpr.
This has the effect of making all SIL instructions having implicit SILLocations which are generated when emitting the LValue of the LoadExpr, even if the SubExprs contained within the LoadExpr are not marked as implicit in the AST dump.
To make this possible, we also added a new flag,
-sil-print-debuginfo-verbose
, which prints the Implicit, and autoGenerated fields for a SILLocation, and prints what the result of callingSILLocation::isHiddenFromDebugInfo()
would be. For testing and diagnostic purposes.For example, if we take the ast-dump below, we can see that the
load_expr
is marked as implicit, but AST nodes it contains are not, however, if we look at the SILGen output of these AST nodes, they are marked as ImplicitScope:
This changes the SILLocation passed to any LoadExpr LValue emission to be the SubExpr instead of the LoadExpr itself, should be a fairly minimal impact.
Issues:
None
Original PRs:
#79524 and #79519
Risk:
The risk should be very low, the change will only affect the SILLocation that is passed and should not cause any major issues.
Testing:
New test cases, and passing test suite.
Reviewers:
@adrian-prantl