[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)
Lei Wang via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 15 10:47:00 PDT 2024
================
@@ -213,6 +208,25 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
bool ShowName) const;
};
+// Address to pseudo probes map.
+class AddressProbesMap
+ : public std::vector<std::reference_wrapper<MCDecodedPseudoProbe>> {
+ auto getIt(uint64_t Addr) const {
+ auto CompareProbe = [](const MCDecodedPseudoProbe &Probe, uint64_t Addr) {
+ return Probe.getAddress() < Addr;
+ };
+ return llvm::lower_bound(*this, Addr, CompareProbe);
----------------
wlei-llvm wrote:
How does this guarantee it's equivalent to `std::map<uint64_t, ....>` ? specifically, if the address doesn't exist in the map, `std::map` returns `end()` but using `lower_bound`, it will points to the next element.
https://github.com/llvm/llvm-project/pull/102904
More information about the llvm-branch-commits
mailing list