Skip to content

Commit 5208d6d

Browse files
committed
Swift Optimizer: make the RunUnitTests a module pass
Which makes more sense. At the time RunUnitTests was added, there were no module passes, yet.
1 parent 732f0c9 commit 5208d6d

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

SwiftCompilerSources/Sources/Optimizer/TestPasses/RunUnitTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import SIL
1414

1515
/// This pass should only be used by sil-opt to run all the unit tests.
1616
///
17-
let runUnitTests = FunctionPass(name: "run-unit-tests", {
18-
(function: Function, context: PassContext) in
17+
let runUnitTests = ModulePass(name: "run-unit-tests", {
18+
(context: ModulePassContext) in
1919

2020
print("--- Run unit tests ---")
2121

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ PASS(SILDebugInfoGenerator, "sil-debuginfo-gen",
401401
"Generate Debug Information with Source Locations into Textual SIL")
402402
PASS(EarlySROA, "early-sroa",
403403
"Scalar Replacement of Aggregate Stack Objects on high-level SIL")
404-
SWIFT_FUNCTION_PASS(RunUnitTests, "run-unit-tests",
404+
SWIFT_MODULE_PASS(RunUnitTests, "run-unit-tests",
405405
"Runs the compiler internal unit tests")
406406
SWIFT_FUNCTION_PASS(SILPrinter, "sil-printer",
407407
"Test pass which prints the SIL of a function")

test/SILOptimizer/swift-unit-tests.sil

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,3 @@
22

33
// REQUIRES: swift_in_compiler
44

5-
// The RunUnitTests is a function pass. Therefore we need one function is this file to trigger the pass run.
6-
sil @trigger_test_run : $@convention(thin) () -> () {
7-
bb0:
8-
%r = tuple()
9-
return %r : $()
10-
}
11-

0 commit comments

Comments
 (0)