GlobalISel: Use result of find rather than rechecking map
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 29 Jul 2020 13:42:03 +0000 (09:42 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 30 Jul 2020 01:26:20 +0000 (21:26 -0400)
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

index f9b0843..264af2b 100644 (file)
@@ -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 =