[llvm-branch-commits] [llvm] [BOLT] Attach pseudo probes to blocks in YAML profile (PR #99554)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 18 12:56:00 PDT 2024


https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99554

>From 9498f8f38cea050fd363d5d4591e8401e5de8bd5 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Thu, 18 Jul 2024 12:49:23 -0700
Subject: [PATCH 1/2] Fix operator==

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/ProfileYAMLMapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Profile/ProfileYAMLMapping.h b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
index 2bc6901e5f591..2a0514d7d9304 100644
--- a/bolt/include/bolt/Profile/ProfileYAMLMapping.h
+++ b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
@@ -100,7 +100,7 @@ struct PseudoProbeInfo {
   uint8_t Type;
 
   bool operator==(const PseudoProbeInfo &Other) const {
-    return Index == Other.Index;
+    return GUID == Other.GUID && Index == Other.Index;
   }
   bool operator!=(const PseudoProbeInfo &Other) const {
     return !(*this == Other);

>From 956084a3b4078f10d953ecab20720e9cf2d25554 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Thu, 18 Jul 2024 12:55:50 -0700
Subject: [PATCH 2/2] Fix probe mapping to block in BAT mode

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 85e583c75728f..1da018c346d36 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2419,14 +2419,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
           for (const auto &[OutputAddress, Probes] : FragmentProbes) {
             const uint32_t InputOffset = BAT->translate(
                 FuncAddr, OutputAddress - FuncAddr, /*IsBranchSrc=*/true);
-            if (!BlockMap.isInputBlock(InputOffset)) {
-              if (opts::Verbosity >= 1)
-                errs() << "BOLT-WARNING: Couldn't map pseudo probe at 0x"
-                       << Twine::utohexstr(InputOffset) << " to a block in "
-                       << F->getPrintName() << '\n';
-              continue;
-            }
-            const unsigned BlockIndex = BlockMap.getBBIndex(InputOffset);
+            const unsigned BlockIndex = getBlock(InputOffset).second;
             for (const MCDecodedPseudoProbe &Probe : Probes)
               YamlBF.Blocks[BlockIndex].PseudoProbes.emplace_back(
                   yaml::bolt::PseudoProbeInfo{Probe.getGuid(), Probe.getIndex(),



More information about the llvm-branch-commits mailing list