@@ -333,7 +333,34 @@ void AvailabilityBoundaryVisitor::computeRegion(
333
333
// Thus finding a value available at the end of such a block means that
334
334
// the block does _not_ must not exits the function normally; in other
335
335
// words its terminator must be an UnreachableInst.
336
- assert (isa<UnreachableInst>(block->getTerminator ()));
336
+ if (!isa<UnreachableInst>(block->getTerminator ())) {
337
+ llvm::errs () << " Invalid SIL provided to OSSALifetimeCompletion?! {{\n " ;
338
+ llvm::errs () << " OSSALifetimeCompletion is visiting the availability "
339
+ " boundary of " ;
340
+ value->print (llvm::errs ());
341
+ llvm::errs ()
342
+ << " When walking forward from the def to the availability boundary "
343
+ " a non-dead-end successor-less block was encountered: bb"
344
+ << block->getDebugID ()
345
+ << " \n Its terminator must be an unreachable but is actually "
346
+ " instead "
347
+ << *block->getTerminator ()
348
+ << " The walk stops at consumes, so reaching such a block means the "
349
+ " value was leaked. The function with the leak is as follows:\n " ;
350
+ block->getFunction ()->print (llvm::errs ());
351
+ llvm::errs ()
352
+ << " Invalid SIL provided to OSSALifetimeCompletion?! }}\n "
353
+ << " Something that ran before OSSALifetimeCompletion (the current "
354
+ " pass, an earlier pass, SILGen) has introduced a leak of this "
355
+ " value.\n "
356
+ << " Please rerun the crashing swift-frontend command with the "
357
+ " following flags added and file a bug with the output:\n "
358
+ << " -sil-ownership-verify-all -Xllvm '-sil-print-function="
359
+ << block->getFunction ()->getName ()
360
+ << " ' -Xllvm -sil-print-types -Xllvm -sil-print-module-on-error\n " ;
361
+ llvm::report_fatal_error (" Invalid lifetime of value whose availability "
362
+ " boundary is being visited." );
363
+ }
337
364
}
338
365
for (auto *successor : block->getSuccessorBlocks ()) {
339
366
regionWorklist.pushIfNotVisited (successor);
0 commit comments