This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Avoid global optimize flag checks in LTO
> On 7 July 2017 15:31:55 CEST, Jan Hubicka <hubicka@ucw.cz> wrote:
> >Hi,
> >this patch fixes some places where we check global optimize flag rather
> >than
> >doing it per-function. This makes optimization attribute work closer to
> >what one gets when passing the same flag at command line.
> >This requires to run IPA passes even with !optimize, but having fast
> >way through
> >which does mostly nothing except when it sees functions with optimize
> >attributes
> >set.
>
> Sounds gross.
Yep, supporting units compiled with different optimization flags is not
prettiest. But with LTO they are sad reality.
> >
> >Bootstrapped/regtested x86_64-linux, comitted.
> >
>
> >Index: ipa-visibility.c
> >===================================================================
> >--- ipa-visibility.c (revision 250021)
> >+++ ipa-visibility.c (working copy)
> >@@ -622,9 +622,12 @@ function_and_variable_visibility (bool w
> > int flags = flags_from_decl_or_type (node->decl);
> >
> > /* Optimize away PURE and CONST constructors and destructors. */
> >- if (optimize
> >+ if (node->analyzed
> >+ && (DECL_STATIC_CONSTRUCTOR (node->decl)
> >+ || DECL_STATIC_CONSTRUCTOR (node->decl))
>
> Typo DECL_STATIC_DESTRUCTOR
Oops, thanks! I will fix it shortly.
Honza
>
> thanks,