Skip to content

Commit df02726

Browse files
committed
[Test] Ensourced simplify-cfg-simplify-block-args.
Moved the test next to the code it calls.
1 parent bc909e5 commit df02726

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

include/swift/SILOptimizer/Transforms/SimplifyCFG.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#include "llvm/ADT/SmallVector.h"
2121
#include "llvm/ADT/Statistic.h"
2222

23+
namespace swift {
24+
class DominanceAnalysis;
25+
}
26+
2327
using namespace swift;
2428

2529
struct ThreadInfo;

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,6 +3547,23 @@ bool SimplifyCFG::simplifyBlockArgs() {
35473547
return Changed;
35483548
}
35493549

3550+
namespace swift::test {
3551+
/// Arguments:
3552+
/// - none
3553+
/// Dumps:
3554+
/// - nothing
3555+
static FunctionTest SimplifyCFGSimplifyBlockArgs(
3556+
"simplify-cfg-simplify-block-args",
3557+
[](auto &function, auto &arguments, auto &test) {
3558+
auto *passToRun = cast<SILFunctionTransform>(createSimplifyCFG());
3559+
passToRun->injectPassManager(test.getPassManager());
3560+
passToRun->injectFunction(&function);
3561+
SimplifyCFG(function, *passToRun, /*VerifyAll=*/false,
3562+
/*EnableJumpThread=*/false)
3563+
.simplifyBlockArgs();
3564+
});
3565+
} // end namespace swift::test
3566+
35503567
// Attempt to simplify the ith argument of BB. We simplify cases
35513568
// where there is a single use of the argument that is an extract from
35523569
// a struct, tuple or enum and where the predecessors all build the struct,

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,6 @@ static FunctionTest FieldSensitiveMultiDefUseLiveRangeTest(
315315
// MARK: SimplifyCFG Unit Tests
316316
//===----------------------------------------------------------------------===//
317317

318-
static FunctionTest SimplifyCFGSimplifyBlockArgs(
319-
"simplify-cfg-simplify-block-args",
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-
.simplifyBlockArgs();
327-
});
328-
329318
static FunctionTest SimplifyCFGCanonicalizeSwitchEnum(
330319
"simplify-cfg-canonicalize-switch-enum",
331320
[](auto &function, auto &arguments, auto &test) {

0 commit comments

Comments
 (0)