[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jul 30 15:12:45 PDT 2024
================
@@ -223,10 +249,31 @@ class StaleMatcher {
return Hash1.InstrHash == Hash2.InstrHash;
}
+ /// Returns true if a profiled block was matched with its pseudo probe.
+ bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) {
+ return MatchedWithPseudoProbes.find(YamlBBHash.combine()) !=
+ MatchedWithPseudoProbes.end();
+ }
+
+ /// Returns the number of blocks matched with opcodes.
+ size_t getNumBlocksMatchedWithOpcodes() const { return MatchedWithOpcodes; }
+
+ /// Returns the number of blocks matched with pseudo probes.
+ size_t getNumBlocksMatchedWithPseudoProbes() const {
+ return MatchedWithPseudoProbes.size();
+ }
+
private:
using HashBlockPairType = std::pair<BlendedBlockHash, FlowBlock *>;
std::unordered_map<uint16_t, std::vector<HashBlockPairType>> OpHashToBlocks;
std::unordered_map<uint64_t, std::vector<HashBlockPairType>> CallHashToBlocks;
+ std::unordered_map<uint64_t, std::vector<const MCDecodedPseudoProbe *>>
----------------
spupyrev wrote:
@dcci @shawbyoung this due to a limitation of ADT maps, e.g., the following code crashes:
```
DenseMap<uint16_t, uint64_t> TestMap;
TestMap[uint16_t(-1)] = 123;
```
If not that, I agree that ADT data structures would be preferred
https://github.com/llvm/llvm-project/pull/99891
More information about the llvm-branch-commits
mailing list