[llvm] [DenseMap] Fix constness issues with lookup_or (PR #139247)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 05:10:22 PDT 2025


================
@@ -15891,25 +15888,19 @@ const SCEV *ScalarEvolution::LoopGuards::rewrite(const SCEV *Expr) const {
     }
 
     const SCEV *visitSignExtendExpr(const SCEVSignExtendExpr *Expr) {
-      auto I = Map.find(Expr);
-      if (I == Map.end())
-        return SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSignExtendExpr(
-            Expr);
-      return I->second;
+      return Map.lookup_or(
+          Expr,
+          SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSignExtendExpr(Expr));
----------------
nikic wrote:

Same for these, they shouldn't be recursing if the map entry already exists.

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


More information about the llvm-commits mailing list