Skip to content

Commit 751e52c

Browse files
committed
Optimizer: convert the DeadEndBlockDumper pass to a test
1 parent dc38a22 commit 751e52c

File tree

7 files changed

+22
-30
lines changed

7 files changed

+22
-30
lines changed

SwiftCompilerSources/Sources/Optimizer/DataStructures/DeadEndBlocks.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,19 @@ struct DeadEndBlocks : CustomStringConvertible, NoReflectionChildren {
5151
worklist.deinitialize()
5252
}
5353
}
54+
55+
//===--------------------------------------------------------------------===//
56+
// Tests
57+
//===--------------------------------------------------------------------===//
58+
59+
let deadEndBlockTest = FunctionTest("deadendblocks") {
60+
function, arguments, context in
61+
62+
print("Function \(function.name)")
63+
64+
var deadEndBlocks = DeadEndBlocks(function: function, context)
65+
print(deadEndBlocks)
66+
defer { deadEndBlocks.deinitialize() }
67+
68+
print("end function \(function.name)")
69+
}

SwiftCompilerSources/Sources/Optimizer/PassManager/PassRegistration.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ private func registerSwiftPasses() {
150150
// Test passes
151151
registerPass(functionUsesDumper, { functionUsesDumper.run($0) })
152152
registerPass(silPrinterPass, { silPrinterPass.run($0) })
153-
registerPass(deadEndBlockDumper, { deadEndBlockDumper.run($0) })
154153
registerPass(rangeDumper, { rangeDumper.run($0) })
155154
registerPass(testInstructionIteration, { testInstructionIteration.run($0) })
156155
registerPass(updateBorrowedFromPass, { updateBorrowedFromPass.run($0) })

SwiftCompilerSources/Sources/Optimizer/TestPasses/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
swift_compiler_sources(Optimizer
1010
FunctionUsesDumper.swift
11-
DeadEndBlockDumper.swift
1211
SILPrinter.swift
1312
RangeDumper.swift
1413
UpdateBorrowedFrom.swift

SwiftCompilerSources/Sources/Optimizer/TestPasses/DeadEndBlockDumper.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

SwiftCompilerSources/Sources/Optimizer/Utilities/FunctionTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public func registerOptimizerTests() {
5353
rangeOverlapsPathTest,
5454
variableIntroducerTest,
5555
destroyBarrierTest,
56+
deadEndBlockTest,
5657
escapeInfoTest,
5758
addressEscapeInfoTest,
5859
aliasingTest,

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ PASS(DestroyHoisting, "destroy-hoisting",
7171
"Hoist destroy_value instructions")
7272
PASS(MandatoryDestroyHoisting, "mandatory-destroy-hoisting",
7373
"Hoist destroy_value instructions for non-lexical values")
74-
PASS(DeadEndBlockDumper, "dump-deadendblocks",
75-
"Tests the DeadEndBlocks utility")
7674
PASS(EmbeddedWitnessCallSpecialization, "embedded-witness-call-specialization",
7775
"Mandatory witness method call specialization")
7876
PASS(ConstantCapturePropagation, "constant-capture-propagation",
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt %s -dump-deadendblocks -o /dev/null | %FileCheck %s
1+
// RUN: %target-sil-opt %s -test-runner -o /dev/null | %FileCheck %s
22

33
// REQUIRES: swift_in_compiler
44

@@ -12,6 +12,7 @@ import Swift
1212
// CHECK: end function simple_test
1313
sil @simple_test : $@convention(thin) () -> () {
1414
bb0:
15+
specify_test "deadendblocks"
1516
cond_br undef, bb1, bb2
1617
bb1:
1718
br bb3
@@ -29,6 +30,7 @@ sil @throwing_fun : $@convention(thin) () -> ((), @error any Error)
2930
// CHECK: end function test_throw
3031
sil @test_throw : $@convention(thin) () -> ((), @error any Error) {
3132
bb0:
33+
specify_test "deadendblocks"
3234
%0 = function_ref @throwing_fun : $@convention(thin) () -> ((), @error any Error)
3335
try_apply %0() : $@convention(thin) () -> ((), @error any Error), normal bb1, error bb2
3436
bb1(%2: $()):
@@ -43,6 +45,7 @@ bb2(%3 : $Error):
4345
// CHECK: end function test_unwind
4446
sil @test_unwind : $@yield_once @convention(thin) () -> @yields () {
4547
bb0:
48+
specify_test "deadendblocks"
4649
%t = tuple ()
4750
yield %t : $(), resume bb1, unwind bb2
4851
bb1:
@@ -56,6 +59,7 @@ bb2:
5659
// CHECK: end function complex_cfg
5760
sil @complex_cfg : $@convention(thin) () -> ((), @error any Error) {
5861
bb0:
62+
specify_test "deadendblocks"
5963
cond_br undef, bb1, bb7
6064
bb1:
6165
%0 = function_ref @throwing_fun : $@convention(thin) () -> ((), @error any Error)

0 commit comments

Comments
 (0)