[NFC][SimplifyCFG] Count the number of invokes turned into calls due to empty cleanup blocks

This commit is contained in:
Roman Lebedev 2020-08-08 16:46:31 +03:00
parent 99cd56906a
commit a587bf3eb0
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 5 additions and 0 deletions

View File

@ -162,6 +162,8 @@ STATISTIC(NumSinkCommonCode,
STATISTIC(NumSinkCommonInstrs,
"Number of common instructions sunk down to the end block");
STATISTIC(NumSpeculations, "Number of speculative executed instructions");
STATISTIC(NumInvokes,
"Number of invokes with empty resume blocks simplified into calls");
namespace {
@ -4017,6 +4019,7 @@ bool SimplifyCFGOpt::simplifyCommonResume(ResumeInst *RI) {
PI != PE;) {
BasicBlock *Pred = *PI++;
removeUnwindEdge(Pred);
++NumInvokes;
}
// In each SimplifyCFG run, only the current processed block can be erased.
@ -4072,6 +4075,7 @@ bool SimplifyCFGOpt::simplifySingleResume(ResumeInst *RI) {
for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE;) {
BasicBlock *Pred = *PI++;
removeUnwindEdge(Pred);
++NumInvokes;
}
// The landingpad is now unreachable. Zap it.
@ -4192,6 +4196,7 @@ static bool removeEmptyCleanup(CleanupReturnInst *RI) {
BasicBlock *PredBB = *PI++;
if (UnwindDest == nullptr) {
removeUnwindEdge(PredBB);
++NumInvokes;
} else {
Instruction *TI = PredBB->getTerminator();
TI->replaceUsesOfWith(BB, UnwindDest);