[llvm] [CodeGen] Use SmallMapVector for SpillPlacement::Node::Links (PR #194653)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 11:50:11 PDT 2026


================
@@ -152,11 +147,11 @@ struct SpillPlacement::Node {
     // Compute the weighted sum of inputs.
     BlockFrequency SumN = BiasN;
     BlockFrequency SumP = BiasP;
-    for (std::pair<BlockFrequency, unsigned> &L : Links) {
-      if (nodes[L.second].Value == -1)
-        SumN += L.first;
-      else if (nodes[L.second].Value == 1)
-        SumP += L.first;
+    for (std::pair<unsigned int, llvm::BlockFrequency> &L : Links) {
----------------
nikic wrote:

While you're here, something like this may be a bit cleaner:
```suggestion
    for (auto [BundleNo, Weight] : Links) {
```

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


More information about the llvm-commits mailing list