Skip to content

Commit 82107c5

Browse files
committed
ComputeSideEffects: consider effects in dead-end blocks
It was a wrong assumption that we can ignore effects in dead-end blocks.
1 parent 0ada6ec commit 82107c5

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ComputeSideEffects.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,9 @@ let computeSideEffects = FunctionPass(name: "compute-side-effects", {
4444

4545
var collectedEffects = CollectedEffects(function: function, context)
4646

47-
var deadEndBlocks = DeadEndBlocks(function: function, context)
48-
defer { deadEndBlocks.deinitialize() }
49-
5047
// First step: collect effects from all instructions.
5148
//
5249
for block in function.blocks {
53-
// Effects in blocks from which the function doesn't return are not relevant for the caller.
54-
if deadEndBlocks.isDeadEnd(block: block) {
55-
continue
56-
}
5750
for inst in block.instructions {
5851
collectedEffects.addInstructionEffects(inst)
5952
}

test/SILOptimizer/side_effects.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ bb0(%0 : $*X):
655655
}
656656

657657
// CHECK-LABEL: sil @call_noreturn
658-
// CHECK-NEXT: [global: ]
658+
// CHECK-NEXT: [global: read]
659659
// CHECK-NEXT: {{^[^[]}}
660660
sil @call_noreturn : $@convention(thin) () -> () {
661661
bb0:

0 commit comments

Comments
 (0)