This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR58115
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, "gcc-patches\ at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 06 Jan 2014 19:16:57 +0000
- Subject: Re: [PATCH] Fix PR58115
- Authentication-results: sourceware.org; auth=none
- References: <DUB122-W8CEA24B3CD3CF0DE08FBAE4F70 at phx dot gbl> <87iotxv211 dot fsf at talisman dot default> <20140106103000 dot GG892 at tucnak dot redhat dot com> <f1eb6537-6c08-437c-9150-938fddf37d6e at email dot android dot com> <DUB122-W13171ACEDEEC745B906363E4B70 at phx dot gbl>
Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
>>
>> Jakub Jelinek <jakub@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);