On Tue, Oct 8, 2013 at 11:04 PM, Easwaran Raman <era...@google.com> wrote: > In cfgexpand.c, variables in non-overlapping lexical scopes are > assigned same stack locations at -O1 and above. At -O0, this is > attempted only if the size of the stack objects is above a threshold > (32). The rationale is at -O0, more variables are going to be in the > stack and the O(n^2) stack slot sharing algorithm will increase the > compilation time. This patch replaces the constant with a param which > is set to 32 by default. We ran into a case where the presence of > always_inline attribute triggered Wframe-larger-than warnings at -O0 > but not at -O2 since the different inlined copies share the stack. We > are ok with a slight increase in compilation time to get smaller stack > frames even at -O0 and this patch would allow us do that easily. > > Bootstraps on x86_64/linux. Is this ok for trunk?
Ok with +DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING, + "min-size-for-stack-sharing", + "Attempt to share stack slots among variables in different lexical blocks " + "at O0 only if their sizes exceed this value", + 32, 0, 0) changed to "The minimum size of variables taking part in stack slot sharing " "when not optimizing" 32, 0, 0) And with adding documentation for that param in doc/invoke.texi. Btw, I'm not sure the sharing algorithm is still quadratic - can you investigate on that? Thanks, Richard. > Thanks, > Easwaran > > > 2013-10-08 Easwaran Raman <era...@google.com> > > * params.def (PARAM_MIN_SIZE_FOR_STACK_SHARING): New param... > * cfgexpand.c (defer_stack_allocation): ...use here