Skip to content

Commit 84e42fd

Browse files
committed
[Test] Ensourced linear-liveness.
Moved the test next to the code it calls.
1 parent 9417651 commit 84e42fd

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

lib/SIL/Utils/OwnershipLiveness.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "swift/SIL/OwnershipLiveness.h"
1314
#include "swift/Basic/Debug.h"
1415
#include "swift/Basic/Defer.h"
1516
#include "swift/Basic/LLVM.h"
1617
#include "swift/SIL/Dominance.h"
17-
#include "swift/SIL/OwnershipLiveness.h"
1818
#include "swift/SIL/PrunedLiveness.h"
1919
#include "swift/SIL/SILArgument.h"
2020
#include "swift/SIL/SILBasicBlock.h"
2121
#include "swift/SIL/SILInstruction.h"
2222
#include "swift/SIL/SILValue.h"
23+
#include "swift/SIL/Test.h"
2324
#include "llvm/ADT/SmallVector.h"
2425

2526
namespace swift {
@@ -365,3 +366,26 @@ void ExtendedLinearLiveness::print(llvm::raw_ostream &OS) const {
365366
void ExtendedLinearLiveness::dump() const { print(llvm::dbgs()); }
366367

367368
} // namespace swift
369+
370+
namespace swift::test {
371+
// Arguments:
372+
// - SILValue: value
373+
// Dumps:
374+
// - function
375+
// - the computed pruned liveness
376+
// - the liveness boundary
377+
static FunctionTest LinearLivenessTest("linear-liveness", [](auto &function,
378+
auto &arguments,
379+
auto &test) {
380+
SILValue value = arguments.takeValue();
381+
function.dump();
382+
llvm::dbgs() << "Linear liveness: " << value;
383+
LinearLiveness liveness(value);
384+
liveness.compute();
385+
liveness.print(llvm::outs());
386+
387+
PrunedLivenessBoundary boundary;
388+
liveness.getLiveness().computeBoundary(boundary);
389+
boundary.print(llvm::outs());
390+
});
391+
} // end namespace swift::test

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

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

314-
// Arguments:
315-
// - SILValue: value
316-
// Dumps:
317-
// - function
318-
// - the computed pruned liveness
319-
// - the liveness boundary
320-
static FunctionTest LinearLivenessTest("linear-liveness", [](auto &function,
321-
auto &arguments,
322-
auto &test) {
323-
SILValue value = arguments.takeValue();
324-
function.dump();
325-
llvm::dbgs() << "Linear liveness: " << value;
326-
LinearLiveness liveness(value);
327-
liveness.compute();
328-
liveness.print(llvm::outs());
329-
330-
PrunedLivenessBoundary boundary;
331-
liveness.getLiveness().computeBoundary(boundary);
332-
boundary.print(llvm::outs());
333-
});
334-
335314
// Arguments:
336315
// - SILValue: value
337316
// Dumps:

0 commit comments

Comments
 (0)