[Inliner] Add per-inlining verification.

Previously, there was an -Xllvm option to verify after all inlining to a
particlar caller.  That makes it a chore to track down which apply's
inlining resulted in invalid code.  Here, a new option is added that
verifies after each run of the inliner.
This commit is contained in:
Nate Chandler
2023-02-27 16:51:24 -08:00
parent 3dae89e83e
commit 32685ce68e
2 changed files with 32 additions and 0 deletions

View File

@@ -50,6 +50,8 @@ extern llvm::cl::opt<bool> SILPrintInliningCallerBefore;
extern llvm::cl::opt<bool> SILPrintInliningCallerAfter;
extern llvm::cl::opt<bool> EnableVerifyAfterEachInlining;
extern void printInliningDetailsCallee(StringRef passName, SILFunction *caller,
SILFunction *callee);
@@ -972,6 +974,16 @@ runOnFunctionRecursively(SILOptFunctionBuilder &FuncBuilder, SILFunction *F,
// later.
changedFunctions.insert(F);
if (EnableVerifyAfterEachInlining) {
if (invalidatedStackNesting) {
StackNesting::fixNesting(F);
changedFunctions.insert(F);
invalidatedStackNesting = false;
}
F->verify();
}
// Resume inlining within nextBB, which contains only the inlined
// instructions and possibly instructions in the original call block that
// have not yet been visited.