Skip to content

[6.0] [IRGenDebugInfo] Fix usage of dbg.declare #73861

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
May 24, 2024

Conversation

Snowy1803
Copy link
Member

  • Explanation: Avoid using dbg.declare in optimized code, as it can cause issues when debug values get moved around.
  • Scope: Affects debug info at the IRGen level
  • Original PR: [IRGenDebugInfo] Fix usage of dbg.declare #73769
  • Risk: Low, only touches debug info in optimized code, and adds missing debug info in unoptimized code
  • Testing: Existing tests have been updated
  • Issue: rdar://128155050 and rdar://128491243
  • Reviewer: @adrian-prantl

Snowy1803 added 2 commits May 23, 2024 13:49
This is unnecessarily dropping debug info, as there is currently
no assertion in LLVM. The sharing of stack slot can happen
because of AllocStackHoisting, which is run at -Onone too.

(cherry picked from commit 2726d83)
Except for the async context, where it is needed (arguments
within an async function).

We don't support dbg.declare in optimized code, as variables can
be moved by SIL optimization passes. If a partial store is
eliminated, we want a dbg.value on the allocation, and another
dbg.value with a fragment in place of the partial store.

rdar://128155050
(cherry picked from commit 5606fbc)
@Snowy1803 Snowy1803 requested a review from a team as a code owner May 23, 2024 20:56
@Snowy1803
Copy link
Member Author

@swift-ci please test

@adrian-prantl adrian-prantl enabled auto-merge May 23, 2024 23:49
@adrian-prantl adrian-prantl merged commit 002360e into swiftlang:release/6.0 May 24, 2024
5 checks passed
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