From a587bf3eb074340710a36c0c00c16dadcf5adb79 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sat, 8 Aug 2020 16:46:31 +0300 Subject: [PATCH] [NFC][SimplifyCFG] Count the number of invokes turned into calls due to empty cleanup blocks --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index a578bbd3f65b..a0e565849e1a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -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);