Skip to content

Commit e2e114f

Browse files
authored
Merge pull request #27463 from gottesmm/pr-cab8832ce5d2768bd6581460dc3f4403be592012
[ownership] Emit a PrettyStackTrace msg telling to re-run with -sil-v…
2 parents c712938 + b0e947b commit e2e114f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/SILOptimizer/Transforms/OwnershipModelEliminator.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,25 @@ struct OwnershipModelEliminator : SILModuleTransform {
383383
continue;
384384

385385
// Verify here to make sure ownership is correct before we strip.
386-
F.verify();
386+
{
387+
// Add a pretty stack trace entry to tell users who see a verification
388+
// failure triggered by this verification check that they need to re-run
389+
// with -sil-verify-all to actually find the pass that introduced the
390+
// verification error.
391+
//
392+
// DISCUSSION: This occurs due to the crash from the verification
393+
// failure happening in the pass itself. This causes us to dump the
394+
// SILFunction and emit a msg that this pass (OME) is the culprit. This
395+
// is generally correct for most passes, but not for OME since we are
396+
// verifying before we have even modified the function to ensure that
397+
// all ownership invariants have been respected before we lower
398+
// ownership from the function.
399+
llvm::PrettyStackTraceString silVerifyAllMsgOnFailure(
400+
"Found verification error when verifying before lowering "
401+
"ownership. Please re-run with -sil-verify-all to identify the "
402+
"actual pass that introduced the verification error.");
403+
F.verify();
404+
}
387405

388406
if (stripOwnership(F)) {
389407
auto InvalidKind =

0 commit comments

Comments
 (0)