On Thu, Jan 29, 2015 at 7:38 PM, Segher Boessenkool <seg...@kernel.crashing.org> wrote: > The problem in this PR is that rs6000_stack_info spends an enormous amount > of time when compiling thunks. This turns out to be a loop in > compute_vrsave_mask that loops (almost) 4G times because the loop counter > is unsigned and the reversed loop is not written in a way that can handle > crtl->args.info.vregno == 0. Make it a forward loop free of such traps, > which is easier to read anyway. > > But, vregno should never be 0 if rs6000_stack_info is called; it means > that various data is not initialised for this function. Which is correct, > this is a thunk: rs6000_stack_info should not be called for thunks. Add > an assert for that. > > rs6000_output_function_prologue (the thing outputting asm stuff) calls > it though. Don't do the savres thing for thunks (they never need it). > Factor the relevant code to a new function while at it. > > rs6000_output_function_epilogue already guards properly with is_thunk, > and the assert didn't fire on a bootstrap+testrun, so it seems this was > the only place the mistake happened. > > > Bootstrapped and tested as usual; okay for mainline? And release branches > if it happens there (the PR doesn't say yet, it's not marked as regression > either, looking at history it seems to go way way back)? > > > Segher > > > 2015-01-29 Segher Boessenkool <seg...@kernel.crashing.org> > > gcc/ > PR target/64580 > * config.rs6000/rs6000.c (compute_vrsave_mask): Reverse loop order. > (rs6000_stack_info): Add assert. > (rs6000_output_savres_externs): New function, split off from... > (rs6000_output_function_prologue): ... here. Do not call it for > thunks.
Okay. Thanks, David