[llvm] 37ef225 - [AArch64] Reuse map iterator instead of double lookup. NFC

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 09:47:18 PDT 2020


Author: Jon Roelofs
Date: 2020-09-28T09:47:00-07:00
New Revision: 37ef2255b6422b8e0b93f0becd340e041047a2aa

URL: https://github.com/llvm/llvm-project/commit/37ef2255b6422b8e0b93f0becd340e041047a2aa
DIFF: https://github.com/llvm/llvm-project/commit/37ef2255b6422b8e0b93f0becd340e041047a2aa.diff

LOG: [AArch64] Reuse map iterator instead of double lookup. NFC

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp b/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp
index fc31e701d3af..713aad3e3ff2 100644
--- a/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp
+++ b/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp
@@ -221,8 +221,9 @@ shouldReplaceInst(MachineFunction *MF, const MCInstrDesc *InstDesc,
   // if so, return it.
   std::string Subtarget = std::string(SchedModel.getSubtargetInfo()->getCPU());
   auto InstID = std::make_pair(InstDesc->getOpcode(), Subtarget);
-  if (SIMDInstrTable.find(InstID) != SIMDInstrTable.end())
-    return SIMDInstrTable[InstID];
+  auto It = SIMDInstrTable.find(InstID);
+  if (It != SIMDInstrTable.end())
+    return It->second;
 
   unsigned SCIdx = InstDesc->getSchedClass();
   const MCSchedClassDesc *SCDesc =


        


More information about the llvm-commits mailing list