forked from OSchip/llvm-project
[NFC][SimplifyCFG] Count the number of invokes turned into calls due to empty cleanup blocks
This commit is contained in:
parent
99cd56906a
commit
a587bf3eb0
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue