jedav wrote:

> I don't really have experience with codebases using 
> -ftrivial-auto-var-init-max-size

It doesn't seem to be much-used; I'm not finding any internal uses at Google, 
nor any clear uses searching across github.

If the intended end-effect of limiting the maximum size of 
automatically-initialized stack variables is to limit the runtime and code-size 
impacts of stack var initialization, and empirically extending size-limited 
automatic initialization to small struct fields still produces a large 
reduction in overhead compared to stack auto-init without a max size, then that 
seems like evidence that small struct fields do not account for a big chunk of 
the overhead of stack auto-init (the bulks of which seems more likely to come 
from arrays, including structs with array fields).  So extending coverage to 
small struct fields seems to be compatible with the end goal of 
-ftrivial-auto-var-init-max-size.

I think a philosophical case could be made that small struct fields are still 
small variables; they're just small variables that happen to reside within 
larger variables.  But they do have their own names, rather than being so 
numerous that they must be referred to by an index.

I'm absolutely open to looking into better subsets of variables to auto-init, 
and I hope to (though perhaps not as part of -ftrivial-auto-var-init-max-size). 
 But given that this TODO is in the codebase, it seems like we should either do 
it, or remove it.

https://github.com/llvm/llvm-project/pull/229584
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to