[llvm] [MCA] Avoid repeated hash lookups (NFC) (PR #129192)

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 11:16:59 PST 2025


================
@@ -634,16 +634,14 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
   bool IsVariadic = MCDesc.isVariadic();
   if ((ID->IsRecyclable = !IsVariadic && !IsVariant)) {
     auto DKey = std::make_pair(MCI.getOpcode(), SchedClassID);
-    Descriptors[DKey] = std::move(ID);
-    return *Descriptors[DKey];
+    return *(Descriptors[DKey] = std::move(ID));
----------------
adibiagio wrote:

Mmm yeah, it forces you to do that annoying first->second to get the iterator from the pair.
Nevermind then. Thanks for the fix!


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


More information about the llvm-commits mailing list