This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR56888
- From: Richard Biener <rguenther at suse dot de>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Feb 2016 12:32:30 +0100 (CET)
- Subject: Re: [PATCH] Fix PR56888
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1602221342040 dot 31547 at t29 dot fhfr dot qr> <20160222125418 dot GI3017 at tucnak dot redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1602221356490 dot 31547 at t29 dot fhfr dot qr> <alpine dot LSU dot 2 dot 11 dot 1602221401430 dot 31547 at t29 dot fhfr dot qr> <20160223102809 dot GC43696 at kam dot mff dot cuni dot cz>
On Tue, 23 Feb 2016, Jan Hubicka wrote:
> >
> > Ok, so maybe a better question to symtab would be if there is an
> > actual definition for what __builtin_FOO will call. Not really
> > whether that definition is cfun. Of course all the fortify
> > always-inline wrappers should not count as such (just in case
> > the symtab code is confused about those).
>
> Also GNU extern inlines that are often used to deal special cases.
> >
> > So,
> >
> > bool symbol_table::have_definition (enum built_in_fn);
> >
> > ? Not sure how to best implement that either. asmname lookups are
> > expensive ...
>
> I am back from China trip, so i can handle you patch if you want.
>
> I see that by stopping the optimization on whole translation unit that
> defines memcpy/memset will solve the reachability issue I mentioned
> in previous mail, but also when LTOing stuff like Linux kernel, it will
> prevent the optimization on the whole program.
Yes, but I think it's reasonable to disable such transform if the
memcpy implementation is being optimized.
> I am not quite sure how to deal with the alwaysinline wrappers however,
> because there theoretically may contain memcpy/memset loops themselves.
It might be a non-issue as we are doing the transforms only after
inlining when those bodies should be gone and thus symtab shouldn't see
such implementation.
Better to double-check, of course. We'd want
#include <string.h>
int main()
{
int s[1204];
for (int i = 0; i < 1204; ++i)
s[i] = 0;
memset (s, 0, sizeof (s));
}
still be optimized as memset.
Richard.
> Honza
> >
> > Richard.
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)