[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
Lei Wang via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jul 25 16:57:04 PDT 2024
================
@@ -266,6 +325,122 @@ class StaleMatcher {
}
return BestBlock;
}
+
+ /// A helper function for logging.
+ static bool LogErrIfExpr(bool Expr, StringRef Message) {
+ if (Expr)
+ errs() << Message;
+ return Expr;
+ }
+
+ /// Matches an inlined profile block with an inlined binary block based on
+ /// pseudo probes.
+ const FlowBlock *matchWithInlinedBlockPseudoProbes(
+ SmallVector<const yaml::bolt::PseudoProbeInfo *>
+ &InlinedBlockPseudoProbes) const {
+ if (opts::Verbosity >= 3)
+ outs() << "BOLT-INFO: attempting to match block with inlined block "
+ "pseudo probes\n";
+
+ size_t NInlinedBlockPseudoProbes = InlinedBlockPseudoProbes.size();
+ if (LogErrIfExpr(NInlinedBlockPseudoProbes == 0,
+ "BOLT-WARNING: no pseudo probes in profile block\n"))
+ return nullptr;
+ if (LogErrIfExpr(
+ NInlinedBlockPseudoProbes > 1,
----------------
wlei-llvm wrote:
it should be common that one basic block contains >1 pseudo probes, e.g. when inlining happens, the inlinee's entry pseudo probe(ID:1) is inlined to replace the inline callsite, whose basic block contains the inliner's pseudo probe.
https://github.com/llvm/llvm-project/pull/99891
More information about the llvm-branch-commits
mailing list