[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 23:40:53 PDT 2024


================
@@ -1183,11 +1183,9 @@ void ProfileGeneratorBase::extractProbesFromRange(
     do {
       const AddressProbesMap &Address2ProbesMap =
           Binary->getAddress2ProbesMap();
-      auto It = Address2ProbesMap.find(IP.Address);
-      if (It != Address2ProbesMap.end()) {
-        for (const MCDecodedPseudoProbe &Probe : It->second) {
-          ProbeCounter[&Probe] += Count;
-        }
+      for (const MCDecodedPseudoProbe &Probe :
+           Address2ProbesMap.find(IP.Address)) {
----------------
wlei-llvm wrote:

This is a hot path, but now we change the O(1) `unordered_map` search to a binary search. Not sure if it can cause noticeable regression. I will run an end-to-end test on llvm-profgen.

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


More information about the llvm-branch-commits mailing list