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? 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
cfgexpand.patch
Description: Binary data