llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Haojian Wu (hokein)

<details>
<summary>Changes</summary>

The `Declarator` class is large (4584 bytes) and used as a stack-local variable 
during parsing.

This patch reduces the default size of its `DeclTypeInfo` member, reducing the 
overall size down to 3880 bytes. This allows clang handle more deeply nested 
expressions without exhausting the stack.

Combined with #<!-- -->148726, the nesting threshold for such expressions 
increases to `~1100`.

No performance impact being 
[observed](https://llvm-compile-time-tracker.com/compare.php?from=d4f5ed6a23464cbe831820cb695aa1d39b11e4aa&amp;to=66ba54b8a295cc2759387ef2a4a162de2ad4946e&amp;stat=instructions:u).

---
Full diff: https://github.com/llvm/llvm-project/pull/148788.diff


1 Files Affected:

- (modified) clang/include/clang/Sema/DeclSpec.h (+1-1) 


``````````diff
diff --git a/clang/include/clang/Sema/DeclSpec.h 
b/clang/include/clang/Sema/DeclSpec.h
index 567ad2d5934d4..4b7c8d609735f 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -1918,7 +1918,7 @@ class Declarator {
   /// parsed.  This is pushed from the identifier out, which means that element
   /// #0 will be the most closely bound to the identifier, and
   /// DeclTypeInfo.back() will be the least closely bound.
-  SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
+  SmallVector<DeclaratorChunk, 4> DeclTypeInfo;
 
   /// InvalidType - Set by Sema::GetTypeForDeclarator().
   LLVM_PREFERRED_TYPE(bool)

``````````

</details>


https://github.com/llvm/llvm-project/pull/148788
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to