[llvm] 36fb886 - [Analysis] Avoid repeated hash lookups (NFC) (#125462)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 12:29:10 PST 2025


Author: Kazu Hirata
Date: 2025-02-03T12:29:07-08:00
New Revision: 36fb886f5a0c0af40095696ea7589309d3dd30d5

URL: https://github.com/llvm/llvm-project/commit/36fb886f5a0c0af40095696ea7589309d3dd30d5
DIFF: https://github.com/llvm/llvm-project/commit/36fb886f5a0c0af40095696ea7589309d3dd30d5.diff

LOG: [Analysis] Avoid repeated hash lookups (NFC) (#125462)

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 6eb1aca1cf76ad..872746b7df5ca9 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -944,10 +944,11 @@ class SCEVLoopAddRecRewriter
       Operands.push_back(visit(Op));
 
     const Loop *L = Expr->getLoop();
-    if (0 == Map.count(L))
+    auto It = Map.find(L);
+    if (It == Map.end())
       return SE.getAddRecExpr(Operands, L, Expr->getNoWrapFlags());
 
-    return SCEVAddRecExpr::evaluateAtIteration(Operands, Map[L], SE);
+    return SCEVAddRecExpr::evaluateAtIteration(Operands, It->second, SE);
   }
 
 private:


        


More information about the llvm-commits mailing list