This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: -fstrict-aliasing fixes 1/5: propagate -fno-strict-aliasing in the inliner
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Dec 2015 03:35:50 +0100
- Subject: Re: -fstrict-aliasing fixes 1/5: propagate -fno-strict-aliasing in the inliner
- Authentication-results: sourceware.org; auth=none
- References: <20151130230539 dot GB30608 at kam dot mff dot cuni dot cz> <54F68D6B-CE30-4358-AAF8-E23FF99DBCAD at gmail dot com>
> > * ipa-inline-transform.c (inline_call): Drop -fstrict-aliasing when
> > inlining -fno-strict-aliasing into -fstrict-aliasing body.
> > * gcc.dg/lto/alias-1_0.c: New testcase.
> > * gcc.dg/lto/alias-1_1.c: New testcase.
> >Index: ipa-inline-transform.c
> >===================================================================
> >--- ipa-inline-transform.c (revision 231081)
> >+++ ipa-inline-transform.c (working copy)
> >@@ -322,6 +322,21 @@ inline_call (struct cgraph_edge *e, bool
> > if (DECL_FUNCTION_PERSONALITY (callee->decl))
> > DECL_FUNCTION_PERSONALITY (to->decl)
> > = DECL_FUNCTION_PERSONALITY (callee->decl);
> >+ if (!opt_for_fn (callee->decl, flag_strict_aliasing)
> >+ && opt_for_fn (to->decl, flag_strict_aliasing))
>
> Just curious why you don't handle the other way round?
After inlining, opt_for_fn of CALLEE will be ignored and will
become opt_for_fn of TO. Turning flag_strict_alising code to
!flag_strict_aliasing is safe, but not the other way around.
>
> >+ {
> >+ struct gcc_options opts = global_options;
> >+
> >+ cl_optimization_restore (&opts,
> >+ TREE_OPTIMIZATION (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (to->decl)));
> >+ opts.x_flag_strict_aliasing = false;
> >+ if (dump_file)
> >+ fprintf (dump_file, "Dropping flag_strict_aliasing on %s:%i\n",
> >+ to->name (), to->order);
>
> ISTR to have seen %s/%i for printing name and order in IPA, no?
Hmm, right, will update it.
> >+void link_error (void);
>
> Unused and unneeded forward decl?
Yep, I originally wanted to check that we optimize out the type punned code (we can)
but we don't seem to be able to do so. It is just a testcase and extra
declaration is harmless I guess.
Thanks!
Honza