Commit 2a9afdb
authored
[clang] Reduce the size of ParsedAttributesView and AttributePool (llvm#148726)
These objects are used as local stack variables during parsing, and they
are not small. This patch reduces their sizes:
* `ParsedAttributesView`: 72 → 40 bytes
* `AttributePool`: 72 → 40 bytes
No negative performance impact has been
[observed](https://llvm-compile-time-tracker.com/compare.php?from=a709621cd545b061782b03136286227867b452a6&to=f50500b3c178e97c0c861301e853e6d5b859040b&stat=instructions:u).
**Context:**
We have some verilator-generated code with extremely deep nesting of
parenthesized expressions, e.g.:
```cpp
bool s =
(...(bool)(i[0])
|(bool)(i[1]))
|(bool)(i[2]))
| ...
|(bool)(i[n]));
```
Before this patch, on my local machine, Clang begins emitting
`-Wstack-exhausted` when `n` is 715. After the patch, that threshold
increases to `950`.1 parent 57d81c2 commit 2a9afdb
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
| 681 | + | |
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
| |||
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
811 | | - | |
| 811 | + | |
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| |||
0 commit comments