-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Debuginfo] Small fixes #73009
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
adrian-prantl
merged 5 commits into
swiftlang:main
from
Snowy1803:debuginfo-small-fixes
Apr 16, 2024
Merged
[Debuginfo] Small fixes #73009
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3136d2e
[DebugInfo] [IRGen] Use instruction column number for variables
Snowy1803 96cf233
[SILPrinter] Hide VarInfo debug info if printing debuginfo is disabled
Snowy1803 5512df5
[SILCloner] Remap debug variable type and scope at the same time (NFC)
Snowy1803 fac61c5
[DebugInfo] [SILSROA] Fix variable scope in some cases
Snowy1803 4a543c8
[DebugInfo] Salvage Debug Info in Swift Function Passes
Snowy1803 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: %target-sil-opt %s -dead-store-elimination -enable-sil-verify-all | %FileCheck %s | ||
|
||
// REQUIRES: swift_in_compiler | ||
|
||
sil_stage canonical | ||
|
||
import Swift | ||
import Builtin | ||
|
||
// We should be able to replace the local store with a debug_value. | ||
// The dead store elimination pass is written in Swift, and should call | ||
// salvage debug info when removing the store. | ||
|
||
// CHECK-LABEL: @trivial_local_dead_store | ||
// CHECK: debug_value %{{[0-9]+}} : $Int, var, name "a" | ||
// CHECK: return | ||
sil hidden @trivial_local_dead_store : $@convention(thin) () -> () { | ||
bb0: | ||
%0 = alloc_stack $Int, var, name "a" | ||
%1 = integer_literal $Builtin.Int64, 1 | ||
%2 = struct $Int (%1 : $Builtin.Int64) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test will probably not work on 32-bit platforms. Could you rewrite it to hardcode an Int32? |
||
store %2 to %0 : $*Int | ||
%4 = tuple () | ||
dealloc_stack %0 : $*Int | ||
return %4 : $() | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// RUN: %target-swiftc_driver -g -emit-ir %s | %FileCheck %s | ||
sil_stage canonical | ||
|
||
import Builtin | ||
import Swift | ||
|
||
sil_scope 2 { loc "simple.swift":1:2 parent @test_debug_value : $@convention(thin) (Builtin.Int64) -> () } | ||
|
||
// CHECK-LABEL: @test_debug_value | ||
// CHECK-SAME: !dbg ![[FUNC_DI:[0-9]+]] | ||
sil hidden @test_debug_value : $@convention(thin) (Builtin.Int64) -> () { | ||
bb0(%0 : $Builtin.Int64): | ||
// CHECK: @llvm.dbg.declare(metadata ptr | ||
// CHECK-SAME: metadata ![[VAR_DI:[0-9]+]] | ||
// CHECK-SAME: ), !dbg ![[LOC_DI:[0-9]+]] | ||
debug_value %0 : $Builtin.Int64, var, name "x", loc "simple.swift":1:16, scope 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is fine! |
||
%zero = integer_literal $Builtin.Int64, 0 | ||
debug_value %zero : $Builtin.Int64, var, (name "x", loc "simple.swift":1:16, scope 2), loc "simple.swift":3:4, scope 2 | ||
%1 = tuple () | ||
return %1 : $() | ||
} | ||
|
||
// One debug_value uses the VarInfo way, the other uses the instruction way. | ||
// They should both resolve to the same variable, so we should only have one x. | ||
|
||
// CHECK: !DISubprogram(name: "test_debug_value" | ||
// CHECK-SAME: retainedNodes: ![[RETAINED:[0-9]+]] | ||
|
||
// Only one variable should be retained | ||
// CHECK: ![[RETAINED]] = !{![[VAR_DI]]} | ||
|
||
// CHECK-NOT: !DILocalVariable(name: "x" | ||
// CHECK: ![[VAR_DI]] = !DILocalVariable(name: "x" | ||
// CHECK-SAME: line: 1 | ||
// CHECK-NOT: !DILocalVariable(name: "x" |
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.
Uh oh!
There was an error while loading. Please reload this page.