@@ -80,8 +80,6 @@ struct CheckerLivenessInfo {
80
80
} // end anonymous namespace
81
81
82
82
bool CheckerLivenessInfo::compute () {
83
- bool foundEscapes = false ;
84
-
85
83
LLVM_DEBUG (llvm::dbgs () << " LivenessVisitor Begin!\n " );
86
84
while (SILValue value = defUseWorklist.pop ()) {
87
85
LLVM_DEBUG (llvm::dbgs () << " New Value: " << value);
@@ -108,7 +106,8 @@ bool CheckerLivenessInfo::compute() {
108
106
// escape. Is it legal to canonicalize ForwardingUnowned?
109
107
case OperandOwnership::ForwardingUnowned:
110
108
case OperandOwnership::PointerEscape:
111
- foundEscapes = true ;
109
+ // This is an escape but it is up to the user to handle this, move
110
+ // checking stops here.
112
111
break ;
113
112
case OperandOwnership::InstantaneousUse:
114
113
case OperandOwnership::UnownedInstantaneousUse:
@@ -133,8 +132,8 @@ bool CheckerLivenessInfo::compute() {
133
132
// binding that should be tracked separately.
134
133
if (!bbi->isLexical ()) {
135
134
bool failed = !liveness.updateForBorrowingOperand (use);
136
- assert (! failed &&
137
- " Shouldn't see reborrows this early in the pipeline " ) ;
135
+ if ( failed)
136
+ return false ;
138
137
}
139
138
}
140
139
break ;
@@ -178,8 +177,8 @@ bool CheckerLivenessInfo::compute() {
178
177
}
179
178
}
180
179
181
- // We succeeded if we did not find any escapes .
182
- return !foundEscapes ;
180
+ // We succeeded if we reached this point since we handled all uses .
181
+ return true ;
183
182
}
184
183
185
184
// ===----------------------------------------------------------------------===//
@@ -380,11 +379,12 @@ bool MoveKillsCopyableValuesChecker::check() {
380
379
// Then compute liveness.
381
380
SWIFT_DEFER { livenessInfo.clear (); };
382
381
livenessInfo.initDef (lexicalValue);
383
- // We do not care if we find an escape. We just want to make sure that any
384
- // non-escaping users obey our property. If the user does something unsafe
385
- // that is on them to manage.
386
- bool foundEscape = livenessInfo.compute ();
387
- (void )foundEscape;
382
+
383
+ // We only fail to optimize if for some reason we hit reborrows. This is
384
+ // temporary since we really should just ban reborrows in Raw SIL.
385
+ bool canOptimize = livenessInfo.compute ();
386
+ if (!canOptimize)
387
+ continue ;
388
388
389
389
// Then look at all of our found consuming uses. See if any of these are
390
390
// _move that are within the boundary.
0 commit comments