Skip to content

Pass correct SubExpr as source location when emitting Load of LValue. #79524

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 2 commits into from
Feb 24, 2025

Conversation

rastogishubham
Copy link
Contributor

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 and thus, preserves the location information.

@rastogishubham
Copy link
Contributor Author

@swift-ci please smoke test Linux

@rastogishubham
Copy link
Contributor Author

@swift-ci please smoke test macOS

@rastogishubham
Copy link
Contributor Author

@swift-ci please test Windows

@rastogishubham
Copy link
Contributor Author

@adrian-prantl the test doesn't contain anything from the -emit-sil output, because the output doesn't change, only the Implicit flag changes, which the current -emit-sil doesn't output, but once #79519 is merged (after the tests pass), I can update the test here to also contain a SILGen output

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()
@adrian-prantl
Copy link
Contributor

@swift-ci test

@rastogishubham
Copy link
Contributor Author

@swift-ci please test

@rastogishubham
Copy link
Contributor Author

@swift-ci please smoke test

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.
@rastogishubham
Copy link
Contributor Author

@swift-ci please smoke test macOS

@rastogishubham
Copy link
Contributor Author

@swift-ci please smoke test Linux

@rastogishubham
Copy link
Contributor Author

@swift-ci please test Windows

@adrian-prantl
Copy link
Contributor

@swift-ci test windows

@adrian-prantl
Copy link
Contributor

@swift-ci test

@rastogishubham
Copy link
Contributor Author

@swift-ci please test Windows

@adrian-prantl
Copy link
Contributor

Does the IRGen/yield_once.sil look like it's related? If not, let's merge this.

@rastogishubham
Copy link
Contributor Author

@adrian-prantl looks like the previous builds also failed on the same tests for the same reasons, so this patch has nothing to do with the yield_once test failing. We can safely merge this.

@rastogishubham rastogishubham merged commit 1e4cec9 into swiftlang:main Feb 24, 2025
3 of 5 checks passed
@rastogishubham rastogishubham deleted the FixASANBug branch February 24, 2025 17:44
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