Skip to content

Commit 1f0f9d6

Browse files
committed
ComputeSideEffects: ignore side effects of debug_value with address operands
We already ignored side effects of debug_value with non-address operands. Now also do this for address operands.
1 parent e26affa commit 1f0f9d6

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ComputeSideEffects.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ private struct ArgumentEscapingWalker : ValueDefUseWalker, AddressDefUseWalker {
442442
return .continueWalk
443443

444444
// Warning: all instruction listed here, must also be handled in `CollectedEffects.addInstructionEffects`
445-
case is StoreInst, is StoreWeakInst, is StoreUnownedInst, is ApplySite, is DestroyAddrInst:
445+
case is StoreInst, is StoreWeakInst, is StoreUnownedInst, is ApplySite, is DestroyAddrInst,
446+
is DebugValueInst:
446447
return .continueWalk
447448

448449
default:

test/SILOptimizer/assemblyvision_remark/chacha.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public func run_ChaCha(_ N: Int) {
3333

3434
var checkedtext = Array(repeating: UInt8(0), count: 1024)
3535
ChaCha20.encrypt(bytes: &checkedtext, key: key, nonce: nonce)
36-
checkResult(checkedtext)// expected-note @-2 {{of 'checkedtext}}
36+
checkResult(checkedtext)
3737

3838

3939
var plaintext = Array(repeating: UInt8(0), count: 30720)
@@ -43,7 +43,7 @@ public func run_ChaCha(_ N: Int) {
4343
// expected-remark @-1:27 {{release of type '}}
4444
}
4545
} // expected-remark {{release of type '}}
46-
// expected-note @-7 {{of 'plaintext}}
46+
4747
// expected-remark @-2 {{release of type '}}
4848
// expected-note @-16 {{of 'nonce}}
4949
// expected-remark @-4 {{release of type '}}

test/SILOptimizer/side_effects.sil

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,3 +1144,15 @@ bb3:
11441144
return %r : $()
11451145
}
11461146

1147+
// CHECK-LABEL: sil @test_debug_value_address
1148+
// CHECK-NEXT: [%0: read v**, write v**, destroy v**]
1149+
// CHECK-NEXT: [global: read,write,copy,destroy,allocate,deinit_barrier]
1150+
// CHECK-NEXT: {{^[^[]}}
1151+
sil @test_debug_value_address : $@convention(thin) <T> (@in T, @inout T) -> () {
1152+
bb0(%0 : $*T, %1 : $*T):
1153+
destroy_addr %0 : $*T
1154+
debug_value %1 : $*T
1155+
%4 = tuple ()
1156+
return %4 : $()
1157+
}
1158+

0 commit comments

Comments
 (0)