Skip to content

Commit 1100108

Browse files
committed
AliasAnalysis: handle debug_step in computeMemoryEffect
The `debug_step` instruction does not have a memory effect on any specific address
1 parent 75f8041 commit 1100108

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

SwiftCompilerSources/Sources/Optimizer/Analysis/AliasAnalysis.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ struct AliasAnalysis {
220220
is StrongCopyUnmanagedValueInst,
221221
is StrongCopyWeakValueInst,
222222
is BeginBorrowInst,
223-
is BeginCOWMutationInst:
223+
is BeginCOWMutationInst,
224+
is DebugStepInst:
224225
return .noEffects
225226

226227
case let load as LoadInst:

SwiftCompilerSources/Sources/Optimizer/TestPasses/MemBehaviorDumper.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ private extension Instruction {
7777
is StoreBorrowInst,
7878
is MarkDependenceInst,
7979
is MarkDependenceAddrInst,
80-
is DebugValueInst:
80+
is DebugValueInst,
81+
is DebugStepInst:
8182
return true
8283
default:
8384
return false

test/SILOptimizer/mem-behavior.sil

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,18 @@ bb0:
12661266
return %r : $()
12671267
}
12681268

1269+
// CHECK-LABEL: @test_debug_step
1270+
// CHECK: PAIR #0.
1271+
// CHECK-NEXT: debug_step
1272+
// CHECK-NEXT: %0 = argument of bb0
1273+
// CHECK-NEXT: r=0,w=0
1274+
sil [ossa] @test_debug_step : $@convention(thin) (@inout_aliasable Int) -> () {
1275+
bb0(%0 : $*Int):
1276+
debug_step
1277+
%99 = tuple ()
1278+
return %99 : $()
1279+
}
1280+
12691281
// CHECK-LABEL: @test_store_assign
12701282
// CHECK: PAIR #0.
12711283
// CHECK-NEXT: store %2 to [assign] %0 : $*C

0 commit comments

Comments
 (0)