[llvm] 7d0b32c - GlobalISel: Use result of find rather than rechecking map

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 18:26:31 PDT 2020


Author: Matt Arsenault
Date: 2020-07-29T21:26:20-04:00
New Revision: 7d0b32c268ab4cfbc0630b2836890f2aef128d8b

URL: https://github.com/llvm/llvm-project/commit/7d0b32c268ab4cfbc0630b2836890f2aef128d8b
DIFF: https://github.com/llvm/llvm-project/commit/7d0b32c268ab4cfbc0630b2836890f2aef128d8b.diff

LOG: GlobalISel: Use result of find rather than rechecking map

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index f9b084317819..264af2b562b3 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -222,8 +222,9 @@ ArrayRef<Register> IRTranslator::getOrCreateVRegs(const Value &Val) {
 }
 
 int IRTranslator::getOrCreateFrameIndex(const AllocaInst &AI) {
-  if (FrameIndices.find(&AI) != FrameIndices.end())
-    return FrameIndices[&AI];
+  auto MapEntry = FrameIndices.find(&AI);
+  if (MapEntry != FrameIndices.end())
+    return MapEntry->second;
 
   uint64_t ElementSize = DL->getTypeAllocSize(AI.getAllocatedType());
   uint64_t Size =


        


More information about the llvm-commits mailing list