[PATCH, PR tree-optimization/65002] Disable SRA for functions wrongly marked as read-only
Richard Biener
richard.guenther@gmail.com
Fri Feb 13 09:21:00 GMT 2015
On Fri, Feb 13, 2015 at 9:54 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Feb 13, 2015 at 09:47:56AM +0100, Richard Biener wrote:
>> > 2015-02-12 Ilya Enkovich <ilya.enkovich@intel.com>
>> >
>> > PR tree-optimization/65002
>> > * tree-cfg.c (pass_data_fixup_cfg): Don't update
>> > SSA on start.
>> > * tree-sra.c (some_callers_have_no_vuse_p): New.
>> > (ipa_early_sra): Reject functions whose callers
>> > assume funciton is read only.
>
> Typo, function.
>
>> > +static bool
>> > +some_callers_have_no_vuse_p (struct cgraph_node *node,
>> > + void *data ATTRIBUTE_UNUSED)
>> > +{
>> > + struct cgraph_edge *cs;
>> > + for (cs = node->callers; cs; cs = cs->next_caller)
>> > + if (!cs->call_stmt || !gimple_vuse (cs->call_stmt))
>> > + return true;
>> > +
>> > + return false;
>> > +}
>> > +
>> > /* Convert all callers of NODE. */
>> >
>> > static bool
>> > @@ -5116,6 +5130,15 @@ ipa_early_sra (void)
>> > goto simple_out;
>> > }
>> >
>> > + if (node->call_for_symbol_thunks_and_aliases
>> > + (some_callers_have_no_vuse_p, NULL, true))
>> > + {
>> > + if (dump_file)
>> > + fprintf (dump_file, "There are callers with no VUSE attached "
>> > + "to a call stmt.\n");
>> > + goto simple_out;
>> > + }
>> > +
>
> I wonder if this won't pessimize const functions that just get called with
> aggregate arguments passed by value, do those count as memory read or
> just as parameters?
They count as memory reads and thus cause a VUSE (similar to aggregate
returns causing a VDEF).
Richard.
> Jakub
More information about the Gcc-patches
mailing list