Skip to content

Commit 1cd2632

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

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

lib/SIL/Utils/OwnershipLiveness.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,29 @@ static FunctionTest LinearLivenessTest("linear-liveness", [](auto &function,
388388
liveness.getLiveness().computeBoundary(boundary);
389389
boundary.print(llvm::outs());
390390
});
391+
392+
// Arguments:
393+
// - SILValue: value
394+
// Dumps:
395+
// - function
396+
// - the computed pruned liveness
397+
// - the liveness boundary
398+
static FunctionTest
399+
InteriorLivenessTest("interior-liveness",
400+
[](auto &function, auto &arguments, auto &test) {
401+
SILValue value = arguments.takeValue();
402+
function.dump();
403+
llvm::dbgs() << "Interior liveness: " << value;
404+
auto *domTree = test.getDominanceInfo();
405+
InteriorLiveness liveness(value);
406+
auto handleInnerScope = [](SILValue innerBorrow) {
407+
llvm::outs() << "Inner scope: " << innerBorrow;
408+
};
409+
liveness.compute(domTree, handleInnerScope);
410+
liveness.print(llvm::outs());
411+
412+
PrunedLivenessBoundary boundary;
413+
liveness.getLiveness().computeBoundary(boundary);
414+
boundary.print(llvm::outs());
415+
});
391416
} // end namespace swift::test

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -311,31 +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 InteriorLivenessTest(
321-
"interior-liveness", [](auto &function, auto &arguments, auto &test) {
322-
SILValue value = arguments.takeValue();
323-
function.dump();
324-
llvm::dbgs() << "Interior liveness: " << value;
325-
auto *dominanceAnalysis = test.template getAnalysis<DominanceAnalysis>();
326-
DominanceInfo *domTree = dominanceAnalysis->get(&function);
327-
InteriorLiveness liveness(value);
328-
auto handleInnerScope = [](SILValue innerBorrow) {
329-
llvm::outs() << "Inner scope: " << innerBorrow;
330-
};
331-
liveness.compute(domTree, handleInnerScope);
332-
liveness.print(llvm::outs());
333-
334-
PrunedLivenessBoundary boundary;
335-
liveness.getLiveness().computeBoundary(boundary);
336-
boundary.print(llvm::outs());
337-
});
338-
339314
// Arguments:
340315
// - SILValue: value
341316
// Dumps:

0 commit comments

Comments
 (0)