[clang] [clang] Reduce LateInstantiatedAttrVec vector default size. (PR #142840)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 4 13:02:14 PDT 2025


https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142840

This increases clang's template instantiation depths.

I can see 7% increase (1510 -> 1612 on my local machine) for the `clang/test/SemaTemplate/instantiation-depth-default.cpp` case. 

No performance regressions have been observed: https://llvm-compile-time-tracker.com/compare.php?from=5f8cf33650c0c71119ecf81f07014329d9466d0d&to=05c2403b0f784325f5b88760ef43a15b6aaf4181&stat=instructions:u


>From 05c2403b0f784325f5b88760ef43a15b6aaf4181 Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Wed, 4 Jun 2025 14:54:37 +0200
Subject: [PATCH] Reduce LateInstantiatedAttrVec vector size.

---
 clang/include/clang/Sema/Sema.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 84d30561fecde..25246374a3c36 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -14015,7 +14015,7 @@ class Sema final : public SemaBase {
                               Decl *D)
         : TmplAttr(A), Scope(S), NewDecl(D) {}
   };
-  typedef SmallVector<LateInstantiatedAttribute, 16> LateInstantiatedAttrVec;
+  typedef SmallVector<LateInstantiatedAttribute, 1> LateInstantiatedAttrVec;
 
   void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
                         const Decl *Pattern, Decl *Inst,



More information about the cfe-commits mailing list