[clang] [clang] Automatic initialization for small struct fields (PR #229584)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 15:57:29 PDT 2026


efriedma-quic wrote:

-ftrivial-auto-var-init-max-size is a tradeoff, similar to weaker variants of stack protectors.  You set it because full initialization costs too much performance or codesize, and you can't add `__attribute__((uninitialized))` to the hotspots for whatever reason.

Some patterns are more likely to cause issues, so it probably makes sense to try to target those specific patterns.  Prioritizing non-array members is probably reasonable.  Prioritizing pointers is probably also reasonable.  Floating-point numbers are less likely to cause issues.  Not sure if anyone has done research into this sort of thing.

https://github.com/llvm/llvm-project/pull/229584


More information about the cfe-commits mailing list