This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR tree-optimization/65002] Disable SRA for functions wrongly marked as read-only
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Ilya Enkovich <enkovich dot gnu at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 13 Feb 2015 10:21:42 +0100
- Subject: Re: [PATCH, PR tree-optimization/65002] Disable SRA for functions wrongly marked as read-only
- Authentication-results: sourceware.org; auth=none
- References: <20150212141419 dot GA35812 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3eLkyD1qm7qxT2=j4JrunyPcBj2DFU=4gDWsazY7Kgkw at mail dot gmail dot com> <20150213085459 dot GH1746 at tucnak dot redhat dot com>
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