Skip to content

Commit 7fd4311

Browse files
committed
[SIL] Verify complete lifetimes when option set.
Only pass DeadEndBlocks to verifyOwnership if OSSAVerifyComplete is not set. The verifier keys off of the nullness of DeadEndBlocks to decide whether to verify complete lifetimes or not.
1 parent f0aba4d commit 7fd4311

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/SILOptimizer/Transforms/CopyPropagation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ void CopyPropagation::run() {
635635
accessBlockAnalysis->unlockInvalidation();
636636
if (f->getModule().getOptions().VerifySILOwnership) {
637637
auto *deBlocksAnalysis = getAnalysis<DeadEndBlocksAnalysis>();
638-
f->verifyOwnership(deBlocksAnalysis->get(f));
638+
f->verifyOwnership(f->getModule().getOptions().OSSAVerifyComplete
639+
? nullptr
640+
: deBlocksAnalysis->get(f));
639641
}
640642
}
641643
}

lib/SILOptimizer/UtilityPasses/OwnershipVerifierTextualErrorDumper.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "swift/SIL/BasicBlockUtils.h"
2424
#include "swift/SIL/SILFunction.h"
2525
#include "swift/SIL/SILInstruction.h"
26+
#include "swift/SILOptimizer/Analysis/DeadEndBlocksAnalysis.h"
2627
#include "swift/SILOptimizer/PassManager/Passes.h"
2728
#include "swift/SILOptimizer/PassManager/Transforms.h"
2829

@@ -37,8 +38,10 @@ namespace {
3738
class OwnershipVerifierTextualErrorDumper : public SILFunctionTransform {
3839
void run() override {
3940
SILFunction *f = getFunction();
40-
DeadEndBlocks deadEndBlocks(f);
41-
f->verifyOwnership(&deadEndBlocks);
41+
auto *deBlocksAnalysis = getAnalysis<DeadEndBlocksAnalysis>();
42+
f->verifyOwnership(f->getModule().getOptions().OSSAVerifyComplete
43+
? nullptr
44+
: deBlocksAnalysis->get(f));
4245
}
4346
};
4447

0 commit comments

Comments
 (0)