Skip to content

Commit 50f2a02

Browse files
committed
[Test] Ensourced ossa-lifetime-completion.
Moved the test next to the code it calls.
1 parent 906a4b9 commit 50f2a02

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

lib/SIL/Utils/OSSALifetimeCompletion.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "swift/SIL/OSSALifetimeCompletion.h"
5353
#include "swift/SIL/SILBuilder.h"
5454
#include "swift/SIL/SILInstruction.h"
55+
#include "swift/SIL/Test.h"
5556

5657
using namespace swift;
5758

@@ -166,6 +167,22 @@ bool OSSALifetimeCompletion::analyzeAndUpdateLifetime(
166167
return changed;
167168
}
168169

170+
namespace swift::test {
171+
// Arguments:
172+
// - SILValue: value
173+
// Dumps:
174+
// - function
175+
static FunctionTest OSSALifetimeCompletionTest(
176+
"ossa-lifetime-completion",
177+
[](auto &function, auto &arguments, auto &test) {
178+
SILValue value = arguments.takeValue();
179+
llvm::dbgs() << "OSSA lifetime completion: " << value;
180+
OSSALifetimeCompletion completion(&function, /*domInfo*/ nullptr);
181+
completion.completeOSSALifetime(value);
182+
function.dump();
183+
});
184+
} // end namespace swift::test
185+
169186
// TODO: create a fast check for 'mayEndLifetime(SILInstruction *)'. Verify that
170187
// it returns true for every instruction that has a lifetime-ending operand.
171188
void UnreachableLifetimeCompletion::visitUnreachableInst(

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

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

314-
// Arguments:
315-
// - SILValue: value
316-
// Dumps:
317-
// - function
318-
static FunctionTest OSSALifetimeCompletionTest(
319-
"ossa-lifetime-completion",
320-
[](auto &function, auto &arguments, auto &test) {
321-
SILValue value = arguments.takeValue();
322-
llvm::dbgs() << "OSSA lifetime completion: " << value;
323-
OSSALifetimeCompletion completion(&function, /*domInfo*/ nullptr);
324-
completion.completeOSSALifetime(value);
325-
function.dump();
326-
});
327-
328314
//===----------------------------------------------------------------------===//
329315
// MARK: SimplifyCFG Unit Tests
330316
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)