[Test] Ensourced ossa-lifetime-completion.

Moved the test next to the code it calls.
This commit is contained in:
Nate Chandler
2023-06-30 13:18:50 -07:00
parent 906a4b9d86
commit 50f2a0250f
2 changed files with 17 additions and 14 deletions

View File

@@ -52,6 +52,7 @@
#include "swift/SIL/OSSALifetimeCompletion.h"
#include "swift/SIL/SILBuilder.h"
#include "swift/SIL/SILInstruction.h"
#include "swift/SIL/Test.h"
using namespace swift;
@@ -166,6 +167,22 @@ bool OSSALifetimeCompletion::analyzeAndUpdateLifetime(
return changed;
}
namespace swift::test {
// Arguments:
// - SILValue: value
// Dumps:
// - function
static FunctionTest OSSALifetimeCompletionTest(
"ossa-lifetime-completion",
[](auto &function, auto &arguments, auto &test) {
SILValue value = arguments.takeValue();
llvm::dbgs() << "OSSA lifetime completion: " << value;
OSSALifetimeCompletion completion(&function, /*domInfo*/ nullptr);
completion.completeOSSALifetime(value);
function.dump();
});
} // end namespace swift::test
// TODO: create a fast check for 'mayEndLifetime(SILInstruction *)'. Verify that
// it returns true for every instruction that has a lifetime-ending operand.
void UnreachableLifetimeCompletion::visitUnreachableInst(