@@ -65,6 +65,10 @@ static llvm::cl::opt<bool> VerifyDIHoles(
65
65
static llvm::cl::opt<bool > SkipConvertEscapeToNoescapeAttributes (
66
66
" verify-skip-convert-escape-to-noescape-attributes" , llvm::cl::init(false ));
67
67
68
+ // Allow unit tests to gradually migrate toward -allow-critical-edges=false.
69
+ static llvm::cl::opt<bool > AllowCriticalEdges (" allow-critical-edges" ,
70
+ llvm::cl::init (true ));
71
+
68
72
// The verifier is basically all assertions, so don't compile it with NDEBUG to
69
73
// prevent release builds from triggering spurious unused variable warnings.
70
74
@@ -5147,7 +5151,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
5147
5151
}
5148
5152
5149
5153
void verifyBranches (const SILFunction *F) {
5150
- // Verify that there is no non_condbr critical edge.
5154
+ // Verify no critical edge.
5151
5155
auto isCriticalEdgePred = [](const TermInst *T, unsigned EdgeIdx) {
5152
5156
assert (T->getSuccessors ().size () > EdgeIdx && " Not enough successors" );
5153
5157
@@ -5170,10 +5174,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
5170
5174
const TermInst *TI = BB.getTerminator ();
5171
5175
CurInstruction = TI;
5172
5176
5173
- // Check for non-cond_br critical edges.
5174
- if (isa<CondBranchInst>(TI)) {
5177
+ // FIXME: In OSSA, critical edges will never be allowed.
5178
+ // In Lowered SIL, they are allowed on unconditional branches only.
5179
+ // if (!(isSILOwnershipEnabled() && F->hasOwnership()))
5180
+ if (AllowCriticalEdges && isa<CondBranchInst>(TI))
5175
5181
continue ;
5176
- }
5177
5182
5178
5183
for (unsigned Idx = 0 , e = BB.getSuccessors ().size (); Idx != e; ++Idx) {
5179
5184
require (!isCriticalEdgePred (TI, Idx),
0 commit comments