[PATCH] D104161: [NFC] [DwarfEHPrepare] Add additional stats for EH
Di Mo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 15 11:34:33 PDT 2021
modimo updated this revision to Diff 352202.
modimo added a comment.
Clang-format
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104161/new/
https://reviews.llvm.org/D104161
Files:
llvm/lib/CodeGen/DwarfEHPrepare.cpp
Index: llvm/lib/CodeGen/DwarfEHPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/DwarfEHPrepare.cpp
+++ llvm/lib/CodeGen/DwarfEHPrepare.cpp
@@ -42,6 +42,12 @@
#define DEBUG_TYPE "dwarfehprepare"
STATISTIC(NumResumesLowered, "Number of resume calls lowered");
+STATISTIC(NumCleanupLandingPadsUnreachable,
+ "Number of cleanup landing pads found unreachable");
+STATISTIC(NumCleanupLandingPadsRemaining,
+ "Number of cleanup landing pads remaining");
+STATISTIC(NumNoUnwind, "Number of functions with nounwind");
+STATISTIC(NumUnwind, "Number of functions with unwind");
namespace {
@@ -163,6 +169,10 @@
bool DwarfEHPrepare::InsertUnwindResumeCalls() {
SmallVector<ResumeInst *, 16> Resumes;
SmallVector<LandingPadInst *, 16> CleanupLPads;
+ if (F.doesNotThrow())
+ NumNoUnwind++;
+ else
+ NumUnwind++;
for (BasicBlock &BB : F) {
if (auto *RI = dyn_cast<ResumeInst>(BB.getTerminator()))
Resumes.push_back(RI);
@@ -171,6 +181,8 @@
CleanupLPads.push_back(LP);
}
+ NumCleanupLandingPadsRemaining += CleanupLPads.size();
+
if (Resumes.empty())
return false;
@@ -182,8 +194,19 @@
LLVMContext &Ctx = F.getContext();
size_t ResumesLeft = Resumes.size();
- if (OptLevel != CodeGenOpt::None)
+ if (OptLevel != CodeGenOpt::None) {
ResumesLeft = pruneUnreachableResumes(Resumes, CleanupLPads);
+#if LLVM_ENABLE_STATS
+ unsigned NumRemainingLPs = 0;
+ for (BasicBlock &BB : F) {
+ if (auto *LP = BB.getLandingPadInst())
+ if (LP->isCleanup())
+ NumRemainingLPs++;
+ }
+ NumCleanupLandingPadsUnreachable += CleanupLPads.size() - NumRemainingLPs;
+ NumCleanupLandingPadsRemaining -= CleanupLPads.size() - NumRemainingLPs;
+#endif
+ }
if (ResumesLeft == 0)
return true; // We pruned them all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104161.352202.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210615/ee38718e/attachment.bin>
More information about the llvm-commits
mailing list