Skip to content

Commit eef89eb

Browse files
authored
Merge pull request #34827 from eeckstein/fix-verifier
Two small SIL verifier improvements
2 parents b6b99f6 + 80d6e6c commit eef89eb

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ static llvm::cl::opt<bool> AbortOnFailure(
6161
static llvm::cl::opt<bool> ContinueOnFailure("verify-continue-on-failure",
6262
llvm::cl::init(false));
6363

64+
static llvm::cl::opt<bool> DumpModuleOnFailure("verify-dump-module-on-failure",
65+
llvm::cl::init(false));
66+
6467
static llvm::cl::opt<bool> VerifyDIHoles(
6568
"verify-di-holes",
6669
llvm::cl::init(true));
@@ -712,8 +715,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
712715

713716
llvm::dbgs() << "In function:\n";
714717
F.print(llvm::dbgs());
715-
llvm::dbgs() << "In module:\n";
716-
F.getModule().print(llvm::dbgs());
718+
if (DumpModuleOnFailure) {
719+
// Don't do this by default because modules can be _very_ large.
720+
llvm::dbgs() << "In module:\n";
721+
F.getModule().print(llvm::dbgs());
722+
}
717723

718724
// We abort by default because we want to always crash in
719725
// the debugger.
@@ -1504,14 +1510,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
15041510
"cannot call coroutine with normal apply");
15051511
require(!calleeConv.funcTy->isAsync() || AI->getFunction()->isAsync(),
15061512
"cannot call an async function from a non async function");
1507-
1508-
// Check that if the apply is of a noreturn callee, make sure that an
1509-
// unreachable is the next instruction.
1510-
if (AI->getModule().getStage() == SILStage::Raw ||
1511-
!AI->isCalleeNoReturn())
1512-
return;
1513-
require(isa<UnreachableInst>(std::next(SILBasicBlock::iterator(AI))),
1514-
"No return apply without an unreachable as a next instruction.");
15151513
}
15161514

15171515
void checkTryApplyInst(TryApplyInst *AI) {

0 commit comments

Comments
 (0)