Hi,

On Mon, Feb 11 2019, Jan Hubicka wrote:
>> Hi.
>> 
>> IPA pure const should always construct ipa_reduced_postorder with
>> possibility to cross AVAIL_INTERPOSABLE boundary. The pass itself
>> can then properly stop propagation on these symbols.
>> 
>> The patch is pre-approved by Honza.
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>> 
>> Thanks,
>> Martin
>> 
>> gcc/ChangeLog:
>> 
>> 2019-02-08  Martin Liska  <mli...@suse.cz>
>> 
>>      PR ipa/89009
>>      * ipa-cp.c (build_toporder_info): Remove usage of a param.
>>      * ipa-inline.c (inline_small_functions): Likewise.
>>      * ipa-pure-const.c (propagate_pure_const): Likewise.
>>      (propagate_nothrow): Likewise.
>>      * ipa-reference.c (propagate): Likewise.
>>      * ipa-utils.c (struct searchc_env): Remove unused field.
>>      (searchc): Always search across AVAIL_INTERPOSABLE.
>>      (ipa_reduced_postorder): Always allow AVAIL_INTERPOSABLE as
>>      the only called IPA pure const can properly not propagate
>>      across interposable boundary.
>>      * ipa-utils.h (ipa_reduced_postorder): Remove param.
>> @@ -105,7 +104,7 @@ searchc (struct searchc_env* env, struct cgraph_node *v,
>>  
>>        if (w->aux
>>        && (avail > AVAIL_INTERPOSABLE
>> -          || (env->allow_overwritable && avail == AVAIL_INTERPOSABLE)))
>> +          || avail == AVAIL_INTERPOSABLE))

This looks a tad too mechanical, surely

   (avail > AVAIL_INTERPOSABLE || avail == AVAIL_INTERPOSABLE)

can be simplified into just one comparison :-)

>>      {
>>        w_info = (struct ipa_dfs_info *) w->aux;
>>        if (w_info->new_node)
>
> This optimizes >= AVAIL_INTERPOSABLE then, but for ipa-cp, ipa-inline,
> ipa-pure-const we do not want interposable calls to close SCC regions
> (because we can not propagate here). ipa-reference is more subtle -
> interposable calls close SCC regions IFF they are declared leaf.
>
> Can you, please, update ignore_edge_p of indiviual optimization passes
> this way? (I.e. for all but ipa-reference add aval <= AVAIL_INTERPOSABLE
> check for the availability of the target function and for ipa-reference
> test also leaf attribute?). 

At least IPA-CP does not have any ignore_edge_p... does it really need
any?  Such node can incur an extra iteration of the propagator over an
entire SCC, that is true, but is it worth adding a callback?  Are SCCs
with an interposable node common?

>
> In all those cases we also want to check that given optimization pass is
> enabled for both caller and callee.  In other cases we do not want to
> consider them part of SCCs as well.  It may make sense to do this as one
> change or I can do that incrementally.

Likewise.

Martin

Reply via email to