@@ -65,6 +65,10 @@ static llvm::cl::opt<bool> VerifyDIHoles(
6565static llvm::cl::opt<bool > SkipConvertEscapeToNoescapeAttributes (
6666 " verify-skip-convert-escape-to-noescape-attributes" , llvm::cl::init(false ));
6767
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+
6872// The verifier is basically all assertions, so don't compile it with NDEBUG to
6973// prevent release builds from triggering spurious unused variable warnings.
7074
@@ -5147,7 +5151,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
51475151 }
51485152
51495153 void verifyBranches (const SILFunction *F) {
5150- // Verify that there is no non_condbr critical edge.
5154+ // Verify no critical edge.
51515155 auto isCriticalEdgePred = [](const TermInst *T, unsigned EdgeIdx) {
51525156 assert (T->getSuccessors ().size () > EdgeIdx && " Not enough successors" );
51535157
@@ -5170,10 +5174,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
51705174 const TermInst *TI = BB.getTerminator ();
51715175 CurInstruction = TI;
51725176
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))
51755181 continue ;
5176- }
51775182
51785183 for (unsigned Idx = 0 , e = BB.getSuccessors ().size (); Idx != e; ++Idx) {
51795184 require (!isCriticalEdgePred (TI, Idx),
0 commit comments