[llvm] [BOLT] Improve profile quality reporting (PR #130810)
Amir Ayupov via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 20 19:35:54 PDT 2025
================
@@ -365,6 +397,72 @@ void printCFGFlowConservationStats(raw_ostream &OS,
}
}
+void printExceptionHandlingStats(const BinaryContext &BC, raw_ostream &OS,
+ iterator_range<function_iterator> &Functions) {
+ std::vector<double> LPCountFractionsOfTotalBBEC;
+ std::vector<double> LPCountFractionsOfTotalInvokeEC;
+ for (const BinaryFunction *Function : Functions) {
+ size_t LPECSum = 0;
+ size_t BBECSum = 0;
+ size_t InvokeECSum = 0;
+ for (BinaryBasicBlock &BB : *Function) {
+ const size_t BBEC = BB.getKnownExecutionCount();
+ BBECSum += BBEC;
+ if (BB.isLandingPad())
+ LPECSum += BBEC;
+ for (const MCInst &Inst : BB) {
+ if (!BC.MIB->isCall(Inst))
+ continue;
+ if (BC.MIB->isInvoke(Inst)) {
+ const std::optional<MCPlus::MCLandingPad> EHInfo =
+ BC.MIB->getEHInfo(Inst);
+ if (EHInfo->first)
+ InvokeECSum += BBEC;
+ }
----------------
aaupov wrote:
Invoke must be a call:
```suggestion
if (!BC.MIB->isInvoke(Inst))
continue;
const std::optional<MCPlus::MCLandingPad> EHInfo =
BC.MIB->getEHInfo(Inst);
if (EHInfo->first)
InvokeECSum += BBEC;
```
https://github.com/llvm/llvm-project/pull/130810
More information about the llvm-commits
mailing list