Message ID | alpine.LNX.2.00.1009271117180.8982@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On 09/27/2010 05:25 PM, Richard Guenther wrote: > so I guess we should instead try to not push builtins to the global > scope. Like with > > Index: c-decl.c > =================================================================== > --- c-decl.c (revision 164591) > +++ c-decl.c (working copy) > @@ -1142,6 +1142,10 @@ pop_scope (void) > "inline function %q+D declared but never > defined", p); > DECL_EXTERNAL (p) = 1; > } > + else if (TREE_CODE (p) == FUNCTION_DECL > +&& DECL_BUILT_IN (p)) > + /* Do not put builtin functions into the outermost BLOCK. */ > + continue; > > goto common_symbol; > > > Joseph might have an idea here (I also see external_scope being used, > but I'm not sure what functions actually end up in that). > > Does the above help? > This change fixed the original regression. But it caused some new ICEs. Like Run cc1 under GDB: (gdb) set args -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase memcpy-chk-lib.c -auxbase memcpy-chk-lib -O3 -fomit-frame-pointer -o memcpy-chk-lib.s (gdb) r Starting program: /home/jie/sources/gcc/builds/build-arm-eabi.git/gcc/cc1 -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase memcpy-chk-lib.c -auxbase memcpy-chk-lib -O3 -fomit-frame-pointer -o memcpy-chk-lib.s Program received signal SIGSEGV, Segmentation fault. 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at ./gt-c-decl.h:92 (gdb) bt #0 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at ./gt-c-decl.h:92 #1 0x00000000004c3027 in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f40b90) at ./gt-c-decl.h:561 #2 0x00000000004c215f in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f43700) at ./gt-c-decl.h:370 #3 0x000000000084b4ff in gt_ggc_mx_cgraph_node (x_p=0x7ffff6f92000) at gtype-desc.c:524 #4 0x0000000000851920 in gt_ggc_m_P11cgraph_node4htab (x_p=0x7ffff6e9e930) at gtype-desc.c:2432 #5 0x00000000007e722f in ggc_mark_root_tab (rt=0x11afce0) at ../../../git/gcc/ggc-common.c:159 #6 0x00000000007e72cb in ggc_mark_roots () at ../../../git/gcc/ggc-common.c:178 #7 0x000000000059c45f in ggc_collect () at ../../../git/gcc/ggc-page.c:1950 #8 0x00000000008f74b9 in execute_todo (flags=2083) at ../../../git/gcc/passes.c:1306 #9 0x00000000008f7cef in execute_one_pass (pass=0x166c180) at ../../../git/gcc/passes.c:1592 #10 0x00000000008f7e1b in execute_pass_list (pass=0x166c180) at ../../../git/gcc/passes.c:1624 #11 0x00000000008f7e3c in execute_pass_list (pass=0x166bfa0) at ../../../git/gcc/passes.c:1625 #12 0x00000000008f7e3c in execute_pass_list (pass=0x166b640) at ../../../git/gcc/passes.c:1625 #13 0x0000000000a7e6e4 in tree_rest_of_compilation (fndecl=0x7ffff6f2af00) at ../../../git/gcc/tree-optimize.c:419 #14 0x0000000000cf1413 in cgraph_expand_function (node=0x7ffff6d952c0) at ../../../git/gcc/cgraphunit.c:1477 #15 0x0000000000cf16ab in cgraph_expand_all_functions () at ../../../git/gcc/cgraphunit.c:1556 #16 0x0000000000cf1cd0 in cgraph_optimize () at ../../../git/gcc/cgraphunit.c:1812 #17 0x0000000000cef817 in cgraph_finalize_compilation_unit () at ../../../git/gcc/cgraphunit.c:1020 #18 0x00000000004c044c in c_write_global_declarations () at ../../../git/gcc/c-decl.c:9748 #19 0x00000000009eb15f in compile_file () at ../../../git/gcc/toplev.c:967 #20 0x00000000009ed64a in do_compile () at ../../../git/gcc/toplev.c:2394 #21 0x00000000009ed718 in toplev_main (argc=12, argv=0x7fffffffe1b8) at ../../../git/gcc/toplev.c:2435 #22 0x0000000000593d8c in main (argc=12, argv=0x7fffffffe1b8) at ../../../git/gcc/main.c:36 (gdb) l 87 struct c_binding * xlimit = x; 88 while (ggc_test_and_set_mark (xlimit)) 89 xlimit = ((*xlimit).prev); 90 while (x != xlimit) 91 { 92 switch (TREE_CODE ((*x).decl) == LABEL_DECL) 93 { 94 case 0: 95 gt_ggc_m_9tree_node ((*x).u.type); 96 break; (gdb) p *x $1 = {u = {type = 0x0, label = 0x0}, decl = 0x0, id = 0x0, prev = 0x7ffff6f77210, shadowed = 0x0, depth = 0, invisible = 0, nested = 0, inner_comp = 0, in_struct = 0, locus = 0} (gdb)
On Mon, 27 Sep 2010, Jie Zhang wrote: > On 09/27/2010 05:25 PM, Richard Guenther wrote: > > so I guess we should instead try to not push builtins to the global > > scope. Like with > > > > Index: c-decl.c > > =================================================================== > > --- c-decl.c (revision 164591) > > +++ c-decl.c (working copy) > > @@ -1142,6 +1142,10 @@ pop_scope (void) > > "inline function %q+D declared but never > > defined", p); > > DECL_EXTERNAL (p) = 1; > > } > > + else if (TREE_CODE (p) == FUNCTION_DECL > > +&& DECL_BUILT_IN (p)) > > + /* Do not put builtin functions into the outermost BLOCK. */ > > + continue; > > > > goto common_symbol; > > > > > > Joseph might have an idea here (I also see external_scope being used, > > but I'm not sure what functions actually end up in that). > > > > Does the above help? > > > This change fixed the original regression. But it caused some new ICEs. Like > > Run cc1 under GDB: Hm, I will later look into this. Btw, as arm has vectorizing intrinsics it should better implement targetm.builtin_decl - that there is no LTO testcase using those builtins is no execuse for it to not do that ;) Richard. > (gdb) set args -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase > memcpy-chk-lib.c -auxbase memcpy-chk-lib -O3 -fomit-frame-pointer -o > memcpy-chk-lib.s > (gdb) r > Starting program: /home/jie/sources/gcc/builds/build-arm-eabi.git/gcc/cc1 > -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase memcpy-chk-lib.c -auxbase > memcpy-chk-lib -O3 -fomit-frame-pointer -o memcpy-chk-lib.s > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at > ./gt-c-decl.h:92 > (gdb) bt > #0 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at > ./gt-c-decl.h:92 > #1 0x00000000004c3027 in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f40b90) at > ./gt-c-decl.h:561 > #2 0x00000000004c215f in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f43700) at > ./gt-c-decl.h:370 > #3 0x000000000084b4ff in gt_ggc_mx_cgraph_node (x_p=0x7ffff6f92000) at > gtype-desc.c:524 > #4 0x0000000000851920 in gt_ggc_m_P11cgraph_node4htab (x_p=0x7ffff6e9e930) at > gtype-desc.c:2432 > #5 0x00000000007e722f in ggc_mark_root_tab (rt=0x11afce0) at > ../../../git/gcc/ggc-common.c:159 > #6 0x00000000007e72cb in ggc_mark_roots () at > ../../../git/gcc/ggc-common.c:178 > #7 0x000000000059c45f in ggc_collect () at ../../../git/gcc/ggc-page.c:1950 > #8 0x00000000008f74b9 in execute_todo (flags=2083) at > ../../../git/gcc/passes.c:1306 > #9 0x00000000008f7cef in execute_one_pass (pass=0x166c180) at > ../../../git/gcc/passes.c:1592 > #10 0x00000000008f7e1b in execute_pass_list (pass=0x166c180) at > ../../../git/gcc/passes.c:1624 > #11 0x00000000008f7e3c in execute_pass_list (pass=0x166bfa0) at > ../../../git/gcc/passes.c:1625 > #12 0x00000000008f7e3c in execute_pass_list (pass=0x166b640) at > ../../../git/gcc/passes.c:1625 > #13 0x0000000000a7e6e4 in tree_rest_of_compilation (fndecl=0x7ffff6f2af00) at > ../../../git/gcc/tree-optimize.c:419 > #14 0x0000000000cf1413 in cgraph_expand_function (node=0x7ffff6d952c0) at > ../../../git/gcc/cgraphunit.c:1477 > #15 0x0000000000cf16ab in cgraph_expand_all_functions () at > ../../../git/gcc/cgraphunit.c:1556 > #16 0x0000000000cf1cd0 in cgraph_optimize () at > ../../../git/gcc/cgraphunit.c:1812 > #17 0x0000000000cef817 in cgraph_finalize_compilation_unit () at > ../../../git/gcc/cgraphunit.c:1020 > #18 0x00000000004c044c in c_write_global_declarations () at > ../../../git/gcc/c-decl.c:9748 > #19 0x00000000009eb15f in compile_file () at ../../../git/gcc/toplev.c:967 > #20 0x00000000009ed64a in do_compile () at ../../../git/gcc/toplev.c:2394 > #21 0x00000000009ed718 in toplev_main (argc=12, argv=0x7fffffffe1b8) at > ../../../git/gcc/toplev.c:2435 > #22 0x0000000000593d8c in main (argc=12, argv=0x7fffffffe1b8) at > ../../../git/gcc/main.c:36 > (gdb) l > 87 struct c_binding * xlimit = x; > 88 while (ggc_test_and_set_mark (xlimit)) > 89 xlimit = ((*xlimit).prev); > 90 while (x != xlimit) > 91 { > 92 switch (TREE_CODE ((*x).decl) == LABEL_DECL) > 93 { > 94 case 0: > 95 gt_ggc_m_9tree_node ((*x).u.type); > 96 break; > (gdb) p *x > $1 = {u = {type = 0x0, label = 0x0}, decl = 0x0, id = 0x0, prev = > 0x7ffff6f77210, shadowed = 0x0, depth = 0, invisible = 0, nested = 0, > inner_comp = 0, in_struct = 0, locus = 0} > (gdb) > > >
On Mon, 27 Sep 2010, Richard Guenther wrote: > On Mon, 27 Sep 2010, Jie Zhang wrote: > > > On 09/27/2010 05:25 PM, Richard Guenther wrote: > > > so I guess we should instead try to not push builtins to the global > > > scope. Like with > > > > > > Index: c-decl.c > > > =================================================================== > > > --- c-decl.c (revision 164591) > > > +++ c-decl.c (working copy) > > > @@ -1142,6 +1142,10 @@ pop_scope (void) > > > "inline function %q+D declared but never > > > defined", p); > > > DECL_EXTERNAL (p) = 1; > > > } > > > + else if (TREE_CODE (p) == FUNCTION_DECL > > > +&& DECL_BUILT_IN (p)) > > > + /* Do not put builtin functions into the outermost BLOCK. */ > > > + continue; > > > > > > goto common_symbol; > > > > > > > > > Joseph might have an idea here (I also see external_scope being used, > > > but I'm not sure what functions actually end up in that). > > > > > > Does the above help? > > > > > This change fixed the original regression. But it caused some new ICEs. Like > > > > Run cc1 under GDB: > > Hm, I will later look into this. Btw, as arm has vectorizing intrinsics > it should better implement targetm.builtin_decl - that there is no > LTO testcase using those builtins is no execuse for it to not do that ;) It works on x86-64 if I comment its builtin_decl support with the single expected FAIL of gcc.dg/lto/20090206-1_0.c (which relies on proper target builtin streaming). So I think this is ineed an issue of the backend not properly keeping the builtins life if they are not used. Richard. > Richard. > > > (gdb) set args -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase > > memcpy-chk-lib.c -auxbase memcpy-chk-lib -O3 -fomit-frame-pointer -o > > memcpy-chk-lib.s > > (gdb) r > > Starting program: /home/jie/sources/gcc/builds/build-arm-eabi.git/gcc/cc1 > > -fpreprocessed memcpy-chk-lib.i -quiet -dumpbase memcpy-chk-lib.c -auxbase > > memcpy-chk-lib -O3 -fomit-frame-pointer -o memcpy-chk-lib.s > > > > Program received signal SIGSEGV, Segmentation fault. > > 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at > > ./gt-c-decl.h:92 > > (gdb) bt > > #0 0x00000000004c0931 in gt_ggc_mx_c_binding (x_p=0x7ffff6f771e0) at > > ./gt-c-decl.h:92 > > #1 0x00000000004c3027 in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f40b90) at > > ./gt-c-decl.h:561 > > #2 0x00000000004c215f in gt_ggc_mx_lang_tree_node (x_p=0x7ffff6f43700) at > > ./gt-c-decl.h:370 > > #3 0x000000000084b4ff in gt_ggc_mx_cgraph_node (x_p=0x7ffff6f92000) at > > gtype-desc.c:524 > > #4 0x0000000000851920 in gt_ggc_m_P11cgraph_node4htab (x_p=0x7ffff6e9e930) at > > gtype-desc.c:2432 > > #5 0x00000000007e722f in ggc_mark_root_tab (rt=0x11afce0) at > > ../../../git/gcc/ggc-common.c:159 > > #6 0x00000000007e72cb in ggc_mark_roots () at > > ../../../git/gcc/ggc-common.c:178 > > #7 0x000000000059c45f in ggc_collect () at ../../../git/gcc/ggc-page.c:1950 > > #8 0x00000000008f74b9 in execute_todo (flags=2083) at > > ../../../git/gcc/passes.c:1306 > > #9 0x00000000008f7cef in execute_one_pass (pass=0x166c180) at > > ../../../git/gcc/passes.c:1592 > > #10 0x00000000008f7e1b in execute_pass_list (pass=0x166c180) at > > ../../../git/gcc/passes.c:1624 > > #11 0x00000000008f7e3c in execute_pass_list (pass=0x166bfa0) at > > ../../../git/gcc/passes.c:1625 > > #12 0x00000000008f7e3c in execute_pass_list (pass=0x166b640) at > > ../../../git/gcc/passes.c:1625 > > #13 0x0000000000a7e6e4 in tree_rest_of_compilation (fndecl=0x7ffff6f2af00) at > > ../../../git/gcc/tree-optimize.c:419 > > #14 0x0000000000cf1413 in cgraph_expand_function (node=0x7ffff6d952c0) at > > ../../../git/gcc/cgraphunit.c:1477 > > #15 0x0000000000cf16ab in cgraph_expand_all_functions () at > > ../../../git/gcc/cgraphunit.c:1556 > > #16 0x0000000000cf1cd0 in cgraph_optimize () at > > ../../../git/gcc/cgraphunit.c:1812 > > #17 0x0000000000cef817 in cgraph_finalize_compilation_unit () at > > ../../../git/gcc/cgraphunit.c:1020 > > #18 0x00000000004c044c in c_write_global_declarations () at > > ../../../git/gcc/c-decl.c:9748 > > #19 0x00000000009eb15f in compile_file () at ../../../git/gcc/toplev.c:967 > > #20 0x00000000009ed64a in do_compile () at ../../../git/gcc/toplev.c:2394 > > #21 0x00000000009ed718 in toplev_main (argc=12, argv=0x7fffffffe1b8) at > > ../../../git/gcc/toplev.c:2435 > > #22 0x0000000000593d8c in main (argc=12, argv=0x7fffffffe1b8) at > > ../../../git/gcc/main.c:36 > > (gdb) l > > 87 struct c_binding * xlimit = x; > > 88 while (ggc_test_and_set_mark (xlimit)) > > 89 xlimit = ((*xlimit).prev); > > 90 while (x != xlimit) > > 91 { > > 92 switch (TREE_CODE ((*x).decl) == LABEL_DECL) > > 93 { > > 94 case 0: > > 95 gt_ggc_m_9tree_node ((*x).u.type); > > 96 break; > > (gdb) p *x > > $1 = {u = {type = 0x0, label = 0x0}, decl = 0x0, id = 0x0, prev = > > 0x7ffff6f77210, shadowed = 0x0, depth = 0, invisible = 0, nested = 0, > > inner_comp = 0, in_struct = 0, locus = 0} > > (gdb) > > > > > > > >
FYI: I am getting the gimple bytecode messages on my IA64 Linux and HP-UX platforms as well when running the testsuite. /proj/opensrc_nobackup/nightly2/src/trunk/gcc/testsuite/gcc.c-torture/compile/20000105-1.c:25:1: sorry, unimplemented: gimple bytecode streams do not support machine specific builtin functions on this target Steve Ellcey sje@cup.hp.com
On Mon, 27 Sep 2010, Steve Ellcey wrote: > FYI: I am getting the gimple bytecode messages on my IA64 Linux and > HP-UX platforms as well when running the testsuite. > > /proj/opensrc_nobackup/nightly2/src/trunk/gcc/testsuite/gcc.c-torture/compile/20000105-1.c:25:1: sorry, unimplemented: gimple bytecode streams do not support machine specific builtin functions on this target Yep, that's a known issue now. Really all targets with builtins need to implement targetm.builtin_decl for LTO to work for them. Richard.
Index: c-decl.c =================================================================== --- c-decl.c (revision 164591) +++ c-decl.c (working copy) @@ -1142,6 +1142,10 @@ pop_scope (void) "inline function %q+D declared but never defined", p); DECL_EXTERNAL (p) = 1; } + else if (TREE_CODE (p) == FUNCTION_DECL + && DECL_BUILT_IN (p)) + /* Do not put builtin functions into the outermost BLOCK. */ + continue; goto common_symbol;