Skip to content

Commit b5e4fcf

Browse files
committed
[NFC] CopyPropagation: Extracted verification.
It makes it easier to temporarily hack in new calls to verify.
1 parent e125c5c commit b5e4fcf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/SILOptimizer/Transforms/CopyPropagation.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ class CopyPropagation : public SILFunctionTransform {
441441

442442
/// The entry point to this function transformation.
443443
void run() override;
444+
445+
void verifyOwnership();
444446
};
445447

446448
} // end anonymous namespace
@@ -635,14 +637,19 @@ void CopyPropagation::run() {
635637
invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions);
636638
accessBlockAnalysis->unlockInvalidation();
637639
if (f->getModule().getOptions().VerifySILOwnership) {
638-
auto *deBlocksAnalysis = getAnalysis<DeadEndBlocksAnalysis>();
639-
f->verifyOwnership(f->getModule().getOptions().OSSAVerifyComplete
640-
? nullptr
641-
: deBlocksAnalysis->get(f));
640+
verifyOwnership();
642641
}
643642
}
644643
}
645644

645+
void CopyPropagation::verifyOwnership() {
646+
auto *f = getFunction();
647+
auto *deBlocksAnalysis = getAnalysis<DeadEndBlocksAnalysis>();
648+
f->verifyOwnership(f->getModule().getOptions().OSSAVerifyComplete
649+
? nullptr
650+
: deBlocksAnalysis->get(f));
651+
}
652+
646653
// MandatoryCopyPropagation is not currently enabled in the -Onone pipeline
647654
// because it may negatively affect the debugging experience.
648655
SILTransform *swift::createMandatoryCopyPropagation() {

0 commit comments

Comments
 (0)