diff mbox

Stream out default optimization nodes

Message ID 20141117183824.GA5137@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Nov. 17, 2014, 6:38 p.m. UTC
Hi,
this patch makes us to store default optimization node same way as we stream
target node.  This means that command line options given at compile time
prevail those given at linktime.  Previously we sort of combined both.

We still have a lot of flags that are global (i.e. not marked as Optimization)
but affect way how the unit is output.  Since I woul dlike to replace the old
option merging, I would like to add "Global" attribute to each of them in .opt
file and generate streaming code for them same way as we do for
optimization/target nodes.

This patch regtested/bootstrapped x86_64-linux and in ealrier tree also
ppc64-linux/ppc64-aix that do not work for me at the moment.
I alosuse it in my tree for some time and tested firefox/libreoffice builds

OK?
Honza

	* tree.c (free_lang_data_in_decl): Store default optimization node.

Comments

Richard Biener Nov. 17, 2014, 7:12 p.m. UTC | #1
On November 17, 2014 7:38:24 PM CET, Jan Hubicka <hubicka@ucw.cz> wrote:
>Hi,
>this patch makes us to store default optimization node same way as we
>stream
>target node.  This means that command line options given at compile
>time
>prevail those given at linktime.  Previously we sort of combined both.
>
>We still have a lot of flags that are global (i.e. not marked as
>Optimization)
>but affect way how the unit is output.  Since I woul dlike to replace
>the old
>option merging, I would like to add "Global" attribute to each of them
>in .opt
>file and generate streaming code for them same way as we do for
>optimization/target nodes.
>
>This patch regtested/bootstrapped x86_64-linux and in ealrier tree also
>ppc64-linux/ppc64-aix that do not work for me at the moment.
>I alosuse it in my tree for some time and tested firefox/libreoffice
>builds
>
>OK?

OK.

Thanks,
Richard.

>Honza
>
>	* tree.c (free_lang_data_in_decl): Store default optimization node.
>Index: tree.c
>===================================================================
>--- tree.c	(revision 217659)
>+++ tree.c	(working copy)
>@@ -5118,6 +5118,9 @@ free_lang_data_in_decl (tree decl)
> 	  if (!DECL_FUNCTION_SPECIFIC_TARGET (decl))
> 	    DECL_FUNCTION_SPECIFIC_TARGET (decl)
> 	      = target_option_default_node;
>+	  if (!DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl))
>+	    DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
>+	      = optimization_default_node;
> 	}
> 
>       /* DECL_SAVED_TREE holds the GENERIC representation for DECL.
H.J. Lu Nov. 18, 2014, 3:59 p.m. UTC | #2
On Mon, Nov 17, 2014 at 10:38 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch makes us to store default optimization node same way as we stream
> target node.  This means that command line options given at compile time
> prevail those given at linktime.  Previously we sort of combined both.
>
> We still have a lot of flags that are global (i.e. not marked as Optimization)
> but affect way how the unit is output.  Since I woul dlike to replace the old
> option merging, I would like to add "Global" attribute to each of them in .opt
> file and generate streaming code for them same way as we do for
> optimization/target nodes.
>
> This patch regtested/bootstrapped x86_64-linux and in ealrier tree also
> ppc64-linux/ppc64-aix that do not work for me at the moment.
> I alosuse it in my tree for some time and tested firefox/libreoffice builds
>
> OK?
> Honza
>
>         * tree.c (free_lang_data_in_decl): Store default optimization node.
> Index: tree.c
> ===================================================================
> --- tree.c      (revision 217659)
> +++ tree.c      (working copy)
> @@ -5118,6 +5118,9 @@ free_lang_data_in_decl (tree decl)
>           if (!DECL_FUNCTION_SPECIFIC_TARGET (decl))
>             DECL_FUNCTION_SPECIFIC_TARGET (decl)
>               = target_option_default_node;
> +         if (!DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl))
> +           DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
> +             = optimization_default_node;
>         }
>
>        /* DECL_SAVED_TREE holds the GENERIC representation for DECL.

I think one of your LTO streaming change breaks GCC LTO build:

https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00473.html

/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/xg++
-B/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/
-B/usr/5.0.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++
-B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
 -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
 -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
 -I/export/gnu/import/git/gcc-test-profiled/src-trunk/libstdc++-v3/libsupc++
-L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
  -g -O2 -flto=jobserver -frandom-seed=1 -fprofile-use -DIN_GCC
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE
-static-libstdc++ -static-libgcc  -o build/genmatch \
    build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a
build/errors.o build/vec.o build/hash-table.o
.././libiberty/libiberty.a
../../src-trunk/libcpp/lex.c: In function âend_directiveâ:
../../src-trunk/libcpp/lex.c:442:43: error:
â__builtin_ia32_pcmpestri128â needs isa option -m32 -msse4.2
       index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
                                           ^
make[7]: *** [/tmp/ccTC6Hk9.ltrans9.ltrans.o] Error 1
Jan Hubicka Nov. 18, 2014, 5:27 p.m. UTC | #3
> https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00473.html
> 
> /export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/xg++
> -B/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/
> -B/usr/5.0.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++
> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
>  -I/export/gnu/import/git/gcc-test-profiled/src-trunk/libstdc++-v3/libsupc++
> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>   -g -O2 -flto=jobserver -frandom-seed=1 -fprofile-use -DIN_GCC
> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
> -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE
> -static-libstdc++ -static-libgcc  -o build/genmatch \
>     build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a
> build/errors.o build/vec.o build/hash-table.o
> .././libiberty/libiberty.a
> ../../src-trunk/libcpp/lex.c: In function âend_directiveâ:
> ../../src-trunk/libcpp/lex.c:442:43: error:
> â__builtin_ia32_pcmpestri128â needs isa option -m32 -msse4.2
>        index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
>                                            ^
> make[7]: *** [/tmp/ccTC6Hk9.ltrans9.ltrans.o] Error 1

Indeed, it looks like the bug is that search_line_sse42 gets inlined int
end_directive that is compiled w/o SSE support.  Probably something that
happened previously, too, just led to compiling the function with
SSE4.2

I will need to setup -m32 LTO bootstrap enviornment...

Honza
H.J. Lu Nov. 18, 2014, 5:28 p.m. UTC | #4
On Tue, Nov 18, 2014 at 9:27 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00473.html
>>
>> /export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/xg++
>> -B/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/
>> -B/usr/5.0.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++
>> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
>> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
>>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
>>  -I/export/gnu/import/git/gcc-test-profiled/src-trunk/libstdc++-v3/libsupc++
>> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
>> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>>   -g -O2 -flto=jobserver -frandom-seed=1 -fprofile-use -DIN_GCC
>> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
>> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
>> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
>> -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE
>> -static-libstdc++ -static-libgcc  -o build/genmatch \
>>     build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a
>> build/errors.o build/vec.o build/hash-table.o
>> .././libiberty/libiberty.a
>> ../../src-trunk/libcpp/lex.c: In function âend_directiveâ:
>> ../../src-trunk/libcpp/lex.c:442:43: error:
>> â__builtin_ia32_pcmpestri128â needs isa option -m32 -msse4.2
>>        index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
>>                                            ^
>> make[7]: *** [/tmp/ccTC6Hk9.ltrans9.ltrans.o] Error 1
>
> Indeed, it looks like the bug is that search_line_sse42 gets inlined int
> end_directive that is compiled w/o SSE support.  Probably something that
> happened previously, too, just led to compiling the function with
> SSE4.2
>
> I will need to setup -m32 LTO bootstrap enviornment...
>

This is -m64 LTO, not -m32.
Jan Hubicka Nov. 18, 2014, 5:29 p.m. UTC | #5
> On Tue, Nov 18, 2014 at 9:27 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> >> https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00473.html
> >>
> >> /export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/xg++
> >> -B/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/
> >> -B/usr/5.0.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++
> >> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
> >> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
> >>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
> >>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
> >>  -I/export/gnu/import/git/gcc-test-profiled/src-trunk/libstdc++-v3/libsupc++
> >> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
> >> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
> >>   -g -O2 -flto=jobserver -frandom-seed=1 -fprofile-use -DIN_GCC
> >> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
> >> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
> >> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
> >> -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE
> >> -static-libstdc++ -static-libgcc  -o build/genmatch \
> >>     build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a
> >> build/errors.o build/vec.o build/hash-table.o
> >> .././libiberty/libiberty.a
> >> ../../src-trunk/libcpp/lex.c: In function âend_directiveâ:
> >> ../../src-trunk/libcpp/lex.c:442:43: error:
> >> â__builtin_ia32_pcmpestri128â needs isa option -m32 -msse4.2
> >>        index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
> >>                                            ^
> >> make[7]: *** [/tmp/ccTC6Hk9.ltrans9.ltrans.o] Error 1
> >
> > Indeed, it looks like the bug is that search_line_sse42 gets inlined int
> > end_directive that is compiled w/o SSE support.  Probably something that
> > happened previously, too, just led to compiling the function with
> > SSE4.2
> >
> > I will need to setup -m32 LTO bootstrap enviornment...
> >
> 
> This is -m64 LTO, not -m32.
OK then the message seems bogus, too.  I will try to reproduce it.

Honza
> 
> 
> -- 
> H.J.
H.J. Lu Nov. 19, 2014, 1:48 p.m. UTC | #6
On Tue, Nov 18, 2014 at 9:29 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On Tue, Nov 18, 2014 at 9:27 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> >> https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00473.html
>> >>
>> >> /export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/xg++
>> >> -B/export/gnu/import/git/gcc-test-profiled/bld/./prev-gcc/
>> >> -B/usr/5.0.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++
>> >> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
>> >> -B/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>> >>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
>> >>  -I/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
>> >>  -I/export/gnu/import/git/gcc-test-profiled/src-trunk/libstdc++-v3/libsupc++
>> >> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
>> >> -L/export/gnu/import/git/gcc-test-profiled/bld/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>> >>   -g -O2 -flto=jobserver -frandom-seed=1 -fprofile-use -DIN_GCC
>> >> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
>> >> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
>> >> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
>> >> -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE
>> >> -static-libstdc++ -static-libgcc  -o build/genmatch \
>> >>     build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a
>> >> build/errors.o build/vec.o build/hash-table.o
>> >> .././libiberty/libiberty.a
>> >> ../../src-trunk/libcpp/lex.c: In function âend_directiveâ:
>> >> ../../src-trunk/libcpp/lex.c:442:43: error:
>> >> â__builtin_ia32_pcmpestri128â needs isa option -m32 -msse4.2
>> >>        index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
>> >>                                            ^
>> >> make[7]: *** [/tmp/ccTC6Hk9.ltrans9.ltrans.o] Error 1
>> >
>> > Indeed, it looks like the bug is that search_line_sse42 gets inlined int
>> > end_directive that is compiled w/o SSE support.  Probably something that
>> > happened previously, too, just led to compiling the function with
>> > SSE4.2
>> >
>> > I will need to setup -m32 LTO bootstrap enviornment...
>> >
>>
>> This is -m64 LTO, not -m32.
> OK then the message seems bogus, too.  I will try to reproduce it.
>

I opened:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63963
diff mbox

Patch

Index: tree.c
===================================================================
--- tree.c	(revision 217659)
+++ tree.c	(working copy)
@@ -5118,6 +5118,9 @@  free_lang_data_in_decl (tree decl)
 	  if (!DECL_FUNCTION_SPECIFIC_TARGET (decl))
 	    DECL_FUNCTION_SPECIFIC_TARGET (decl)
 	      = target_option_default_node;
+	  if (!DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl))
+	    DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
+	      = optimization_default_node;
 	}
 
       /* DECL_SAVED_TREE holds the GENERIC representation for DECL.