Skip to content

Commit b21802c

Browse files
committed
SILVerifier: turn on the ownership verifier again
It was turned off by mistake
1 parent c93a235 commit b21802c

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,10 +969,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
969969
return numInsts;
970970
}
971971

972-
SILVerifier(const SILFunction &F, bool SingleFunction = true)
972+
SILVerifier(const SILFunction &F, bool SingleFunction, bool checkLinearLifetime)
973973
: M(F.getModule().getSwiftModule()), F(F),
974974
fnConv(F.getConventionsInContext()), TC(F.getModule().Types),
975975
SingleFunction(SingleFunction),
976+
checkLinearLifetime(checkLinearLifetime),
976977
Dominance(nullptr),
977978
InstNumbers(numInstsInFunction(F)),
978979
loadBorrowImmutabilityAnalysis(DEBlocks.get(), &F) {
@@ -6423,7 +6424,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
64236424
}
64246425
}
64256426

6426-
void verify(bool isCompleteOSSA, bool checkLinearLifetimes) {
6427+
void verify(bool isCompleteOSSA) {
64276428
if (!isCompleteOSSA || !F.getModule().getOptions().OSSACompleteLifetimes) {
64286429
DEBlocks = std::make_unique<DeadEndBlocks>(const_cast<SILFunction *>(&F));
64296430
}
@@ -6467,14 +6468,15 @@ void SILFunction::verify(bool SingleFunction, bool isCompleteOSSA,
64676468
// Please put all checks in visitSILFunction in SILVerifier, not here. This
64686469
// ensures that the pretty stack trace in the verifier is included with the
64696470
// back trace when the verifier crashes.
6470-
SILVerifier(*this, SingleFunction).verify(isCompleteOSSA, checkLinearLifetime);
6471+
SILVerifier(*this, SingleFunction, checkLinearLifetime).verify(isCompleteOSSA);
64716472
}
64726473

64736474
void SILFunction::verifyCriticalEdges() const {
64746475
if (!verificationEnabled(getModule()))
64756476
return;
64766477

6477-
SILVerifier(*this, /*SingleFunction=*/true).verifyBranches(this);
6478+
SILVerifier(*this, /*SingleFunction=*/true,
6479+
/*checkLinearLifetime=*/ false).verifyBranches(this);
64786480
}
64796481

64806482
/// Verify that a property descriptor follows invariants.
@@ -6591,7 +6593,8 @@ void SILVTable::verify(const SILModule &M) const {
65916593
}
65926594

65936595
if (M.getStage() != SILStage::Lowered) {
6594-
SILVerifier(*entry.getImplementation())
6596+
SILVerifier(*entry.getImplementation(), /*SingleFunction=*/true,
6597+
/*checkLinearLifetime=*/ false)
65956598
.requireABICompatibleFunctionTypes(
65966599
baseInfo.getSILType().castTo<SILFunctionType>(),
65976600
entry.getImplementation()->getLoweredFunctionType(),

test/SIL/OwnershipVerifier/basic.sil

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-sil-opt %s
2+
// REQUIRES: asserts
3+
// XFAIL: *
4+
5+
// Make sure that the ownership verifier is turned on by default
6+
7+
sil_stage canonical
8+
9+
import Builtin
10+
import Swift
11+
import SwiftShims
12+
13+
class X {}
14+
15+
sil [ossa] @testit : $@convention(thin) (@owned X) -> () {
16+
bb0(%0 : @owned $X):
17+
destroy_value %0 : $X
18+
destroy_value %0 : $X
19+
%r = tuple ()
20+
return %r : $()
21+
}
22+
23+

test/SILOptimizer/ossa_lifetime_completion.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-ossa-complete-lifetimes -unit-test-runner %s -o /dev/null 2>&1 | %FileCheck %s
1+
// RUN: %target-sil-opt -enable-ossa-complete-lifetimes -unit-test-runner -sil-verify-none %s -o /dev/null 2>&1 | %FileCheck %s
22

33
sil_stage raw
44

0 commit comments

Comments
 (0)