Bernd Edlinger <bernd.edlin...@hotmail.de> writes: >> >> Jakub Jelinek <ja...@redhat.com> wrote: >>>On Mon, Jan 06, 2014 at 10:27:06AM +0000, Richard Sandiford wrote: >>>> Of course, IMO, the cleanest fix would be to use switchable targets >>>> for i386... >>> >>>We IMHO want that anyway, e.g. #pragma omp declare simd tests take eons >>>to >>>compile because even with just a few routines in a CU there are >>>hundreds or >>>thousands of IRA reinitializations. >> >> We also want a big fat comment before the non-obvious order of inits >> when switching cfuns. >> >> Bernd, please revert your patch for now. >> > > OK, reverted for now.
Thanks Bernd. (And sorry for the tone of my original message -- wasn't happy with that when I read it back.) How about this patch for the big comment? Thanks, Richard gcc/ * function.c (invoke_set_current_function_hook): Add more commentary. Index: gcc/function.c =================================================================== --- gcc/function.c 2014-01-06 19:09:27.821167117 +0000 +++ gcc/function.c 2014-01-06 19:15:27.764240857 +0000 @@ -4405,9 +4405,23 @@ invoke_set_current_function_hook (tree f cl_optimization_restore (&global_options, TREE_OPTIMIZATION (opts)); } + /* Give the target an opportunity to change the global state in + response to function attributes. This includes picking the + correct value of this_target on SWITCHABLE_TARGET targets. + + Note that this_target (and in particular this_target_optabs) + should always reflect the target state with default optimization + options. We therefore call the target hook first and then apply + any function-specific optimization options on top. */ targetm.set_current_function (fndecl); + + /* Set this_fn_optabs appropriately, on the assumption that we + want the default optimization options. */ this_fn_optabs = this_target_optabs; + /* Now adjust this_fn_optabs if using non-default optimization options. + init_tree_optimization_optabs ensures that the cached value of + TREE_OPTIMIZATION_OPTABS (opts) is correct for this_target. */ if (opts != optimization_default_node) { init_tree_optimization_optabs (opts);