[clang] [clang] Share normalized constraints between decls with same constraint expressions (PR #226620)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 27 19:40:18 PDT 2026
================
@@ -15186,6 +15186,11 @@ class Sema final : public SemaBase {
/// here.
llvm::DenseMap<ConstrainedDeclOrNestedRequirement, NormalizedConstraint *>
NormalizationCache;
+ /// Caches the normal form of constraint expressions (and their pack
+ /// substitution index). These are shared by e.g. the members of all
+ /// specializations of a class template. Used to fill NormalizationCache.
+ llvm::DenseMap<std::pair<const Expr *, unsigned>, NormalizedConstraint *>
+ NormalizedConstraintExprCache;
----------------
zyn0217 wrote:
> So the constraints of e.g. the constrained constructors of std::optional, std::span, std::pair or of the members of range adaptors were normalized from scratch for every single specialization of those classes that a TU uses.
Instead of introducing a new cache kv, can we instead use the primary template as the key for NormalizationCache?
https://github.com/llvm/llvm-project/pull/226620
More information about the cfe-commits
mailing list