@@ -433,7 +433,6 @@ class StaleMatcher {
433433 else
434434 BlockPseudoProbes.push_back (&PseudoProbe);
435435 }
436-
437436 // Returns nullptr if there is not a 1:1 mapping of the profile block pseudo
438437 // probe and a binary block pseudo probe.
439438 const FlowBlock *MatchedInlinedBlock =
@@ -636,23 +635,21 @@ size_t matchWeightsByHashes(
636635 // pseudo probe block matching. Otherwise, the YamlBF's GUID is used for
637636 // pseudo probe block matching.
638637 const MCPseudoProbeDecoder *PseudoProbeDecoder =
639- opts::ProfileUsePseudoProbes ? BC.getPseudoProbeDecoder () : nullptr ;
638+ opts::ProfileUsePseudoProbes && opts::StaleMatchingWithBlockPseudoProbes
639+ ? BC.getPseudoProbeDecoder ()
640+ : nullptr ;
640641 uint64_t BFPseudoProbeDescHash = 0 ;
641- if (opts::ProfileUsePseudoProbes && BF.getGUID () != 0 ) {
642+ if (opts::ProfileUsePseudoProbes &&
643+ opts::StaleMatchingWithBlockPseudoProbes && BF.getGUID () != 0 ) {
642644 assert (PseudoProbeDecoder &&
643645 " If BF has pseudo probe, BC should have a pseudo probe decoder" );
644646 auto &GUID2FuncDescMap = PseudoProbeDecoder->getGUID2FuncDescMap ();
645647 auto It = GUID2FuncDescMap.find (BF.getGUID ());
646648 if (It != GUID2FuncDescMap.end ())
647649 BFPseudoProbeDescHash = It->second .FuncHash ;
648650 }
649- uint64_t YamlBFGUID =
650- BFPseudoProbeDescHash && YamlBF.PseudoProbeDescHash &&
651- BFPseudoProbeDescHash == YamlBF.PseudoProbeDescHash
652- ? static_cast <uint64_t >(YamlBF.GUID )
653- : 0 ;
654651
655- StaleMatcher Matcher (YamlBFGUID );
652+ StaleMatcher Matcher (YamlBF. GUID );
656653 std::vector<uint64_t > CallHashes;
657654 std::vector<FlowBlock *> Blocks;
658655 std::vector<BlendedBlockHash> BlendedHashes;
@@ -677,7 +674,11 @@ size_t matchWeightsByHashes(
677674 BlendedHashes.push_back (BlendedHash);
678675 // Collects pseudo probes attached to the BB for use in the StaleMatcher.
679676 if (opts::ProfileUsePseudoProbes &&
680- opts::StaleMatchingWithBlockPseudoProbes && PseudoProbeDecoder) {
677+ opts::StaleMatchingWithBlockPseudoProbes && BFPseudoProbeDescHash &&
678+ YamlBF.PseudoProbeDescHash &&
679+ BFPseudoProbeDescHash == YamlBF.PseudoProbeDescHash ) {
680+ assert (PseudoProbeDecoder &&
681+ " If pseudo probes are in use, psuedo probe decoder should exist" );
681682 const AddressProbesMap &ProbeMap =
682683 PseudoProbeDecoder->getAddress2ProbesMap ();
683684 const uint64_t FuncAddr = BF.getAddress ();
0 commit comments