[llvm] [BOLT]Improve profile quality reporting (PR #130810)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 11:33:14 PDT 2025


================
@@ -295,12 +303,38 @@ void printCFGFlowConservationStats(raw_ostream &OS,
       if (BB.isEntryPoint() || BB.succ_size() == 0)
         continue;
 
+      if (BB.getKnownExecutionCount() == 0 || BB.getNumNonPseudos() == 0)
+        continue;
+
+      // We don't consider blocks that is a landing pad or has a
+      // positive-execution-count landing pad
+      if (BB.isLandingPad())
+        continue;
+
+      bool HasPosECLP = false;
+      for (const BinaryBasicBlock *LP : BB.landing_pads()) {
+        if (LP->getKnownExecutionCount() > 0) {
+          HasPosECLP = true;
+          break;
+        }
+      }
+      if (HasPosECLP)
+        continue;
----------------
aaupov wrote:

```suggestion
      auto isPosEC = std::bind(&BinaryBasicBlock::getKnownExecutionCount, std::placeholders::_1);
      if (llvm::any_of(BB.landing_pads(), isPosEC))
        continue;
```

https://github.com/llvm/llvm-project/pull/130810


More information about the llvm-commits mailing list