[llvm] [LV] Strip unnecessary make_{pair, optional} (NFC) (PR #141924)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 01:35:29 PDT 2025


================
@@ -8491,7 +8486,7 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {
     PartialReductionChain Chain = Pair.first;
     if (ExtendIsOnlyUsedByPartialReductions(Chain.ExtendA) &&
         ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB))
-      ScaledReductionMap.insert(std::make_pair(Chain.Reduction, Pair.second));
+      ScaledReductionMap.emplace_or_assign(Chain.Reduction, Pair.second);
----------------
david-arm wrote:

Looks like:

```
  std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
    return try_emplace(KV.first, KV.second);
  }
```

so I agree that it's better to call `try_emplace` to keep this PR NFC.

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


More information about the llvm-commits mailing list