[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

Lei Wang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 15 23:56:25 PDT 2024


================
@@ -100,8 +101,15 @@ class MCDecodedPseudoProbe;
 using InlineSite = std::tuple<uint64_t, uint32_t>;
 using MCPseudoProbeInlineStack = SmallVector<InlineSite, 8>;
 // GUID to PseudoProbeFuncDesc map
-using GUIDProbeFunctionMap =
-    std::unordered_map<uint64_t, MCPseudoProbeFuncDesc>;
+class GUIDProbeFunctionMap : public std::vector<MCPseudoProbeFuncDesc> {
+public:
+  auto find(uint64_t GUID) const {
+    return llvm::lower_bound(
+        *this, GUID, [](const MCPseudoProbeFuncDesc &Desc, uint64_t GUID) {
+          return Desc.FuncGUID < GUID;
----------------
wlei-llvm wrote:

This is similar to the previous PR. we need to make sure return `end()` when GUID doesn't exist. (this case did happen before https://github.com/llvm/llvm-project/issues/98127)

https://github.com/llvm/llvm-project/pull/102905


More information about the llvm-branch-commits mailing list