Skip to content

Commit b9b286e

Browse files
committed
[Test] Ensourced simplify-cfg-try-jump-threading.
Moved the test next to the code it calls.
1 parent f1d61af commit b9b286e

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,22 @@ bool SimplifyCFG::tryJumpThreading(BranchInst *BI) {
10661066
return true;
10671067
}
10681068

1069+
namespace swift::test {
1070+
/// Arguments:
1071+
/// - BranchInst - the branch whose destination might be merged into its parent
1072+
/// Dumps:
1073+
/// - nothing
1074+
static FunctionTest SimplifyCFGTryJumpThreading(
1075+
"simplify-cfg-try-jump-threading",
1076+
[](auto &function, auto &arguments, auto &test) {
1077+
auto *passToRun = cast<SILFunctionTransform>(createSimplifyCFG());
1078+
passToRun->injectPassManager(test.getPassManager());
1079+
passToRun->injectFunction(&function);
1080+
SimplifyCFG(function, *passToRun, /*VerifyAll=*/false,
1081+
/*EnableJumpThread=*/false)
1082+
.tryJumpThreading(cast<BranchInst>(arguments.takeInstruction()));
1083+
});
1084+
} // end namespace swift::test
10691085

10701086
/// simplifyBranchOperands - Simplify operands of branches, since it can
10711087
/// result in exposing opportunities for CFG simplification.

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -311,21 +311,6 @@ static FunctionTest FieldSensitiveMultiDefUseLiveRangeTest(
311311
boundary.print(llvm::errs());
312312
});
313313

314-
//===----------------------------------------------------------------------===//
315-
// MARK: SimplifyCFG Unit Tests
316-
//===----------------------------------------------------------------------===//
317-
318-
static FunctionTest SimplifyCFGTryJumpThreading(
319-
"simplify-cfg-try-jump-threading",
320-
[](auto &function, auto &arguments, auto &test) {
321-
auto *passToRun = cast<SILFunctionTransform>(createSimplifyCFG());
322-
passToRun->injectPassManager(test.getPassManager());
323-
passToRun->injectFunction(&function);
324-
SimplifyCFG(function, *passToRun, /*VerifyAll=*/false,
325-
/*EnableJumpThread=*/false)
326-
.tryJumpThreading(cast<BranchInst>(arguments.takeInstruction()));
327-
});
328-
329314
//===----------------------------------------------------------------------===//
330315
// MARK: AccessPath Unit Tests
331316
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)