[llvm] [SLPVectorizer] Use DenseMap::{find, try_emplace} (NFC) (PR #107123)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 12:21:32 PDT 2024


================
@@ -11841,9 +11841,10 @@ void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
 }
 
 Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
-  auto &Res = EntryToLastInstruction.FindAndConstruct(E);
-  if (Res.second)
-    return *Res.second;
+  auto It = EntryToLastInstruction.find(E);
+  if (It != EntryToLastInstruction.end())
+    return *It->second;
+  auto &Res = EntryToLastInstruction.try_emplace(E).first->second;
----------------
kazutakahirata wrote:

Thank you for catching this!  I'm addressing this with https://github.com/llvm/llvm-project/pull/107143.

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


More information about the llvm-commits mailing list