================ @@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { + DenseMap<uint32_t, const MCDecodedPseudoProbeInlineTree *> Map; + + void mapInlineTreeNode(uint32_t ProfileNode, + const MCDecodedPseudoProbeInlineTree *BinaryNode) { + auto Res = Map.try_emplace(ProfileNode, BinaryNode); + assert(Res.second && + "Duplicate mapping from profile node index to binary inline tree"); + (void)Res; + } + + public: + /// Returns matched InlineTree * for a given profile inline_tree_id. + const MCDecodedPseudoProbeInlineTree * + getInlineTreeNode(uint32_t ProfileInlineTreeNodeId) const { + auto It = Map.find(ProfileInlineTreeNodeId); + if (It == Map.end()) + return nullptr; + return It->second; + } + + // Match up YAML inline tree with binary inline tree. ---------------- wlei-llvm wrote:
Could you add more comments to explain the output of this function and how it will be used for the matching later? https://github.com/llvm/llvm-project/pull/99891 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits