[llvm] [CodeLayout] CDSortImpl: remove linear-time erase_value from mergeChains (PR #69276)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 09:04:00 PDT 2023


================
@@ -1152,6 +1153,7 @@ class CDSortImpl {
       MergeGainT BestGain = BestEdge->getMergeGain();
       mergeChains(BestSrcChain, BestDstChain, BestGain.mergeOffset(),
                   BestGain.mergeType());
+      --NumHotChains;
----------------
spupyrev wrote:

Seems like the list, HotChains, is not used in the algorithm. Can we get rid of it altogether?

Instead of `for (ChainT *ChainPred : HotChains) {...` we'd have something like
```
for (NodeT &Node : AllNodes) {
  if (Node.ExecutionCount > 0) {
    ChainT *ChainPred = Node.CurChain;
    ...
  }
}
```

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


More information about the llvm-commits mailing list