[llvm] [SCEV] Improve code in SCEVLoopGuardRewriter (NFC) (PR #139257)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat May 10 02:08:22 PDT 2025
================
@@ -15887,29 +15887,29 @@ const SCEV *ScalarEvolution::LoopGuards::rewrite(const SCEV *Expr) const {
return SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitZeroExtendExpr(
Expr);
}
- return I->second;
+ return S;
}
const SCEV *visitSignExtendExpr(const SCEVSignExtendExpr *Expr) {
- auto I = Map.find(Expr);
- if (I == Map.end())
+ const SCEV *S = Map.lookup(Expr);
+ if (!S)
----------------
fhahn wrote:
nit: with `lookup`, we could also fold it into the `if`, limiting the scope, like
```suggestion
if (const SCEV *S = Map.lookup(Expr))
return S;
```
https://github.com/llvm/llvm-project/pull/139257
More information about the llvm-commits
mailing list