[llvm] 3357938 - [SCEV] Increase RewriteMap default size (NFC). (#224864)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 04:42:42 PDT 2026
Author: Florian Hahn
Date: 2026-09-20T11:42:37Z
New Revision: 335793850c499195d9af75715bbbe84ce272666b
URL: https://github.com/llvm/llvm-project/commit/335793850c499195d9af75715bbbe84ce272666b
DIFF: https://github.com/llvm/llvm-project/commit/335793850c499195d9af75715bbbe84ce272666b.diff
LOG: [SCEV] Increase RewriteMap default size (NFC). (#224864)
The old automatic default of 4 inline buckets meant that in practice we
were frequently hitting the grow path to 64 buckets, causing unnecessary
memory traffic.
SCEVRewriteVisitor is used each time loop guards are applied and the new
default improves compile-time slightly for SCEV-heavy workloads. Geomean
improves by -0.03%, but mafft and lencod see bigger wins:
https://llvm-compile-time-tracker.com/compare.php?from=7c55ad084c8b1503cafa42c60d88bff65919c9fa&to=c1f14fba38c4cd7b282709d8bd9481d28642b2c6&stat=instructions:u
It mostly makes applying loop guards cheaper, making it easier to use in
more places in the future.
PR: https://github.com/llvm/llvm-project/pull/224864
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 277f445b93a81..ace050bd2c2c1 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -803,7 +803,7 @@ class SCEVRewriteVisitor : public SCEVVisitor<SC, const SCEV *> {
// a SCEV is referenced by multiple SCEVs. Without memoization, this
// visit algorithm would have exponential time complexity in the worst
// case, causing the compiler to hang on certain tests.
- SmallDenseMap<const SCEV *, const SCEV *> RewriteResults;
+ SmallDenseMap<const SCEV *, const SCEV *, 16> RewriteResults;
public:
SCEVRewriteVisitor(ScalarEvolution &SE) : SE(SE) {}
More information about the llvm-commits
mailing list