diff --git a/bolt/lib/Core/HashUtilities.cpp b/bolt/lib/Core/HashUtilities.cpp --- a/bolt/lib/Core/HashUtilities.cpp +++ b/bolt/lib/Core/HashUtilities.cpp @@ -139,7 +139,8 @@ // instruction opcodes, which is then hashed with std::hash. std::set 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 diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp --- a/bolt/lib/Profile/StaleProfileMatching.cpp +++ b/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];