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

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 15:47:43 PDT 2025


================
@@ -311,14 +318,9 @@ void printCFGFlowConservationStats(const BinaryContext &BC, raw_ostream &OS,
       if (BB.isLandingPad())
         continue;
 
-      bool HasPosECLP = false;
-      for (const BinaryBasicBlock *LP : BB.landing_pads()) {
-        if (LP->getKnownExecutionCount() > 0) {
-          HasPosECLP = true;
-          break;
-        }
-      }
-      if (HasPosECLP)
+      auto isPosEC = std::bind(&BinaryBasicBlock::getKnownExecutionCount,
+                               std::placeholders::_1);
+      if (llvm::any_of(BB.landing_pads(), isPosEC))
----------------
aaupov wrote:

Maksim told me about this trick:
```suggestion
      if (llvm::any_of(BB.landing_pads(),
          std::mem_fn(&BinaryBasicBlock::getKnownExecutionCount))
```

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


More information about the llvm-commits mailing list