[PATCH] D159488: [BOLT] Always match stale entry blocks

Sergey Pupyrev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 15:46:57 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG42da84fda979: [BOLT] Always match stale entry blocks (authored by spupyrev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159488/new/

https://reviews.llvm.org/D159488

Files:
  bolt/lib/Core/HashUtilities.cpp
  bolt/lib/Profile/StaleProfileMatching.cpp


Index: bolt/lib/Profile/StaleProfileMatching.cpp
===================================================================
--- bolt/lib/Profile/StaleProfileMatching.cpp
+++ bolt/lib/Profile/StaleProfileMatching.cpp
@@ -389,6 +389,9 @@
     assert(YamlBB.Hash != 0 && "empty hash of BinaryBasicBlockProfile");
     BlendedBlockHash YamlHash(YamlBB.Hash);
     const FlowBlock *MatchedBlock = Matcher.matchBlock(YamlHash);
+    // Always match the entry block.
+    if (MatchedBlock == nullptr && YamlBB.Index == 0)
+      MatchedBlock = Blocks[0];
     if (MatchedBlock != nullptr) {
       MatchedBlocks[YamlBB.Index] = MatchedBlock;
       BlendedBlockHash BinHash = BlendedHashes[MatchedBlock->Index - 1];
Index: bolt/lib/Core/HashUtilities.cpp
===================================================================
--- bolt/lib/Core/HashUtilities.cpp
+++ bolt/lib/Core/HashUtilities.cpp
@@ -139,7 +139,8 @@
   // instruction opcodes, which is then hashed with std::hash.
   std::set<std::string> Opcodes;
   for (const MCInst &Inst : BB) {
-    if (BC.MIB->isPseudo(Inst))
+    // Skip pseudo instructions and nops.
+    if (BC.MIB->isPseudo(Inst) || BC.MIB->isNoop(Inst))
       continue;
 
     // Ignore unconditional jumps, as they can be added / removed as a result


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159488.556317.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230908/42b83f33/attachment.bin>


More information about the llvm-commits mailing list