* Patch ping... @ 2005-06-20 19:37 Jan Hubicka 2005-06-20 22:42 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2005-06-20 19:37 UTC (permalink / raw) To: gcc-patches, rth Hi, There are two patches that apparently got suck.. fix to the -fdump-rtl-expand: http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02126.html and also the -fwhole-program patch: http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00267.html Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2005-06-20 19:37 Patch ping Jan Hubicka @ 2005-06-20 22:42 ` Richard Henderson 2005-06-21 8:34 ` Jan Hubicka 2005-06-23 12:40 ` Update RTL passes patch [was Re: Patch ping...] Paolo Bonzini 0 siblings, 2 replies; 504+ messages in thread From: Richard Henderson @ 2005-06-20 22:42 UTC (permalink / raw) To: Jan Hubicka; +Cc: gcc-patches On Mon, Jun 20, 2005 at 09:37:33PM +0200, Jan Hubicka wrote: > fix to the -fdump-rtl-expand: > http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02126.html Ok. > and also the -fwhole-program patch: > http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00267.html The documentation for -fwhole-program still mentions "used", instead of "externally_visible". Otherwise ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2005-06-20 22:42 ` Richard Henderson @ 2005-06-21 8:34 ` Jan Hubicka 2005-06-23 12:40 ` Update RTL passes patch [was Re: Patch ping...] Paolo Bonzini 1 sibling, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2005-06-21 8:34 UTC (permalink / raw) To: Richard Henderson, Jan Hubicka, gcc-patches > On Mon, Jun 20, 2005 at 09:37:33PM +0200, Jan Hubicka wrote: > > fix to the -fdump-rtl-expand: > > http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02126.html > > Ok. > > > and also the -fwhole-program patch: > > http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00267.html > > The documentation for -fwhole-program still mentions "used", > instead of "externally_visible". Fixed in my local copy, I will commit it from summit after testing. > > Otherwise ok. Thanks a lot! Honza > > > r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Update RTL passes patch [was Re: Patch ping...] 2005-06-20 22:42 ` Richard Henderson 2005-06-21 8:34 ` Jan Hubicka @ 2005-06-23 12:40 ` Paolo Bonzini 2005-06-26 21:51 ` Richard Henderson 1 sibling, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2005-06-23 12:40 UTC (permalink / raw) To: gcc-patches; +Cc: Richard Henderson, Jan Hubicka [-- Attachment #1: Type: text/plain, Size: 453 bytes --] Richard Henderson wrote: > On Mon, Jun 20, 2005 at 09:37:33PM +0200, Jan Hubicka wrote: > >>fix to the -fdump-rtl-expand: >>http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02126.html > > Ok. With this patch in, I can update the patch for using the pass manager in RTL passes, so that the code I move from tree-optimize.c to passes.c is exactly verbatim. Bootstrapped i686-pc-linux-gnu on top of Honza's patch, all languages, ok for mainline? Paolo [-- Attachment #2: rtl-passes-other-things.patch --] [-- Type: text/plain, Size: 17895 bytes --] 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * Makefile.in: Adjust dependencies for tree-pretty-print.c, cgraph.c, opts.c. * passes.c (finish_optimization_passes): Use dump_begin and dump_end, TDI_end. (gate_rest_of_compilation): New. (pass_rest_of_compilation): Use it. (gate_postreload, pass_postreload): New. * toplev.c (general_init): Rename init_tree_optimization_passes. * toplev.h (init_tree_optimization_passes): Rename to init_optimizations_passes. * tree-dump.c (dump_flag): Make static. (dump_files): Remove RTL dumps. * tree-optimize.c (pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures, pass_fixup_cfg): Make non-static. * tree-pretty-print.c: Include tree-pass.h. * cgraph.c: Include tree-dump.h. cp: 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (class.o, decl2.o): Adjust dependencies. * class.c: Include tree-dump.h. * decl2.c: Include tree-dump.h. java: 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (parse.o): Adjust dependencies. * parse.y: Include tree-dump.h. Index: passes.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/passes.c,v retrieving revision 2.90 diff -p -u -r2.90 passes.c --- passes.c 27 Apr 2005 21:35:20 -0000 2.90 +++ passes.c 18 May 2005 10:29:55 -0000 @@ -209,20 +213,25 @@ timevar_push (TV_DUMP); if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) { - open_dump_file (DFI_bp, NULL); + dump_file = dump_begin (pass_branch_prob.static_pass_number, NULL); end_branch_prob (); - close_dump_file (DFI_bp, NULL, NULL_RTX); + if (dump_file) + dump_end (pass_branch_prob.static_pass_number, dump_file); } - if (optimize > 0 && open_dump_file (DFI_combine, NULL)) + if (optimize > 0) { - dump_combine_total_stats (dump_file); - close_dump_file (DFI_combine, NULL, NULL_RTX); + dump_file = dump_begin (pass_combine.static_pass_number, NULL); + if (dump_file) + { + dump_combine_total_stats (dump_file); + dump_end (pass_combine.static_pass_number, dump_file); + } } /* Do whatever is necessary to finish printing the graphs. */ if (graph_dump_format != no_graph) - for (i = DFI_MIN; (dfi = get_dump_file_info (i)) != NULL; ++i) + for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i) if (dump_initialized_p (i) && (dfi->flags & TDF_RTL) != 0 && (name = get_dump_file_name (i)) != NULL) @@ -234,23 +243,53 @@ timevar_pop (TV_DUMP); } +static bool +gate_rest_of_compilation (void) +{ + /* Early return if there were errors. We can run afoul of our + consistency checks, and there's not really much point in fixing them. */ + return !(rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount); +} + struct tree_opt_pass pass_rest_of_compilation = { - NULL, /* name */ - NULL, /* gate */ - rest_of_compilation, /* execute */ + NULL, /* name */ + gate_rest_of_compilation, /* gate */ + NULL, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ TV_REST_OF_COMPILATION, /* tv_id */ - PROP_rtl, /* properties_required */ + PROP_rtl, /* properties_required */ 0, /* properties_provided */ - PROP_rtl, /* properties_destroyed */ + 0, /* properties_destroyed */ 0, /* todo_flags_start */ - TODO_ggc_collect, /* todo_flags_finish */ - 0 /* letter */ + TODO_ggc_collect, /* todo_flags_finish */ + 0 /* letter */ }; +static bool +gate_postreload (void) +{ + return reload_completed; +} + +struct tree_opt_pass pass_postreload = +{ + NULL, /* name */ + gate_postreload, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + PROP_rtl, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_ggc_collect, /* todo_flags_finish */ + 0 /* letter */ +}; /* The root of the compilation pass tree, once constructed. */ Index: toplev.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/toplev.c,v retrieving revision 1.954 diff -p -u -r1.954 toplev.c --- toplev.c 3 May 2005 17:55:38 -0000 1.954 +++ toplev.c 18 May 2005 10:30:36 -0000 @@ -1668,7 +1668,7 @@ general_init (const char *argv0) /* This must be done after add_params but before argument processing. */ init_ggc_heuristics(); - init_tree_optimization_passes (); + init_optimization_passes (); } /* Process the options that have been parsed. */ Index: toplev.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/toplev.h,v retrieving revision 1.134 diff -p -u -r1.134 toplev.h --- toplev.h 23 Apr 2005 21:27:56 -0000 1.134 +++ toplev.h 18 May 2005 10:30:36 -0000 @@ -77,7 +77,7 @@ extern void inform (const char *, ...) A extern void rest_of_decl_compilation (tree, int, int); extern void rest_of_type_compilation (tree, int); extern void tree_rest_of_compilation (tree); -extern void init_tree_optimization_passes (void); +extern void init_optimization_passes (void); extern void finish_optimization_passes (void); extern bool enable_rtl_dump_file (int); Index: tree-dump.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v retrieving revision 1.42 diff -p -u -r1.42 tree-dump.c --- tree-dump.c 13 May 2005 13:56:53 -0000 1.42 +++ tree-dump.c 18 May 2005 10:30:38 -0000 @@ -681,43 +683,6 @@ static struct dump_file_info dump_files[ {NULL, "ipa-all", NULL, TDF_IPA, 0, 0, 0}, { ".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 1, 0}, - - { ".sibling", "rtl-sibling", NULL, TDF_RTL, 0, 1, 'i'}, - { ".eh", "rtl-eh", NULL, TDF_RTL, 0, 2, 'h'}, - { ".jump", "rtl-jump", NULL, TDF_RTL, 0, 3, 'j'}, - { ".cse", "rtl-cse", NULL, TDF_RTL, 0, 4, 's'}, - { ".gcse", "rtl-gcse", NULL, TDF_RTL, 0, 5, 'G'}, - { ".loop", "rtl-loop", NULL, TDF_RTL, 0, 6, 'L'}, - { ".bypass", "rtl-bypass", NULL, TDF_RTL, 0, 7, 'G'}, - { ".cfg", "rtl-cfg", NULL, TDF_RTL, 0, 8, 'f'}, - { ".bp", "rtl-bp", NULL, TDF_RTL, 0, 9, 'b'}, - { ".vpt", "rtl-vpt", NULL, TDF_RTL, 0, 10, 'V'}, - { ".ce1", "rtl-ce1", NULL, TDF_RTL, 0, 11, 'C'}, - { ".tracer", "rtl-tracer", NULL, TDF_RTL, 0, 12, 'T'}, - { ".loop2", "rtl-loop2", NULL, TDF_RTL, 0, 13, 'L'}, - { ".web", "rtl-web", NULL, TDF_RTL, 0, 14, 'Z'}, - { ".cse2", "rtl-cse2", NULL, TDF_RTL, 0, 15, 't'}, - { ".life", "rtl-life", NULL, TDF_RTL, 0, 16, 'f'}, - { ".combine", "rtl-combine", NULL, TDF_RTL, 0, 17, 'c'}, - { ".ce2", "rtl-ce2", NULL, TDF_RTL, 0, 18, 'C'}, - { ".regmove", "rtl-regmove", NULL, TDF_RTL, 0, 19, 'N'}, - { ".sms", "rtl-sms", NULL, TDF_RTL, 0, 20, 'm'}, - { ".sched", "rtl-sched", NULL, TDF_RTL, 0, 21, 'S'}, - { ".lreg", "rtl-lreg", NULL, TDF_RTL, 0, 22, 'l'}, - { ".greg", "rtl-greg", NULL, TDF_RTL, 0, 23, 'g'}, - { ".postreload", "rtl-postreload", NULL, TDF_RTL, 0, 24, 'o'}, - { ".gcse2", "rtl-gcse2", NULL, TDF_RTL, 0, 25, 'J'}, - { ".flow2", "rtl-flow2", NULL, TDF_RTL, 0, 26, 'w'}, - { ".peephole2", "rtl-peephole2", NULL, TDF_RTL, 0, 27, 'z'}, - { ".ce3", "rtl-ce3", NULL, TDF_RTL, 0, 28, 'E'}, - { ".rnreg", "rtl-rnreg", NULL, TDF_RTL, 0, 29, 'n'}, - { ".bbro", "rtl-bbro", NULL, TDF_RTL, 0, 30, 'B'}, - { ".btl", "rtl-btl", NULL, TDF_RTL, 0, 31, 'd'}, - { ".sched2", "rtl-sched2", NULL, TDF_RTL, 0, 32, 'R'}, - { ".stack", "rtl-stack", NULL, TDF_RTL, 0, 33, 'k'}, - { ".vartrack", "rtl-vartrack", NULL, TDF_RTL, 0, 34, 'V'}, - { ".mach", "rtl-mach", NULL, TDF_RTL, 0, 35, 'M'}, - { ".dbr", "rtl-dbr", NULL, TDF_RTL, 0, 36, 'd'} }; /* Dynamically registered tree dump files and switches. */ Index: tree-optimize.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v retrieving revision 2.98 diff -p -u -r2.98 tree-optimize.c --- tree-optimize.c 17 May 2005 20:28:22 -0000 2.98 +++ tree-optimize.c 18 May 2005 10:30:39 -0000 @@ -68,7 +68,7 @@ gate_all_optimizations (void) && !(errorcount || sorrycount)); } -static struct tree_opt_pass pass_all_optimizations = +struct tree_opt_pass pass_all_optimizations = { NULL, /* name */ gate_all_optimizations, /* gate */ @@ -98,7 +98,7 @@ execute_cleanup_cfg_post_optimizing (voi group_case_labels (); } -static struct tree_opt_pass pass_cleanup_cfg_post_optimizing = +struct tree_opt_pass pass_cleanup_cfg_post_optimizing = { "final_cleanup", /* name */ NULL, /* gate */ @@ -142,7 +142,7 @@ execute_free_datastructures (void) delete_tree_cfg_annotations (); } -static struct tree_opt_pass pass_free_datastructures = +struct tree_opt_pass pass_free_datastructures = { NULL, /* name */ NULL, /* gate */ @@ -181,7 +181,7 @@ execute_fixup_cfg (void) cleanup_tree_cfg (); } -static struct tree_opt_pass pass_fixup_cfg = +struct tree_opt_pass pass_fixup_cfg = { NULL, /* name */ NULL, /* gate */ @@ -215,7 +215,7 @@ execute_init_datastructures (void) init_tree_ssa (); } -static struct tree_opt_pass pass_init_datastructures = +struct tree_opt_pass pass_init_datastructures = { NULL, /* name */ NULL, /* gate */ Index: cgraph.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v retrieving revision 1.71 --- cgraph.c 27 Apr 2005 08:35:49 -0000 1.71 +++ cgraph.c 19 May 2005 18:46:47 -0000 @@ -97,6 +97,7 @@ #include "output.h" #include "intl.h" #include "tree-gimple.h" +#include "tree-dump.h" static void cgraph_node_remove_callers (struct cgraph_node *node); static inline void cgraph_edge_remove_caller (struct cgraph_edge *e); Index: tree-pretty-print.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v retrieving revision 2.58 diff -p -u -r2.58 tree-pretty-print.c --- tree-pretty-print.c 04 May 2005 17:35:19 -0000 2.58 +++ tree-pretty-print.c 19 May 2005 18:29:11 -0000 @@ -32,6 +32,7 @@ #include "langhooks.h" #include "tree-iterator.h" #include "tree-chrec.h" +#include "tree-pass.h" /* Local functions, macros and variables. */ static int op_prio (tree); Index: opts.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/opts.c,v retrieving revision 1.113 diff -p -u -r1.113 opts.c --- opts.c 1 Jun 2005 07:02:17 -0000 1.113 +++ opts.c 7 Jun 2005 09:28:52 -0000 @@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - S #include "tm_p.h" /* For OPTIMIZATION_OPTIONS. */ #include "insn-attr.h" /* For INSN_SCHEDULING. */ #include "target.h" +#include "tree-pass.h" /* Value of the -G xx switch, and whether it was passed or not. */ unsigned HOST_WIDE_INT g_switch_value; Index: Makefile.in =================================================================== RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v retrieving revision 1.1486 diff -p -u -u -r1.1486 Makefile.in --- Makefile.in 17 May 2005 09:55:08 -0000 1.1486 +++ Makefile.in 18 May 2005 12:37:43 -0000 @@ -1908,7 +1908,7 @@ $(GGC_H) gt-tree-mudflap.h tree-pass.h toplev.h tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(DIAGNOSTIC_H) real.h $(HASHTAB_H) $(TREE_FLOW_H) \ - $(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h + $(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) \ $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) @@ -1923,7 +1923,7 @@ diagnostic.o : diagnostic.c $(CONFIG_H) opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(RTL_H) \ output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \ - $(FLAGS_H) $(PARAMS_H) + $(FLAGS_H) $(PARAMS_H) tree-pass.h targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) function.h output.h toplev.h \ $(MACHMODE_H) $(TARGET_DEF_H) $(TARGET_H) @@ -1944,7 +1944,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \ langhooks.h insn-flags.h $(CFGLAYOUT_H) real.h $(CFGLOOP_H) \ hosthooks.h $(CGRAPH_H) $(COVERAGE_H) tree-pass.h $(TREE_DUMP_H) \ - $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h + $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h tree-flow.h tree-inline.h main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h @@ -2067,7 +2068,7 @@ simplify-rtx.o : simplify-rtx.c $(CONFIG cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ langhooks.h toplev.h $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \ gt-cgraph.h output.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \ - tree-inline.h $(VARRAY_H) + tree-inline.h $(VARRAY_H) tree-dump.h cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h tree-inline.h toplev.h $(FLAGS_H) $(GGC_H) \ $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h function.h $(TREE_GIMPLE_H) \ Index: cp/Make-lang.in =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v retrieving revision 1.204 diff -p -u -r1.204 Make-lang.in --- cp/Make-lang.in 2 Jun 2005 17:52:07 -0000 1.204 +++ cp/Make-lang.in 7 Jun 2005 10:06:25 -0000 @@ -243,7 +243,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_ debug.h gt-cp-decl.h timevar.h $(TREE_FLOW_H) cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/decl.h $(EXPR_H) \ output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h \ - c-pragma.h + c-pragma.h $(TREE_DUMP_H) cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) c-common.h toplev.h langhooks.h \ $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h $(CXX_PRETTY_PRINT_H) \ @@ -253,7 +253,7 @@ cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) \ toplev.h diagnostic.h convert.h c-common.h cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \ - $(TARGET_H) convert.h $(CGRAPH_H) + $(TARGET_H) convert.h $(CGRAPH_H) $(TREE_DUMP_H) cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \ $(EXPR_H) diagnostic.h intl.h gt-cp-call.h convert.h target.h cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h \ Index: cp/class.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v retrieving revision 1.719 diff -p -u -r1.719 class.c --- cp/class.c 6 Jun 2005 14:18:04 -0000 1.719 +++ cp/class.c 7 Jun 2005 10:06:25 -0000 @@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA. */ #include "target.h" #include "convert.h" #include "cgraph.h" +#include "tree-dump.h" /* The number of nested classes being processed. If we are not in the scope of any class, this is zero. */ Index: cp/decl2.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v retrieving revision 1.785 diff -p -u -r1.785 decl2.c --- cp/decl2.c 6 Jun 2005 14:18:06 -0000 1.785 +++ cp/decl2.c 7 Jun 2005 10:06:26 -0000 @@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA. */ #include "cgraph.h" #include "tree-inline.h" #include "c-pragma.h" +#include "tree-dump.h" extern cpp_reader *parse_in; Index: java/Make-lang.in =================================================================== RCS file: /cvs/gcc/gcc/gcc/java/Make-lang.in,v retrieving revision 1.160 diff -p -u -r1.160 Make-lang.in --- java/Make-lang.in 1 Jun 2005 02:51:16 -0000 1.160 +++ java/Make-lang.in 7 Jun 2005 10:39:56 -0000 @@ -365,7 +365,8 @@ java/parse-scan.o: java/parse-scan.c $(C coretypes.h $(TM_H) toplev.h $(JAVA_LEX_C) java/parse.h java/lex.h input.h java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) function.h $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h \ - java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h target.h + java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h target.h \ + $(TREE_DUMP_H) # jcf-io.o needs $(ZLIBINC) added to cflags. java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ Index: java/parse.y =================================================================== RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v retrieving revision 1.537 diff -p -u -r1.537 parse.y --- java/parse.y 6 Jun 2005 19:31:35 -0000 1.537 +++ java/parse.y 7 Jun 2005 10:40:20 -0000 @@ -72,6 +72,7 @@ definitions and other extensions. */ #include "ggc.h" #include "debug.h" #include "tree-inline.h" +#include "tree-dump.h" #include "cgraph.h" #include "target.h" [-- Attachment #3: rtl-passes-move-stuff.patch --] [-- Type: text/plain, Size: 42170 bytes --] 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * cgraphunit.c (ipa_passes): Moved from tree-optimize.c. * passes.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list): Moved from tree-optimize.c. (init_optimization_passes): Moved from tree-optimize.c, adding the RTL optimizations. * tree-dump.h (dump_info_p, dump_flag): Moved from tree.h. * tree-optimize.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list, init_tree_optimization_passes, ipa_passes): Delete. * tree-pass.h (enum tree_dump_index): Moved from tree.h, removing the RTL dumps. (TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved from tree.h. (ipa_passes): Remove. (all_passes, all_ipa_passes, all_lowering_passes): Now extern. * tree.h (enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved to tree-pass.h. (dump_info_p, dump_flag): Moved to tree-dump.h. Index: cgraphunit.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v retrieving revision 1.107 diff -p -u -r1.107 cgraphunit.c --- cgraphunit.c 20 May 2005 08:05:07 -0000 1.107 +++ cgraphunit.c 25 May 2005 16:31:09 -0000 @@ -1089,6 +1089,16 @@ cgraph_preserve_function_body_p (tree de return false; } +static void +ipa_passes (void) +{ + cfun = NULL; + tree_register_cfg_hooks (); + bitmap_obstack_initialize (NULL); + execute_ipa_pass_list (all_ipa_passes); + bitmap_obstack_release (NULL); +} + /* Perform simple optimizations based on callgraph. */ void Index: passes.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/passes.c,v retrieving revision 2.90 diff -p -u -r2.90 passes.c --- passes.c 27 Apr 2005 21:35:20 -0000 2.90 +++ passes.c 18 May 2005 10:29:55 -0000 @@ -78,6 +78,8 @@ #include "opts.h" #include "coverage.h" #include "value-prof.h" +#include "tree-inline.h" +#include "tree-flow.h" #include "tree-pass.h" #include "tree-dump.h" @@ -98,6 +99,9 @@ declarations for e.g. AIX 4.x. */ #endif +/* Global variables used to communicate with passes. */ +int dump_flags; +bool in_gimple_form; /* This is called from various places for FUNCTION_DECL, VAR_DECL, @@ -254,3 +290,539 @@ 0 /* letter */ }; + + +/* The root of the compilation pass tree, once constructed. */ +struct tree_opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; + +/* Iterate over the pass tree allocating dump file numbers. We want + to do this depth first, and independent of whether the pass is + enabled or not. */ + +static void +register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int n) +{ + char *dot_name, *flag_name, *glob_name; + char num[10]; + + /* See below in next_pass_1. */ + num[0] = '\0'; + if (pass->static_pass_number != -1) + sprintf (num, "%d", ((int) pass->static_pass_number < 0 + ? 1 : pass->static_pass_number)); + + dot_name = concat (".", pass->name, num, NULL); + if (ipa) + { + flag_name = concat ("ipa-", pass->name, num, NULL); + glob_name = concat ("ipa-", pass->name, NULL); + /* First IPA dump is cgraph that is dumped via separate channels. */ + pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, + TDF_IPA, n + 1, 0); + } + else if (pass->properties_provided & PROP_trees) + { + flag_name = concat ("tree-", pass->name, num, NULL); + glob_name = concat ("tree-", pass->name, NULL); + pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, + TDF_TREE, n + TDI_tree_all, 0); + } + else + { + flag_name = concat ("rtl-", pass->name, num, NULL); + glob_name = concat ("rtl-", pass->name, NULL); + pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, + TDF_RTL, n, pass->letter); + } +} + +static int +register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties) +{ + static int n = 0; + do + { + int new_properties; + int pass_number; + + pass->properties_required = properties; + new_properties = + (properties | pass->properties_provided) & ~pass->properties_destroyed; + + /* Reset the counter when we reach RTL-based passes. */ + if ((new_properties ^ pass->properties_required) & PROP_rtl) + n = 0; + + pass_number = n; + if (pass->name) + n++; + + if (pass->sub) + new_properties = register_dump_files (pass->sub, ipa, new_properties); + + /* If we have a gate, combine the properties that we could have with + and without the pass being examined. */ + if (pass->gate) + properties &= new_properties; + else + properties = new_properties; + + pass->properties_provided = properties; + if (pass->name) + register_one_dump_file (pass, ipa, pass_number); + + pass = pass->next; + } + while (pass); + + return properties; +} + +/* Add a pass to the pass list. Duplicate the pass if it's already + in the list. */ + +static struct tree_opt_pass ** +next_pass_1 (struct tree_opt_pass **list, struct tree_opt_pass *pass) +{ + + /* A nonzero static_pass_number indicates that the + pass is already in the list. */ + if (pass->static_pass_number) + { + struct tree_opt_pass *new; + + new = xmalloc (sizeof (*new)); + memcpy (new, pass, sizeof (*new)); + + /* Indicate to register_dump_files that this pass has duplicates, + and so it should rename the dump file. The first instance will + be -1, and be number of duplicates = -static_pass_number - 1. + Subsequent instances will be > 0 and just the duplicate number. */ + if (pass->name) + { + pass->static_pass_number -= 1; + new->static_pass_number = -pass->static_pass_number; + } + + *list = new; + } + else + { + pass->static_pass_number = -1; + *list = pass; + } + + return &(*list)->next; + +} + +/* Construct the pass tree. */ + +void +init_optimization_passes (void) +{ + struct tree_opt_pass **p; + +#define NEXT_PASS(PASS) (p = next_pass_1 (p, &PASS)) + /* Intraprocedural optimization passes. */ + p = &all_ipa_passes; + NEXT_PASS (pass_ipa_inline); + *p = NULL; + + /* All passes needed to lower the function into shape optimizers can operate + on. These passes are performed before interprocedural passes, unlike rest + of local passes (all_passes). */ + p = &all_lowering_passes; + NEXT_PASS (pass_remove_useless_stmts); + NEXT_PASS (pass_mudflap_1); + NEXT_PASS (pass_lower_cf); + NEXT_PASS (pass_lower_eh); + NEXT_PASS (pass_build_cfg); + NEXT_PASS (pass_lower_complex_O0); + NEXT_PASS (pass_lower_vector); + NEXT_PASS (pass_warn_function_return); + NEXT_PASS (pass_tree_profile); + *p = NULL; + + p = &all_passes; + NEXT_PASS (pass_fixup_cfg); + NEXT_PASS (pass_init_datastructures); + NEXT_PASS (pass_all_optimizations); + NEXT_PASS (pass_warn_function_noreturn); + NEXT_PASS (pass_mudflap_2); + NEXT_PASS (pass_free_datastructures); + NEXT_PASS (pass_expand); + NEXT_PASS (pass_rest_of_compilation); + NEXT_PASS (pass_clean_state); + *p = NULL; + + p = &pass_all_optimizations.sub; + NEXT_PASS (pass_referenced_vars); + NEXT_PASS (pass_create_structure_vars); + NEXT_PASS (pass_build_ssa); + NEXT_PASS (pass_build_pta); + NEXT_PASS (pass_may_alias); + NEXT_PASS (pass_del_pta); + NEXT_PASS (pass_rename_ssa_copies); + NEXT_PASS (pass_early_warn_uninitialized); + + /* Initial scalar cleanups. */ + NEXT_PASS (pass_ccp); + NEXT_PASS (pass_fre); + NEXT_PASS (pass_dce); + NEXT_PASS (pass_forwprop); + NEXT_PASS (pass_vrp); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_dce); + NEXT_PASS (pass_merge_phi); + NEXT_PASS (pass_dominator); + + NEXT_PASS (pass_phiopt); + NEXT_PASS (pass_build_pta); + NEXT_PASS (pass_may_alias); + NEXT_PASS (pass_del_pta); + NEXT_PASS (pass_tail_recursion); + NEXT_PASS (pass_profile); + NEXT_PASS (pass_ch); + NEXT_PASS (pass_stdarg); + NEXT_PASS (pass_lower_complex); + NEXT_PASS (pass_sra); + /* FIXME: SRA may generate arbitrary gimple code, exposing new + aliased and call-clobbered variables. As mentioned below, + pass_may_alias should be a TODO item. */ + NEXT_PASS (pass_may_alias); + NEXT_PASS (pass_rename_ssa_copies); + NEXT_PASS (pass_dominator); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_dce); + NEXT_PASS (pass_dse); + NEXT_PASS (pass_may_alias); + NEXT_PASS (pass_forwprop); + NEXT_PASS (pass_phiopt); + NEXT_PASS (pass_store_ccp); + NEXT_PASS (pass_store_copy_prop); + NEXT_PASS (pass_fold_builtins); + /* FIXME: May alias should a TODO but for 4.0.0, + we add may_alias right after fold builtins + which can create arbitrary GIMPLE. */ + NEXT_PASS (pass_may_alias); + NEXT_PASS (pass_cse_reciprocals); + NEXT_PASS (pass_split_crit_edges); + NEXT_PASS (pass_reassoc); + NEXT_PASS (pass_pre); + NEXT_PASS (pass_sink_code); + NEXT_PASS (pass_loop); + NEXT_PASS (pass_dominator); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_cd_dce); + + /* FIXME: If DCE is not run before checking for uninitialized uses, + we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). + However, this also causes us to misdiagnose cases that should be + real warnings (e.g., testsuite/gcc.dg/pr18501.c). + + To fix the false positives in uninit-5.c, we would have to + account for the predicates protecting the set and the use of each + variable. Using a representation like Gated Single Assignment + may help. */ + NEXT_PASS (pass_late_warn_uninitialized); + NEXT_PASS (pass_dse); + NEXT_PASS (pass_forwprop); + NEXT_PASS (pass_phiopt); + NEXT_PASS (pass_tail_calls); + NEXT_PASS (pass_rename_ssa_copies); + NEXT_PASS (pass_uncprop); + NEXT_PASS (pass_del_ssa); + NEXT_PASS (pass_nrv); + NEXT_PASS (pass_remove_useless_vars); + NEXT_PASS (pass_mark_used_blocks); + NEXT_PASS (pass_cleanup_cfg_post_optimizing); + *p = NULL; + + p = &pass_loop.sub; + NEXT_PASS (pass_loop_init); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_lim); + NEXT_PASS (pass_unswitch); + NEXT_PASS (pass_scev_cprop); + NEXT_PASS (pass_record_bounds); + NEXT_PASS (pass_linear_transform); + NEXT_PASS (pass_iv_canon); + NEXT_PASS (pass_if_conversion); + NEXT_PASS (pass_vectorize); + /* NEXT_PASS (pass_may_alias) cannot be done again because the + vectorizer creates alias relations that are not supported by + pass_may_alias. */ + NEXT_PASS (pass_lower_vector_ssa); + NEXT_PASS (pass_complete_unroll); + NEXT_PASS (pass_iv_optimize); + NEXT_PASS (pass_loop_done); + *p = NULL; + + p = &pass_rest_of_compilation.sub; + NEXT_PASS (pass_remove_unnecessary_notes); + NEXT_PASS (pass_init_function); + NEXT_PASS (pass_jump); + NEXT_PASS (pass_insn_locators_initialize); + NEXT_PASS (pass_rtl_eh); + NEXT_PASS (pass_initial_value_sets); + NEXT_PASS (pass_unshare_all_rtl); + NEXT_PASS (pass_instantiate_virtual_regs); + NEXT_PASS (pass_jump2); + NEXT_PASS (pass_cse); + NEXT_PASS (pass_gcse); + NEXT_PASS (pass_loop_optimize); + NEXT_PASS (pass_jump_bypass); + NEXT_PASS (pass_cfg); + NEXT_PASS (pass_profiling); + NEXT_PASS (pass_rtl_ifcvt); + NEXT_PASS (pass_tracer); + NEXT_PASS (pass_loop2); + NEXT_PASS (pass_web); + NEXT_PASS (pass_cse2); + NEXT_PASS (pass_life); + NEXT_PASS (pass_combine); + NEXT_PASS (pass_if_after_combine); + NEXT_PASS (pass_partition_blocks); + NEXT_PASS (pass_regmove); + NEXT_PASS (pass_split_all_insns); + NEXT_PASS (pass_mode_switching); + NEXT_PASS (pass_recompute_reg_usage); + NEXT_PASS (pass_sms); + NEXT_PASS (pass_sched); + NEXT_PASS (pass_local_alloc); + NEXT_PASS (pass_global_alloc); + NEXT_PASS (pass_postreload); + *p = NULL; + + p = &pass_profiling.sub; + NEXT_PASS (pass_branch_prob); + NEXT_PASS (pass_value_profile_transformations); + NEXT_PASS (pass_remove_death_notes); + *p = NULL; + + p = &pass_postreload.sub; + NEXT_PASS (pass_postreload_cse); + NEXT_PASS (pass_gcse2); + NEXT_PASS (pass_flow2); + NEXT_PASS (pass_stack_adjustments); + NEXT_PASS (pass_peephole2); + NEXT_PASS (pass_if_after_reload); + NEXT_PASS (pass_regrename); + NEXT_PASS (pass_reorder_blocks); + NEXT_PASS (pass_branch_target_load_optimize); + NEXT_PASS (pass_leaf_regs); + NEXT_PASS (pass_sched2); + NEXT_PASS (pass_split_before_regstack); + NEXT_PASS (pass_stack_regs); + NEXT_PASS (pass_compute_alignments); + NEXT_PASS (pass_duplicate_computed_gotos); + NEXT_PASS (pass_variable_tracking); + NEXT_PASS (pass_free_cfg); + NEXT_PASS (pass_machine_reorg); + NEXT_PASS (pass_purge_lineno_notes); + NEXT_PASS (pass_cleanup_barriers); + NEXT_PASS (pass_delay_slots); + NEXT_PASS (pass_split_for_shorten_branches); + NEXT_PASS (pass_convert_to_eh_region_ranges); + NEXT_PASS (pass_shorten_branches); + NEXT_PASS (pass_set_nothrow_function_flags); + NEXT_PASS (pass_final); + *p = NULL; + +#undef NEXT_PASS + + /* Register the passes with the tree dump code. */ + register_dump_files (all_lowering_passes, false, PROP_gimple_any); + register_dump_files (all_passes, false, PROP_gimple_leh + | PROP_cfg); + register_dump_files (all_ipa_passes, true, PROP_gimple_leh + | PROP_cfg); +} + +static unsigned int last_verified; + +static void +execute_todo (struct tree_opt_pass *pass, unsigned int flags, bool use_required) +{ + int properties + = use_required ? pass->properties_required : pass->properties_provided; + +#if defined ENABLE_CHECKING + if (need_ssa_update_p ()) + gcc_assert (flags & TODO_update_ssa_any); +#endif + + if (flags & TODO_update_ssa_any) + { + unsigned update_flags = flags & TODO_update_ssa_any; + update_ssa (update_flags); + } + + if (flags & TODO_cleanup_cfg) + { + if (current_loops) + cleanup_tree_cfg_loop (); + else + cleanup_tree_cfg (); + } + + if ((flags & TODO_dump_func) + && dump_file && current_function_decl) + { + if (properties & PROP_trees) + dump_function_to_file (current_function_decl, + dump_file, dump_flags); + else if (properties & PROP_cfg) + print_rtl_with_bb (dump_file, get_insns ()); + else + print_rtl (dump_file, get_insns ()); + + /* Flush the file. If verification fails, we won't be able to + close the file before aborting. */ + fflush (dump_file); + } + if ((flags & TODO_dump_cgraph) + && dump_file && !current_function_decl) + { + dump_cgraph (dump_file); + /* Flush the file. If verification fails, we won't be able to + close the file before aborting. */ + fflush (dump_file); + } + + if (flags & TODO_ggc_collect) + { + ggc_collect (); + } + +#if defined ENABLE_CHECKING + if ((pass->properties_required & PROP_ssa) + && !(pass->properties_destroyed & PROP_ssa)) + verify_ssa (true); + if (flags & TODO_verify_flow) + verify_flow_info (); + if (flags & TODO_verify_stmts) + verify_stmts (); + if (flags & TODO_verify_loops) + verify_loop_closed_ssa (); +#endif +} + +static bool +execute_one_pass (struct tree_opt_pass *pass) +{ + unsigned int todo; + + /* See if we're supposed to run this pass. */ + if (pass->gate && !pass->gate ()) + return false; + + /* Note that the folders should only create gimple expressions. + This is a hack until the new folder is ready. */ + in_gimple_form = (pass->properties_provided & PROP_trees) != 0; + + /* Run pre-pass verification. */ + todo = pass->todo_flags_start & ~last_verified; + if (todo) + execute_todo (pass, todo, true); + + /* If a dump file name is present, open it if enabled. */ + if (pass->static_pass_number != -1) + { + bool initializing_dump = !dump_initialized_p (pass->static_pass_number); + dump_file_name = get_dump_file_name (pass->static_pass_number); + dump_file = dump_begin (pass->static_pass_number, &dump_flags); + if (dump_file && current_function_decl) + { + const char *dname, *aname; + dname = lang_hooks.decl_printable_name (current_function_decl, 2); + aname = (IDENTIFIER_POINTER + (DECL_ASSEMBLER_NAME (current_function_decl))); + fprintf (dump_file, "\n;; Function %s (%s)%s\n\n", dname, aname, + cfun->function_frequency == FUNCTION_FREQUENCY_HOT + ? " (hot)" + : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED + ? " (unlikely executed)" + : ""); + } + + if (initializing_dump + && graph_dump_format != no_graph + && (pass->properties_provided & (PROP_cfg | PROP_rtl)) + == (PROP_cfg | PROP_rtl)) + clean_graph_dump_file (dump_file_name); + } + + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + + /* Do it! */ + if (pass->execute) + pass->execute (); + + /* Stop timevar. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); + + /* Run post-pass cleanup and verification. */ + todo = pass->todo_flags_finish; + last_verified = todo & TODO_verify_all; + if (todo) + execute_todo (pass, todo, false); + + /* Flush and close dump file. */ + if (dump_file_name) + { + free ((char *) dump_file_name); + dump_file_name = NULL; + } + if (dump_file) + { + dump_end (pass->static_pass_number, dump_file); + dump_file = NULL; + } + + return true; +} + +void +execute_pass_list (struct tree_opt_pass *pass) +{ + do + { + if (execute_one_pass (pass) && pass->sub) + execute_pass_list (pass->sub); + pass = pass->next; + } + while (pass); +} + +/* Same as execute_pass_list but assume that subpasses of IPA passes + are local passes. */ +void +execute_ipa_pass_list (struct tree_opt_pass *pass) +{ + do + { + if (execute_one_pass (pass) && pass->sub) + { + struct cgraph_node *node; + for (node = cgraph_nodes; node; node = node->next) + if (node->analyzed) + { + push_cfun (DECL_STRUCT_FUNCTION (node->decl)); + current_function_decl = node->decl; + execute_pass_list (pass); + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + current_function_decl = NULL; + pop_cfun (); + ggc_collect (); + } + } + pass = pass->next; + } + while (pass); +} Index: tree-dump.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-dump.h,v retrieving revision 1.10 diff -p -u -r1.10 tree-dump.h --- tree-dump.h 15 Feb 2005 15:53:47 -0000 1.10 +++ tree-dump.h 7 Jun 2005 10:17:12 -0000 @@ -23,6 +23,9 @@ Software Foundation, 59 Temple Place - S #define GCC_TREE_DUMP_H #include "splay-tree.h" +#include "tree-pass.h" + +typedef struct dump_info *dump_info_p; /* Flags used with queue functions. */ #define DUMP_NONE 0 @@ -87,6 +90,7 @@ extern void queue_and_dump_index (dump_i extern void queue_and_dump_type (dump_info_p, tree); extern void dump_function (enum tree_dump_index, tree); extern void dump_function_to_file (tree, FILE *, int); +extern int dump_flag (dump_info_p, int, tree); extern unsigned int dump_register (const char *, const char *, const char *, int, unsigned int, int); Index: tree-optimize.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v retrieving revision 2.98 diff -p -u -r2.98 tree-optimize.c --- tree-optimize.c 17 May 2005 20:28:22 -0000 2.98 +++ tree-optimize.c 18 May 2005 10:30:39 -0000 @@ -51,13 +51,6 @@ #include "cfgloop.h" #include "except.h" -/* Global variables used to communicate with passes. */ -int dump_flags; -bool in_gimple_form; - -/* The root of the compilation pass tree, once constructed. */ -static struct tree_opt_pass *all_passes, *all_ipa_passes, * all_lowering_passes; - /* Gate: execute, or not, all of the non-trivial optimizations. */ static bool @@ -232,469 +244,7 @@ static struct tree_opt_pass pass_init_da 0 /* letter */ }; -/* Iterate over the pass tree allocating dump file numbers. We want - to do this depth first, and independent of whether the pass is - enabled or not. */ - -static void -register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int n) -{ - char *dot_name, *flag_name, *glob_name; - char num[10]; - - /* See below in next_pass_1. */ - num[0] = '\0'; - if (pass->static_pass_number != -1) - sprintf (num, "%d", ((int) pass->static_pass_number < 0 - ? 1 : pass->static_pass_number)); - - dot_name = concat (".", pass->name, num, NULL); - if (ipa) - { - flag_name = concat ("ipa-", pass->name, num, NULL); - glob_name = concat ("ipa-", pass->name, NULL); - /* First IPA dump is cgraph that is dumped via separate channels. */ - pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, - TDF_IPA, n + 1, 0); - } - else if (pass->properties_provided & PROP_trees) - { - flag_name = concat ("tree-", pass->name, num, NULL); - glob_name = concat ("tree-", pass->name, NULL); - pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, - TDF_TREE, n + TDI_tree_all, 0); - } - else - { - flag_name = concat ("rtl-", pass->name, num, NULL); - glob_name = concat ("rtl-", pass->name, NULL); - pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, - TDF_RTL, n, pass->letter); - } -} - -static int -register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties) -{ - static int n = 0; - do - { - int new_properties; - int pass_number; - - pass->properties_required = properties; - new_properties = - (properties | pass->properties_provided) & ~pass->properties_destroyed; - - /* Reset the counter when we reach RTL-based passes. */ - if ((pass->properties_provided ^ pass->properties_required) & PROP_rtl) - n = 0; - - pass_number = n; - if (pass->name) - n++; - - if (pass->sub) - new_properties = register_dump_files (pass->sub, ipa, new_properties); - - /* If we have a gate, combine the properties that we could have with - and without the pass being examined. */ - if (pass->gate) - properties &= new_properties; - else - properties = new_properties; - - pass->properties_provided = properties; - if (pass->name) - register_one_dump_file (pass, ipa, pass_number); - - pass = pass->next; - } - while (pass); - - return properties; -} - -/* Add a pass to the pass list. Duplicate the pass if it's already - in the list. */ - -static struct tree_opt_pass ** -next_pass_1 (struct tree_opt_pass **list, struct tree_opt_pass *pass) -{ - - /* A nonzero static_pass_number indicates that the - pass is already in the list. */ - if (pass->static_pass_number) - { - struct tree_opt_pass *new; - - new = xmalloc (sizeof (*new)); - memcpy (new, pass, sizeof (*new)); - - /* Indicate to register_dump_files that this pass has duplicates, - and so it should rename the dump file. The first instance will - be -1, and be number of duplicates = -static_pass_number - 1. - Subsequent instances will be > 0 and just the duplicate number. */ - if (pass->name) - { - pass->static_pass_number -= 1; - new->static_pass_number = -pass->static_pass_number; - } - - *list = new; - } - else - { - pass->static_pass_number = -1; - *list = pass; - } - - return &(*list)->next; - -} - -/* Construct the pass tree. */ - -void -init_tree_optimization_passes (void) -{ - struct tree_opt_pass **p; - -#define NEXT_PASS(PASS) (p = next_pass_1 (p, &PASS)) - /* Intraprocedural optimization passes. */ - p = &all_ipa_passes; - NEXT_PASS (pass_ipa_inline); - *p = NULL; - - /* All passes needed to lower the function into shape optimizers can operate - on. These passes are performed before interprocedural passes, unlike rest - of local passes (all_passes). */ - p = &all_lowering_passes; - NEXT_PASS (pass_remove_useless_stmts); - NEXT_PASS (pass_mudflap_1); - NEXT_PASS (pass_lower_cf); - NEXT_PASS (pass_lower_eh); - NEXT_PASS (pass_build_cfg); - NEXT_PASS (pass_lower_complex_O0); - NEXT_PASS (pass_lower_vector); - NEXT_PASS (pass_warn_function_return); - NEXT_PASS (pass_tree_profile); - *p = NULL; - - p = &all_passes; - NEXT_PASS (pass_fixup_cfg); - NEXT_PASS (pass_init_datastructures); - NEXT_PASS (pass_all_optimizations); - NEXT_PASS (pass_warn_function_noreturn); - NEXT_PASS (pass_mudflap_2); - NEXT_PASS (pass_free_datastructures); - NEXT_PASS (pass_expand); - NEXT_PASS (pass_rest_of_compilation); - *p = NULL; - - p = &pass_all_optimizations.sub; - NEXT_PASS (pass_referenced_vars); - NEXT_PASS (pass_create_structure_vars); - NEXT_PASS (pass_build_ssa); - NEXT_PASS (pass_build_pta); - NEXT_PASS (pass_may_alias); - NEXT_PASS (pass_del_pta); - NEXT_PASS (pass_rename_ssa_copies); - NEXT_PASS (pass_early_warn_uninitialized); - - /* Initial scalar cleanups. */ - NEXT_PASS (pass_ccp); - NEXT_PASS (pass_fre); - NEXT_PASS (pass_dce); - NEXT_PASS (pass_forwprop); - NEXT_PASS (pass_vrp); - NEXT_PASS (pass_copy_prop); - NEXT_PASS (pass_dce); - NEXT_PASS (pass_merge_phi); - NEXT_PASS (pass_dominator); - - NEXT_PASS (pass_phiopt); - NEXT_PASS (pass_build_pta); - NEXT_PASS (pass_may_alias); - NEXT_PASS (pass_del_pta); - NEXT_PASS (pass_tail_recursion); - NEXT_PASS (pass_profile); - NEXT_PASS (pass_ch); - NEXT_PASS (pass_stdarg); - NEXT_PASS (pass_lower_complex); - NEXT_PASS (pass_sra); - /* FIXME: SRA may generate arbitrary gimple code, exposing new - aliased and call-clobbered variables. As mentioned below, - pass_may_alias should be a TODO item. */ - NEXT_PASS (pass_may_alias); - NEXT_PASS (pass_rename_ssa_copies); - NEXT_PASS (pass_dominator); - NEXT_PASS (pass_copy_prop); - NEXT_PASS (pass_dce); - NEXT_PASS (pass_dse); - NEXT_PASS (pass_may_alias); - NEXT_PASS (pass_forwprop); - NEXT_PASS (pass_phiopt); - NEXT_PASS (pass_store_ccp); - NEXT_PASS (pass_store_copy_prop); - NEXT_PASS (pass_fold_builtins); - /* FIXME: May alias should a TODO but for 4.0.0, - we add may_alias right after fold builtins - which can create arbitrary GIMPLE. */ - NEXT_PASS (pass_may_alias); - NEXT_PASS (pass_cse_reciprocals); - NEXT_PASS (pass_split_crit_edges); - NEXT_PASS (pass_reassoc); - NEXT_PASS (pass_pre); - NEXT_PASS (pass_sink_code); - NEXT_PASS (pass_loop); - NEXT_PASS (pass_dominator); - NEXT_PASS (pass_copy_prop); - NEXT_PASS (pass_cd_dce); - /* FIXME: If DCE is not run before checking for uninitialized uses, - we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). - However, this also causes us to misdiagnose cases that should be - real warnings (e.g., testsuite/gcc.dg/pr18501.c). - - To fix the false positives in uninit-5.c, we would have to - account for the predicates protecting the set and the use of each - variable. Using a representation like Gated Single Assignment - may help. */ - NEXT_PASS (pass_late_warn_uninitialized); - NEXT_PASS (pass_dse); - NEXT_PASS (pass_forwprop); - NEXT_PASS (pass_phiopt); - NEXT_PASS (pass_tail_calls); - NEXT_PASS (pass_rename_ssa_copies); - NEXT_PASS (pass_uncprop); - NEXT_PASS (pass_del_ssa); - NEXT_PASS (pass_nrv); - NEXT_PASS (pass_remove_useless_vars); - NEXT_PASS (pass_mark_used_blocks); - NEXT_PASS (pass_cleanup_cfg_post_optimizing); - *p = NULL; - - p = &pass_loop.sub; - NEXT_PASS (pass_loop_init); - NEXT_PASS (pass_copy_prop); - NEXT_PASS (pass_lim); - NEXT_PASS (pass_unswitch); - NEXT_PASS (pass_scev_cprop); - NEXT_PASS (pass_record_bounds); - NEXT_PASS (pass_linear_transform); - NEXT_PASS (pass_iv_canon); - NEXT_PASS (pass_if_conversion); - NEXT_PASS (pass_vectorize); - /* NEXT_PASS (pass_may_alias) cannot be done again because the - vectorizer creates alias relations that are not supported by - pass_may_alias. */ - NEXT_PASS (pass_lower_vector_ssa); - NEXT_PASS (pass_complete_unroll); - NEXT_PASS (pass_iv_optimize); - NEXT_PASS (pass_loop_done); - *p = NULL; - -#undef NEXT_PASS - - register_dump_files (all_lowering_passes, false, PROP_gimple_any); - register_dump_files (all_passes, false, PROP_gimple_leh - | PROP_cfg); - register_dump_files (all_ipa_passes, true, PROP_gimple_leh - | PROP_cfg); -} - -static unsigned int last_verified; - -static void -execute_todo (struct tree_opt_pass *pass, unsigned int flags, bool use_required) -{ - int properties - = use_required ? pass->properties_required : pass->properties_provided; - -#if defined ENABLE_CHECKING - if (need_ssa_update_p ()) - gcc_assert (flags & TODO_update_ssa_any); -#endif - - if (flags & TODO_update_ssa_any) - { - unsigned update_flags = flags & TODO_update_ssa_any; - update_ssa (update_flags); - } - - if (flags & TODO_cleanup_cfg) - { - if (current_loops) - cleanup_tree_cfg_loop (); - else - cleanup_tree_cfg (); - } - - if ((flags & TODO_dump_func) - && dump_file && current_function_decl) - { - if (properties & PROP_trees) - dump_function_to_file (current_function_decl, - dump_file, dump_flags); - else if (properties & PROP_cfg) - print_rtl_with_bb (dump_file, get_insns ()); - else - print_rtl (dump_file, get_insns ()); - - /* Flush the file. If verification fails, we won't be able to - close the file before dieing. */ - fflush (dump_file); - } - if ((flags & TODO_dump_cgraph) - && dump_file && !current_function_decl) - { - dump_cgraph (dump_file); - /* Flush the file. If verification fails, we won't be able to - close the file before aborting. */ - fflush (dump_file); - } - - if (flags & TODO_ggc_collect) - { - ggc_collect (); - } - -#if defined ENABLE_CHECKING - if ((pass->properties_required & PROP_ssa) - && !(pass->properties_destroyed & PROP_ssa)) - verify_ssa (true); - if (flags & TODO_verify_flow) - verify_flow_info (); - if (flags & TODO_verify_stmts) - verify_stmts (); - if (flags & TODO_verify_loops) - verify_loop_closed_ssa (); -#endif -} - -static bool -execute_one_pass (struct tree_opt_pass *pass) -{ - unsigned int todo; - - /* See if we're supposed to run this pass. */ - if (pass->gate && !pass->gate ()) - return false; - - /* Note that the folders should only create gimple expressions. - This is a hack until the new folder is ready. */ - in_gimple_form = (pass->properties_provided & PROP_trees) != 0; - - /* Run pre-pass verification. */ - todo = pass->todo_flags_start & ~last_verified; - if (todo) - execute_todo (pass, todo, true); - - /* If a dump file name is present, open it if enabled. */ - if (pass->static_pass_number != -1) - { - bool initializing_dump = !dump_initialized_p (pass->static_pass_number); - dump_file_name = get_dump_file_name (pass->static_pass_number); - dump_file = dump_begin (pass->static_pass_number, &dump_flags); - if (dump_file && current_function_decl) - { - const char *dname, *aname; - dname = lang_hooks.decl_printable_name (current_function_decl, 2); - aname = (IDENTIFIER_POINTER - (DECL_ASSEMBLER_NAME (current_function_decl))); - fprintf (dump_file, "\n;; Function %s (%s)%s\n\n", dname, aname, - cfun->function_frequency == FUNCTION_FREQUENCY_HOT - ? " (hot)" - : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED - ? " (unlikely executed)" - : ""); - } - - if (initializing_dump - && graph_dump_format != no_graph - && (pass->properties_provided & (PROP_cfg | PROP_rtl)) - == (PROP_cfg | PROP_rtl)) - clean_graph_dump_file (dump_file_name); - } - - /* If a timevar is present, start it. */ - if (pass->tv_id) - timevar_push (pass->tv_id); - - /* Do it! */ - if (pass->execute) - pass->execute (); - - /* Stop timevar. */ - if (pass->tv_id) - timevar_pop (pass->tv_id); - - if (dump_file - && (pass->properties_provided & (PROP_cfg | PROP_rtl)) - == (PROP_cfg | PROP_rtl)) - print_rtl_with_bb (dump_file, get_insns ()); - - /* Run post-pass cleanup and verification. */ - todo = pass->todo_flags_finish; - last_verified = todo & TODO_verify_all; - if (todo) - execute_todo (pass, todo, false); - - /* Flush and close dump file. */ - if (dump_file_name) - { - free ((char *) dump_file_name); - dump_file_name = NULL; - } - if (dump_file) - { - dump_end (pass->static_pass_number, dump_file); - dump_file = NULL; - } - - return true; -} - -static void -execute_pass_list (struct tree_opt_pass *pass) -{ - do - { - if (execute_one_pass (pass) && pass->sub) - execute_pass_list (pass->sub); - pass = pass->next; - } - while (pass); -} - -/* Same as execute_pass_list but assume that subpasses of IPA passes - are local passes. */ -static void -execute_ipa_pass_list (struct tree_opt_pass *pass) -{ - do - { - if (execute_one_pass (pass) && pass->sub) - { - struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed) - { - push_cfun (DECL_STRUCT_FUNCTION (node->decl)); - current_function_decl = node->decl; - execute_pass_list (pass); - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - current_function_decl = NULL; - pop_cfun (); - ggc_collect (); - } - } - pass = pass->next; - } - while (pass); -} - +\f void tree_lowering_passes (tree fn) { @@ -678,18 +262,6 @@ tree_lowering_passes (tree fn) pop_cfun (); } -/* Execute all IPA passes. */ -void -ipa_passes (void) -{ - cfun = NULL; - tree_register_cfg_hooks (); - bitmap_obstack_initialize (NULL); - execute_ipa_pass_list (all_ipa_passes); - bitmap_obstack_release (NULL); -} -\f - /* Update recursively all inlined_to pointers of functions inlined into NODE to INLINED_TO. */ static void Index: tree-pass.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-pass.h,v retrieving revision 2.35 diff -p -u -r2.35 tree-pass.h --- tree-pass.h 17 May 2005 09:55:24 -0000 2.35 +++ tree-pass.h 18 May 2005 10:30:40 -0000 @@ -23,6 +23,59 @@ Boston, MA 02111-1307, USA. */ #ifndef GCC_TREE_PASS_H #define GCC_TREE_PASS_H 1 +/* In tree-dump.c */ + +/* Different tree dump places. When you add new tree dump places, + extend the DUMP_FILES array in tree-dump.c. */ +enum tree_dump_index +{ + TDI_none, /* No dump */ + TDI_tu, /* dump the whole translation unit. */ + TDI_class, /* dump class hierarchy. */ + TDI_original, /* dump each function before optimizing it */ + TDI_generic, /* dump each function after genericizing it */ + TDI_nested, /* dump each function after unnesting it */ + TDI_inlined, /* dump each function after inlining + within it. */ + TDI_vcg, /* create a VCG graph file for each + function's flowgraph. */ + TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ + TDI_rtl_all, /* enable all the RTL dumps. */ + TDI_ipa_all, /* enable all the IPA dumps. */ + + TDI_cgraph, /* dump function call graph. */ + TDI_end +}; + +/* Bit masks to control dumping. Not all values are applicable to + all dumps. Add new ones at the end. When you define new + values, extend the DUMP_OPTIONS array in tree-dump.c */ +#define TDF_ADDRESS (1 << 0) /* dump node addresses */ +#define TDF_SLIM (1 << 1) /* don't go wild following links */ +#define TDF_RAW (1 << 2) /* don't unparse the function */ +#define TDF_DETAILS (1 << 3) /* show more detailed info about + each pass */ +#define TDF_STATS (1 << 4) /* dump various statistics about + each pass */ +#define TDF_BLOCKS (1 << 5) /* display basic block boundaries */ +#define TDF_VOPS (1 << 6) /* display virtual operands */ +#define TDF_LINENO (1 << 7) /* display statement line numbers */ +#define TDF_UID (1 << 8) /* display decl UIDs */ + +#define TDF_TREE (1 << 9) /* is a tree dump */ +#define TDF_RTL (1 << 10) /* is a RTL dump */ +#define TDF_IPA (1 << 11) /* is an IPA dump */ +#define TDF_STMTADDR (1 << 12) /* Address of stmt. */ + +extern char *get_dump_file_name (enum tree_dump_index); +extern int dump_enabled_p (enum tree_dump_index); +extern int dump_initialized_p (enum tree_dump_index); +extern FILE *dump_begin (enum tree_dump_index, int *); +extern void dump_end (enum tree_dump_index, FILE *); +extern void dump_node (tree, int, FILE *); +extern int dump_switch_p (const char *); +extern const char *dump_flag_name (enum tree_dump_index); + /* Global variables used to communicate with passes. */ extern FILE *dump_file; extern int dump_flags; @@ -154,7 +207,6 @@ struct dump_file_info #define TODO_verify_all \ (TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts) -extern void ipa_passes (void); extern void tree_lowering_passes (tree decl); extern struct tree_opt_pass pass_mudflap_1; @@ -291,4 +342,11 @@ extern struct tree_opt_pass pass_uncprop extern struct tree_opt_pass pass_shorten_branches; extern struct tree_opt_pass pass_set_nothrow_function_flags; extern struct tree_opt_pass pass_final; + +/* The root of the compilation pass tree, once constructed. */ +extern struct tree_opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; + +extern void execute_pass_list (struct tree_opt_pass *); +extern void execute_ipa_pass_list (struct tree_opt_pass *); + #endif /* GCC_TREE_PASS_H */ Index: tree.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree.h,v retrieving revision 1.727 diff -p -u -r1.727 tree.h --- tree.h 11 May 2005 16:25:30 -0000 1.727 +++ tree.h 18 May 2005 10:30:50 -0000 @@ -3844,100 +3844,6 @@ typedef tree (*walk_tree_fn) (tree *, in extern tree walk_tree (tree*, walk_tree_fn, void*, struct pointer_set_t*); extern tree walk_tree_without_duplicates (tree*, walk_tree_fn, void*); -/* In tree-dump.c */ - -/* Different tree dump places. When you add new tree dump places, - extend the DUMP_FILES array in tree-dump.c. */ -enum tree_dump_index -{ - TDI_none, /* No dump */ - TDI_tu, /* dump the whole translation unit. */ - TDI_class, /* dump class hierarchy. */ - TDI_original, /* dump each function before optimizing it */ - TDI_generic, /* dump each function after genericizing it */ - TDI_nested, /* dump each function after unnesting it */ - TDI_inlined, /* dump each function after inlining - within it. */ - TDI_vcg, /* create a VCG graph file for each - function's flowgraph. */ - TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ - TDI_rtl_all, /* enable all the RTL dumps. */ - TDI_ipa_all, /* enable all the IPA dumps. */ - - TDI_cgraph, /* dump function call graph. */ - - DFI_MIN, /* For now, RTL dumps are placed here. */ - DFI_sibling = DFI_MIN, - DFI_eh, - DFI_jump, - DFI_cse, - DFI_gcse, - DFI_loop, - DFI_bypass, - DFI_cfg, - DFI_bp, - DFI_vpt, - DFI_ce1, - DFI_tracer, - DFI_loop2, - DFI_web, - DFI_cse2, - DFI_life, - DFI_combine, - DFI_ce2, - DFI_regmove, - DFI_sms, - DFI_sched, - DFI_lreg, - DFI_greg, - DFI_postreload, - DFI_gcse2, - DFI_flow2, - DFI_peephole2, - DFI_ce3, - DFI_rnreg, - DFI_bbro, - DFI_branch_target_load, - DFI_sched2, - DFI_stack, - DFI_vartrack, - DFI_mach, - DFI_dbr, - - TDI_end -}; - -/* Bit masks to control dumping. Not all values are applicable to - all dumps. Add new ones at the end. When you define new - values, extend the DUMP_OPTIONS array in tree-dump.c */ -#define TDF_ADDRESS (1 << 0) /* dump node addresses */ -#define TDF_SLIM (1 << 1) /* don't go wild following links */ -#define TDF_RAW (1 << 2) /* don't unparse the function */ -#define TDF_DETAILS (1 << 3) /* show more detailed info about - each pass */ -#define TDF_STATS (1 << 4) /* dump various statistics about - each pass */ -#define TDF_BLOCKS (1 << 5) /* display basic block boundaries */ -#define TDF_VOPS (1 << 6) /* display virtual operands */ -#define TDF_LINENO (1 << 7) /* display statement line numbers */ -#define TDF_UID (1 << 8) /* display decl UIDs */ - -#define TDF_TREE (1 << 9) /* is a tree dump */ -#define TDF_RTL (1 << 10) /* is a RTL dump */ -#define TDF_IPA (1 << 11) /* is an IPA dump */ -#define TDF_STMTADDR (1 << 12) /* Address of stmt. */ - -typedef struct dump_info *dump_info_p; - -extern char *get_dump_file_name (enum tree_dump_index); -extern int dump_flag (dump_info_p, int, tree); -extern int dump_enabled_p (enum tree_dump_index); -extern int dump_initialized_p (enum tree_dump_index); -extern FILE *dump_begin (enum tree_dump_index, int *); -extern void dump_end (enum tree_dump_index, FILE *); -extern void dump_node (tree, int, FILE *); -extern int dump_switch_p (const char *); -extern const char *dump_flag_name (enum tree_dump_index); /* Assign the RTX to declaration. */ extern void set_decl_rtl (tree, rtx); [-- Attachment #4: rtl-passes-delete-stuff.patch --] [-- Type: text/plain, Size: 45851 bytes --] 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * passes.c (open_dump_file, close_dump_file, rest_of_handle_final, rest_of_handle_delay_slots, rest_of_handle_stack_regs, rest_of_handle_variable_tracking, rest_of_handle_machine_reorg, rest_of_handle_old_regalloc, rest_of_handle_regrename, rest_of_handle_reorder_blocks, rest_of_handle_partition_blocks, rest_of_handle_sms, rest_of_handle_sched, rest_of_handle_sched2, rest_of_handle_gcse2, rest_of_handle_regmove, rest_of_handle_tracer, rest_of_handle_if_conversion, rest_of_handle_if_after_combine, rest_of_handle_if_after_reload, rest_of_handle_web, rest_of_handle_branch_prob, rest_of_handle_value_profile_transformations, rest_of_handle_cfg, rest_of_handle_jump_bypass, rest_of_handle_combine, rest_of_handle_life, rest_of_handle_cse, rest_of_handle_cse2, rest_of_handle_gcse, rest_of_handle_loop_optimize, rest_of_handle_loop2, rest_of_handle_branch_target_load_optimize, rest_of_handle_mode_switching, rest_of_handle_jump, rest_of_handle_eh, rest_of_handle_stack_adjustments, rest_of_handle_flow2, rest_of_handle_jump2, rest_of_handle_peephole2, rest_of_handle_postreload, rest_of_handle_shorten_branches, rest_of_clean_state, rest_of_compilation): Remove. Index: passes.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/passes.c,v retrieving revision 2.90 diff -p -u -r2.90 passes.c --- passes.c 27 Apr 2005 21:35:20 -0000 2.90 +++ passes.c 18 May 2005 10:29:55 -0000 @@ -98,80 +99,7 @@ Software Foundation, 59 Temple Place - S declarations for e.g. AIX 4.x. */ #endif -#ifndef HAVE_conditional_execution -#define HAVE_conditional_execution 0 -#endif - -/* Format to use to print dumpfile index value */ -#ifndef DUMPFILE_FORMAT -#define DUMPFILE_FORMAT ".%02d." -#endif - -static int initializing_dump = 0; - -/* Routine to open a dump file. Return true if the dump file is enabled. */ - -static int -open_dump_file (enum tree_dump_index index, tree decl) -{ - if (! dump_enabled_p (index)) - return 0; - - timevar_push (TV_DUMP); - - gcc_assert (!dump_file && !dump_file_name); - - dump_file_name = get_dump_file_name (index); - initializing_dump = !dump_initialized_p (index); - dump_file = dump_begin (index, NULL); - - if (dump_file == NULL) - fatal_error ("can't open %s: %m", dump_file_name); - - if (decl) - fprintf (dump_file, "\n;; Function %s%s\n\n", - lang_hooks.decl_printable_name (decl, 2), - cfun->function_frequency == FUNCTION_FREQUENCY_HOT - ? " (hot)" - : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED - ? " (unlikely executed)" - : ""); - - timevar_pop (TV_DUMP); - return 1; -} - -/* Routine to close a dump file. */ - -static void -close_dump_file (enum tree_dump_index index, - void (*func) (FILE *, rtx), - rtx insns) -{ - if (! dump_file) - return; - - timevar_push (TV_DUMP); - if (insns - && graph_dump_format != no_graph) - { - /* If we've not initialized the files, do so now. */ - if (initializing_dump) - clean_graph_dump_file (dump_file_name); - - print_rtl_graph_with_bb (dump_file_name, insns); - } - - if (func && insns) - func (dump_file, insns); - dump_end (index, dump_file); - free ((char *) dump_file_name); - - dump_file = NULL; - dump_file_name = NULL; - timevar_pop (TV_DUMP); -} /* This is called from various places for FUNCTION_DECL, VAR_DECL, and TYPE_DECL nodes. @@ -270,1487 +198,8 @@ rest_of_type_compilation (tree type, int timevar_pop (TV_SYMOUT); } -/* Turn the RTL into assembly. */ -static void -rest_of_handle_final (void) -{ - timevar_push (TV_FINAL); - { - rtx x; - const char *fnname; - - /* Get the function's name, as described by its RTL. This may be - different from the DECL_NAME name used in the source file. */ - - x = DECL_RTL (current_function_decl); - gcc_assert (MEM_P (x)); - x = XEXP (x, 0); - gcc_assert (GET_CODE (x) == SYMBOL_REF); - fnname = XSTR (x, 0); - - assemble_start_function (current_function_decl, fnname); - final_start_function (get_insns (), asm_out_file, optimize); - final (get_insns (), asm_out_file, optimize); - final_end_function (); - -#ifdef TARGET_UNWIND_INFO - /* ??? The IA-64 ".handlerdata" directive must be issued before - the ".endp" directive that closes the procedure descriptor. */ - output_function_exception_table (); -#endif - - assemble_end_function (current_function_decl, fnname); - -#ifndef TARGET_UNWIND_INFO - /* Otherwise, it feels unclean to switch sections in the middle. */ - output_function_exception_table (); -#endif - - user_defined_section_attribute = false; - - if (! quiet_flag) - fflush (asm_out_file); - - /* Release all memory allocated by flow. */ - free_basic_block_vars (); - } - - /* Write DBX symbols if requested. */ - - /* Note that for those inline functions where we don't initially - know for certain that we will be generating an out-of-line copy, - the first invocation of this routine (rest_of_compilation) will - skip over this code by doing a `goto exit_rest_of_compilation;'. - Later on, wrapup_global_declarations will (indirectly) call - rest_of_compilation again for those inline functions that need - to have out-of-line copies generated. During that call, we - *will* be routed past here. */ - - timevar_push (TV_SYMOUT); - (*debug_hooks->function_decl) (current_function_decl); - timevar_pop (TV_SYMOUT); - - ggc_collect (); - timevar_pop (TV_FINAL); -} - -#ifdef DELAY_SLOTS -/* Run delay slot optimization. */ -static void -rest_of_handle_delay_slots (void) -{ - timevar_push (TV_DBR_SCHED); - open_dump_file (DFI_dbr, current_function_decl); - - dbr_schedule (get_insns (), dump_file); - - close_dump_file (DFI_dbr, print_rtl, get_insns ()); - - ggc_collect (); - - timevar_pop (TV_DBR_SCHED); -} -#endif - -#ifdef STACK_REGS -/* Convert register usage from flat register file usage to a stack - register file. */ -static void -rest_of_handle_stack_regs (void) -{ -#if defined (HAVE_ATTR_length) - /* If flow2 creates new instructions which need splitting - and scheduling after reload is not done, they might not be - split until final which doesn't allow splitting - if HAVE_ATTR_length. */ -#ifdef INSN_SCHEDULING - if (optimize && !flag_schedule_insns_after_reload) -#else - if (optimize) -#endif - { - timevar_push (TV_SHORTEN_BRANCH); - split_all_insns (1); - timevar_pop (TV_SHORTEN_BRANCH); - } -#endif - - timevar_push (TV_REG_STACK); - open_dump_file (DFI_stack, current_function_decl); - - if (reg_to_stack (dump_file) && optimize) - { - if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK - | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)) - && (flag_reorder_blocks || flag_reorder_blocks_and_partition)) - { - reorder_basic_blocks (0); - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK); - } - } - - close_dump_file (DFI_stack, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - timevar_pop (TV_REG_STACK); -} -#endif - -/* Track the variables, i.e. compute where the variable is stored at each position in function. */ -static void -rest_of_handle_variable_tracking (void) -{ - timevar_push (TV_VAR_TRACKING); - open_dump_file (DFI_vartrack, current_function_decl); - - variable_tracking_main (); - - close_dump_file (DFI_vartrack, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_VAR_TRACKING); -} - -/* Machine dependent reorg pass. */ -static void -rest_of_handle_machine_reorg (void) -{ - timevar_push (TV_MACH_DEP); - open_dump_file (DFI_mach, current_function_decl); - - targetm.machine_dependent_reorg (); - - close_dump_file (DFI_mach, print_rtl, get_insns ()); - - ggc_collect (); - timevar_pop (TV_MACH_DEP); -} - - -/* Run old register allocator. Return TRUE if we must exit - rest_of_compilation upon return. */ -static bool -rest_of_handle_old_regalloc (void) -{ - int failure; - int rebuild_notes; - - timevar_push (TV_LOCAL_ALLOC); - open_dump_file (DFI_lreg, current_function_decl); - - /* Allocate the reg_renumber array. */ - allocate_reg_info (max_regno, FALSE, TRUE); - - /* And the reg_equiv_memory_loc array. */ - VARRAY_GROW (reg_equiv_memory_loc_varray, max_regno); - reg_equiv_memory_loc = &VARRAY_RTX (reg_equiv_memory_loc_varray, 0); - - allocate_initial_values (reg_equiv_memory_loc); - - regclass (get_insns (), max_reg_num (), dump_file); - rebuild_notes = local_alloc (); - - timevar_pop (TV_LOCAL_ALLOC); - - /* Local allocation may have turned an indirect jump into a direct - jump. If so, we must rebuild the JUMP_LABEL fields of jumping - instructions. */ - if (rebuild_notes) - { - timevar_push (TV_JUMP); - - rebuild_jump_labels (get_insns ()); - purge_all_dead_edges (); - delete_unreachable_blocks (); - - timevar_pop (TV_JUMP); - } - - if (dump_enabled_p (DFI_lreg)) - { - timevar_push (TV_DUMP); - dump_flow_info (dump_file); - dump_local_alloc (dump_file); - timevar_pop (TV_DUMP); - } - - close_dump_file (DFI_lreg, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - - timevar_push (TV_GLOBAL_ALLOC); - open_dump_file (DFI_greg, current_function_decl); - - /* If optimizing, allocate remaining pseudo-regs. Do the reload - pass fixing up any insns that are invalid. */ - - if (optimize) - failure = global_alloc (dump_file); - else - { - build_insn_chain (get_insns ()); - failure = reload (get_insns (), 0); - } - - if (dump_enabled_p (DFI_greg)) - { - timevar_push (TV_DUMP); - dump_global_regs (dump_file); - timevar_pop (TV_DUMP); - - close_dump_file (DFI_greg, print_rtl_with_bb, get_insns ()); - } - - ggc_collect (); - - timevar_pop (TV_GLOBAL_ALLOC); - - return failure; -} - -/* Run the regrename and cprop passes. */ -static void -rest_of_handle_regrename (void) -{ - timevar_push (TV_RENAME_REGISTERS); - open_dump_file (DFI_rnreg, current_function_decl); - - if (flag_rename_registers) - regrename_optimize (); - if (flag_cprop_registers) - copyprop_hardreg_forward (); - - close_dump_file (DFI_rnreg, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_RENAME_REGISTERS); -} - -/* Reorder basic blocks. */ -static void -rest_of_handle_reorder_blocks (void) -{ - bool changed; - unsigned int liveness_flags; - - open_dump_file (DFI_bbro, current_function_decl); - - /* Last attempt to optimize CFG, as scheduling, peepholing and insn - splitting possibly introduced more crossjumping opportunities. */ - liveness_flags = (!HAVE_conditional_execution ? CLEANUP_UPDATE_LIFE : 0); - changed = cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags); - - if (flag_sched2_use_traces && flag_schedule_insns_after_reload) - tracer (liveness_flags); - if (flag_reorder_blocks || flag_reorder_blocks_and_partition) - reorder_basic_blocks (liveness_flags); - if (flag_reorder_blocks || flag_reorder_blocks_and_partition - || (flag_sched2_use_traces && flag_schedule_insns_after_reload)) - changed |= cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags); - - /* On conditional execution targets we can not update the life cheaply, so - we deffer the updating to after both cleanups. This may lose some cases - but should not be terribly bad. */ - if (changed && HAVE_conditional_execution) - update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, - PROP_DEATH_NOTES); - close_dump_file (DFI_bbro, print_rtl_with_bb, get_insns ()); -} - -/* Partition hot and cold basic blocks. */ -static void -rest_of_handle_partition_blocks (void) -{ - no_new_pseudos = 0; - partition_hot_cold_basic_blocks (); - allocate_reg_life_data (); - update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, - PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES); - no_new_pseudos = 1; -} - -#ifdef INSN_SCHEDULING -/* Run instruction scheduler. */ -/* Perform SMS module scheduling. */ -static void -rest_of_handle_sms (void) -{ - basic_block bb; - sbitmap blocks; - - timevar_push (TV_SMS); - open_dump_file (DFI_sms, current_function_decl); - - /* We want to be able to create new pseudos. */ - no_new_pseudos = 0; - /* Collect loop information to be used in SMS. */ - cfg_layout_initialize (CLEANUP_UPDATE_LIFE); - sms_schedule (dump_file); - close_dump_file (DFI_sms, print_rtl, get_insns ()); - - /* Update the life information, because we add pseudos. */ - max_regno = max_reg_num (); - allocate_reg_info (max_regno, FALSE, FALSE); - blocks = sbitmap_alloc (last_basic_block); - sbitmap_ones (blocks); - update_life_info (blocks, UPDATE_LIFE_GLOBAL_RM_NOTES, - (PROP_DEATH_NOTES - | PROP_REG_INFO - | PROP_KILL_DEAD_CODE - | PROP_SCAN_DEAD_CODE)); - - no_new_pseudos = 1; - - /* Finalize layout changes. */ - FOR_EACH_BB (bb) - if (bb->next_bb != EXIT_BLOCK_PTR) - bb->rbi->next = bb->next_bb; - cfg_layout_finalize (); - free_dominance_info (CDI_DOMINATORS); - ggc_collect (); - timevar_pop (TV_SMS); -} - -/* Run instruction scheduler. */ -static void -rest_of_handle_sched (void) -{ - timevar_push (TV_SCHED); - - /* Print function header into sched dump now - because doing the sched analysis makes some of the dump. */ - open_dump_file (DFI_sched, current_function_decl); - - /* Do control and data sched analysis, - and write some of the results to dump file. */ - - schedule_insns (dump_file); - - close_dump_file (DFI_sched, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - timevar_pop (TV_SCHED); -} - -/* Run second scheduling pass after reload. */ -static void -rest_of_handle_sched2 (void) -{ - timevar_push (TV_SCHED2); - open_dump_file (DFI_sched2, current_function_decl); - - /* Do control and data sched analysis again, - and write some more of the results to dump file. */ - - split_all_insns (1); - - if (flag_sched2_use_superblocks || flag_sched2_use_traces) - { - schedule_ebbs (dump_file); - /* No liveness updating code yet, but it should be easy to do. - reg-stack recomputes the liveness when needed for now. */ - count_or_remove_death_notes (NULL, 1); - cleanup_cfg (CLEANUP_EXPENSIVE); - } - else - schedule_insns (dump_file); - - close_dump_file (DFI_sched2, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - - timevar_pop (TV_SCHED2); -} -#endif - -static void -rest_of_handle_gcse2 (void) -{ - timevar_push (TV_GCSE_AFTER_RELOAD); - open_dump_file (DFI_gcse2, current_function_decl); - - gcse_after_reload_main (get_insns ()); - rebuild_jump_labels (get_insns ()); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - close_dump_file (DFI_gcse2, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif - - timevar_pop (TV_GCSE_AFTER_RELOAD); -} - -/* Register allocation pre-pass, to reduce number of moves necessary - for two-address machines. */ -static void -rest_of_handle_regmove (void) -{ - timevar_push (TV_REGMOVE); - open_dump_file (DFI_regmove, current_function_decl); - - regmove_optimize (get_insns (), max_reg_num (), dump_file); - - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); - close_dump_file (DFI_regmove, print_rtl_with_bb, get_insns ()); - - ggc_collect (); - timevar_pop (TV_REGMOVE); -} - -/* Run tracer. */ -static void -rest_of_handle_tracer (void) -{ - open_dump_file (DFI_tracer, current_function_decl); - if (dump_file) - dump_flow_info (dump_file); - tracer (0); - cleanup_cfg (CLEANUP_EXPENSIVE); - reg_scan (get_insns (), max_reg_num ()); - close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ()); -} - -/* If-conversion and CFG cleanup. */ -static void -rest_of_handle_if_conversion (void) -{ - timevar_push (TV_IFCVT); - open_dump_file (DFI_ce1, current_function_decl); - - if (flag_if_conversion) - { - if (dump_file) - dump_flow_info (dump_file); - cleanup_cfg (CLEANUP_EXPENSIVE); - reg_scan (get_insns (), max_reg_num ()); - if_convert (0); - } - - timevar_push (TV_JUMP); - cleanup_cfg (CLEANUP_EXPENSIVE); - reg_scan (get_insns (), max_reg_num ()); - timevar_pop (TV_JUMP); - - close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_IFCVT); -} - -/* Rerun if-conversion, as combine may have simplified things enough - to now meet sequence length restrictions. */ -static void -rest_of_handle_if_after_combine (void) -{ - timevar_push (TV_IFCVT); - open_dump_file (DFI_ce2, current_function_decl); - - no_new_pseudos = 0; - if_convert (1); - no_new_pseudos = 1; - - close_dump_file (DFI_ce2, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_IFCVT); -} - -static void -rest_of_handle_if_after_reload (void) -{ - timevar_push (TV_IFCVT2); - open_dump_file (DFI_ce3, current_function_decl); - - /* Last attempt to optimize CFG, as scheduling, peepholing and insn - splitting possibly introduced more crossjumping opportunities. */ - cleanup_cfg (CLEANUP_EXPENSIVE - | CLEANUP_UPDATE_LIFE - | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); - if (flag_if_conversion2) - if_convert (1); - close_dump_file (DFI_ce3, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_IFCVT2); -} - -static void -rest_of_handle_web (void) -{ - open_dump_file (DFI_web, current_function_decl); - timevar_push (TV_WEB); - web_main (); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - cleanup_cfg (CLEANUP_EXPENSIVE); - - timevar_pop (TV_WEB); - close_dump_file (DFI_web, print_rtl_with_bb, get_insns ()); - reg_scan (get_insns (), max_reg_num ()); -} - -/* Do branch profiling and static profile estimation passes. */ -static void -rest_of_handle_branch_prob (void) -{ - struct loops loops; - - timevar_push (TV_BRANCH_PROB); - open_dump_file (DFI_bp, current_function_decl); - - if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) - branch_prob (); - - /* Discover and record the loop depth at the head of each basic - block. The loop infrastructure does the real job for us. */ - flow_loops_find (&loops); - - if (dump_file) - flow_loops_dump (&loops, dump_file, NULL, 0); - - /* Estimate using heuristics if no profiling info is available. */ - if (flag_guess_branch_prob) - estimate_probability (&loops); - - flow_loops_free (&loops); - free_dominance_info (CDI_DOMINATORS); - close_dump_file (DFI_bp, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_BRANCH_PROB); -} - -/* Do optimizations based on expression value profiles. */ -static void -rest_of_handle_value_profile_transformations (void) -{ - open_dump_file (DFI_vpt, current_function_decl); - timevar_push (TV_VPT); - - if (value_profile_transformations ()) - cleanup_cfg (CLEANUP_EXPENSIVE); - - timevar_pop (TV_VPT); - close_dump_file (DFI_vpt, print_rtl_with_bb, get_insns ()); -} - -/* Do control and data flow analysis; write some of the results to the - dump file. */ -static void -rest_of_handle_cfg (void) -{ - open_dump_file (DFI_cfg, current_function_decl); - if (dump_file) - dump_flow_info (dump_file); - if (optimize) - cleanup_cfg (CLEANUP_EXPENSIVE - | (flag_thread_jumps ? CLEANUP_THREADING : 0)); - - /* It may make more sense to mark constant functions after dead code is - eliminated by life_analysis, but we need to do it early, as -fprofile-arcs - may insert code making function non-constant, but we still must consider - it as constant, otherwise -fbranch-probabilities will not read data back. - - life_analysis rarely eliminates modification of external memory. - - FIXME: now with tree based profiling we are in the trap described above - again. It seems to be easiest to disable the optimization for time - being before the problem is either solved by moving the transformation - to the IPA level (we need the CFG for this) or the very early optimization - passes are made to ignore the const/pure flags so code does not change. */ - if (optimize - && (!flag_tree_based_profiling - || (!profile_arc_flag && !flag_branch_probabilities))) - { - /* Alias analysis depends on this information and mark_constant_function - depends on alias analysis. */ - reg_scan (get_insns (), max_reg_num ()); - mark_constant_function (); - } - - close_dump_file (DFI_cfg, print_rtl_with_bb, get_insns ()); -} - -/* Perform jump bypassing and control flow optimizations. */ -static void -rest_of_handle_jump_bypass (void) -{ - timevar_push (TV_BYPASS); - open_dump_file (DFI_bypass, current_function_decl); - - cleanup_cfg (CLEANUP_EXPENSIVE); - reg_scan (get_insns (), max_reg_num ()); - - if (bypass_jumps (dump_file)) - { - rebuild_jump_labels (get_insns ()); - cleanup_cfg (CLEANUP_EXPENSIVE); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - } - - close_dump_file (DFI_bypass, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_BYPASS); - - ggc_collect (); - -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif -} - -/* Try combining insns through substitution. */ -static void -rest_of_handle_combine (void) -{ - int rebuild_jump_labels_after_combine = 0; - - timevar_push (TV_COMBINE); - open_dump_file (DFI_combine, current_function_decl); - - rebuild_jump_labels_after_combine - = combine_instructions (get_insns (), max_reg_num ()); - - /* Combining insns may have turned an indirect jump into a - direct jump. Rebuild the JUMP_LABEL fields of jumping - instructions. */ - if (rebuild_jump_labels_after_combine) - { - timevar_push (TV_JUMP); - rebuild_jump_labels (get_insns ()); - timevar_pop (TV_JUMP); - - delete_dead_jumptables (); - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); - } - - close_dump_file (DFI_combine, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_COMBINE); - - ggc_collect (); -} - -/* Perform life analysis. */ -static void -rest_of_handle_life (void) -{ - open_dump_file (DFI_life, current_function_decl); - regclass_init (); - -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif - life_analysis (dump_file, PROP_FINAL); - if (optimize) - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE | CLEANUP_LOG_LINKS - | (flag_thread_jumps ? CLEANUP_THREADING : 0)); - - if (extra_warnings) - { - setjmp_vars_warning (DECL_INITIAL (current_function_decl)); - setjmp_args_warning (); - } - - if (optimize) - { - if (initialize_uninitialized_subregs ()) - { - /* Insns were inserted, and possibly pseudos created, so - things might look a bit different. */ - allocate_reg_life_data (); - update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, - PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES); - } - } - - no_new_pseudos = 1; - - close_dump_file (DFI_life, print_rtl_with_bb, get_insns ()); - - ggc_collect (); -} - -/* Perform common subexpression elimination. Nonzero value from - `cse_main' means that jumps were simplified and some code may now - be unreachable, so do jump optimization again. */ -static void -rest_of_handle_cse (void) -{ - int tem; - - open_dump_file (DFI_cse, current_function_decl); - if (dump_file) - dump_flow_info (dump_file); - timevar_push (TV_CSE); - - reg_scan (get_insns (), max_reg_num ()); - - tem = cse_main (get_insns (), max_reg_num (), dump_file); - if (tem) - rebuild_jump_labels (get_insns ()); - if (purge_all_dead_edges ()) - delete_unreachable_blocks (); - - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - - /* If we are not running more CSE passes, then we are no longer - expecting CSE to be run. But always rerun it in a cheap mode. */ - cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse; - - if (tem) - delete_dead_jumptables (); - - if (tem || optimize > 1) - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); - - timevar_pop (TV_CSE); - close_dump_file (DFI_cse, print_rtl_with_bb, get_insns ()); - - ggc_collect (); -} - -/* Run second CSE pass after loop optimizations. */ -static void -rest_of_handle_cse2 (void) -{ - int tem; - - timevar_push (TV_CSE2); - open_dump_file (DFI_cse2, current_function_decl); - if (dump_file) - dump_flow_info (dump_file); - /* CFG is no longer maintained up-to-date. */ - tem = cse_main (get_insns (), max_reg_num (), dump_file); - - /* Run a pass to eliminate duplicated assignments to condition code - registers. We have to run this after bypass_jumps, because it - makes it harder for that pass to determine whether a jump can be - bypassed safely. */ - cse_condition_code_reg (); - - purge_all_dead_edges (); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - - if (tem) - { - timevar_push (TV_JUMP); - rebuild_jump_labels (get_insns ()); - delete_dead_jumptables (); - cleanup_cfg (CLEANUP_EXPENSIVE); - timevar_pop (TV_JUMP); - } - reg_scan (get_insns (), max_reg_num ()); - close_dump_file (DFI_cse2, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_CSE2); - - ggc_collect (); -} - -/* Perform global cse. */ -static void -rest_of_handle_gcse (void) -{ - int save_csb, save_cfj; - int tem2 = 0, tem; - - timevar_push (TV_GCSE); - open_dump_file (DFI_gcse, current_function_decl); - - tem = gcse_main (get_insns (), dump_file); - rebuild_jump_labels (get_insns ()); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - - save_csb = flag_cse_skip_blocks; - save_cfj = flag_cse_follow_jumps; - flag_cse_skip_blocks = flag_cse_follow_jumps = 0; - - /* If -fexpensive-optimizations, re-run CSE to clean up things done - by gcse. */ - if (flag_expensive_optimizations) - { - timevar_push (TV_CSE); - reg_scan (get_insns (), max_reg_num ()); - tem2 = cse_main (get_insns (), max_reg_num (), dump_file); - purge_all_dead_edges (); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - timevar_pop (TV_CSE); - cse_not_expected = !flag_rerun_cse_after_loop; - } - - /* If gcse or cse altered any jumps, rerun jump optimizations to clean - things up. */ - if (tem || tem2) - { - timevar_push (TV_JUMP); - rebuild_jump_labels (get_insns ()); - delete_dead_jumptables (); - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); - timevar_pop (TV_JUMP); - } - - close_dump_file (DFI_gcse, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_GCSE); - - ggc_collect (); - flag_cse_skip_blocks = save_csb; - flag_cse_follow_jumps = save_cfj; -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif -} - -/* Move constant computations out of loops. */ -static void -rest_of_handle_loop_optimize (void) -{ - int do_prefetch; - - timevar_push (TV_LOOP); - open_dump_file (DFI_loop, current_function_decl); - - /* CFG is no longer maintained up-to-date. */ - free_bb_for_insn (); - profile_status = PROFILE_ABSENT; - - do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0; - - if (flag_rerun_loop_opt) - { - cleanup_barriers (); - - /* We only want to perform unrolling once. */ - loop_optimize (get_insns (), dump_file, 0); - - /* The first call to loop_optimize makes some instructions - trivially dead. We delete those instructions now in the - hope that doing so will make the heuristics in loop work - better and possibly speed up compilation. */ - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - - /* The regscan pass is currently necessary as the alias - analysis code depends on this information. */ - reg_scan (get_insns (), max_reg_num ()); - } - cleanup_barriers (); - loop_optimize (get_insns (), dump_file, do_prefetch); - - /* Loop can create trivially dead instructions. */ - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - find_basic_blocks (get_insns ()); - close_dump_file (DFI_loop, print_rtl, get_insns ()); - timevar_pop (TV_LOOP); - - ggc_collect (); -} - -/* Perform loop optimizations. It might be better to do them a bit - sooner, but we want the profile feedback to work more - efficiently. */ -static void -rest_of_handle_loop2 (void) -{ - struct loops *loops; - basic_block bb; - - if (!flag_move_loop_invariants - && !flag_unswitch_loops - && !flag_peel_loops - && !flag_unroll_loops - && !flag_branch_on_count_reg) - return; - - timevar_push (TV_LOOP); - open_dump_file (DFI_loop2, current_function_decl); - if (dump_file) - dump_flow_info (dump_file); - - /* Initialize structures for layout changes. */ - cfg_layout_initialize (0); - - loops = loop_optimizer_init (dump_file); - - if (loops) - { - /* The optimizations: */ - if (flag_move_loop_invariants) - move_loop_invariants (loops); - - if (flag_unswitch_loops) - unswitch_loops (loops); - - if (flag_peel_loops || flag_unroll_loops) - unroll_and_peel_loops (loops, - (flag_peel_loops ? UAP_PEEL : 0) | - (flag_unroll_loops ? UAP_UNROLL : 0) | - (flag_unroll_all_loops ? UAP_UNROLL_ALL : 0)); - -#ifdef HAVE_doloop_end - if (flag_branch_on_count_reg && HAVE_doloop_end) - doloop_optimize_loops (loops); -#endif /* HAVE_doloop_end */ - - loop_optimizer_finalize (loops, dump_file); - } - - free_dominance_info (CDI_DOMINATORS); - - /* Finalize layout changes. */ - FOR_EACH_BB (bb) - if (bb->next_bb != EXIT_BLOCK_PTR) - bb->rbi->next = bb->next_bb; - cfg_layout_finalize (); - - cleanup_cfg (CLEANUP_EXPENSIVE); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - reg_scan (get_insns (), max_reg_num ()); - if (dump_file) - dump_flow_info (dump_file); - close_dump_file (DFI_loop2, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_LOOP); - ggc_collect (); -} - -static void -rest_of_handle_branch_target_load_optimize (void) -{ - static int warned = 0; - - /* Leave this a warning for now so that it is possible to experiment - with running this pass twice. In 3.6, we should either make this - an error, or use separate dump files. */ - if (flag_branch_target_load_optimize - && flag_branch_target_load_optimize2 - && !warned) - { - warning (0, "branch target register load optimization is not intended " - "to be run twice"); - - warned = 1; - } - - open_dump_file (DFI_branch_target_load, current_function_decl); - branch_target_load_optimize (epilogue_completed); - close_dump_file (DFI_branch_target_load, print_rtl_with_bb, get_insns ()); - ggc_collect (); -} - -#ifdef OPTIMIZE_MODE_SWITCHING -static void -rest_of_handle_mode_switching (void) -{ - timevar_push (TV_MODE_SWITCH); - - no_new_pseudos = 0; - optimize_mode_switching (NULL); - no_new_pseudos = 1; - - timevar_pop (TV_MODE_SWITCH); -} -#endif - -static void -rest_of_handle_jump (void) -{ - ggc_collect (); - - timevar_push (TV_JUMP); - open_dump_file (DFI_sibling, current_function_decl); - - delete_unreachable_blocks (); -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif - - if (cfun->tail_call_emit) - fixup_tail_calls (); - - close_dump_file (DFI_sibling, print_rtl, get_insns ()); - timevar_pop (TV_JUMP); -} - -static void -rest_of_handle_eh (void) -{ - insn_locators_initialize (); - /* Complete generation of exception handling code. */ - if (doing_eh (0)) - { - timevar_push (TV_JUMP); - open_dump_file (DFI_eh, current_function_decl); - - cleanup_cfg (CLEANUP_PRE_LOOP | CLEANUP_NO_INSN_DEL); - - finish_eh_generation (); - - cleanup_cfg (CLEANUP_PRE_LOOP | CLEANUP_NO_INSN_DEL); - - close_dump_file (DFI_eh, print_rtl, get_insns ()); - timevar_pop (TV_JUMP); - } -} - -static void -rest_of_handle_stack_adjustments (void) -{ - life_analysis (dump_file, PROP_POSTRELOAD); - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE - | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); - - /* This is kind of a heuristic. We need to run combine_stack_adjustments - even for machines with possibly nonzero RETURN_POPS_ARGS - and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having - push instructions will have popping returns. */ -#ifndef PUSH_ROUNDING - if (!ACCUMULATE_OUTGOING_ARGS) -#endif - combine_stack_adjustments (); -} - -static void -rest_of_handle_flow2 (void) -{ - timevar_push (TV_FLOW2); - open_dump_file (DFI_flow2, current_function_decl); - - /* Re-create the death notes which were deleted during reload. */ -#ifdef ENABLE_CHECKING - verify_flow_info (); -#endif - - /* If optimizing, then go ahead and split insns now. */ -#ifndef STACK_REGS - if (optimize > 0) -#endif - split_all_insns (0); - - if (flag_branch_target_load_optimize) - { - close_dump_file (DFI_flow2, print_rtl_with_bb, get_insns ()); - rest_of_handle_branch_target_load_optimize (); - open_dump_file (DFI_flow2, current_function_decl); - } - - if (optimize) - cleanup_cfg (CLEANUP_EXPENSIVE); - - /* On some machines, the prologue and epilogue code, or parts thereof, - can be represented as RTL. Doing so lets us schedule insns between - it and the rest of the code and also allows delayed branch - scheduling to operate in the epilogue. */ - thread_prologue_and_epilogue_insns (get_insns ()); - epilogue_completed = 1; - - if (optimize) - rest_of_handle_stack_adjustments (); - - flow2_completed = 1; - - close_dump_file (DFI_flow2, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_FLOW2); - - ggc_collect (); -} - - -static void -rest_of_handle_jump2 (void) -{ - open_dump_file (DFI_jump, current_function_decl); - - /* Always do one jump optimization pass to ensure that JUMP_LABEL fields - are initialized and to compute whether control can drop off the end - of the function. */ - - timevar_push (TV_JUMP); - /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this - before jump optimization switches branch directions. */ - if (flag_guess_branch_prob) - expected_value_to_br_prob (); - - delete_trivially_dead_insns (get_insns (), max_reg_num ()); - reg_scan (get_insns (), max_reg_num ()); - if (dump_file) - dump_flow_info (dump_file); - cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP - | (flag_thread_jumps ? CLEANUP_THREADING : 0)); - - create_loop_notes (); - - purge_line_number_notes (get_insns ()); - - if (optimize) - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); - - /* Jump optimization, and the removal of NULL pointer checks, may - have reduced the number of instructions substantially. CSE, and - future passes, allocate arrays whose dimensions involve the - maximum instruction UID, so if we can reduce the maximum UID - we'll save big on memory. */ - renumber_insns (dump_file); - - close_dump_file (DFI_jump, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_JUMP); - - ggc_collect (); -} - -#ifdef HAVE_peephole2 -static void -rest_of_handle_peephole2 (void) -{ - timevar_push (TV_PEEPHOLE2); - open_dump_file (DFI_peephole2, current_function_decl); - - peephole2_optimize (dump_file); - - close_dump_file (DFI_peephole2, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_PEEPHOLE2); -} -#endif - -static void -rest_of_handle_postreload (void) -{ - timevar_push (TV_RELOAD_CSE_REGS); - open_dump_file (DFI_postreload, current_function_decl); - - /* Do a very simple CSE pass over just the hard registers. */ - reload_cse_regs (get_insns ()); - /* reload_cse_regs can eliminate potentially-trapping MEMs. - Remove any EH edges associated with them. */ - if (flag_non_call_exceptions) - purge_all_dead_edges (); - - close_dump_file (DFI_postreload, print_rtl_with_bb, get_insns ()); - timevar_pop (TV_RELOAD_CSE_REGS); -} - -static void -rest_of_handle_shorten_branches (void) -{ - /* Shorten branches. */ - timevar_push (TV_SHORTEN_BRANCH); - shorten_branches (get_insns ()); - timevar_pop (TV_SHORTEN_BRANCH); -} - -static void -rest_of_clean_state (void) -{ - rtx insn, next; - - /* It is very important to decompose the RTL instruction chain here: - debug information keeps pointing into CODE_LABEL insns inside the function - body. If these remain pointing to the other insns, we end up preserving - whole RTL chain and attached detailed debug info in memory. */ - for (insn = get_insns (); insn; insn = next) - { - next = NEXT_INSN (insn); - NEXT_INSN (insn) = NULL; - PREV_INSN (insn) = NULL; - } - - /* In case the function was not output, - don't leave any temporary anonymous types - queued up for sdb output. */ -#ifdef SDB_DEBUGGING_INFO - if (write_symbols == SDB_DEBUG) - sdbout_types (NULL_TREE); -#endif - - reload_completed = 0; - epilogue_completed = 0; - flow2_completed = 0; - no_new_pseudos = 0; - - timevar_push (TV_FINAL); - - /* Clear out the insn_length contents now that they are no - longer valid. */ - init_insn_lengths (); - - /* Show no temporary slots allocated. */ - init_temp_slots (); - - free_basic_block_vars (); - free_bb_for_insn (); - - timevar_pop (TV_FINAL); - - if (targetm.binds_local_p (current_function_decl)) - { - int pref = cfun->preferred_stack_boundary; - if (cfun->stack_alignment_needed > cfun->preferred_stack_boundary) - pref = cfun->stack_alignment_needed; - cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary - = pref; - } - - /* Make sure volatile mem refs aren't considered valid operands for - arithmetic insns. We must call this here if this is a nested inline - function, since the above code leaves us in the init_recog state - (from final.c), and the function context push/pop code does not - save/restore volatile_ok. - - ??? Maybe it isn't necessary for expand_start_function to call this - anymore if we do it here? */ - - init_recog_no_volatile (); - - /* We're done with this function. Free up memory if we can. */ - free_after_parsing (cfun); - free_after_compilation (cfun); -} \f -/* This function is called from the pass manager in tree-optimize.c - after all tree passes have finished for a single function, and we - have expanded the function body from trees to RTL. - Once we are here, we have decided that we're supposed to output - that function, i.e. that we should write assembler code for it. - - We run a series of low-level passes here on the function's RTL - representation. Each pass is called via a rest_of_* function. */ - -static void -rest_of_compilation (void) -{ - /* If we're emitting a nested function, make sure its parent gets - emitted as well. Doing otherwise confuses debug info. */ - { - tree parent; - for (parent = DECL_CONTEXT (current_function_decl); - parent != NULL_TREE; - parent = get_containing_scope (parent)) - if (TREE_CODE (parent) == FUNCTION_DECL) - TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1; - } - - /* We are now committed to emitting code for this function. Do any - preparation, such as emitting abstract debug info for the inline - before it gets mangled by optimization. */ - if (cgraph_function_possibly_inlined_p (current_function_decl)) - (*debug_hooks->outlining_inline_function) (current_function_decl); - - /* Remove any notes we don't need. That will make iterating - over the instruction sequence faster, and allow the garbage - collector to reclaim the memory used by the notes. */ - remove_unnecessary_notes (); - - /* Initialize some variables used by the optimizers. */ - init_function_for_compilation (); - - TREE_ASM_WRITTEN (current_function_decl) = 1; - - /* Early return if there were errors. We can run afoul of our - consistency checks, and there's not really much point in fixing them. */ - if (rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount) - goto exit_rest_of_compilation; - - rest_of_handle_jump (); - - rest_of_handle_eh (); - - /* Delay emitting hard_reg_initial_value sets until after EH landing pad - generation, which might create new sets. */ - emit_initial_value_sets (); - -#ifdef FINALIZE_PIC - /* If we are doing position-independent code generation, now - is the time to output special prologues and epilogues. - We do not want to do this earlier, because it just clutters - up inline functions with meaningless insns. */ - if (flag_pic) - FINALIZE_PIC; -#endif - - /* Copy any shared structure that should not be shared. */ - unshare_all_rtl (); - - /* Instantiate all virtual registers. */ - instantiate_virtual_regs (); - - rest_of_handle_jump2 (); - - if (optimize > 0) - rest_of_handle_cse (); - - if (optimize > 0) - { - if (flag_gcse) - rest_of_handle_gcse (); - - if (flag_loop_optimize) - rest_of_handle_loop_optimize (); - - if (flag_gcse) - rest_of_handle_jump_bypass (); - } - - timevar_push (TV_FLOW); - rest_of_handle_cfg (); - - if (!flag_tree_based_profiling - && (optimize > 0 || profile_arc_flag - || flag_test_coverage || flag_branch_probabilities)) - { - rtl_register_profile_hooks (); - rtl_register_value_prof_hooks (); - rest_of_handle_branch_prob (); - - if (flag_branch_probabilities - && flag_profile_values - && (flag_value_profile_transformations - || flag_speculative_prefetching)) - rest_of_handle_value_profile_transformations (); - - /* Remove the death notes created for vpt. */ - if (flag_profile_values) - count_or_remove_death_notes (NULL, 1); - } - - if (optimize > 0) - rest_of_handle_if_conversion (); - - if (optimize > 0 && flag_tracer) - rest_of_handle_tracer (); - - if (optimize > 0 - && flag_loop_optimize2) - rest_of_handle_loop2 (); - - if (optimize > 0 && flag_web) - rest_of_handle_web (); - - if (optimize > 0 && flag_rerun_cse_after_loop) - rest_of_handle_cse2 (); - - cse_not_expected = 1; - - rest_of_handle_life (); - timevar_pop (TV_FLOW); - - if (optimize > 0) - rest_of_handle_combine (); - - if (optimize > 0 && flag_if_conversion) - rest_of_handle_if_after_combine (); - - /* The optimization to partition hot/cold basic blocks into separate - sections of the .o file does not work well with linkonce or with - user defined section attributes. Don't call it if either case - arises. */ - - if (flag_reorder_blocks_and_partition - && !DECL_ONE_ONLY (current_function_decl) - && !user_defined_section_attribute) - rest_of_handle_partition_blocks (); - - if (optimize > 0 && flag_regmove) - rest_of_handle_regmove (); - - /* Do unconditional splitting before register allocation to allow machine - description to add extra information not needed previously. */ - split_all_insns (1); - -#ifdef OPTIMIZE_MODE_SWITCHING - rest_of_handle_mode_switching (); -#endif - - /* Any of the several passes since flow1 will have munged register - lifetime data a bit. We need it to be up to date for scheduling - (see handling of reg_known_equiv in init_alias_analysis). */ - recompute_reg_usage (); - -#ifdef INSN_SCHEDULING - if (optimize > 0 && flag_modulo_sched) - rest_of_handle_sms (); - - if (flag_schedule_insns) - rest_of_handle_sched (); -#endif - - /* Determine if the current function is a leaf before running reload - since this can impact optimizations done by the prologue and - epilogue thus changing register elimination offsets. */ - current_function_is_leaf = leaf_function_p (); - - if (rest_of_handle_old_regalloc ()) - goto exit_rest_of_compilation; - - if (optimize > 0) - rest_of_handle_postreload (); - - if (optimize > 0 && flag_gcse_after_reload) - rest_of_handle_gcse2 (); - - rest_of_handle_flow2 (); - -#ifdef HAVE_peephole2 - if (optimize > 0 && flag_peephole2) - rest_of_handle_peephole2 (); -#endif - - if (optimize > 0) - rest_of_handle_if_after_reload (); - - if (optimize > 0) - { - if (flag_rename_registers || flag_cprop_registers) - rest_of_handle_regrename (); - - rest_of_handle_reorder_blocks (); - } - - if (flag_branch_target_load_optimize2) - rest_of_handle_branch_target_load_optimize (); - -#ifdef LEAF_REGISTERS - current_function_uses_only_leaf_regs - = optimize > 0 && only_leaf_regs_used () && leaf_function_p (); -#endif - -#ifdef INSN_SCHEDULING - if (optimize > 0 && flag_schedule_insns_after_reload) - rest_of_handle_sched2 (); -#endif - -#ifdef STACK_REGS - rest_of_handle_stack_regs (); -#endif - - compute_alignments (); - - /* Aggressively duplicate basic blocks ending in computed gotos to the - tails of their predecessors, unless we are optimizing for size. */ - if (flag_expensive_optimizations && !optimize_size) - duplicate_computed_gotos (); - - if (flag_var_tracking) - rest_of_handle_variable_tracking (); - - /* CFG is no longer maintained up-to-date. */ - free_bb_for_insn (); - - if (targetm.machine_dependent_reorg != 0) - rest_of_handle_machine_reorg (); - - purge_line_number_notes (get_insns ()); - cleanup_barriers (); - -#ifdef DELAY_SLOTS - if (flag_delayed_branch) - rest_of_handle_delay_slots (); -#endif - -#if defined (HAVE_ATTR_length) && !defined (STACK_REGS) - timevar_push (TV_SHORTEN_BRANCH); - split_all_insns_noflow (); - timevar_pop (TV_SHORTEN_BRANCH); -#endif - - convert_to_eh_region_ranges (); - - rest_of_handle_shorten_branches (); - - set_nothrow_function_flags (); - - rest_of_handle_final (); - - exit_rest_of_compilation: - - rest_of_clean_state (); -} - void finish_optimization_passes (void) { [-- Attachment #5: rtl-add-passes.patch --] [-- Type: text/plain, Size: 140222 bytes --] 2005-05-19 Paolo Bonzini <bonzini@gnu.org> * Makefile.in: Adjust dependencies. * tree-pass.h: Add new passes and passes formerly in tree-optimize.c. * basic-block.h (duplicate_computed_gotos): Remove, it is now static. * alias.c (rest_of_handle_cfg, pass_cfg): New. * bb-reorder.c (duplicate_computed_gotos): Make it static. * cfgexpand.c (tree_expand_cfg): Add code formerly at the beginning of rest_of_compilation. * bb-reorder.c (gate_duplicate_computed_gotos, pass_duplicate_computed_gotos, gate_handle_reorder_blocks, rest_of_handle_reorder_blocks, pass_reorder_blocks, gate_handle_partition_blocks, rest_of_handle_partition_blocks, pass_partition_blocks): New. * bt-load.c (gate_handle_branch_target_load_optimize, rest_of_handle_branch_target_load_optimize, pass_branch_target_load_optimize): New. * cfgcleanup.c (rest_of_handle_jump, pass_jump, rest_of_handle_jump2, pass_jump2): New. * cfglayout.c (pass_insn_locators_initialize): New. * cfgrtl.c (pass_free_cfg): New. * combine.c (gate_handle_combine, rest_of_handle_combine, pass_combine): New. * cse.c (gate_handle_cse, rest_of_handle_cse, pass_cse, gate_handle_cse2, rest_of_handle_cse2, pass_cse2): New. * emit-rtl.c (pass_unshare_all_rtl, pass_remove_unnecessary_notes): New. * except.c (pass_set_nothrow_function_flags, pass_convert_to_eh_region_ranges, gate_handle_eh, rest_of_handle_eh, pass_rtl_eh): New. * final.c (pass_compute_alignments, rest_of_handle_final, pass_final, rest_of_handle_shorten_branches, pass_shorten_branches, rest_of_clean_state, pass_clean_state): New. * flow.c (pass_recompute_reg_usage, gate_remove_death_notes, rest_of_handle_remove_death_notes, pass_remove_death_notes, rest_of_handle_life, pass_life, rest_of_handle_flow2, pass_flow2): New. * function.c (pass_instantiate_virtual_regs, pass_init_function, rest_of_handle_check_leaf_regs, pass_leaf_regs): New. * gcse.c (gate_handle_jump_bypass, rest_of_handle_jump_bypass, pass_jump_bypass, gate_handle_gcse, rest_of_handle_gcse, pass_gcse): New. * global.c (rest_of_handle_global_alloc, pass_global_alloc): New. * ifcvt.c (gate_handle_if_conversion, rest_of_handle_if_conversion, pass_rtl_ifcvt, gate_handle_if_after_combine, rest_of_handle_if_after_combine, pass_if_after_combine, gate_handle_if_after_reload, rest_of_handle_if_after_reload, pass_if_after_reload): New. * integrate.c (pass_initial_value_sets): New. * jump.c (pass_cleanup_barriers, purge_line_number_notes, pass_purge_lineno_notes): New. * mode-switching.c (rest_of_handle_mode_switching, pass_mode_switching): New. * local-alloc.c (rest_of_handle_local_alloc, pass_local_alloc): New. * loop-init.c (gate_handle_loop2, rest_of_handle_loop2, pass_loop2): New. * loop.c (gate_handle_loop_optimize, rest_of_handle_loop_optimize, pass_loop_optimize): New. * modulo-sched.c (gate_handle_sms, rest_of_handle_sms, pass_sms): New. * postreload-gcse.c (gate_handle_gcse2, rest_of_handle_gcse2, pass_gcse2): New. * postreload.c (gate_handle_postreload, rest_of_handle_postreload, pass_postreload_cse): New. * profile.c (gate_handle_profiling, pass_profiling, rest_of_handle_branch_prob, pass_branch_prob): New. * recog.c (pass pass_split_for_shorten_branches, gate_do_final_split, pass_split_before_regstack, gate_handle_split_before_regstack, gate_handle_peephole2, rest_of_handle_peephole2, pass_peephole2, rest_of_handle_split_all_insns, pass_split_all_insns): New. * reg-stack.c (gate_handle_stack_regs, rest_of_handle_stack_regs, pass_stack_regs): New. * regmove.c (gate_handle_regmove, rest_of_handle_regmove, pass_regmove, gate_handle_stack_adjustments, rest_of_handle_stack_adjustments, pass_stack_adjustments): New. * regrename.c (gate_handle_regrename, rest_of_handle_regrename, pass_regrename): New. * reorg.c (gate_handle_delay_slots, rest_of_handle_delay_slots, pass_delay_slots, gate_handle_machine_reorg, rest_of_handle_machine_reorg, pass_machine_reorg): New. * rtl.h (extern void purge_line_number_notes): New. * sched-rgn.c (gate_handle_sched, rest_of_handle_sched, gate_handle_sched2, rest_of_handle_sched2, pass_sched, pass_sched2): New. * tracer.c (gate_handle_tracer, rest_of_handle_tracer, pass_tracer): New. * value-prof.c (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): New. * var-tracking.c (gate_handle_var_tracking, pass_variable_tracking): New. * web.c (gate_handle_web, rest_of_handle_web, pass_web): New. Index: Makefile.in =================================================================== RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v retrieving revision 1.1496 diff -p -u -r1.1496 Makefile.in --- Makefile.in 4 Jun 2005 17:07:50 -0000 1.1496 +++ Makefile.in 6 Jun 2005 07:41:49 -0000 @@ -1974,7 +1974,7 @@ function.o : function.c $(CONFIG_H) $(SY $(TREE_H) $(CFGLAYOUT_H) $(TREE_GIMPLE_H) $(FLAGS_H) function.h $(EXPR_H) \ $(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ output.h toplev.h except.h $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \ - gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) + gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) tree-pass.h stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) function.h insn-config.h hard-reg-set.h $(EXPR_H) \ libfuncs.h except.h $(RECOG_H) toplev.h output.h $(GGC_H) $(TM_P_H) \ @@ -1985,7 +1985,7 @@ except.o : except.c $(CONFIG_H) $(SYSTEM langhooks.h insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \ dwarf2asm.h dwarf2out.h toplev.h $(HASHTAB_H) intl.h $(GGC_H) \ gt-except.h $(CGRAPH_H) $(INTEGRATE_H) $(DIAGNOSTIC_H) dwarf2.h \ - $(TARGET_H) $(TM_P_H) + $(TARGET_H) $(TM_P_H) tree-pass.h timevar.h expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) \ libfuncs.h $(INSN_ATTR_H) insn-config.h $(RECOG_H) output.h \ @@ -2042,16 +2042,17 @@ xcoffout.o : xcoffout.c $(CONFIG_H) $(SY emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \ $(GGC_H) $(EXPR_H) hard-reg-set.h bitmap.h toplev.h $(BASIC_BLOCK_H) \ - $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h gt-emit-rtl.h + $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h tree-pass.h gt-emit-rtl.h real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ toplev.h $(TM_P_H) real.h integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) $(FLAGS_H) debug.h $(INTEGRATE_H) insn-config.h \ $(EXPR_H) real.h $(REGS_H) intl.h function.h output.h $(RECOG_H) \ except.h toplev.h $(PARAMS_H) $(TM_P_H) $(TARGET_H) langhooks.h \ - gt-integrate.h $(GGC_H) + gt-integrate.h $(GGC_H) tree-pass.h jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(FLAGS_H) \ - hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \ + hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) real.h except.h \ + function.h tree-pass.h \ toplev.h $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) $(TIMEVAR_H) \ $(DIAGNOSTIC_H) @@ -2084,24 +2085,25 @@ cselib.o : cselib.c $(CONFIG_H) $(SYSTEM cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ output.h function.h $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \ - except.h $(TARGET_H) $(PARAMS_H) rtlhooks-def.h + except.h $(TARGET_H) $(PARAMS_H) rtlhooks-def.h tree-pass.h web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) function.h output.h toplev.h \ - $(DF_H) $(OBSTACK_H) + $(DF_H) $(OBSTACK_H) timevar.h tree-pass.h gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(GGC_H) \ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) function.h output.h toplev.h \ $(TM_P_H) $(PARAMS_H) except.h gt-gcse.h $(TREE_H) cselib.h $(TIMEVAR_H) \ - intl.h $(OBSTACK_H) + intl.h $(OBSTACK_H) tree-pass.h resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \ coretypes.h $(TM_H) $(REGS_H) $(FLAGS_H) output.h $(RESOURCE_H) \ function.h toplev.h $(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H) lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) \ $(BASIC_BLOCK_H) $(TM_P_H) function.h output.h -mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h \ - $(INSN_ATTR_H) $(RECOG_H) $(BASIC_BLOCK_H) $(TM_P_H) function.h output.h +mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h \ + $(INSN_ATTR_H) $(RECOG_H) $(BASIC_BLOCK_H) $(TM_P_H) function.h output.h \ + tree-pass.h timevar.h tree-ssa-dce.o : tree-ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \ coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(BASIC_BLOCK_H) \ @@ -2131,12 +2133,13 @@ df.o : df.c $(CONFIG_H) $(SYSTEM_H) core var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h $(FLAGS_H) \ $(BASIC_BLOCK_H) output.h sbitmap.h alloc-pool.h $(FIBHEAP_H) $(HASHTAB_H) \ - $(REGS_H) $(EXPR_H) + $(REGS_H) $(EXPR_H) timevar.h tree-pass.h conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OBSTACK_H) \ $(HASHTAB_H) $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H) profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) function.h \ - toplev.h $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h + toplev.h $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \ + cfgloop.h timevar.h tree-pass.h tree-profile.o : tree-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \ function.h toplev.h $(COVERAGE_H) $(TREE_H) value-prof.h $(TREE_DUMP_H) \ @@ -2148,11 +2152,12 @@ value-prof.o : value-prof.c $(CONFIG_H) $(BASIC_BLOCK_H) hard-reg-set.h value-prof.h $(EXPR_H) output.h $(FLAGS_H) \ $(RECOG_H) insn-config.h $(OPTABS_H) $(REGS_H) $(GGC_H) $(DIAGNOSTIC_H) \ $(TREE_H) $(COVERAGE_H) $(RTL_H) $(GCOV_IO_H) $(TREE_FLOW_H) \ - tree-flow-inline.h + tree-flow-inline.h timevar.h tree-pass.h loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \ real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h $(CFGLOOP_H) \ - toplev.h except.h cselib.h $(OPTABS_H) $(TM_P_H) $(GGC_H) insn-flags.h + toplev.h except.h cselib.h $(OPTABS_H) $(TM_P_H) $(GGC_H) insn-flags.h \ + timevar.h tree-pass.h loop-doloop.o : loop-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \ toplev.h $(CFGLOOP_H) output.h $(PARAMS_H) @@ -2160,7 +2165,7 @@ alloc-pool.o : alloc-pool.c $(CONFIG_H) flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \ hard-reg-set.h output.h toplev.h $(RECOG_H) function.h except.h \ - $(EXPR_H) $(TM_P_H) $(OBSTACK_H) $(SPLAY_TREE_H) $(TIMEVAR_H) + $(EXPR_H) $(TM_P_H) $(OBSTACK_H) $(SPLAY_TREE_H) $(TIMEVAR_H) tree-pass.h cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(FLAGS_H) \ $(REGS_H) hard-reg-set.h output.h toplev.h function.h except.h $(GGC_H) \ $(TM_P_H) $(TIMEVAR_H) $(OBSTACK_H) $(TREE_H) @@ -2169,11 +2174,12 @@ cfghooks.o: cfghooks.c $(CONFIG_H) $(SYS cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) function.h $(TIMEVAR_H) $(TM_H) \ coretypes.h $(TREE_DUMP_H) except.h langhooks.h tree-pass.h $(RTL_H) \ - $(DIAGNOSTIC_H) toplev.h $(BASIC_BLOCK_H) $(FLAGS_H) + $(DIAGNOSTIC_H) toplev.h $(BASIC_BLOCK_H) $(FLAGS_H) debug.h cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \ output.h toplev.h function.h except.h $(TM_P_H) insn-config.h $(EXPR_H) \ - $(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) + $(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \ + tree-pass.h cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(TM_P_H) \ $(TIMEVAR_H) $(OBSTACK_H) toplev.h @@ -2183,7 +2189,7 @@ cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SY cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TIMEVAR_H) hard-reg-set.h output.h $(FLAGS_H) $(RECOG_H) \ toplev.h insn-config.h cselib.h $(TARGET_H) $(TM_P_H) $(PARAMS_H) \ - $(REGS_H) $(EMIT_RTL_H) $(CFGLAYOUT_H) + $(REGS_H) $(EMIT_RTL_H) $(CFGLAYOUT_H) tree-pass.h cfgloop.h expr.h cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(FLAGS_H) function.h \ $(OBSTACK_H) toplev.h $(TREE_FLOW_H) $(TREE_H) @@ -2201,7 +2207,7 @@ cfgloopmanip.o : cfgloopmanip.c $(CONFIG coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H) loop-init.o : loop-init.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) \ - coretypes.h $(TM_H) $(OBSTACK_H) + coretypes.h $(TM_H) $(OBSTACK_H) tree-pass.h timevar.h $(FLAGS_H) loop-unswitch.o : loop-unswitch.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) $(PARAMS_H) \ output.h $(EXPR_H) coretypes.h $(TM_H) $(OBSTACK_H) @@ -2217,7 +2223,7 @@ combine.o : combine.c $(CONFIG_H) $(SYST $(FLAGS_H) function.h insn-config.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \ rtlhooks-def.h $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h \ toplev.h $(TM_P_H) $(TREE_H) $(TARGET_H) output.h $(PARAMS_H) $(OPTABS_H) \ - insn-codes.h + insn-codes.h timevar.h tree-pass.h regclass.o : regclass.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(REGS_H) insn-config.h \ $(RECOG_H) reload.h real.h toplev.h function.h output.h $(GGC_H) \ @@ -2225,12 +2231,13 @@ regclass.o : regclass.c $(CONFIG_H) $(SY local-alloc.o : local-alloc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ output.h function.h $(INSN_ATTR_H) toplev.h except.h reload.h $(TM_P_H) \ - $(GGC_H) $(INTEGRATE_H) + $(GGC_H) $(INTEGRATE_H) timevar.h tree-pass.h bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) $(GGC_H) gt-bitmap.h bitmap.h $(OBSTACK_H) global.o : global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) reload.h function.h $(RECOG_H) $(REGS_H) hard-reg-set.h \ - insn-config.h output.h toplev.h $(TM_P_H) $(MACHMODE_H) + insn-config.h output.h toplev.h $(TM_P_H) $(MACHMODE_H) tree-pass.h \ + timevar.h varray.o : varray.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) \ $(HASHTAB_H) $(BCONFIG_H) $(VARRAY_H) toplev.h vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h $(GGC_H) \ @@ -2249,28 +2256,30 @@ postreload.o : postreload.c $(CONFIG_H) $(RTL_H) real.h $(FLAGS_H) $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) \ hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) output.h \ function.h toplev.h cselib.h $(TM_P_H) except.h $(TREE_H) $(MACHMODE_H) \ - $(OBSTACK_H) + $(OBSTACK_H) timevar.h tree-pass.h postreload-gcse.o : postreload-gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h \ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) function.h output.h toplev.h \ $(TM_P_H) except.h $(TREE_H) $(TARGET_H) $(HASHTAB_H) intl.h $(OBSTACK_H) \ - $(PARAMS_H) + $(PARAMS_H) timevar.h tree-pass.h caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \ $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H) bt-load.o : bt-load.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) except.h \ - $(RTL_H) hard-reg-set.h $(REGS_H) $(TM_P_H) $(FIBHEAP_H) output.h \ - $(TARGET_H) $(EXPR_H) $(FLAGS_H) $(INSN_ATTR_H) function.h + $(RTL_H) hard-reg-set.h $(REGS_H) $(TM_P_H) $(FIBHEAP_H) output.h $(EXPR_H) \ + $(TARGET_H) $(FLAGS_H) $(INSN_ATTR_H) function.h tree-pass.h toplev.h reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ conditions.h hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) insn-config.h \ $(INSN_ATTR_H) except.h $(RECOG_H) function.h $(FLAGS_H) output.h \ - $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H) $(OBSTACK_H) $(RESOURCE_H) + $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H) $(OBSTACK_H) $(RESOURCE_H) \ + timevar.h target.h tree-pass.h alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h \ $(ALIAS_H) $(EMIT_RTL_H) $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) \ langhooks.h $(TARGET_H) gt-alias.h $(TIMEVAR_H) $(CGRAPH_H) \ - $(SPLAY_TREE_H) $(VARRAY_H) -regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \ + $(SPLAY_TREE_H) $(VARRAY_H) tree-pass.h +regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + insn-config.h timevar.h tree-pass.h \ $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) function.h \ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h ddg.o : ddg.c $(DDG_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) \ @@ -2282,7 +2291,7 @@ modulo-sched.o : modulo-sched.c $(DDG_H) coretypes.h $(TARGET_H) toplev.h $(RTL_H) $(TM_P_H) $(REGS_H) function.h \ $(FLAGS_H) insn-config.h $(INSN_ATTR_H) except.h $(RECOG_H) \ $(SCHED_INT_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(EXPR_H) $(PARAMS_H) \ - cfghooks.h $(DF_H) $(GCOV_IO_H) hard-reg-set.h $(TM_H) + cfghooks.h $(DF_H) $(GCOV_IO_H) hard-reg-set.h $(TM_H) timevar.h tree-pass.h haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h function.h \ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) @@ -2293,7 +2302,7 @@ sched-deps.o : sched-deps.c $(CONFIG_H) sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \ function.h $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(PARAMS_H) \ - $(TM_P_H) $(TARGET_H) $(CFGLAYOUT_H) + $(TM_P_H) $(TARGET_H) $(CFGLAYOUT_H) timevar.h tree-pass.h sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \ function.h $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) \ @@ -2304,16 +2313,17 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $( final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \ insn-config.h $(INSN_ATTR_H) function.h real.h output.h hard-reg-set.h \ - except.h debug.h xcoffout.h toplev.h reload.h dwarf2out.h \ - $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) $(CFGLAYOUT_H) dbxout.h + except.h debug.h xcoffout.h toplev.h reload.h dwarf2out.h tree-pass.h \ + $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) $(CFGLAYOUT_H) dbxout.h \ + timevar.h cgraph.h coverage.h recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ function.h $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h \ $(FLAGS_H) insn-config.h $(INSN_ATTR_H) real.h toplev.h output.h reload.h \ - $(TM_P_H) + $(TM_P_H) timevar.h tree-pass.h reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \ insn-config.h toplev.h reload.h function.h $(TM_P_H) $(GGC_H) \ - gt-reg-stack.h $(BASIC_BLOCK_H) output.h $(VARRAY_H) + gt-reg-stack.h $(BASIC_BLOCK_H) output.h $(VARRAY_H) timevar.h tree-pass.h sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \ @@ -2326,24 +2336,25 @@ lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(FLAGS_H) $(TIMEVAR_H) output.h $(CFGLAYOUT_H) $(FIBHEAP_H) \ $(TARGET_H) function.h $(TM_P_H) $(OBSTACK_H) $(EXPR_H) $(REGS_H) \ - $(PARAMS_H) toplev.h + $(PARAMS_H) toplev.h tree-pass.h tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h $(CFGLAYOUT_H) \ - $(FLAGS_H) $(TIMEVAR_H) $(PARAMS_H) $(COVERAGE_H) $(FIBHEAP_H) + $(FLAGS_H) $(TIMEVAR_H) $(PARAMS_H) $(COVERAGE_H) $(FIBHEAP_H) \ + tree-pass.h cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \ function.h $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) gt-cfglayout.h \ - $(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) + $(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) tree-pass.h timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TIMEVAR_H) $(FLAGS_H) intl.h toplev.h $(RTL_H) timevar.def regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \ output.h $(RECOG_H) function.h $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \ - reload.h toplev.h + reload.h toplev.h timevar.h tree-pass.h ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(REGS_H) toplev.h $(FLAGS_H) insn-config.h function.h $(RECOG_H) \ $(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) \ - real.h $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h + real.h $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h timevar.h tree-pass.h lambda-mat.o : lambda-mat.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ $(TM_H) coretypes.h $(TREE_H) $(VARRAY_H) lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ Index: alias.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/alias.c,v retrieving revision 1.250 diff -p -u -r1.250 alias.c --- alias.c 21 Apr 2005 15:47:04 -0000 1.250 +++ alias.c 18 May 2005 10:27:08 -0000 @@ -44,6 +44,7 @@ Software Foundation, 59 Temple Place - S #include "target.h" #include "cgraph.h" #include "varray.h" +#include "tree-pass.h" /* The alias sets assigned to MEMs assist the back-end in determining which MEMs can alias which other MEMs. In general, two MEMs in @@ -2967,5 +2968,57 @@ end_alias_analysis (void) alias_invariant_size = 0; } } +\f +/* Do control and data flow analysis; write some of the results to the + dump file. */ +static void +rest_of_handle_cfg (void) +{ + if (dump_file) + dump_flow_info (dump_file); + if (optimize) + cleanup_cfg (CLEANUP_EXPENSIVE + | (flag_thread_jumps ? CLEANUP_THREADING : 0)); + + /* It may make more sense to mark constant functions after dead code is + eliminated by life_analysis, but we need to do it early, as -fprofile-arcs + may insert code making function non-constant, but we still must consider + it as constant, otherwise -fbranch-probabilities will not read data back. + + life_analysis rarely eliminates modification of external memory. + + FIXME: now with tree based profiling we are in the trap described above + again. It seems to be easiest to disable the optimization for time + being before the problem is either solved by moving the transformation + to the IPA level (we need the CFG for this) or the very early optimization + passes are made to ignore the const/pure flags so code does not change. */ + if (optimize + && (!flag_tree_based_profiling + || (!profile_arc_flag && !flag_branch_probabilities))) + { + /* Alias analysis depends on this information and mark_constant_function + depends on alias analysis. */ + reg_scan (get_insns (), max_reg_num ()); + mark_constant_function (); + } +} + +struct tree_opt_pass pass_cfg = +{ + "cfg", /* name */ + NULL, /* gate */ + rest_of_handle_cfg, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FLOW, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'f' /* letter */ +}; + #include "gt-alias.h" Index: basic-block.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v retrieving revision 1.256 diff -p -u -r1.256 basic-block.h --- basic-block.h 13 May 2005 13:34:17 -0000 1.256 +++ basic-block.h 18 May 2005 10:27:10 -0000 @@ -934,7 +934,6 @@ extern bool control_flow_insn_p (rtx); /* In bb-reorder.c */ extern void reorder_basic_blocks (unsigned int); -extern void duplicate_computed_gotos (void); extern void partition_hot_cold_basic_blocks (void); /* In cfg.c */ Index: bb-reorder.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v retrieving revision 1.104 diff -p -u -u -p -r1.104 bb-reorder.c --- bb-reorder.c 1 Jun 2005 02:50:51 -0000 1.104 +++ bb-reorder.c 6 Jun 2005 08:43:28 -0000 @@ -83,6 +83,11 @@ #include "expr.h" #include "params.h" #include "toplev.h" +#include "tree-pass.h" + +#ifndef HAVE_conditional_execution +#define HAVE_conditional_execution 0 +#endif /* The number of rounds. In most cases there will only be 4 rounds, but when partitioning hot and cold basic blocks into separate sections of @@ -1893,8 +1898,6 @@ reorder_basic_blocks (unsigned int flags if (targetm.cannot_modify_jumps_p ()) return; - timevar_push (TV_REORDER_BLOCKS); - cfg_layout_initialize (flags); set_edge_can_fallthru_flag (); @@ -1930,8 +1933,6 @@ reorder_basic_blocks (unsigned int flags cfg_layout_finalize (); if (flag_reorder_blocks_and_partition) verify_hot_cold_block_grouping (); - - timevar_pop (TV_REORDER_BLOCKS); } /* Determine which partition the first basic block in the function @@ -1969,7 +1970,14 @@ insert_section_boundary_note (void) which can seriously pessimize code with many computed jumps in the source code, such as interpreters. See e.g. PR15242. */ -void +static bool +gate_duplicate_computed_gotos (void) +{ + return (optimize > 0 && flag_expensive_optimizations && !optimize_size); +} + + +static void duplicate_computed_gotos (void) { basic_block bb, new_bb; @@ -1982,8 +1990,6 @@ duplicate_computed_gotos (void) if (targetm.cannot_modify_jumps_p ()) return; - timevar_push (TV_REORDER_BLOCKS); - cfg_layout_initialize (0); /* We are estimating the length of uncond jump insn only once @@ -2075,10 +2081,26 @@ done: cfg_layout_finalize (); BITMAP_FREE (candidates); - - timevar_pop (TV_REORDER_BLOCKS); } +struct tree_opt_pass pass_duplicate_computed_gotos = +{ + NULL, /* name */ + gate_duplicate_computed_gotos, /* gate */ + duplicate_computed_gotos, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_REORDER_BLOCKS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + /* This function is the main 'entrance' for the optimization that partitions hot and cold basic blocks into separate sections of the .o file (to improve performance and cache locality). Ideally it @@ -2168,3 +2190,104 @@ partition_hot_cold_basic_blocks (void) cfg_layout_finalize(); } +\f +static bool +gate_handle_reorder_blocks (void) +{ + return (optimize > 0); +} + + +/* Reorder basic blocks. */ +static void +rest_of_handle_reorder_blocks (void) +{ + bool changed; + unsigned int liveness_flags; + + /* Last attempt to optimize CFG, as scheduling, peepholing and insn + splitting possibly introduced more crossjumping opportunities. */ + liveness_flags = (!HAVE_conditional_execution ? CLEANUP_UPDATE_LIFE : 0); + changed = cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags); + + if (flag_sched2_use_traces && flag_schedule_insns_after_reload) + { + timevar_push (TV_TRACER); + tracer (liveness_flags); + timevar_pop (TV_TRACER); + } + + if (flag_reorder_blocks || flag_reorder_blocks_and_partition) + reorder_basic_blocks (liveness_flags); + if (flag_reorder_blocks || flag_reorder_blocks_and_partition + || (flag_sched2_use_traces && flag_schedule_insns_after_reload)) + changed |= cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags); + + /* On conditional execution targets we can not update the life cheaply, so + we deffer the updating to after both cleanups. This may lose some cases + but should not be terribly bad. */ + if (changed && HAVE_conditional_execution) + update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, + PROP_DEATH_NOTES); +} + +struct tree_opt_pass pass_reorder_blocks = +{ + "bbro", /* name */ + gate_handle_reorder_blocks, /* gate */ + rest_of_handle_reorder_blocks, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_REORDER_BLOCKS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'B' /* letter */ +}; + +static bool +gate_handle_partition_blocks (void) +{ + /* The optimization to partition hot/cold basic blocks into separate + sections of the .o file does not work well with linkonce or with + user defined section attributes. Don't call it if either case + arises. */ + + return (flag_reorder_blocks_and_partition + && !DECL_ONE_ONLY (current_function_decl) + && !user_defined_section_attribute); +} + +/* Partition hot and cold basic blocks. */ +static void +rest_of_handle_partition_blocks (void) +{ + no_new_pseudos = 0; + partition_hot_cold_basic_blocks (); + allocate_reg_life_data (); + update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, + PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES); + no_new_pseudos = 1; +} + +struct tree_opt_pass pass_partition_blocks = +{ + NULL, /* name */ + gate_handle_partition_blocks, /* gate */ + rest_of_handle_partition_blocks, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_REORDER_BLOCKS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + Index: bt-load.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/bt-load.c,v retrieving revision 2.34 diff -p -u -r2.34 bt-load.c --- bt-load.c 13 May 2005 16:56:11 -0000 2.34 +++ bt-load.c 18 May 2005 10:27:17 -0000 @@ -34,6 +34,8 @@ Software Foundation, 59 Temple Place - S #include "function.h" #include "except.h" #include "tm_p.h" +#include "toplev.h" +#include "tree-pass.h" /* Target register optimizations - these are performed after reload. */ @@ -1478,3 +1480,50 @@ branch_target_load_optimize (bool after_ PROP_DEATH_NOTES | PROP_REG_INFO); } } +\f +static bool +gate_handle_branch_target_load_optimize (void) +{ + return (optimize > 0 && flag_branch_target_load_optimize2); +} + + +static void +rest_of_handle_branch_target_load_optimize (void) +{ + static int warned = 0; + + /* Leave this a warning for now so that it is possible to experiment + with running this pass twice. In 3.6, we should either make this + an error, or use separate dump files. */ + if (flag_branch_target_load_optimize + && flag_branch_target_load_optimize2 + && !warned) + { + warning (0, "branch target register load optimization is not intended " + "to be run twice"); + + warned = 1; + } + + branch_target_load_optimize (epilogue_completed); +} + +struct tree_opt_pass pass_branch_target_load_optimize = +{ + "btl", /* name */ + gate_handle_branch_target_load_optimize, /* gate */ + rest_of_handle_branch_target_load_optimize, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'd' /* letter */ +}; + Index: cfgcleanup.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v retrieving revision 1.145 diff -p -u -r1.145 cfgcleanup.c --- cfgcleanup.c 17 May 2005 06:48:17 -0000 1.145 +++ cfgcleanup.c 18 May 2005 10:27:21 -0000 @@ -50,6 +50,9 @@ Software Foundation, 59 Temple Place - S #include "target.h" #include "cfglayout.h" #include "emit-rtl.h" +#include "tree-pass.h" +#include "cfgloop.h" +#include "expr.h" /* cleanup_cfg maintains following flags for each basic block. */ @@ -2138,3 +2141,81 @@ cleanup_cfg (int mode) return changed; } +\f +static void +rest_of_handle_jump (void) +{ + delete_unreachable_blocks (); + + if (cfun->tail_call_emit) + fixup_tail_calls (); +} + +struct tree_opt_pass pass_jump = +{ + "sibling", /* name */ + NULL, /* gate */ + rest_of_handle_jump, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_JUMP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + TODO_ggc_collect, /* todo_flags_start */ + TODO_dump_func | + TODO_verify_flow, /* todo_flags_finish */ + 'i' /* letter */ +}; + + +static void +rest_of_handle_jump2 (void) +{ + /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this + before jump optimization switches branch directions. */ + if (flag_guess_branch_prob) + expected_value_to_br_prob (); + + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + reg_scan (get_insns (), max_reg_num ()); + if (dump_file) + dump_flow_info (dump_file); + cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP + | (flag_thread_jumps ? CLEANUP_THREADING : 0)); + + create_loop_notes (); + + purge_line_number_notes (); + + if (optimize) + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); + + /* Jump optimization, and the removal of NULL pointer checks, may + have reduced the number of instructions substantially. CSE, and + future passes, allocate arrays whose dimensions involve the + maximum instruction UID, so if we can reduce the maximum UID + we'll save big on memory. */ + renumber_insns (dump_file); +} + + +struct tree_opt_pass pass_jump2 = +{ + "jump", /* name */ + NULL, /* gate */ + rest_of_handle_jump2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_JUMP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + TODO_ggc_collect, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'j' /* letter */ +}; + + Index: cfgexpand.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cfgexpand.c,v retrieving revision 2.38 diff -p -u -r2.38 cfgexpand.c --- cfgexpand.c 28 Apr 2005 05:02:59 -0000 2.38 +++ cfgexpand.c 18 May 2005 10:27:23 -0000 @@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "diagnostic.h" #include "toplev.h" +#include "debug.h" /* Verify that there is exactly single jump instruction since last and attach REG_BR_PROB note specifying probability. @@ -1342,6 +1343,30 @@ tree_expand_cfg (void) "\n\n;;\n;; Full RTL generated for this function:\n;;\n"); /* And the pass manager will dump RTL for us. */ } + + /* If we're emitting a nested function, make sure its parent gets + emitted as well. Doing otherwise confuses debug info. */ + { + tree parent; + for (parent = DECL_CONTEXT (current_function_decl); + parent != NULL_TREE; + parent = get_containing_scope (parent)) + if (TREE_CODE (parent) == FUNCTION_DECL) + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1; + } + + /* We are now committed to emitting code for this function. Do any + preparation, such as emitting abstract debug info for the inline + before it gets mangled by optimization. */ + if (cgraph_function_possibly_inlined_p (current_function_decl)) + (*debug_hooks->outlining_inline_function) (current_function_decl); + + TREE_ASM_WRITTEN (current_function_decl) = 1; + +#ifdef FINALIZE_PIC + if (flag_pic) + FINALIZE_PIC; +#endif } struct tree_opt_pass pass_expand = @@ -1358,6 +1383,6 @@ struct tree_opt_pass pass_expand = PROP_rtl, /* properties_provided */ PROP_gimple_leh, /* properties_destroyed */ 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ + TODO_dump_func, /* todo_flags_finish */ 'r' /* letter */ }; Index: cfglayout.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v retrieving revision 1.87 diff -p -u -r1.87 cfglayout.c --- cfglayout.c 3 May 2005 16:35:17 -0000 1.87 +++ cfglayout.c 18 May 2005 10:27:25 -0000 @@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - S #include "ggc.h" #include "alloc-pool.h" #include "flags.h" +#include "tree-pass.h" /* Holds the interesting trailing notes for the function. */ rtx cfg_layout_function_footer, cfg_layout_function_header; @@ -327,6 +328,24 @@ insn_locators_initialize (void) free_block_changes (); } +struct tree_opt_pass pass_insn_locators_initialize = +{ + NULL, /* name */ + NULL, /* gate */ + insn_locators_initialize, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + /* For each lexical block, set BLOCK_NUMBER to the depth at which it is found in the block tree. */ Index: cfgrtl.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v retrieving revision 1.174 diff -p -u -u -p -r1.174 cfgrtl.c --- cfgrtl.c 4 Jun 2005 17:07:55 -0000 1.174 +++ cfgrtl.c 6 Jun 2005 08:43:40 -0000 @@ -58,6 +58,7 @@ Software Foundation, 59 Temple Place - S #include "target.h" #include "cfgloop.h" #include "ggc.h" +#include "tree-pass.h" static int can_delete_note_p (rtx); static int can_delete_label_p (rtx); @@ -417,6 +418,23 @@ free_bb_for_insn (void) BLOCK_FOR_INSN (insn) = NULL; } +struct tree_opt_pass pass_free_cfg = +{ + NULL, /* name */ + NULL, /* gate */ + free_bb_for_insn, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + PROP_cfg, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + /* Return RTX to emit after when we want to emit code on the entry of function. */ rtx entry_of_function (void) Index: combine.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/combine.c,v retrieving revision 1.489 diff -p -u -r1.489 combine.c --- combine.c 3 May 2005 22:15:39 -0000 1.489 +++ combine.c 18 May 2005 10:27:59 -0000 @@ -96,6 +96,8 @@ Software Foundation, 59 Temple Place - S /* Include output.h for dump_file. */ #include "output.h" #include "params.h" +#include "timevar.h" +#include "tree-pass.h" /* Number of attempts to combine instructions in this function. */ @@ -12510,3 +12512,50 @@ dump_combine_total_stats (FILE *file) "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n", total_attempts, total_merges, total_extras, total_successes); } +\f + +static bool +gate_handle_combine (void) +{ + return (optimize > 0); +} + +/* Try combining insns through substitution. */ +static void +rest_of_handle_combine (void) +{ + int rebuild_jump_labels_after_combine + = combine_instructions (get_insns (), max_reg_num ()); + + /* Combining insns may have turned an indirect jump into a + direct jump. Rebuild the JUMP_LABEL fields of jumping + instructions. */ + if (rebuild_jump_labels_after_combine) + { + timevar_push (TV_JUMP); + rebuild_jump_labels (get_insns ()); + timevar_pop (TV_JUMP); + + delete_dead_jumptables (); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); + } +} + +struct tree_opt_pass pass_combine = +{ + "combine", /* name */ + gate_handle_combine, /* gate */ + rest_of_handle_combine, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_COMBINE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'c' /* letter */ +}; + Index: cse.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cse.c,v retrieving revision 1.354 diff -p -u -r1.354 cse.c --- cse.c 22 Apr 2005 16:14:52 -0000 1.354 +++ cse.c 18 May 2005 10:28:13 -0000 @@ -43,6 +43,7 @@ Software Foundation, 59 Temple Place - S #include "target.h" #include "params.h" #include "rtlhooks-def.h" +#include "tree-pass.h" /* The basic idea of common subexpression elimination is to go through the code, keeping a record of expressions that would @@ -7741,3 +7742,119 @@ cse_condition_code_reg (void) } } } +\f + +/* Perform common subexpression elimination. Nonzero value from + `cse_main' means that jumps were simplified and some code may now + be unreachable, so do jump optimization again. */ +static bool +gate_handle_cse (void) +{ + return optimize > 0; +} + +static void +rest_of_handle_cse (void) +{ + int tem; + + if (dump_file) + dump_flow_info (dump_file); + + reg_scan (get_insns (), max_reg_num ()); + + tem = cse_main (get_insns (), max_reg_num (), dump_file); + if (tem) + rebuild_jump_labels (get_insns ()); + if (purge_all_dead_edges ()) + delete_unreachable_blocks (); + + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + + /* If we are not running more CSE passes, then we are no longer + expecting CSE to be run. But always rerun it in a cheap mode. */ + cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse; + + if (tem) + delete_dead_jumptables (); + + if (tem || optimize > 1) + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); +} + +struct tree_opt_pass pass_cse = +{ + "cse1", /* name */ + gate_handle_cse, /* gate */ + rest_of_handle_cse, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_CSE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 's' /* letter */ +}; + + +static bool +gate_handle_cse2 (void) +{ + return optimize > 0 && flag_rerun_cse_after_loop; +} + +/* Run second CSE pass after loop optimizations. */ +static void +rest_of_handle_cse2 (void) +{ + int tem; + + if (dump_file) + dump_flow_info (dump_file); + /* CFG is no longer maintained up-to-date. */ + tem = cse_main (get_insns (), max_reg_num (), dump_file); + + /* Run a pass to eliminate duplicated assignments to condition code + registers. We have to run this after bypass_jumps, because it + makes it harder for that pass to determine whether a jump can be + bypassed safely. */ + cse_condition_code_reg (); + + purge_all_dead_edges (); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + + if (tem) + { + timevar_push (TV_JUMP); + rebuild_jump_labels (get_insns ()); + delete_dead_jumptables (); + cleanup_cfg (CLEANUP_EXPENSIVE); + timevar_pop (TV_JUMP); + } + reg_scan (get_insns (), max_reg_num ()); + cse_not_expected = 1; +} + + +struct tree_opt_pass pass_cse2 = +{ + "cse2", /* name */ + gate_handle_cse2, /* gate */ + rest_of_handle_cse2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_CSE2, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 't' /* letter */ +}; + Index: emit-rtl.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v retrieving revision 1.440 diff -p -u -r1.440 emit-rtl.c --- emit-rtl.c 28 Apr 2005 05:03:02 -0000 1.440 +++ emit-rtl.c 18 May 2005 10:28:21 -0000 @@ -55,6 +55,7 @@ Software Foundation, 59 Temple Place - S #include "ggc.h" #include "debug.h" #include "langhooks.h" +#include "tree-pass.h" /* Commonly used modes. */ @@ -2135,6 +2136,24 @@ unshare_all_rtl (void) unshare_all_rtl_1 (current_function_decl, get_insns ()); } +struct tree_opt_pass pass_unshare_all_rtl = +{ + NULL, /* name */ + NULL, /* gate */ + unshare_all_rtl, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + /* Check that ORIG is not marked when it should not be and mark ORIG as in use, Recursively does the same for subexpressions. */ @@ -3705,6 +3724,23 @@ remove_unnecessary_notes (void) gcc_assert (!eh_stack); } +struct tree_opt_pass pass_remove_unnecessary_notes = +{ + NULL, /* name */ + NULL, /* gate */ + remove_unnecessary_notes, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f /* Emit insn(s) of given code and pattern at a specified place within the doubly-linked list. Index: except.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/except.c,v retrieving revision 1.306 diff -p -u -r1.306 except.c --- except.c 12 May 2005 19:29:16 -0000 1.306 +++ except.c 18 May 2005 10:28:27 -0000 @@ -75,6 +75,8 @@ Software Foundation, 59 Temple Place - S #include "langhooks.h" #include "cgraph.h" #include "diagnostic.h" +#include "tree-pass.h" +#include "timevar.h" /* Provide defaults for stuff that may not be defined when using sjlj exceptions. */ @@ -2696,6 +2698,23 @@ set_nothrow_function_flags (void) } } +struct tree_opt_pass pass_set_nothrow_function_flags = +{ + NULL, /* name */ + NULL, /* gate */ + set_nothrow_function_flags, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f /* Various hooks for unwind library. */ @@ -3205,6 +3224,23 @@ convert_to_eh_region_ranges (void) htab_delete (ar_hash); } +struct tree_opt_pass pass_convert_to_eh_region_ranges = +{ + NULL, /* name */ + NULL, /* gate */ + convert_to_eh_region_ranges, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f static void push_uleb128 (varray_type *data_area, unsigned int value) @@ -3729,4 +3765,38 @@ verify_eh_tree (struct function *fun) } } } + +\f +static bool +gate_handle_eh (void) +{ + return doing_eh (0); +} + +/* Complete generation of exception handling code. */ +static void +rest_of_handle_eh (void) +{ + cleanup_cfg (CLEANUP_PRE_LOOP | CLEANUP_NO_INSN_DEL); + finish_eh_generation (); + cleanup_cfg (CLEANUP_PRE_LOOP | CLEANUP_NO_INSN_DEL); +} + +struct tree_opt_pass pass_rtl_eh = +{ + "eh", /* name */ + gate_handle_eh, /* gate */ + rest_of_handle_eh, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_JUMP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'h' /* letter */ +}; + #include "gt-except.h" Index: final.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/final.c,v retrieving revision 1.355 diff -p -u -r1.355 final.c --- final.c 26 Apr 2005 01:01:19 -0000 1.355 +++ final.c 18 May 2005 10:28:35 -0000 @@ -72,6 +72,10 @@ Software Foundation, 59 Temple Place - S #include "debug.h" #include "expr.h" #include "cfglayout.h" +#include "tree-pass.h" +#include "timevar.h" +#include "cgraph.h" +#include "coverage.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" /* Needed for external data @@ -735,6 +739,24 @@ compute_alignments (void) LABEL_TO_MAX_SKIP (label) = max_skip; } } + +struct tree_opt_pass pass_compute_alignments = +{ + NULL, /* name */ + NULL, /* gate */ + compute_alignments, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f /* Make a pass over all insns and compute their actual lengths by shortening any branches of variable length if possible. */ @@ -3862,3 +3884,186 @@ debug_free_queue (void) symbol_queue_size = 0; } } +\f +/* Turn the RTL into assembly. */ +static void +rest_of_handle_final (void) +{ + rtx x; + const char *fnname; + + /* Get the function's name, as described by its RTL. This may be + different from the DECL_NAME name used in the source file. */ + + x = DECL_RTL (current_function_decl); + gcc_assert (MEM_P (x)); + x = XEXP (x, 0); + gcc_assert (GET_CODE (x) == SYMBOL_REF); + fnname = XSTR (x, 0); + + assemble_start_function (current_function_decl, fnname); + final_start_function (get_insns (), asm_out_file, optimize); + final (get_insns (), asm_out_file, optimize); + final_end_function (); + +#ifdef TARGET_UNWIND_INFO + /* ??? The IA-64 ".handlerdata" directive must be issued before + the ".endp" directive that closes the procedure descriptor. */ + output_function_exception_table (); +#endif + + assemble_end_function (current_function_decl, fnname); + +#ifndef TARGET_UNWIND_INFO + /* Otherwise, it feels unclean to switch sections in the middle. */ + output_function_exception_table (); +#endif + + user_defined_section_attribute = false; + + if (! quiet_flag) + fflush (asm_out_file); + + /* Release all memory allocated by flow. */ + free_basic_block_vars (); + + /* Write DBX symbols if requested. */ + + /* Note that for those inline functions where we don't initially + know for certain that we will be generating an out-of-line copy, + the first invocation of this routine (rest_of_compilation) will + skip over this code by doing a `goto exit_rest_of_compilation;'. + Later on, wrapup_global_declarations will (indirectly) call + rest_of_compilation again for those inline functions that need + to have out-of-line copies generated. During that call, we + *will* be routed past here. */ + + timevar_push (TV_SYMOUT); + (*debug_hooks->function_decl) (current_function_decl); + timevar_pop (TV_SYMOUT); +} + +struct tree_opt_pass pass_final = +{ + NULL, /* name */ + NULL, /* gate */ + rest_of_handle_final, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FINAL, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_ggc_collect, /* todo_flags_finish */ + 0 /* letter */ +}; + + +static void +rest_of_handle_shorten_branches (void) +{ + /* Shorten branches. */ + shorten_branches (get_insns ()); +} + +struct tree_opt_pass pass_shorten_branches = +{ + NULL, /* name */ + NULL, /* gate */ + rest_of_handle_shorten_branches, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FINAL, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + +static void +rest_of_clean_state (void) +{ + rtx insn, next; + + /* It is very important to decompose the RTL instruction chain here: + debug information keeps pointing into CODE_LABEL insns inside the function + body. If these remain pointing to the other insns, we end up preserving + whole RTL chain and attached detailed debug info in memory. */ + for (insn = get_insns (); insn; insn = next) + { + next = NEXT_INSN (insn); + NEXT_INSN (insn) = NULL; + PREV_INSN (insn) = NULL; + } + + /* In case the function was not output, + don't leave any temporary anonymous types + queued up for sdb output. */ +#ifdef SDB_DEBUGGING_INFO + if (write_symbols == SDB_DEBUG) + sdbout_types (NULL_TREE); +#endif + + reload_completed = 0; + epilogue_completed = 0; + flow2_completed = 0; + no_new_pseudos = 0; + + /* Clear out the insn_length contents now that they are no + longer valid. */ + init_insn_lengths (); + + /* Show no temporary slots allocated. */ + init_temp_slots (); + + free_basic_block_vars (); + free_bb_for_insn (); + + + if (targetm.binds_local_p (current_function_decl)) + { + int pref = cfun->preferred_stack_boundary; + if (cfun->stack_alignment_needed > cfun->preferred_stack_boundary) + pref = cfun->stack_alignment_needed; + cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary + = pref; + } + + /* Make sure volatile mem refs aren't considered valid operands for + arithmetic insns. We must call this here if this is a nested inline + function, since the above code leaves us in the init_recog state, + and the function context push/pop code does not save/restore volatile_ok. + + ??? Maybe it isn't necessary for expand_start_function to call this + anymore if we do it here? */ + + init_recog_no_volatile (); + + /* We're done with this function. Free up memory if we can. */ + free_after_parsing (cfun); + free_after_compilation (cfun); +} + +struct tree_opt_pass pass_clean_state = +{ + NULL, /* name */ + NULL, /* gate */ + rest_of_clean_state, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FINAL, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + PROP_rtl, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + Index: flow.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/flow.c,v retrieving revision 1.628 diff -p -u -r1.628 flow.c --- flow.c 13 May 2005 12:25:28 -0000 1.628 +++ flow.c 18 May 2005 10:28:44 -0000 @@ -140,6 +140,7 @@ Software Foundation, 59 Temple Place - S #include "obstack.h" #include "splay-tree.h" +#include "tree-pass.h" #ifndef HAVE_epilogue #define HAVE_epilogue 0 @@ -4347,6 +4348,23 @@ recompute_reg_usage (void) update_life_info (NULL, UPDATE_LIFE_LOCAL, PROP_REG_INFO | PROP_DEATH_NOTES); } +struct tree_opt_pass pass_recompute_reg_usage = +{ + NULL, /* name */ + NULL, /* gate */ + recompute_reg_usage, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + /* Optionally removes all the REG_DEAD and REG_UNUSED notes from a set of blocks. If BLOCKS is NULL, assume the universal set. Returns a count of the number of registers that died. */ @@ -4488,3 +4506,131 @@ reg_set_to_hard_reg_set (HARD_REG_SET *t SET_HARD_REG_BIT (*to, i); } } +\f + +static bool +gate_remove_death_notes (void) +{ + return flag_profile_values; +} + +static void +rest_of_handle_remove_death_notes (void) +{ + count_or_remove_death_notes (NULL, 1); +} + +struct tree_opt_pass pass_remove_death_notes = +{ + NULL, /* name */ + gate_remove_death_notes, /* gate */ + rest_of_handle_remove_death_notes, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + +/* Perform life analysis. */ +static void +rest_of_handle_life (void) +{ + regclass_init (); + + life_analysis (dump_file, PROP_FINAL); + if (optimize) + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE | CLEANUP_LOG_LINKS + | (flag_thread_jumps ? CLEANUP_THREADING : 0)); + + if (extra_warnings) + { + setjmp_vars_warning (DECL_INITIAL (current_function_decl)); + setjmp_args_warning (); + } + + if (optimize) + { + if (initialize_uninitialized_subregs ()) + { + /* Insns were inserted, and possibly pseudos created, so + things might look a bit different. */ + allocate_reg_life_data (); + update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, + PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES); + } + } + + no_new_pseudos = 1; +} + +struct tree_opt_pass pass_life = +{ + "life", /* name */ + NULL, /* gate */ + rest_of_handle_life, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FLOW, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + TODO_verify_flow, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'f' /* letter */ +}; + +static void +rest_of_handle_flow2 (void) +{ + /* Re-create the death notes which were deleted during reload. */ +#ifdef ENABLE_CHECKING + verify_flow_info (); +#endif + + /* If optimizing, then go ahead and split insns now. */ +#ifndef STACK_REGS + if (optimize > 0) +#endif + split_all_insns (0); + + if (flag_branch_target_load_optimize) + branch_target_load_optimize (epilogue_completed); + + if (optimize) + cleanup_cfg (CLEANUP_EXPENSIVE); + + /* On some machines, the prologue and epilogue code, or parts thereof, + can be represented as RTL. Doing so lets us schedule insns between + it and the rest of the code and also allows delayed branch + scheduling to operate in the epilogue. */ + thread_prologue_and_epilogue_insns (get_insns ()); + epilogue_completed = 1; + flow2_completed = 1; +} + +struct tree_opt_pass pass_flow2 = +{ + "flow2", /* name */ + NULL, /* gate */ + rest_of_handle_flow2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_FLOW2, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + TODO_verify_flow, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'w' /* letter */ +}; + Index: function.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/function.c,v retrieving revision 1.624 diff -p -u -u -p -r1.624 function.c --- function.c 4 Jun 2005 17:22:18 -0000 1.624 +++ function.c 6 Jun 2005 08:43:12 -0000 @@ -61,6 +61,7 @@ Software Foundation, 59 Temple Place - S #include "target.h" #include "cfglayout.h" #include "tree-gimple.h" +#include "tree-pass.h" #ifndef LOCAL_ALIGNMENT #define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT @@ -1662,6 +1663,24 @@ instantiate_virtual_regs (void) frame_pointer_rtx. */ virtuals_instantiated = 1; } + +struct tree_opt_pass pass_instantiate_virtual_regs = +{ + NULL, /* name */ + NULL, /* gate */ + instantiate_virtual_regs, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f /* Return 1 if EXP is an aggregate type (or a value with aggregate type). This means a type for which function calls must pass an address to the @@ -3876,6 +3895,24 @@ init_function_for_compilation (void) gcc_assert (VEC_length (int, sibcall_epilogue) == 0); } +struct tree_opt_pass pass_init_function = +{ + NULL, /* name */ + NULL, /* gate */ + init_function_for_compilation, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + void expand_main_function (void) { @@ -5397,5 +5434,33 @@ current_function_name (void) { return lang_hooks.decl_printable_name (cfun->decl, 2); } +\f + +static void +rest_of_handle_check_leaf_regs (void) +{ +#ifdef LEAF_REGISTERS + current_function_uses_only_leaf_regs + = optimize > 0 && only_leaf_regs_used () && leaf_function_p (); +#endif +} + +struct tree_opt_pass pass_leaf_regs = +{ + NULL, /* name */ + NULL, /* gate */ + rest_of_handle_check_leaf_regs, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + #include "gt-function.h" Index: gcse.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/gcse.c,v retrieving revision 1.341 diff -p -u -r1.341 gcse.c --- gcse.c 9 May 2005 17:52:16 -0000 1.341 +++ gcse.c 18 May 2005 10:29:04 -0000 @@ -169,6 +169,7 @@ Software Foundation, 59 Temple Place - S #include "intl.h" #include "obstack.h" #include "timevar.h" +#include "tree-pass.h" /* Propagate flow information through back edges and thus enable PRE's moving loop invariant calculations out of loops. @@ -6551,5 +6552,113 @@ is_too_expensive (const char *pass) return false; } +\f +static bool +gate_handle_jump_bypass (void) +{ + return optimize > 0 && flag_gcse; +} + +/* Perform jump bypassing and control flow optimizations. */ +static void +rest_of_handle_jump_bypass (void) +{ + cleanup_cfg (CLEANUP_EXPENSIVE); + reg_scan (get_insns (), max_reg_num ()); + + if (bypass_jumps (dump_file)) + { + rebuild_jump_labels (get_insns ()); + cleanup_cfg (CLEANUP_EXPENSIVE); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + } +} + +struct tree_opt_pass pass_jump_bypass = +{ + "bypass", /* name */ + gate_handle_jump_bypass, /* gate */ + rest_of_handle_jump_bypass, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_BYPASS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect | TODO_verify_flow, /* todo_flags_finish */ + 'G' /* letter */ +}; + + +static bool +gate_handle_gcse (void) +{ + return optimize > 0 && flag_gcse; +} + + +static void +rest_of_handle_gcse (void) +{ + int save_csb, save_cfj; + int tem2 = 0, tem; + + tem = gcse_main (get_insns (), dump_file); + rebuild_jump_labels (get_insns ()); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + + save_csb = flag_cse_skip_blocks; + save_cfj = flag_cse_follow_jumps; + flag_cse_skip_blocks = flag_cse_follow_jumps = 0; + + /* If -fexpensive-optimizations, re-run CSE to clean up things done + by gcse. */ + if (flag_expensive_optimizations) + { + timevar_push (TV_CSE); + reg_scan (get_insns (), max_reg_num ()); + tem2 = cse_main (get_insns (), max_reg_num (), dump_file); + purge_all_dead_edges (); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + timevar_pop (TV_CSE); + cse_not_expected = !flag_rerun_cse_after_loop; + } + + /* If gcse or cse altered any jumps, rerun jump optimizations to clean + things up. */ + if (tem || tem2) + { + timevar_push (TV_JUMP); + rebuild_jump_labels (get_insns ()); + delete_dead_jumptables (); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); + timevar_pop (TV_JUMP); + } + + flag_cse_skip_blocks = save_csb; + flag_cse_follow_jumps = save_cfj; +} + +struct tree_opt_pass pass_gcse = +{ + "gcse1", /* name */ + gate_handle_gcse, /* gate */ + rest_of_handle_gcse, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_GCSE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_verify_flow | TODO_ggc_collect, /* todo_flags_finish */ + 'G' /* letter */ +}; + #include "gt-gcse.h" Index: global.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/global.c,v retrieving revision 1.126 diff -p -u -r1.126 global.c --- global.c 1 May 2005 23:34:24 -0000 1.126 +++ global.c 18 May 2005 10:29:09 -0000 @@ -36,6 +36,8 @@ Software Foundation, 59 Temple Place - S #include "reload.h" #include "output.h" #include "toplev.h" +#include "tree-pass.h" +#include "timevar.h" /* This pass of the compiler performs global register allocation. It assigns hard register numbers to all the pseudo registers @@ -2474,3 +2476,50 @@ make_accurate_live_analysis (void) } free_bb_info (); } +/* Run old register allocator. Return TRUE if we must exit + rest_of_compilation upon return. */ +static void +rest_of_handle_global_alloc (void) +{ + bool failure; + + /* If optimizing, allocate remaining pseudo-regs. Do the reload + pass fixing up any insns that are invalid. */ + + if (optimize) + failure = global_alloc (dump_file); + else + { + build_insn_chain (get_insns ()); + failure = reload (get_insns (), 0); + } + + if (dump_enabled_p (pass_global_alloc.static_pass_number)) + { + timevar_push (TV_DUMP); + dump_global_regs (dump_file); + timevar_pop (TV_DUMP); + } + + gcc_assert (reload_completed || failure); + reload_completed = !failure; +} + +struct tree_opt_pass pass_global_alloc = +{ + "greg", /* name */ + NULL, /* gate */ + rest_of_handle_global_alloc, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_GLOBAL_ALLOC, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'g' /* letter */ +}; + Index: ifcvt.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v retrieving revision 1.186 diff -p -u -r1.186 ifcvt.c --- ifcvt.c 21 Apr 2005 15:47:23 -0000 1.186 +++ ifcvt.c 18 May 2005 10:29:15 -0000 @@ -41,6 +41,8 @@ #include "tm_p.h" #include "cfgloop.h" #include "target.h" +#include "timevar.h" +#include "tree-pass.h" #ifndef HAVE_conditional_execution @@ -3396,3 +3398,120 @@ if_convert (int x_life_data_ok) verify_flow_info (); #endif } +\f +static bool +gate_handle_if_conversion (void) +{ + return (optimize > 0); +} + +/* If-conversion and CFG cleanup. */ +static void +rest_of_handle_if_conversion (void) +{ + if (flag_if_conversion) + { + if (dump_file) + dump_flow_info (dump_file); + cleanup_cfg (CLEANUP_EXPENSIVE); + reg_scan (get_insns (), max_reg_num ()); + if_convert (0); + } + + timevar_push (TV_JUMP); + cleanup_cfg (CLEANUP_EXPENSIVE); + reg_scan (get_insns (), max_reg_num ()); + timevar_pop (TV_JUMP); +} + +struct tree_opt_pass pass_rtl_ifcvt = +{ + "ce1", /* name */ + gate_handle_if_conversion, /* gate */ + rest_of_handle_if_conversion, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IFCVT, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'C' /* letter */ +}; + +static bool +gate_handle_if_after_combine (void) +{ + return (optimize > 0 && flag_if_conversion); +} + + +/* Rerun if-conversion, as combine may have simplified things enough + to now meet sequence length restrictions. */ +static void +rest_of_handle_if_after_combine (void) +{ + no_new_pseudos = 0; + if_convert (1); + no_new_pseudos = 1; +} + +struct tree_opt_pass pass_if_after_combine = +{ + "ce2", /* name */ + gate_handle_if_after_combine, /* gate */ + rest_of_handle_if_after_combine, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IFCVT, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'C' /* letter */ +}; + + +static bool +gate_handle_if_after_reload (void) +{ + return (optimize > 0); +} + +static void +rest_of_handle_if_after_reload (void) +{ + /* Last attempt to optimize CFG, as scheduling, peepholing and insn + splitting possibly introduced more crossjumping opportunities. */ + cleanup_cfg (CLEANUP_EXPENSIVE + | CLEANUP_UPDATE_LIFE + | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); + if (flag_if_conversion2) + if_convert (1); +} + + +struct tree_opt_pass pass_if_after_reload = +{ + "ce3", /* name */ + gate_handle_if_after_reload, /* gate */ + rest_of_handle_if_after_reload, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IFCVT2, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'E' /* letter */ +}; + + Index: integrate.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/integrate.c,v retrieving revision 1.278 diff -p -u -r1.278 integrate.c --- integrate.c 13 May 2005 16:56:11 -0000 1.278 +++ integrate.c 18 May 2005 10:29:16 -0000 @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - S #include "ggc.h" #include "target.h" #include "langhooks.h" +#include "tree-pass.h" /* Round to the next highest integer that meets the alignment. */ #define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1)) @@ -369,6 +370,23 @@ emit_initial_value_sets (void) emit_insn_after (seq, entry_of_function ()); } +struct tree_opt_pass pass_initial_value_sets = +{ + NULL, /* name */ + NULL, /* gate */ + emit_initial_value_sets, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + /* If the backend knows where to allocate pseudos for hard register initial values, register these allocations now. */ void Index: jump.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/jump.c,v retrieving revision 1.260 diff -p -u -r1.260 jump.c --- jump.c 25 Apr 2005 12:46:09 -0000 1.260 +++ jump.c 18 May 2005 10:29:19 -0000 @@ -56,6 +56,7 @@ Software Foundation, 59 Temple Place - S #include "reload.h" #include "predict.h" #include "timevar.h" +#include "tree-pass.h" /* Optimize jump y; x: ... y: jumpif... x? Don't know if it is worth bothering with. */ @@ -120,8 +121,25 @@ cleanup_barriers (void) } } +struct tree_opt_pass pass_cleanup_barriers = +{ + NULL, /* name */ + NULL, /* gate */ + cleanup_barriers, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + void -purge_line_number_notes (rtx f) +purge_line_number_notes (void) { rtx last_note = 0; rtx insn; @@ -130,7 +148,7 @@ purge_line_number_notes (rtx f) extraneous. There should be some indication where that line belonged, even if it became empty. */ - for (insn = f; insn; insn = NEXT_INSN (insn)) + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) if (NOTE_P (insn)) { if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG) @@ -157,6 +175,24 @@ purge_line_number_notes (rtx f) } } } + +struct tree_opt_pass pass_purge_lineno_notes = +{ + NULL, /* name */ + NULL, /* gate */ + purge_line_number_notes, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + \f /* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL notes whose labels don't occur in the insn any more. Returns the Index: mode-switching.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/mode-switching.c,v retrieving revision 2.1 diff -p -u -u -p -r2.1 mode-switching.c --- mode-switching.c 4 Jun 2005 17:07:56 -0000 2.1 +++ mode-switching.c 6 Jun 2005 07:42:36 -0000 @@ -34,6 +34,8 @@ Software Foundation, 59 Temple Place - S #include "output.h" #include "tm_p.h" #include "function.h" +#include "tree-pass.h" +#include "timevar.h" /* We want target macros for the mode switching code to be able to refer to instruction attribute values. */ @@ -708,4 +710,43 @@ optimize_mode_switching (FILE *file) return 1; } + #endif /* OPTIMIZE_MODE_SWITCHING */ +\f +static bool +gate_mode_switching (void) +{ +#ifdef OPTIMIZE_MODE_SWITCHING + return true; +#else + return false; +#endif +} + +static void +rest_of_handle_mode_switching (void) +{ +#ifdef OPTIMIZE_MODE_SWITCHING + no_new_pseudos = 0; + optimize_mode_switching (NULL); + no_new_pseudos = 1; +#endif /* OPTIMIZE_MODE_SWITCHING */ +} + + +struct tree_opt_pass pass_mode_switching = +{ + NULL, /* name */ + gate_mode_switching, /* gate */ + rest_of_handle_mode_switching, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_MODE_SWITCH, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; Index: local-alloc.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/local-alloc.c,v retrieving revision 1.147 diff -p -u -r1.147 local-alloc.c --- local-alloc.c 28 Apr 2005 05:38:32 -0000 1.147 +++ local-alloc.c 18 May 2005 10:29:26 -0000 @@ -76,6 +76,8 @@ Software Foundation, 59 Temple Place - S #include "integrate.h" #include "reload.h" #include "ggc.h" +#include "timevar.h" +#include "tree-pass.h" \f /* Next quantity number available for allocation. */ @@ -2416,3 +2419,69 @@ dump_local_alloc (FILE *file) if (reg_renumber[i] != -1) fprintf (file, ";; Register %d in %d.\n", i, reg_renumber[i]); } + +/* Run old register allocator. Return TRUE if we must exit + rest_of_compilation upon return. */ +static void +rest_of_handle_local_alloc (void) +{ + int rebuild_notes; + + /* Determine if the current function is a leaf before running reload + since this can impact optimizations done by the prologue and + epilogue thus changing register elimination offsets. */ + current_function_is_leaf = leaf_function_p (); + + /* Allocate the reg_renumber array. */ + allocate_reg_info (max_regno, FALSE, TRUE); + + /* And the reg_equiv_memory_loc array. */ + VARRAY_GROW (reg_equiv_memory_loc_varray, max_regno); + reg_equiv_memory_loc = &VARRAY_RTX (reg_equiv_memory_loc_varray, 0); + + allocate_initial_values (reg_equiv_memory_loc); + + regclass (get_insns (), max_reg_num (), dump_file); + rebuild_notes = local_alloc (); + + /* Local allocation may have turned an indirect jump into a direct + jump. If so, we must rebuild the JUMP_LABEL fields of jumping + instructions. */ + if (rebuild_notes) + { + timevar_push (TV_JUMP); + + rebuild_jump_labels (get_insns ()); + purge_all_dead_edges (); + delete_unreachable_blocks (); + + timevar_pop (TV_JUMP); + } + + if (dump_enabled_p (pass_local_alloc.static_pass_number)) + { + timevar_push (TV_DUMP); + dump_flow_info (dump_file); + dump_local_alloc (dump_file); + timevar_pop (TV_DUMP); + } +} + +struct tree_opt_pass pass_local_alloc = +{ + "lreg", /* name */ + NULL, /* gate */ + rest_of_handle_local_alloc, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_LOCAL_ALLOC, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'l' /* letter */ +}; + Index: loop-init.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop-init.c,v retrieving revision 1.16 diff -p -u -r1.16 loop-init.c --- loop-init.c 11 Mar 2005 09:05:03 -0000 1.16 +++ loop-init.c 18 May 2005 10:29:26 -0000 @@ -28,6 +29,9 @@ Software Foundation, 59 Temple Place - S #include "basic-block.h" #include "cfgloop.h" #include "cfglayout.h" +#include "tree-pass.h" +#include "timevar.h" +#include "flags.h" /* Initialize loop optimizer. */ @@ -116,3 +119,88 @@ loop_optimizer_finalize (struct loops *l verify_flow_info (); #endif } +\f +static bool +gate_handle_loop2 (void) +{ + return (optimize > 0 && flag_loop_optimize2 + && (flag_move_loop_invariants + || flag_unswitch_loops + || flag_peel_loops + || flag_unroll_loops + || flag_branch_on_count_reg)); +} + +/* Perform loop optimizations. It might be better to do them a bit + sooner, but we want the profile feedback to work more + efficiently. */ +static void +rest_of_handle_loop2 (void) +{ + struct loops *loops; + basic_block bb; + + if (dump_file) + dump_flow_info (dump_file); + + /* Initialize structures for layout changes. */ + cfg_layout_initialize (0); + + loops = loop_optimizer_init (dump_file); + + if (loops) + { + /* The optimizations: */ + if (flag_move_loop_invariants) + move_loop_invariants (loops); + + if (flag_unswitch_loops) + unswitch_loops (loops); + + if (flag_peel_loops || flag_unroll_loops) + unroll_and_peel_loops (loops, + (flag_peel_loops ? UAP_PEEL : 0) | + (flag_unroll_loops ? UAP_UNROLL : 0) | + (flag_unroll_all_loops ? UAP_UNROLL_ALL : 0)); + +#ifdef HAVE_doloop_end + if (flag_branch_on_count_reg && HAVE_doloop_end) + doloop_optimize_loops (loops); +#endif /* HAVE_doloop_end */ + + loop_optimizer_finalize (loops, dump_file); + } + + free_dominance_info (CDI_DOMINATORS); + + /* Finalize layout changes. */ + FOR_EACH_BB (bb) + if (bb->next_bb != EXIT_BLOCK_PTR) + bb->rbi->next = bb->next_bb; + cfg_layout_finalize (); + + cleanup_cfg (CLEANUP_EXPENSIVE); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + reg_scan (get_insns (), max_reg_num ()); + if (dump_file) + dump_flow_info (dump_file); +} + +struct tree_opt_pass pass_loop2 = +{ + "loop2", /* name */ + gate_handle_loop2, /* gate */ + rest_of_handle_loop2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_LOOP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'L' /* letter */ +}; + Index: loop.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop.c,v retrieving revision 1.529 diff -p -u -r1.529 loop.c --- loop.c 25 Apr 2005 12:46:10 -0000 1.529 +++ loop.c 18 May 2005 10:29:48 -0000 @@ -66,6 +66,8 @@ Software Foundation, 59 Temple Place - S #include "optabs.h" #include "cfgloop.h" #include "ggc.h" +#include "timevar.h" +#include "tree-pass.h" /* Get the loop info pointer of a loop. */ #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) @@ -11806,3 +11808,66 @@ debug_loops (const struct loops *loops) { flow_loops_dump (loops, stderr, loop_dump_aux, 1); } +\f +static bool +gate_handle_loop_optimize (void) +{ + return (optimize > 0 && flag_loop_optimize); +} + +/* Move constant computations out of loops. */ +static void +rest_of_handle_loop_optimize (void) +{ + int do_prefetch; + + /* CFG is no longer maintained up-to-date. */ + free_bb_for_insn (); + profile_status = PROFILE_ABSENT; + + do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0; + + if (flag_rerun_loop_opt) + { + cleanup_barriers (); + + /* We only want to perform unrolling once. */ + loop_optimize (get_insns (), dump_file, 0); + + /* The first call to loop_optimize makes some instructions + trivially dead. We delete those instructions now in the + hope that doing so will make the heuristics in loop work + better and possibly speed up compilation. */ + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + + /* The regscan pass is currently necessary as the alias + analysis code depends on this information. */ + reg_scan (get_insns (), max_reg_num ()); + } + cleanup_barriers (); + loop_optimize (get_insns (), dump_file, do_prefetch); + + /* Loop can create trivially dead instructions. */ + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + find_basic_blocks (get_insns ()); +} + +struct tree_opt_pass pass_loop_optimize = +{ + "old-loop", /* name */ + gate_handle_loop_optimize, /* gate */ + rest_of_handle_loop_optimize, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_LOOP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'L' /* letter */ +}; + + Index: modulo-sched.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/modulo-sched.c,v retrieving revision 1.29 diff -p -u -r1.29 modulo-sched.c --- modulo-sched.c 28 Apr 2005 02:25:22 -0000 1.29 +++ modulo-sched.c 18 May 2005 10:29:53 -0000 @@ -47,6 +47,8 @@ Software Foundation, 59 Temple Place - S #include "gcov-io.h" #include "df.h" #include "ddg.h" +#include "timevar.h" +#include "tree-pass.h" #ifdef INSN_SCHEDULING @@ -2551,5 +2553,67 @@ ps_unschedule_node (partial_schedule_ptr return remove_node_from_ps (ps, ps_i); } -#endif /* INSN_SCHEDULING*/ +#endif /* INSN_SCHEDULING */ +\f +static bool +gate_handle_sms (void) +{ + return (optimize > 0 && flag_modulo_sched); +} + + +/* Run instruction scheduler. */ +/* Perform SMS module scheduling. */ +static void +rest_of_handle_sms (void) +{ +#ifdef INSN_SCHEDULING + basic_block bb; + sbitmap blocks; + + /* We want to be able to create new pseudos. */ + no_new_pseudos = 0; + /* Collect loop information to be used in SMS. */ + cfg_layout_initialize (CLEANUP_UPDATE_LIFE); + sms_schedule (dump_file); + + /* Update the life information, because we add pseudos. */ + max_regno = max_reg_num (); + allocate_reg_info (max_regno, FALSE, FALSE); + blocks = sbitmap_alloc (last_basic_block); + sbitmap_ones (blocks); + update_life_info (blocks, UPDATE_LIFE_GLOBAL_RM_NOTES, + (PROP_DEATH_NOTES + | PROP_REG_INFO + | PROP_KILL_DEAD_CODE + | PROP_SCAN_DEAD_CODE)); + + no_new_pseudos = 1; + + /* Finalize layout changes. */ + FOR_EACH_BB (bb) + if (bb->next_bb != EXIT_BLOCK_PTR) + bb->rbi->next = bb->next_bb; + cfg_layout_finalize (); + free_dominance_info (CDI_DOMINATORS); +#endif /* INSN_SCHEDULING */ +} + +struct tree_opt_pass pass_sms = +{ + "sms", /* name */ + gate_handle_sms, /* gate */ + rest_of_handle_sms, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_SMS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'm' /* letter */ +}; Index: postreload-gcse.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/postreload-gcse.c,v retrieving revision 2.14 diff -p -u -r2.14 postreload-gcse.c --- postreload-gcse.c 27 Apr 2005 18:39:05 -0000 2.14 +++ postreload-gcse.c 18 May 2005 10:29:57 -0000 @@ -44,6 +44,8 @@ Software Foundation, 59 Temple Place - S #include "hashtab.h" #include "params.h" #include "target.h" +#include "timevar.h" +#include "tree-pass.h" /* The following code implements gcse after reload, the purpose of this pass is to cleanup redundant loads generated by reload and other @@ -1337,3 +1339,37 @@ gcse_after_reload_main (rtx f ATTRIBUTE_ free_mem (); } +\f +static bool +gate_handle_gcse2 (void) +{ + return (optimize > 0 && flag_gcse_after_reload); +} + + +static void +rest_of_handle_gcse2 (void) +{ + gcse_after_reload_main (get_insns ()); + rebuild_jump_labels (get_insns ()); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); +} + +struct tree_opt_pass pass_gcse2 = +{ + "gcse2", /* name */ + gate_handle_gcse2, /* gate */ + rest_of_handle_gcse2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_GCSE_AFTER_RELOAD, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_verify_flow | TODO_ggc_collect, /* todo_flags_finish */ + 'J' /* letter */ +}; + Index: postreload.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/postreload.c,v retrieving revision 2.30 diff -p -u -r2.30 postreload.c --- postreload.c 29 Apr 2005 18:39:22 -0000 2.30 +++ postreload.c 18 May 2005 10:30:00 -0000 @@ -44,6 +44,8 @@ Software Foundation, 59 Temple Place - S #include "toplev.h" #include "except.h" #include "tree.h" +#include "timevar.h" +#include "tree-pass.h" static int reload_cse_noop_set_p (rtx); static void reload_cse_simplify (rtx, rtx); @@ -1561,3 +1563,39 @@ move2add_note_store (rtx dst, rtx set, v reg_set_luid[i] = 0; } } +\f +static bool +gate_handle_postreload (void) +{ + return (optimize > 0); +} + + +static void +rest_of_handle_postreload (void) +{ + /* Do a very simple CSE pass over just the hard registers. */ + reload_cse_regs (get_insns ()); + /* reload_cse_regs can eliminate potentially-trapping MEMs. + Remove any EH edges associated with them. */ + if (flag_non_call_exceptions) + purge_all_dead_edges (); +} + +struct tree_opt_pass pass_postreload_cse = +{ + "postreload", /* name */ + gate_handle_postreload, /* gate */ + rest_of_handle_postreload, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_RELOAD_CSE_REGS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'o' /* letter */ +}; + Index: profile.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/profile.c,v retrieving revision 1.157 diff -p -u -r1.157 profile.c --- profile.c 21 Apr 2005 09:17:19 -0000 1.157 +++ profile.c 18 May 2005 10:30:03 -0000 @@ -65,6 +65,9 @@ Software Foundation, 59 Temple Place - S #include "tree.h" #include "cfghooks.h" #include "tree-flow.h" +#include "timevar.h" +#include "cfgloop.h" +#include "tree-pass.h" /* Hooks for profiling. */ static struct profile_hooks* profile_hooks; @@ -1328,3 +1331,76 @@ rtl_register_profile_hooks (void) gcc_assert (!ir_type ()); profile_hooks = &rtl_profile_hooks; } +\f +static bool +gate_handle_profiling (void) +{ + return (!flag_tree_based_profiling + && (optimize > 0 || profile_arc_flag + || flag_test_coverage || flag_branch_probabilities)); +} + +struct tree_opt_pass pass_profiling = +{ + NULL, /* name */ + gate_handle_profiling, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + +/* Do branch profiling and static profile estimation passes. */ +static void +rest_of_handle_branch_prob (void) +{ + struct loops loops; + + rtl_register_profile_hooks (); + rtl_register_value_prof_hooks (); + + if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) + branch_prob (); + + /* Discover and record the loop depth at the head of each basic + block. The loop infrastructure does the real job for us. */ + flow_loops_find (&loops); + + if (dump_file) + flow_loops_dump (&loops, dump_file, NULL, 0); + + /* Estimate using heuristics if no profiling info is available. */ + if (flag_guess_branch_prob) + estimate_probability (&loops); + + flow_loops_free (&loops); + free_dominance_info (CDI_DOMINATORS); +} + +struct tree_opt_pass pass_branch_prob = +{ + "bp", /* name */ + NULL, /* gate */ + rest_of_handle_branch_prob, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_BRANCH_PROB, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'b' /* letter */ +}; + + + Index: recog.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/recog.c,v retrieving revision 1.222 diff -p -u -r1.222 recog.c --- recog.c 10 Apr 2005 04:00:46 -0000 1.222 +++ recog.c 7 Jun 2005 11:18:19 -0000 @@ -39,6 +39,8 @@ Software Foundation, 59 Temple Place - S #include "basic-block.h" #include "output.h" #include "reload.h" +#include "timevar.h" +#include "tree-pass.h" #ifndef STACK_PUSH_CODE #ifdef STACK_GROWS_DOWNWARD @@ -3418,3 +3421,122 @@ if_test_bypass_p (rtx out_insn, rtx in_i return true; } +\f +static bool +gate_handle_peephole2 (void) +{ + return (optimize > 0 && flag_peephole2); +} + +static void +rest_of_handle_peephole2 (void) +{ +#ifdef HAVE_peephole2 + peephole2_optimize (dump_file); +#endif +} + +struct tree_opt_pass pass_peephole2 = +{ + "peephole2", /* name */ + gate_handle_peephole2, /* gate */ + rest_of_handle_peephole2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_PEEPHOLE2, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'z' /* letter */ +}; + +static void +rest_of_handle_split_all_insns (void) +{ + split_all_insns (1); +} + +struct tree_opt_pass pass_split_all_insns = +{ + NULL, /* name */ + NULL, /* gate */ + rest_of_handle_split_all_insns, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + +/* The placement of the splitting that we do for shorten_branches + depends on whether regstack is used by the target or not. */ +static bool +gate_do_final_split (void) +{ +#if defined (HAVE_ATTR_length) && !defined (STACK_REGS) + return 1; +#else + return 0; +#endif +} + +struct tree_opt_pass pass_split_for_shorten_branches = +{ + NULL, /* name */ + gate_do_final_split, /* gate */ + split_all_insns_noflow, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_SHORTEN_BRANCH, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + +static bool +gate_handle_split_before_regstack (void) +{ +#if defined (HAVE_ATTR_length) && defined (STACK_REGS) + /* If flow2 creates new instructions which need splitting + and scheduling after reload is not done, they might not be + split until final which doesn't allow splitting + if HAVE_ATTR_length. */ +# ifdef INSN_SCHEDULING + return (optimize && !flag_schedule_insns_after_reload); +# else + return (optimize); +# endif +#else + return 0; +#endif +} + +struct tree_opt_pass pass_split_before_regstack = +{ + NULL, /* name */ + gate_handle_split_before_regstack, /* gate */ + rest_of_handle_split_all_insns, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_SHORTEN_BRANCH, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; Index: reg-stack.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v retrieving revision 1.183 diff -p -u -r1.183 reg-stack.c --- reg-stack.c 4 Jun 2005 22:05:35 -0000 1.183 +++ reg-stack.c 7 Jun 2005 11:25:07 -0000 @@ -170,6 +170,8 @@ #include "varray.h" #include "reload.h" #include "ggc.h" +#include "timevar.h" +#include "tree-pass.h" /* We use this array to cache info about insns, because otherwise we spend too much time in stack_regs_mentioned_p. @@ -3125,5 +3127,52 @@ reg_to_stack (FILE *file) return true; } #endif /* STACK_REGS */ +\f +static bool +gate_handle_stack_regs (void) +{ +#ifdef STACK_REGS + return 1; +#else + return 0; +#endif +} + +/* Convert register usage from flat register file usage to a stack + register file. */ +static void +rest_of_handle_stack_regs (void) +{ +#ifdef STACK_REGS + if (reg_to_stack (dump_file) && optimize) + { + if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK + | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)) + && (flag_reorder_blocks || flag_reorder_blocks_and_partition)) + { + reorder_basic_blocks (0); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK); + } + } +#endif +} + +struct tree_opt_pass pass_stack_regs = +{ + "stack", /* name */ + gate_handle_stack_regs, /* gate */ + rest_of_handle_stack_regs, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_REG_STACK, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'k' /* letter */ +}; #include "gt-reg-stack.h" Index: regmove.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/regmove.c,v retrieving revision 1.168 diff -p -u -r1.168 regmove.c --- regmove.c 28 Apr 2005 05:38:34 -0000 1.168 +++ regmove.c 18 May 2005 10:30:17 -0000 @@ -43,6 +43,8 @@ Software Foundation, 59 Temple Place - S #include "except.h" #include "toplev.h" #include "reload.h" +#include "timevar.h" +#include "tree-pass.h" /* Turn STACK_GROWS_DOWNWARD into a boolean. */ @@ -2461,3 +2463,80 @@ combine_stack_adjustments_for_block (bas if (memlist) free_csa_memlist (memlist); } +\f +static bool +gate_handle_regmove (void) +{ + return (optimize > 0 && flag_regmove); +} + + +/* Register allocation pre-pass, to reduce number of moves necessary + for two-address machines. */ +static void +rest_of_handle_regmove (void) +{ + regmove_optimize (get_insns (), max_reg_num (), dump_file); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); +} + +struct tree_opt_pass pass_regmove = +{ + "regmove", /* name */ + gate_handle_regmove, /* gate */ + rest_of_handle_regmove, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_REGMOVE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'N' /* letter */ +}; + + +static bool +gate_handle_stack_adjustments (void) +{ + return (optimize > 0); +} + +static void +rest_of_handle_stack_adjustments (void) +{ + life_analysis (dump_file, PROP_POSTRELOAD); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE + | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); + + /* This is kind of a heuristic. We need to run combine_stack_adjustments + even for machines with possibly nonzero RETURN_POPS_ARGS + and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having + push instructions will have popping returns. */ +#ifndef PUSH_ROUNDING + if (!ACCUMULATE_OUTGOING_ARGS) +#endif + combine_stack_adjustments (); +} + +struct tree_opt_pass pass_stack_adjustments = +{ + NULL, /* name */ + gate_handle_stack_adjustments, /* gate */ + rest_of_handle_stack_adjustments, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 0 /* letter */ +}; + Index: regrename.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/regrename.c,v retrieving revision 1.97 diff -p -u -r1.97 regrename.c --- regrename.c 11 Mar 2005 09:05:06 -0000 1.97 +++ regrename.c 18 May 2005 10:30:20 -0000 @@ -36,6 +36,8 @@ #include "flags.h" #include "toplev.h" #include "obstack.h" +#include "timevar.h" +#include "tree-pass.h" struct du_chain { @@ -1901,3 +1903,38 @@ validate_value_data (struct value_data * vd->e[i].next_regno); } #endif +\f +static bool +gate_handle_regrename (void) +{ + return (optimize > 0 && (flag_rename_registers || flag_cprop_registers)); +} + + +/* Run the regrename and cprop passes. */ +static void +rest_of_handle_regrename (void) +{ + if (flag_rename_registers) + regrename_optimize (); + if (flag_cprop_registers) + copyprop_hardreg_forward (); +} + +struct tree_opt_pass pass_regrename = +{ + "rnreg", /* name */ + gate_handle_regrename, /* gate */ + rest_of_handle_regrename, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_RENAME_REGISTERS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'n' /* letter */ +}; + Index: reorg.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/reorg.c,v retrieving revision 1.107 diff -p -u -r1.107 reorg.c --- reorg.c 28 Apr 2005 05:03:08 -0000 1.107 +++ reorg.c 18 May 2005 10:30:27 -0000 @@ -133,6 +133,9 @@ Software Foundation, 59 Temple Place - S #include "resource.h" #include "except.h" #include "params.h" +#include "timevar.h" +#include "target.h" +#include "tree-pass.h" #ifdef DELAY_SLOTS @@ -3809,3 +3812,73 @@ dbr_schedule (rtx first, FILE *file) #endif } #endif /* DELAY_SLOTS */ +\f +static bool +gate_handle_delay_slots (void) +{ +#ifdef DELAY_SLOTS + return flag_delayed_branch; +#else + return 0; +#endif +} + +/* Run delay slot optimization. */ +static void +rest_of_handle_delay_slots (void) +{ +#ifdef DELAY_SLOTS + dbr_schedule (get_insns (), dump_file); +#endif +} + +struct tree_opt_pass pass_delay_slots = +{ + "dbr", /* name */ + gate_handle_delay_slots, /* gate */ + rest_of_handle_delay_slots, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_DBR_SCHED, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'd' /* letter */ +}; + +/* Machine dependent reorg pass. */ +static bool +gate_handle_machine_reorg (void) +{ + return targetm.machine_dependent_reorg != 0; +} + + +static void +rest_of_handle_machine_reorg (void) +{ + targetm.machine_dependent_reorg (); +} + +struct tree_opt_pass pass_machine_reorg = +{ + "mach", /* name */ + gate_handle_machine_reorg, /* gate */ + rest_of_handle_machine_reorg, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_MACH_DEP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'M' /* letter */ +}; + Index: rtl.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/rtl.h,v retrieving revision 1.549 diff -p -u -r1.549 rtl.h --- rtl.h 27 Apr 2005 17:38:17 -0000 1.549 +++ rtl.h 18 May 2005 10:30:31 -0000 @@ -1899,7 +1899,7 @@ extern enum rtx_code reversed_comparison rtx, rtx, rtx); extern void delete_for_peephole (rtx, rtx); extern int condjump_in_parallel_p (rtx); -extern void purge_line_number_notes (rtx); +extern void purge_line_number_notes (void); /* In emit-rtl.c. */ extern int max_reg_num (void); Index: sched-rgn.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v retrieving revision 1.93 diff -p -u -r1.93 sched-rgn.c --- sched-rgn.c 11 Mar 2005 09:05:06 -0000 1.93 +++ sched-rgn.c 18 May 2005 10:30:34 -0000 @@ -65,6 +65,8 @@ Software Foundation, 59 Temple Place - S #include "params.h" #include "sched-int.h" #include "target.h" +#include "timevar.h" +#include "tree-pass.h" /* Define when we want to do count REG_DEAD notes before and after scheduling for sanity checking. We can't do that when conditional execution is used, @@ -2585,3 +2587,95 @@ schedule_insns (FILE *dump_file) sbitmap_free (large_region_blocks); } #endif +\f +static bool +gate_handle_sched (void) +{ +#ifdef INSN_SCHEDULING + return flag_schedule_insns; +#else + return 0; +#endif +} + +/* Run instruction scheduler. */ +static void +rest_of_handle_sched (void) +{ +#ifdef INSN_SCHEDULING + /* Do control and data sched analysis, + and write some of the results to dump file. */ + + schedule_insns (dump_file); +#endif +} + +static bool +gate_handle_sched2 (void) +{ +#ifdef INSN_SCHEDULING + return optimize > 0 && flag_schedule_insns_after_reload; +#else + return 0; +#endif +} + +/* Run second scheduling pass after reload. */ +static void +rest_of_handle_sched2 (void) +{ +#ifdef INSN_SCHEDULING + /* Do control and data sched analysis again, + and write some more of the results to dump file. */ + + split_all_insns (1); + + if (flag_sched2_use_superblocks || flag_sched2_use_traces) + { + schedule_ebbs (dump_file); + /* No liveness updating code yet, but it should be easy to do. + reg-stack recomputes the liveness when needed for now. */ + count_or_remove_death_notes (NULL, 1); + cleanup_cfg (CLEANUP_EXPENSIVE); + } + else + schedule_insns (dump_file); +#endif +} + +struct tree_opt_pass pass_sched = +{ + "sched1", /* name */ + gate_handle_sched, /* gate */ + rest_of_handle_sched, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_SCHED, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'S' /* letter */ +}; + +struct tree_opt_pass pass_sched2 = +{ + "sched2", /* name */ + gate_handle_sched2, /* gate */ + rest_of_handle_sched2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_SCHED2, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func | + TODO_ggc_collect, /* todo_flags_finish */ + 'R' /* letter */ +}; + Index: tracer.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tracer.c,v retrieving revision 1.25 diff -p -u -r1.25 tracer.c --- tracer.c 12 Mar 2005 00:34:04 -0000 1.25 +++ tracer.c 18 May 2005 10:30:37 -0000 @@ -48,6 +48,7 @@ #include "timevar.h" #include "params.h" #include "coverage.h" +#include "tree-pass.h" static int count_insns (basic_block); static bool ignore_bb_p (basic_block); @@ -365,8 +366,6 @@ tracer (unsigned int flags) if (n_basic_blocks <= 1) return; - timevar_push (TV_TRACER); - cfg_layout_initialize (flags); mark_dfs_back_edges (); if (dump_file) @@ -379,6 +378,39 @@ tracer (unsigned int flags) /* Merge basic blocks in duplicated traces. */ cleanup_cfg (CLEANUP_EXPENSIVE); +} +\f +static bool +gate_handle_tracer (void) +{ + return (optimize > 0 && flag_tracer); +} - timevar_pop (TV_TRACER); +/* Run tracer. */ +static void +rest_of_handle_tracer (void) +{ + if (dump_file) + dump_flow_info (dump_file); + tracer (0); + cleanup_cfg (CLEANUP_EXPENSIVE); + reg_scan (get_insns (), max_reg_num ()); } + +struct tree_opt_pass pass_tracer = +{ + "tracer", /* name */ + gate_handle_tracer, /* gate */ + rest_of_handle_tracer, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_TRACER, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'T' /* letter */ +}; + Index: tree-pass.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-pass.h,v retrieving revision 2.35 diff -p -u -r2.35 tree-pass.h --- tree-pass.h 17 May 2005 09:55:24 -0000 2.35 +++ tree-pass.h 18 May 2005 10:30:40 -0000 @@ -221,4 +272,74 @@ extern struct tree_opt_pass pass_uncprop extern struct tree_opt_pass pass_ipa_inline; +extern struct tree_opt_pass pass_all_optimizations; +extern struct tree_opt_pass pass_cleanup_cfg_post_optimizing; +extern struct tree_opt_pass pass_free_datastructures; +extern struct tree_opt_pass pass_init_datastructures; +extern struct tree_opt_pass pass_fixup_cfg; + +extern struct tree_opt_pass pass_remove_unnecessary_notes; +extern struct tree_opt_pass pass_init_function; +extern struct tree_opt_pass pass_jump; +extern struct tree_opt_pass pass_insn_locators_initialize; +extern struct tree_opt_pass pass_rtl_eh; +extern struct tree_opt_pass pass_initial_value_sets; +extern struct tree_opt_pass pass_unshare_all_rtl; +extern struct tree_opt_pass pass_instantiate_virtual_regs; +extern struct tree_opt_pass pass_jump2; +extern struct tree_opt_pass pass_cse; +extern struct tree_opt_pass pass_gcse; +extern struct tree_opt_pass pass_loop_optimize; +extern struct tree_opt_pass pass_jump_bypass; +extern struct tree_opt_pass pass_cfg; +extern struct tree_opt_pass pass_profiling; +extern struct tree_opt_pass pass_rtl_ifcvt; +extern struct tree_opt_pass pass_tracer; +extern struct tree_opt_pass pass_loop2; +extern struct tree_opt_pass pass_web; +extern struct tree_opt_pass pass_cse2; +extern struct tree_opt_pass pass_life; +extern struct tree_opt_pass pass_combine; +extern struct tree_opt_pass pass_if_after_combine; +extern struct tree_opt_pass pass_partition_blocks; +extern struct tree_opt_pass pass_partition_blocks; +extern struct tree_opt_pass pass_regmove; +extern struct tree_opt_pass pass_split_all_insns; +extern struct tree_opt_pass pass_mode_switching; +extern struct tree_opt_pass pass_recompute_reg_usage; +extern struct tree_opt_pass pass_sms; +extern struct tree_opt_pass pass_sched; +extern struct tree_opt_pass pass_local_alloc; +extern struct tree_opt_pass pass_global_alloc; +extern struct tree_opt_pass pass_postreload; +extern struct tree_opt_pass pass_clean_state; +extern struct tree_opt_pass pass_branch_prob; +extern struct tree_opt_pass pass_value_profile_transformations; +extern struct tree_opt_pass pass_remove_death_notes; +extern struct tree_opt_pass pass_postreload_cse; +extern struct tree_opt_pass pass_gcse2; +extern struct tree_opt_pass pass_flow2; +extern struct tree_opt_pass pass_stack_adjustments; +extern struct tree_opt_pass pass_peephole2; +extern struct tree_opt_pass pass_if_after_reload; +extern struct tree_opt_pass pass_regrename; +extern struct tree_opt_pass pass_reorder_blocks; +extern struct tree_opt_pass pass_branch_target_load_optimize; +extern struct tree_opt_pass pass_leaf_regs; +extern struct tree_opt_pass pass_sched2; +extern struct tree_opt_pass pass_stack_regs; +extern struct tree_opt_pass pass_compute_alignments; +extern struct tree_opt_pass pass_duplicate_computed_gotos; +extern struct tree_opt_pass pass_variable_tracking; +extern struct tree_opt_pass pass_free_cfg; +extern struct tree_opt_pass pass_machine_reorg; +extern struct tree_opt_pass pass_purge_lineno_notes; +extern struct tree_opt_pass pass_cleanup_barriers; +extern struct tree_opt_pass pass_delay_slots; +extern struct tree_opt_pass pass_split_for_shorten_branches; +extern struct tree_opt_pass pass_split_before_regstack; +extern struct tree_opt_pass pass_convert_to_eh_region_ranges; +extern struct tree_opt_pass pass_shorten_branches; +extern struct tree_opt_pass pass_set_nothrow_function_flags; +extern struct tree_opt_pass pass_final; #endif /* GCC_TREE_PASS_H */ Index: value-prof.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/value-prof.c,v retrieving revision 1.28 diff -p -u -r1.28 value-prof.c --- value-prof.c 28 Apr 2005 05:03:09 -0000 1.28 +++ value-prof.c 18 May 2005 10:30:54 -0000 @@ -40,6 +40,8 @@ Software Foundation, 59 Temple Place - S #include "coverage.h" #include "tree.h" #include "gcov-io.h" +#include "timevar.h" +#include "tree-pass.h" static struct value_prof_hooks *value_prof_hooks; @@ -1797,3 +1799,39 @@ value_profile_transformations (void) VEC_free (histogram_value, heap, static_values); return retval; } +\f +static bool +gate_handle_value_profile_transformations (void) +{ + return flag_branch_probabilities + && flag_profile_values + && (flag_value_profile_transformations + || flag_speculative_prefetching); +} + + +/* Do optimizations based on expression value profiles. */ +static void +rest_of_handle_value_profile_transformations (void) +{ + if (value_profile_transformations ()) + cleanup_cfg (CLEANUP_EXPENSIVE); +} + +struct tree_opt_pass pass_value_profile_transformations = +{ + "vpt", /* name */ + gate_handle_value_profile_transformations, /* gate */ + rest_of_handle_value_profile_transformations, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_VPT, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'V' /* letter */ +}; + Index: var-tracking.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/var-tracking.c,v retrieving revision 2.27 diff -p -u -r2.27 var-tracking.c --- var-tracking.c 10 Mar 2005 15:36:39 -0000 2.27 +++ var-tracking.c 18 May 2005 10:30:58 -0000 @@ -102,6 +102,8 @@ #include "hashtab.h" #include "regs.h" #include "expr.h" +#include "timevar.h" +#include "tree-pass.h" /* Type of micro operation. */ enum micro_operation_type @@ -2734,3 +2736,29 @@ variable_tracking_main (void) vt_finalize (); } +\f +static bool +gate_handle_var_tracking (void) +{ + return (flag_var_tracking); +} + + + +struct tree_opt_pass pass_variable_tracking = +{ + "vartrack", /* name */ + gate_handle_var_tracking, /* gate */ + variable_tracking_main, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_VAR_TRACKING, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'V' /* letter */ +}; + Index: web.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/web.c,v retrieving revision 2.14 diff -p -u -r2.14 web.c --- web.c 22 Nov 2004 12:23:59 -0000 2.14 +++ web.c 18 May 2005 10:30:59 -0000 @@ -56,6 +56,8 @@ Software Foundation, 59 Temple Place - S #include "output.h" #include "df.h" #include "function.h" +#include "timevar.h" +#include "tree-pass.h" /* This entry is allocated for each reference in the insn stream. */ @@ -271,3 +273,36 @@ web_main (void) free (used); df_finish (df); } +\f +static bool +gate_handle_web (void) +{ + return (optimize > 0 && flag_web); +} + +static void +rest_of_handle_web (void) +{ + web_main (); + delete_trivially_dead_insns (get_insns (), max_reg_num ()); + cleanup_cfg (CLEANUP_EXPENSIVE); + reg_scan (get_insns (), max_reg_num ()); +} + +struct tree_opt_pass pass_web = +{ + "web", /* name */ + gate_handle_web, /* gate */ + rest_of_handle_web, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_WEB, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func, /* todo_flags_finish */ + 'Z' /* letter */ +}; + ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Update RTL passes patch [was Re: Patch ping...] 2005-06-23 12:40 ` Update RTL passes patch [was Re: Patch ping...] Paolo Bonzini @ 2005-06-26 21:51 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2005-06-26 21:51 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches, Jan Hubicka On Thu, Jun 23, 2005 at 02:38:35PM +0200, Paolo Bonzini wrote: > With this patch in, I can update the patch for using the pass manager in > RTL passes, so that the code I move from tree-optimize.c to passes.c is > exactly verbatim. > > Bootstrapped i686-pc-linux-gnu on top of Honza's patch, all languages, > ok for mainline? Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2024-02-09 9:44 Jakub Jelinek 2024-02-12 16:07 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2024-02-09 9:44 UTC (permalink / raw) To: Richard Biener, Jeff Law, Vladimir Makarov; +Cc: gcc-patches Hi! I'd like to ping 2 patches: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/644580.html PR113617 P1 - Handle private COMDAT function symbol reference in readonly data section More details in the https://gcc.gnu.org/pipermail/gcc-patches/2024-January/thread.html#644121 and https://gcc.gnu.org/pipermail/gcc-patches/2024-January/thread.html#644486 threads. and https://gcc.gnu.org/pipermail/gcc-patches/2024-February/644701.html Introduce HOST_SIZE_T_PRINT_UNSIGNED etc. macros to fix LLP64 host build issue Both have been successfully bootstrapped/regtested on x86_64-linux and i686-linux, the latter has been tested by Jonathan on Windows too. The alternative is start using %zu (AFAIK we only do that in libgccjit which isn't supported everywhere and while it is C99, not sure if all supported host C libraries support it), or change ira-conflicts.cc to --- gcc/ira-conflicts.cc 2024-02-01 21:03:57.339193085 +0100 +++ gcc/ira-conflicts.cc 2024-02-09 10:41:39.201150644 +0100 @@ -151,8 +151,8 @@ build_conflict_bit_table (void) fprintf (ira_dump_file, "+++Allocating %ld bytes for conflict table (uncompressed size %ld)\n", - (long) allocated_words_num * sizeof (IRA_INT_TYPE), - (long) object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE)); + (long) (allocated_words_num * sizeof (IRA_INT_TYPE)), + (long) (object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE))); objects_live = sparseset_alloc (ira_objects_num); for (i = 0; i < ira_max_point; i++) Note, we have many more cases where we use %ld or %lu to print size_t values (ideally %zd/%zu if we can assume it on all hosts, or with the above introduced HOST_SIZE_T_PRINT*, the problem with the %ld/%lu and casts is that it truncates the values on LLP64 hosts (aka %Windows). Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2024-02-09 9:44 Patch ping Jakub Jelinek @ 2024-02-12 16:07 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2024-02-12 16:07 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Vladimir Makarov; +Cc: gcc-patches On 2/9/24 02:44, Jakub Jelinek wrote: > > https://gcc.gnu.org/pipermail/gcc-patches/2024-February/644701.html > Introduce HOST_SIZE_T_PRINT_UNSIGNED etc. macros to fix LLP64 host build issue > > Both have been successfully bootstrapped/regtested on x86_64-linux and > i686-linux, the latter has been tested by Jonathan on Windows too. > The alternative is start using %zu (AFAIK we only do that in libgccjit which > isn't supported everywhere and while it is C99, not sure if all supported > host C libraries support it), or change ira-conflicts.cc to > --- gcc/ira-conflicts.cc 2024-02-01 21:03:57.339193085 +0100 > +++ gcc/ira-conflicts.cc 2024-02-09 10:41:39.201150644 +0100 > @@ -151,8 +151,8 @@ build_conflict_bit_table (void) > fprintf > (ira_dump_file, > "+++Allocating %ld bytes for conflict table (uncompressed size %ld)\n", > - (long) allocated_words_num * sizeof (IRA_INT_TYPE), > - (long) object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE)); > + (long) (allocated_words_num * sizeof (IRA_INT_TYPE)), > + (long) (object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE))); > > objects_live = sparseset_alloc (ira_objects_num); > for (i = 0; i < ira_max_point; i++) > Note, we have many more cases where we use %ld or %lu to print > size_t values (ideally %zd/%zu if we can assume it on all hosts, or > with the above introduced HOST_SIZE_T_PRINT*, the problem with the > %ld/%lu and casts is that it truncates the values on LLP64 hosts (aka > %Windows). While I'd love to be able to use %z, I suspect it's going to be problematical. That's one of the cleanups I need to have Mariam do on the CRC code which uses %z extensively in its debugging dumps. So let's assume %z is a no-go for now. Having a HOST_SIZE_T_PRINT_UNSIGNED seems useful, so I'd tend to prefer we go with that solution from the URL above rather than just throwing some parens around the expression before casting the result to "long". jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2023-03-01 10:23 Jakub Jelinek 2023-03-04 1:33 ` Joseph Myers 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2023-03-01 10:23 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw, Kyrylo Tkachov, richard.sandiford, Jonathan Wakely Cc: gcc-patches Hi! I'd like to ping a few pending patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html - PR107846 - P1 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610285.html - PR108464 - P1 - file-prefix-map: Fix up -f*-prefix-map= (3 variants) https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611647.html - PR108702 - P1 - c++: Don't defer local statics initialized with constant expressions https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606382.html - PR107703 - P3, ABI - libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html - PR107465 - P2 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html - PR107465 - P2 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607145.html - PR107558 - P2 - c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608932.html - PR108079 - P2 - c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611615.html - PR108716 - P2 - c++, debug: Fix up locus of DW_TAG_imported_module https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611180.html - PR108634 - P3 - tree: Use comdat tree_code_{type,length} even for C++11/14 https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605965.html - ABI - aarch64: Add bfloat16_t support for aarch64 (enabling it in GCC 14 will be harder) https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612342.html - libstdc++: Some baseline_symbols.txt updates Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2023-03-01 10:23 Jakub Jelinek @ 2023-03-04 1:33 ` Joseph Myers 0 siblings, 0 replies; 504+ messages in thread From: Joseph Myers @ 2023-03-04 1:33 UTC (permalink / raw) To: Jakub Jelinek Cc: Jason Merrill, Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw, Kyrylo Tkachov, richard.sandiford, Jonathan Wakely, gcc-patches On Wed, 1 Mar 2023, Jakub Jelinek via Gcc-patches wrote: > Hi! > > I'd like to ping a few pending patches: > > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html > - PR107846 - P1 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning OK. > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html > - PR107465 - P2 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling OK. > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html > - PR107465 - P2 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling OK. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2023-02-13 10:35 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2023-02-13 10:35 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw, Kyrylo Tkachov, richard.sandiford Cc: gcc-patches I'd like to ping a few pending patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html - PR107846 - P1 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610285.html - PR108464 - P1 - file-prefix-map: Fix up -f*-prefix-map= (3 variants) https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611647.html - PR108702 - P1 - c++: Don't defer local statics initialized with constant expressions https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606382.html - PR107703 - P3, ABI - libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html - PR107465 - P2 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html - PR107465 - P2 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607145.html - PR107558 - P2 - c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608932.html - PR108079 - P2 - c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611615.html - PR108716 - P2 - c++, debug: Fix up locus of DW_TAG_imported_module https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611180.html - PR108634 - P3 - tree: Use comdat tree_code_{type,length} even for C++11/14 https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605965.html - ABI - aarch64: Add bfloat16_t support for aarch64 (enabling it in GCC 14 will be harder) Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2023-01-30 9:50 Jakub Jelinek 2023-01-30 23:07 ` Richard Sandiford 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2023-01-30 9:50 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw, Kyrylo Tkachov, richard.sandiford Cc: gcc-patches I'd like to ping a few pending patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html - PR107846 - P1 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610285.html - PR108464 - P1 - file-prefix-map: Fix up -f*-prefix-map= (3 variants) https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606382.html - PR107703 - P3, ABI - libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html - PR107465 - P2 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html - PR107465 - P2 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607145.html - PR107558 - P2 - c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608932.html - PR108079 - P2 - c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605965.html - ABI - aarch64: Add bfloat16_t support for aarch64 (enabling it in GCC 14 will be harder) Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2023-01-30 9:50 Jakub Jelinek @ 2023-01-30 23:07 ` Richard Sandiford 0 siblings, 0 replies; 504+ messages in thread From: Richard Sandiford @ 2023-01-30 23:07 UTC (permalink / raw) To: Jakub Jelinek Cc: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw, Kyrylo Tkachov, gcc-patches Jakub Jelinek <jakub@redhat.com> writes: > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605965.html > - ABI - aarch64: Add bfloat16_t support for aarch64 (enabling it in GCC 14 > will be harder) Sorry for the delay on this. There's still an ongoing debate about whether to keep the current AArch64 mangling or switch to the new one. Thanks, Richard ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2023-01-09 16:50 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2023-01-09 16:50 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping a few pending patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html - PR107465 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html - PR107465 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607145.html - PR107558 - c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html - PR107846 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606382.html - PR107703 - libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608932.html - PR108079 - c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2022-12-09 15:09 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2022-12-09 15:09 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Uros Bizjak, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping a few pending patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606973.html - PR107465 - c-family: Fix up -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607104.html - PR107465 - c-family: Incremental fix for -Wsign-compare BIT_NOT_EXPR handling https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607145.html - PR107558 - c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607534.html - PR107846 - c-family: Account for integral promotions of left shifts for -Wshift-overflow warning https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606382.html - PR107703 - libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* [PATCH] builtins: Add __builtin_nextafterf16b builtin @ 2022-10-21 7:23 Jakub Jelinek 2022-10-21 15:42 ` [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x} Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2022-10-21 7:23 UTC (permalink / raw) To: Joseph S. Myers, Richard Biener, Jeff Law; +Cc: gcc-patches, Jonathan Wakely Hi! On top of the pending https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html patch, the following patch adds another needed builtin. The above patch adds among other things __builtin_nextafterf16 builtin which we need in order to constexpr evaluate std::nextafter(_Float16) overload (patch for that to be posted momentarily). While there is inline implementation of the overload, it isn't constant evaluation friendly, and the builtin doesn't need libm implementation because it will be used only during constant expression evaluation. We need the same thing also for std::nextafter(__gnu_cxx::__bfloat16_t) though and this patch does that. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-10-21 Jakub Jelinek <jakub@redhat.com> * builtin-types.def (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16): New. * builtins.def (BUILT_IN_NEXTAFTERF16B): New builtin. * fold-const-call.cc (fold_const_call_sss): Handle CFN_BUILT_IN_NEXTAFTERF16B. --- gcc/builtin-types.def.jj 2022-10-20 16:43:03.031928876 +0200 +++ gcc/builtin-types.def 2022-10-20 16:44:15.768934809 +0200 @@ -461,6 +461,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOA BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X) +DEF_FUNCTION_TYPE_2 (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, + BT_BFLOAT16, BT_BFLOAT16, BT_BFLOAT16) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_FLOATPTR, BT_FLOAT, BT_FLOAT, BT_FLOAT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, --- gcc/builtins.def.jj 2022-10-20 16:43:03.033928849 +0200 +++ gcc/builtins.def 2022-10-20 16:46:27.467135944 +0200 @@ -591,6 +591,7 @@ DEF_C99_BUILTIN (BUILT_IN_NEXTAFT DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERL, "nextafterl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) #define NEXTAFTER_TYPE(F) BT_FN_##F##_##F##_##F DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEXTAFTER, "nextafter", NEXTAFTER_TYPE, ATTR_MATHFN_ERRNO) +DEF_GCC_BUILTIN (BUILT_IN_NEXTAFTERF16B, "nextafterf16b", BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARD, "nexttoward", BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDF, "nexttowardf", BT_FN_FLOAT_FLOAT_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDL, "nexttowardl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) --- gcc/fold-const-call.cc.jj 2022-10-20 16:43:03.033928849 +0200 +++ gcc/fold-const-call.cc 2022-10-20 16:50:14.300038009 +0200 @@ -1438,6 +1438,7 @@ fold_const_call_sss (real_value *result, CASE_CFN_NEXTAFTER: CASE_CFN_NEXTAFTER_FN: + case CFN_BUILT_IN_NEXTAFTERF16B: CASE_CFN_NEXTTOWARD: return fold_const_nextafter (result, arg0, arg1, format); Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x} 2022-10-21 7:23 [PATCH] builtins: Add __builtin_nextafterf16b builtin Jakub Jelinek @ 2022-10-21 15:42 ` Jakub Jelinek 2022-10-24 16:28 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2022-10-21 15:42 UTC (permalink / raw) To: Joseph S. Myers, Richard Biener, Jeff Law; +Cc: gcc-patches, Jonathan Wakely Hi! On top of the pending https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604080.html the following patch adds some complex builtins which have libm implementation in glibc 2.26 and later on various arches. It is needed for libstdc++ _Float128 support when long double is not IEEE quad. Tested on x86_64-linux, ok for trunk? 2022-10-21 Jakub Jelinek <jakub@redhat.com> * builtin-types.def (BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT128X, BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16, BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32, BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64, BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128, BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X, BT_FN_FLOAT16_COMPLEX_FLOAT16, BT_FN_FLOAT32_COMPLEX_FLOAT32, BT_FN_FLOAT64_COMPLEX_FLOAT64, BT_FN_FLOAT128_COMPLEX_FLOAT128, BT_FN_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_FLOAT64X_COMPLEX_FLOAT64X, BT_FN_FLOAT128X_COMPLEX_FLOAT128X, BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16, BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32, BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64, BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128, BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X): New. * builtins.def (CABS_TYPE, CACOSH_TYPE, CARG_TYPE, CASINH_TYPE, CPOW_TYPE, CPROJ_TYPE): Define and undefine later. (BUILT_IN_CABS, BUILT_IN_CACOSH, BUILT_IN_CACOS, BUILT_IN_CARG, BUILT_IN_CASINH, BUILT_IN_CASIN, BUILT_IN_CATANH, BUILT_IN_CATAN, BUILT_IN_CCOSH, BUILT_IN_CCOS, BUILT_IN_CEXP, BUILT_IN_CLOG, BUILT_IN_CPOW, BUILT_IN_CPROJ, BUILT_IN_CSINH, BUILT_IN_CSIN, BUILT_IN_CSQRT, BUILT_IN_CTANH, BUILT_IN_CTAN): Add DEF_EXT_LIB_FLOATN_NX_BUILTINS. * fold-const-call.cc (fold_const_call_sc, fold_const_call_cc, fold_const_call_ccc): Add various CASE_CFN_*_FN: cases when CASE_CFN_* is present. * gimple-ssa-backprop.cc (backprop::process_builtin_call_use): Likewise. * builtins.cc (expand_builtin, fold_builtin_1): Likewise. * fold-const.cc (negate_mathfn_p, tree_expr_finite_p, tree_expr_maybe_signaling_nan_p, tree_expr_maybe_nan_p, tree_expr_maybe_real_minus_zero_p, tree_call_nonnegative_warnv_p): Likewise. --- gcc/builtin-types.def.jj 2022-10-21 09:44:13.918939702 +0200 +++ gcc/builtin-types.def 2022-10-21 13:55:25.152070472 +0200 @@ -109,6 +109,34 @@ DEF_PRIMITIVE_TYPE (BT_FLOAT128X, (float DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT, complex_float_type_node) DEF_PRIMITIVE_TYPE (BT_COMPLEX_DOUBLE, complex_double_type_node) DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBLE, complex_long_double_type_node) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT16, (float16_type_node + ? build_complex_type + (float16_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32, (float32_type_node + ? build_complex_type + (float32_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64, (float64_type_node + ? build_complex_type + (float64_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128, (float128_type_node + ? build_complex_type + (float128_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32X, (float32x_type_node + ? build_complex_type + (float32x_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64X, (float64x_type_node + ? build_complex_type + (float64x_type_node) + : error_mark_node)) +DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128X, (float128x_type_node + ? build_complex_type + (float128x_type_node) + : error_mark_node)) DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node) DEF_PRIMITIVE_TYPE (BT_FILEPTR, fileptr_type_node) @@ -242,12 +270,40 @@ DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBL BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE) DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16, + BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32, + BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64, + BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128, + BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, + BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, + BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X) +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X, + BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X) DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT_COMPLEX_FLOAT, BT_FLOAT, BT_COMPLEX_FLOAT) DEF_FUNCTION_TYPE_1 (BT_FN_DOUBLE_COMPLEX_DOUBLE, BT_DOUBLE, BT_COMPLEX_DOUBLE) DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, BT_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT16_COMPLEX_FLOAT16, + BT_FLOAT16, BT_COMPLEX_FLOAT16) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32_COMPLEX_FLOAT32, + BT_FLOAT32, BT_COMPLEX_FLOAT32) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64_COMPLEX_FLOAT64, + BT_FLOAT64, BT_COMPLEX_FLOAT64) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128_COMPLEX_FLOAT128, + BT_FLOAT128, BT_COMPLEX_FLOAT128) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32X_COMPLEX_FLOAT32X, + BT_FLOAT32X, BT_COMPLEX_FLOAT32X) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64X_COMPLEX_FLOAT64X, + BT_FLOAT64X, BT_COMPLEX_FLOAT64X) +DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128X_COMPLEX_FLOAT128X, + BT_FLOAT128X, BT_COMPLEX_FLOAT128X) DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT_FLOAT, BT_COMPLEX_FLOAT, BT_FLOAT) DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBLE_DOUBLE, @@ -565,6 +621,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_DOUBL BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE) DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16, + BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32, + BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64, + BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128, + BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, + BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, + BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X) +DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X, + BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X) DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING, BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING) --- gcc/builtins.def.jj 2022-10-21 09:44:13.919939689 +0200 +++ gcc/builtins.def 2022-10-21 16:59:20.600317489 +0200 @@ -709,36 +709,54 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_YNL, "y DEF_C99_COMPL_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +#define CABS_TYPE(F) BT_FN_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CABS, "cabs", CABS_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CABS_TYPE DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +#define CACOSH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOSH, "cacosh", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOS, "cacos", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CACOSH_TYPE DEF_C99_COMPL_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +#define CARG_TYPE(F) BT_FN_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CARG, "carg", CARG_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CARG_TYPE DEF_C99_COMPL_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +#define CASINH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASINH, "casinh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASIN, "casin", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATANH, "catanh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATAN, "catan", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOSH, "ccosh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOS, "ccos", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CEXP, "cexp", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) DEF_GCC_BUILTIN (BUILT_IN_CEXPI, "cexpi", BT_FN_COMPLEX_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_GCC_BUILTIN (BUILT_IN_CEXPIF, "cexpif", BT_FN_COMPLEX_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_GCC_BUILTIN (BUILT_IN_CEXPIL, "cexpil", BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) @@ -748,6 +766,8 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CLOG, "clog", CASINH_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CASINH_TYPE DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10, "clog10", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10F, "clog10f", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10L, "clog10l", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) @@ -757,9 +777,14 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +#define CPOW_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPOW, "cpow", CPOW_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CPOW_TYPE DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) +#define CPROJ_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPROJ, "cproj", CPROJ_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_COMPL_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) @@ -768,16 +793,22 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSINH, "csinh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSIN, "csin", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSQRT, "csqrt", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTANH, "ctanh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING) DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTAN, "ctan", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING) +#undef CPROJ_TYPE /* Category: string/memory builtins. */ DEF_EXT_LIB_BUILTIN (BUILT_IN_BCMP, "bcmp", BT_FN_INT_CONST_PTR_CONST_PTR_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF) --- gcc/fold-const-call.cc.jj 2022-10-21 09:44:13.919939689 +0200 +++ gcc/fold-const-call.cc 2022-10-21 16:59:58.028812651 +0200 @@ -1112,6 +1112,7 @@ fold_const_call_sc (real_value *result, switch (fn) { CASE_CFN_CABS: + CASE_CFN_CABS_FN: return do_mpfr_arg2 (result, mpfr_hypot, arg_real, arg_imag, format); default: @@ -1135,14 +1136,17 @@ fold_const_call_cc (real_value *result_r switch (fn) { CASE_CFN_CCOS: + CASE_CFN_CCOS_FN: return do_mpc_arg1 (result_real, result_imag, mpc_cos, arg_real, arg_imag, format); CASE_CFN_CCOSH: + CASE_CFN_CCOSH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_cosh, arg_real, arg_imag, format); CASE_CFN_CPROJ: + CASE_CFN_CPROJ_FN: if (real_isinf (arg_real) || real_isinf (arg_imag)) { *result_real = dconstinf; @@ -1157,54 +1161,67 @@ fold_const_call_cc (real_value *result_r return true; CASE_CFN_CSIN: + CASE_CFN_CSIN_FN: return do_mpc_arg1 (result_real, result_imag, mpc_sin, arg_real, arg_imag, format); CASE_CFN_CSINH: + CASE_CFN_CSINH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_sinh, arg_real, arg_imag, format); CASE_CFN_CTAN: + CASE_CFN_CTAN_FN: return do_mpc_arg1 (result_real, result_imag, mpc_tan, arg_real, arg_imag, format); CASE_CFN_CTANH: + CASE_CFN_CTANH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_tanh, arg_real, arg_imag, format); CASE_CFN_CLOG: + CASE_CFN_CLOG_FN: return do_mpc_arg1 (result_real, result_imag, mpc_log, arg_real, arg_imag, format); CASE_CFN_CSQRT: + CASE_CFN_CSQRT_FN: return do_mpc_arg1 (result_real, result_imag, mpc_sqrt, arg_real, arg_imag, format); CASE_CFN_CASIN: + CASE_CFN_CASIN_FN: return do_mpc_arg1 (result_real, result_imag, mpc_asin, arg_real, arg_imag, format); CASE_CFN_CACOS: + CASE_CFN_CACOS_FN: return do_mpc_arg1 (result_real, result_imag, mpc_acos, arg_real, arg_imag, format); CASE_CFN_CATAN: + CASE_CFN_CATAN_FN: return do_mpc_arg1 (result_real, result_imag, mpc_atan, arg_real, arg_imag, format); CASE_CFN_CASINH: + CASE_CFN_CASINH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_asinh, arg_real, arg_imag, format); CASE_CFN_CACOSH: + CASE_CFN_CACOSH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_acosh, arg_real, arg_imag, format); CASE_CFN_CATANH: + CASE_CFN_CATANH_FN: return do_mpc_arg1 (result_real, result_imag, mpc_atanh, arg_real, arg_imag, format); CASE_CFN_CEXP: + CASE_CFN_CEXP_FN: return do_mpc_arg1 (result_real, result_imag, mpc_exp, arg_real, arg_imag, format); @@ -1532,6 +1549,7 @@ fold_const_call_ccc (real_value *result_ switch (fn) { CASE_CFN_CPOW: + CASE_CFN_CPOW_FN: return do_mpc_arg2 (result_real, result_imag, mpc_pow, arg0_real, arg0_imag, arg1_real, arg1_imag, format); --- gcc/gimple-ssa-backprop.cc.jj 2022-06-28 13:03:30.773691775 +0200 +++ gcc/gimple-ssa-backprop.cc 2022-10-21 13:50:12.943336688 +0200 @@ -351,10 +351,15 @@ backprop::process_builtin_call_use (gcal break; CASE_CFN_COS: + CASE_CFN_COS_FN: CASE_CFN_COSH: + CASE_CFN_COSH_FN: CASE_CFN_CCOS: + CASE_CFN_CCOS_FN: CASE_CFN_CCOSH: + CASE_CFN_CCOSH_FN: CASE_CFN_HYPOT: + CASE_CFN_HYPOT_FN: /* The signs of all inputs are ignored. */ info->flags.ignore_sign = true; break; @@ -367,6 +372,7 @@ backprop::process_builtin_call_use (gcal break; CASE_CFN_POW: + CASE_CFN_POW_FN: { /* The sign of the first input is ignored as long as the second input is an even real. */ --- gcc/builtins.cc.jj 2022-10-21 09:44:01.537108876 +0200 +++ gcc/builtins.cc 2022-10-21 13:33:39.310898575 +0200 @@ -7393,6 +7393,7 @@ expand_builtin (tree exp, rtx target, rt /* Just do a normal library call if we were unable to fold the values. */ CASE_FLT_FN (BUILT_IN_CABS): + CASE_FLT_FN_FLOATN_NX (BUILT_IN_CABS): break; CASE_FLT_FN (BUILT_IN_FMA): @@ -9661,6 +9662,7 @@ fold_builtin_1 (location_t loc, tree exp break; CASE_FLT_FN (BUILT_IN_CARG): + CASE_FLT_FN_FLOATN_NX (BUILT_IN_CARG): return fold_builtin_carg (loc, arg0, type); case BUILT_IN_ISASCII: --- gcc/fold-const.cc.jj 2022-10-21 09:44:01.540108835 +0200 +++ gcc/fold-const.cc 2022-10-21 16:59:47.280957627 +0200 @@ -322,36 +322,62 @@ negate_mathfn_p (combined_fn fn) switch (fn) { CASE_CFN_ASIN: + CASE_CFN_ASIN_FN: CASE_CFN_ASINH: + CASE_CFN_ASINH_FN: CASE_CFN_ATAN: + CASE_CFN_ATAN_FN: CASE_CFN_ATANH: + CASE_CFN_ATANH_FN: CASE_CFN_CASIN: + CASE_CFN_CASIN_FN: CASE_CFN_CASINH: + CASE_CFN_CASINH_FN: CASE_CFN_CATAN: + CASE_CFN_CATAN_FN: CASE_CFN_CATANH: + CASE_CFN_CATANH_FN: CASE_CFN_CBRT: + CASE_CFN_CBRT_FN: CASE_CFN_CPROJ: + CASE_CFN_CPROJ_FN: CASE_CFN_CSIN: + CASE_CFN_CSIN_FN: CASE_CFN_CSINH: + CASE_CFN_CSINH_FN: CASE_CFN_CTAN: + CASE_CFN_CTAN_FN: CASE_CFN_CTANH: + CASE_CFN_CTANH_FN: CASE_CFN_ERF: + CASE_CFN_ERF_FN: CASE_CFN_LLROUND: + CASE_CFN_LLROUND_FN: CASE_CFN_LROUND: + CASE_CFN_LROUND_FN: CASE_CFN_ROUND: CASE_CFN_ROUNDEVEN: CASE_CFN_ROUNDEVEN_FN: CASE_CFN_SIN: + CASE_CFN_SIN_FN: CASE_CFN_SINH: + CASE_CFN_SINH_FN: CASE_CFN_TAN: + CASE_CFN_TAN_FN: CASE_CFN_TANH: + CASE_CFN_TANH_FN: CASE_CFN_TRUNC: + CASE_CFN_TRUNC_FN: return true; CASE_CFN_LLRINT: + CASE_CFN_LLRINT_FN: CASE_CFN_LRINT: + CASE_CFN_LRINT_FN: CASE_CFN_NEARBYINT: + CASE_CFN_NEARBYINT_FN: CASE_CFN_RINT: + CASE_CFN_RINT_FN: return !flag_rounding_math; default: @@ -14288,9 +14314,12 @@ tree_expr_finite_p (const_tree x) switch (get_call_combined_fn (x)) { CASE_CFN_FABS: + CASE_CFN_FABS_FN: return tree_expr_finite_p (CALL_EXPR_ARG (x, 0)); CASE_CFN_FMAX: + CASE_CFN_FMAX_FN: CASE_CFN_FMIN: + CASE_CFN_FMIN_FN: return tree_expr_finite_p (CALL_EXPR_ARG (x, 0)) && tree_expr_finite_p (CALL_EXPR_ARG (x, 1)); default: @@ -14408,9 +14437,12 @@ tree_expr_maybe_signaling_nan_p (const_t switch (get_call_combined_fn (x)) { CASE_CFN_FABS: + CASE_CFN_FABS_FN: return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0)); CASE_CFN_FMAX: + CASE_CFN_FMAX_FN: CASE_CFN_FMIN: + CASE_CFN_FMIN_FN: return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0)) || tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 1)); default: @@ -14481,9 +14513,12 @@ tree_expr_maybe_nan_p (const_tree x) switch (get_call_combined_fn (x)) { CASE_CFN_FABS: + CASE_CFN_FABS_FN: return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0)); CASE_CFN_FMAX: + CASE_CFN_FMAX_FN: CASE_CFN_FMIN: + CASE_CFN_FMIN_FN: return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0)) || tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 1)); default: @@ -14520,6 +14555,7 @@ tree_expr_maybe_real_minus_zero_p (const switch (get_call_combined_fn (x)) { CASE_CFN_FABS: + CASE_CFN_FABS_FN: return false; default: break; @@ -14801,6 +14837,7 @@ tree_call_nonnegative_warnv_p (tree type CASE_CFN_ACOSH: CASE_CFN_ACOSH_FN: CASE_CFN_CABS: + CASE_CFN_CABS_FN: CASE_CFN_COSH: CASE_CFN_COSH_FN: CASE_CFN_ERFC: Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x} 2022-10-21 15:42 ` [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x} Jakub Jelinek @ 2022-10-24 16:28 ` Jeff Law 2022-10-25 9:03 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2022-10-24 16:28 UTC (permalink / raw) To: Jakub Jelinek, Joseph S. Myers, Richard Biener Cc: gcc-patches, Jonathan Wakely On 10/21/22 09:42, Jakub Jelinek wrote: > Hi! > > On top of the pending > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604080.html > the following patch adds some complex builtins which have libm > implementation in glibc 2.26 and later on various arches. > It is needed for libstdc++ _Float128 support when long double is not > IEEE quad. > > Tested on x86_64-linux, ok for trunk? > > 2022-10-21 Jakub Jelinek <jakub@redhat.com> > > * builtin-types.def (BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT32, > BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT32X, > BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT128X, > BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16, > BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32, > BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64, > BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128, > BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, > BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, > BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X, > BT_FN_FLOAT16_COMPLEX_FLOAT16, BT_FN_FLOAT32_COMPLEX_FLOAT32, > BT_FN_FLOAT64_COMPLEX_FLOAT64, BT_FN_FLOAT128_COMPLEX_FLOAT128, > BT_FN_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_FLOAT64X_COMPLEX_FLOAT64X, > BT_FN_FLOAT128X_COMPLEX_FLOAT128X, > BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16, > BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32, > BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64, > BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128, > BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X, > BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X, > BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X): New. > * builtins.def (CABS_TYPE, CACOSH_TYPE, CARG_TYPE, CASINH_TYPE, > CPOW_TYPE, CPROJ_TYPE): Define and undefine later. > (BUILT_IN_CABS, BUILT_IN_CACOSH, BUILT_IN_CACOS, BUILT_IN_CARG, > BUILT_IN_CASINH, BUILT_IN_CASIN, BUILT_IN_CATANH, BUILT_IN_CATAN, > BUILT_IN_CCOSH, BUILT_IN_CCOS, BUILT_IN_CEXP, BUILT_IN_CLOG, > BUILT_IN_CPOW, BUILT_IN_CPROJ, BUILT_IN_CSINH, BUILT_IN_CSIN, > BUILT_IN_CSQRT, BUILT_IN_CTANH, BUILT_IN_CTAN): Add > DEF_EXT_LIB_FLOATN_NX_BUILTINS. > * fold-const-call.cc (fold_const_call_sc, fold_const_call_cc, > fold_const_call_ccc): Add various CASE_CFN_*_FN: cases when > CASE_CFN_* is present. > * gimple-ssa-backprop.cc (backprop::process_builtin_call_use): > Likewise. > * builtins.cc (expand_builtin, fold_builtin_1): Likewise. > * fold-const.cc (negate_mathfn_p, tree_expr_finite_p, > tree_expr_maybe_signaling_nan_p, tree_expr_maybe_nan_p, > tree_expr_maybe_real_minus_zero_p, tree_call_nonnegative_warnv_p): > Likewise. OK jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2022-10-24 16:28 ` Jeff Law @ 2022-10-25 9:03 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2022-10-25 9:03 UTC (permalink / raw) To: Jeff Law, Joseph S. Myers, Richard Biener; +Cc: gcc-patches, Jonathan Wakely Hi! On Mon, Oct 24, 2022 at 10:28:34AM -0600, Jeff Law wrote: > On 10/21/22 09:42, Jakub Jelinek wrote: > > On top of the pending > > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html > > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604080.html > > the following patch adds some complex builtins which have libm > > implementation in glibc 2.26 and later on various arches. > > It is needed for libstdc++ _Float128 support when long double is not > > IEEE quad. > > OK Thanks a lot. Can I ping the https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html patch these 2 approved patches (and the libstdc++ changes too) depend on? Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2022-03-02 9:47 Jakub Jelinek 2022-03-02 18:59 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2022-03-02 9:47 UTC (permalink / raw) To: Richard Biener, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping the https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590526.html PR104558 - when bypassing emit_push_insn for 0 sized arg, emit at least anti_adjust_stack for alignment pad if needed patch. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2022-03-02 9:47 Jakub Jelinek @ 2022-03-02 18:59 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2022-03-02 18:59 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener; +Cc: gcc-patches On 3/2/2022 2:47 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping the > > https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590526.html > PR104558 - when bypassing emit_push_insn for 0 sized arg, emit at least anti_adjust_stack for alignment pad if needed > > patch. So the issue is the stack isn't aligned to the pad, thus triggering the abort. Right? Assuming that's the case, the patch is OK with a suitable comment. Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2022-01-04 12:45 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2022-01-04 12:45 UTC (permalink / raw) To: Jonathan Wakely; +Cc: gcc-patches, libstdc++ Hi! I'd like to ping the https://gcc.gnu.org/pipermail/libstdc++/2021-December/053680.html time_get patch. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2022-01-03 10:40 Jakub Jelinek 2022-01-03 12:38 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2022-01-03 10:40 UTC (permalink / raw) To: Richard Biener; +Cc: gcc-patches Hi! I'd like to ping the middle-end part of the https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586879.html patch (which Uros approved the backend part for with a minor change I have in my tree). Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2022-01-03 10:40 Jakub Jelinek @ 2022-01-03 12:38 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2022-01-03 12:38 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Mon, 3 Jan 2022, Jakub Jelinek wrote: > Hi! > > I'd like to ping the middle-end part of the > https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586879.html > patch (which Uros approved the backend part for with a minor change > I have in my tree). OK for the middle-end parts if you properly amend md.texi Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2022-01-03 10:25 Jakub Jelinek 2022-01-03 12:39 ` Richard Biener 2022-01-03 13:15 ` Jan Hubicka 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2022-01-03 10:25 UTC (permalink / raw) To: Jan Hubicka, Richard Biener, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping the https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586553.html symtab: Fold &a == &b to 0 if folding_initializer [PR94716] patch. Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2022-01-03 10:25 Jakub Jelinek @ 2022-01-03 12:39 ` Richard Biener 2022-01-03 13:15 ` Jan Hubicka 1 sibling, 0 replies; 504+ messages in thread From: Richard Biener @ 2022-01-03 12:39 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jan Hubicka, Jason Merrill, gcc-patches On Mon, 3 Jan 2022, Jakub Jelinek wrote: > Hi! > > I'd like to ping the > https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586553.html > symtab: Fold &a == &b to 0 if folding_initializer [PR94716] OK. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2022-01-03 10:25 Jakub Jelinek 2022-01-03 12:39 ` Richard Biener @ 2022-01-03 13:15 ` Jan Hubicka 1 sibling, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2022-01-03 13:15 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Biener, Jason Merrill, gcc-patches > Hi! > > I'd like to ping the > https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586553.html > symtab: Fold &a == &b to 0 if folding_initializer [PR94716] > > patch. Thanks. OK. Note that with LTO partitioning it may happen that alias is defined in one partition but used in another. We do take care to bring the symtab info with it so it should be safe. Honza > > Jakub > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2021-12-01 15:15 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2021-12-01 15:15 UTC (permalink / raw) To: Jason Merrill, Richard Biener, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping following patches: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583289.html c++, dyninit: Optimize C++ dynamic initialization by constants into DECL_INITIAL adjustment [PR102876] While Jason has added -fimplicit-constexpr which can fix up some cases, it still doesn't handle non-inline functions, or functions defined after the dynamic initialization, or functions defined in other TUs, so I think trying to optimize those after IPA is useful and as has been said, other compilers do it late as well. https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584802.html pch, v2: Add support for PCH for relocatable executables I do support Iain's patches to make PCH configure time disableable, but if people do want it and can't use it because of PIEs, it seems a pitty not to support it when it is so easy. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2021-03-31 7:07 Jakub Jelinek 2021-03-31 7:10 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2021-03-31 7:07 UTC (permalink / raw) To: Jonathan Yong, Richard Biener, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping the PR98860 P1 fix - workaround for PECOFF linkers without DWARF5 support - to make -gdwarf-4 the default in such configurations. https://gcc.gnu.org/pipermail/gcc-patches/2021-March/567245.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-31 7:07 Jakub Jelinek @ 2021-03-31 7:10 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2021-03-31 7:10 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jonathan Yong, Jeff Law, gcc-patches On Wed, 31 Mar 2021, Jakub Jelinek wrote: > Hi! > > I'd like to ping the PR98860 P1 fix - workaround for PECOFF linkers without > DWARF5 support - to make -gdwarf-4 the default in such configurations. > > https://gcc.gnu.org/pipermail/gcc-patches/2021-March/567245.html OK. Richard. > Thanks > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2021-03-24 11:44 Jakub Jelinek 2021-03-24 15:45 ` Martin Sebor 2021-03-24 16:12 ` Jeff Law 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2021-03-24 11:44 UTC (permalink / raw) To: Jason Merrill, Richard Biener; +Cc: gcc-patches Hi! I'd like to ping the https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566821.html P1 PR99565 fix. Marek has acked the gcc/c/ and gcc/c-family/ part of that patch, but it still has gcc/cp/ and gcc/ parts that weren't acked. If you have suggestions for better OEP_* flag name, I can change it. Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-24 11:44 Jakub Jelinek @ 2021-03-24 15:45 ` Martin Sebor 2021-03-24 16:40 ` Jakub Jelinek 2021-03-24 16:12 ` Jeff Law 1 sibling, 1 reply; 504+ messages in thread From: Martin Sebor @ 2021-03-24 15:45 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, Richard Biener; +Cc: gcc-patches On 3/24/21 5:44 AM, Jakub Jelinek via Gcc-patches wrote: > Hi! > > I'd like to ping the > https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566821.html > P1 PR99565 fix. > > Marek has acked the gcc/c/ and gcc/c-family/ part of that patch, but it still > has gcc/cp/ and gcc/ parts that weren't acked. > If you have suggestions for better OEP_* flag name, I can change it. > Yes, as I said, I think changing it would be helpful. I already tried to make some these points in my comments on the patch but it might help to reiterate them. A good API name reflects the purpose of the API rather than one of its (conceivably many) use cases. By way of an example, when a new flag was needed to implement -Wduplicate-branches it wasn't called OEM_DUPLICATE_BRANCHES but OEM_LEXICOGRAPHIC. That was a good choice of a name because it's generic enough not to be surprising when used in other contexts. For the same reason, when an another flag is needed to refine the behavior of the function in a way that affects the same warning, it too should describe the effect of the flag on the function rather than just one possible use case. Since the new flag determines whether or not distinct members at the same offset are considered equal, a name that mentions MEMBER and OFFSET might be suitable. E.g., OEP_IGNORE_MEMBER_OFFSET or OEP_SAME_MEMBER_OFFSET (for the converse of the first) or something like that, but hopefully you get the idea. Martin ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-24 15:45 ` Martin Sebor @ 2021-03-24 16:40 ` Jakub Jelinek 2021-03-24 17:14 ` Martin Sebor 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2021-03-24 16:40 UTC (permalink / raw) To: Martin Sebor; +Cc: Jason Merrill, Richard Biener, gcc-patches On Wed, Mar 24, 2021 at 09:45:31AM -0600, Martin Sebor via Gcc-patches wrote: > E.g., OEP_IGNORE_MEMBER_OFFSET or OEP_SAME_MEMBER_OFFSET (for > the converse of the first) or something like that, but hopefully > you get the idea. Neither of these look like a good name to me, OEP_IGNORE_MEMBER_OFFSET seems like a request that member offset is not important to the equality, it is always important, but in the new mode we want not just the member offset to be equal, but also the fields to be the same, i.e. a stronger requirement. So, what about /* For OEP_ADDRESS_OF of COMPONENT_REFs, only consider same fields as equivalent rather than also different fields with the same offset. */ OEP_ADDRESS_OF_SAME_FIELD = 256 Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-24 16:40 ` Jakub Jelinek @ 2021-03-24 17:14 ` Martin Sebor 2021-03-25 8:45 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Martin Sebor @ 2021-03-24 17:14 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Richard Biener, gcc-patches On 3/24/21 10:40 AM, Jakub Jelinek wrote: > On Wed, Mar 24, 2021 at 09:45:31AM -0600, Martin Sebor via Gcc-patches wrote: >> E.g., OEP_IGNORE_MEMBER_OFFSET or OEP_SAME_MEMBER_OFFSET (for >> the converse of the first) or something like that, but hopefully >> you get the idea. > > Neither of these look like a good name to me, OEP_IGNORE_MEMBER_OFFSET > seems like a request that member offset is not important to the equality, > it is always important, but in the new mode we want not just the member > offset to be equal, but also the fields to be the same, i.e. a stronger > requirement. > > So, what about > /* For OEP_ADDRESS_OF of COMPONENT_REFs, only consider same fields as > equivalent rather than also different fields with the same offset. */ > OEP_ADDRESS_OF_SAME_FIELD = 256 This name works for me. Thanks Martin > > Jakub > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-24 17:14 ` Martin Sebor @ 2021-03-25 8:45 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2021-03-25 8:45 UTC (permalink / raw) To: Martin Sebor; +Cc: Jakub Jelinek, Jason Merrill, gcc-patches On Wed, 24 Mar 2021, Martin Sebor wrote: > On 3/24/21 10:40 AM, Jakub Jelinek wrote: > > On Wed, Mar 24, 2021 at 09:45:31AM -0600, Martin Sebor via Gcc-patches > > wrote: > >> E.g., OEP_IGNORE_MEMBER_OFFSET or OEP_SAME_MEMBER_OFFSET (for > >> the converse of the first) or something like that, but hopefully > >> you get the idea. > > > > Neither of these look like a good name to me, OEP_IGNORE_MEMBER_OFFSET > > seems like a request that member offset is not important to the equality, > > it is always important, but in the new mode we want not just the member > > offset to be equal, but also the fields to be the same, i.e. a stronger > > requirement. > > > > So, what about > > /* For OEP_ADDRESS_OF of COMPONENT_REFs, only consider same fields as > > equivalent rather than also different fields with the same offset. */ > > OEP_ADDRESS_OF_SAME_FIELD = 256 > > This name works for me. Works for me as well, aka OK. Richard. > Thanks > Martin > > > > > Jakub > > > > > -- Richard Biener <rguenther@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-03-24 11:44 Jakub Jelinek 2021-03-24 15:45 ` Martin Sebor @ 2021-03-24 16:12 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2021-03-24 16:12 UTC (permalink / raw) To: gcc-patches On 3/24/2021 5:44 AM, Jakub Jelinek via Gcc-patches wrote: > Hi! > > I'd like to ping the > https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566821.html > P1 PR99565 fix. > > Marek has acked the gcc/c/ and gcc/c-family/ part of that patch, but it still > has gcc/cp/ and gcc/ parts that weren't acked. > If you have suggestions for better OEP_* flag name, I can change it. Once Martin and you agree on a name, this is fine with the name update [if any]. Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2021-03-19 9:57 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2021-03-19 9:57 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping two patches: https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566324.html PR99388 dwarf2out half float fix https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566669.html PR99490 dwarf2out -gsplit-dwarf ranges fixes Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* [PATCH] cfgrtl: Fix up fixup_partitions caused ICE [PR99085] @ 2021-02-16 8:13 Jakub Jelinek 2021-02-23 8:49 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2021-02-16 8:13 UTC (permalink / raw) To: Richard Biener, Jan Hubicka; +Cc: gcc-patches Hi! fixup_partitions sometimes changes some basic blocks from hot partition to cold partition, in particular if after unreachable block removal or other optimizations a hot partition block is dominated by cold partition block(s). It fixes up the edges and jumps on those edges, but when after reorder blocks and in rtl (non-cfglayout) mode that is clearly not enough, because it keeps the block order the same and so we can end up with more than 1 hot/cold section transition in the same function. So, this patch fixes that up too. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2021-02-15 Jakub Jelinek <jakub@redhat.com> PR target/99085 * cfgrtl.c (fixup_partitions): When changing some bbs from hot to cold partitions, if in non-layout mode after reorder_blocks also move affected blocks to ensure a single partition transition. * gcc.dg/graphite/pr99085.c: New test. --- gcc/cfgrtl.c.jj 2021-02-10 19:27:33.000000000 +0100 +++ gcc/cfgrtl.c 2021-02-15 16:47:41.625798717 +0100 @@ -2414,8 +2414,6 @@ find_partition_fixes (bool flag_only) void fixup_partitions (void) { - basic_block bb; - if (!crtl->has_bb_partition) return; @@ -2436,10 +2434,61 @@ fixup_partitions (void) /* Do the partition fixup after all necessary blocks have been converted to cold, so that we only update the region crossings the minimum number of places, which can require forcing edges to be non fallthru. */ - while (! bbs_to_fix.is_empty ()) + if (! bbs_to_fix.is_empty ()) { - bb = bbs_to_fix.pop (); - fixup_new_cold_bb (bb); + do + { + basic_block bb = bbs_to_fix.pop (); + fixup_new_cold_bb (bb); + } + while (! bbs_to_fix.is_empty ()); + + /* Fix up hot cold block grouping if needed. */ + if (crtl->bb_reorder_complete && current_ir_type () == IR_RTL_CFGRTL) + { + basic_block bb, first = NULL, second = NULL; + int current_partition = BB_UNPARTITIONED; + + FOR_EACH_BB_FN (bb, cfun) + { + if (current_partition != BB_UNPARTITIONED + && BB_PARTITION (bb) != current_partition) + { + if (first == NULL) + first = bb; + else if (second == NULL) + second = bb; + else + { + /* If we switch partitions for the 3rd, 5th etc. time, + move bbs first (inclusive) .. second (exclusive) right + before bb. */ + basic_block prev_first = first->prev_bb; + basic_block prev_second = second->prev_bb; + basic_block prev_bb = bb->prev_bb; + prev_first->next_bb = second; + second->prev_bb = prev_first; + prev_second->next_bb = bb; + bb->prev_bb = prev_second; + prev_bb->next_bb = first; + first->prev_bb = prev_bb; + rtx_insn *prev_first_insn = PREV_INSN (BB_HEAD (first)); + rtx_insn *prev_second_insn + = PREV_INSN (BB_HEAD (second)); + rtx_insn *prev_bb_insn = PREV_INSN (BB_HEAD (bb)); + SET_NEXT_INSN (prev_first_insn) = BB_HEAD (second); + SET_PREV_INSN (BB_HEAD (second)) = prev_first_insn; + SET_NEXT_INSN (prev_second_insn) = BB_HEAD (bb); + SET_PREV_INSN (BB_HEAD (bb)) = prev_second_insn; + SET_NEXT_INSN (prev_bb_insn) = BB_HEAD (first); + SET_PREV_INSN (BB_HEAD (first)) = prev_bb_insn; + second = NULL; + } + } + current_partition = BB_PARTITION (bb); + } + gcc_assert (!second); + } } } --- gcc/testsuite/gcc.dg/graphite/pr99085.c.jj 2021-02-15 16:52:59.313169888 +0100 +++ gcc/testsuite/gcc.dg/graphite/pr99085.c 2021-02-15 16:51:54.589910609 +0100 @@ -0,0 +1,20 @@ +/* PR target/99085 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fgraphite-identity -fsel-sched-pipelining -fselective-scheduling2" } */ + +void +foo (int m, int n, int o, int i) +{ + long double a2[m]; + int c2[n][o]; + int j, k; + + while (i < m) + a2[i++] = 13.132L; + + for (j = 0; j < n; j++) + for (k = 0; k < o; k++) + c2[j][k] = 1; + + __builtin_abort (); +} Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2021-02-16 8:13 [PATCH] cfgrtl: Fix up fixup_partitions caused ICE [PR99085] Jakub Jelinek @ 2021-02-23 8:49 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2021-02-23 8:49 UTC (permalink / raw) To: Richard Biener, Jan Hubicka, Jeff Law, Eric Botcazou; +Cc: gcc-patches Hi! I'd like to ping the https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565350.html patch, P2 PR99085 ice-on-valid-code fix in fixup_partitions. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2021-01-25 9:43 Jakub Jelinek 2021-01-25 22:34 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2021-01-25 9:43 UTC (permalink / raw) To: Richard Biener, Jeff Law, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping 3 patches: https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563710.html expand: Expand x / y * y as x - x % y if the latter is cheaper [PR96696] https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563711.html match.pd: Add some __builtin_ctz (x) cmp cst simplifications [PR95527] https://gcc.gnu.org/pipermail/gcc-patches/2020-December/560741.html dwarf: -gdwarf64 fix for 32-bit targets Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2021-01-25 9:43 Jakub Jelinek @ 2021-01-25 22:34 ` Jason Merrill 0 siblings, 0 replies; 504+ messages in thread From: Jason Merrill @ 2021-01-25 22:34 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Jeff Law; +Cc: gcc-patches On 1/25/21 4:43 AM, Jakub Jelinek wrote: > > https://gcc.gnu.org/pipermail/gcc-patches/2020-December/560741.html > dwarf: -gdwarf64 fix for 32-bit targets OK. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-10-22 9:05 Jakub Jelinek 2020-10-22 20:42 ` Joseph Myers 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2020-10-22 9:05 UTC (permalink / raw) To: gcc-patches; +Cc: Jeff Law, Joseph S. Myers, Jan Hubicka Hi! I'd like to ping a few patches: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552451.html - allow plugins to deal with global_options layout changes https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553420.html - --enable-link-serialization{,=N} support https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554804.html - PR97164 - reject forming arrays with elt sizes not divisible by elt alignment https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555477.html - optimize LTO streaming of optimization nodes https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556153.html - fix up plugin header install Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-10-22 9:05 Jakub Jelinek @ 2020-10-22 20:42 ` Joseph Myers 0 siblings, 0 replies; 504+ messages in thread From: Joseph Myers @ 2020-10-22 20:42 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jan Hubicka On Thu, 22 Oct 2020, Jakub Jelinek via Gcc-patches wrote: > https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554804.html > - PR97164 - reject forming arrays with elt sizes not divisible by elt alignment OK. > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556153.html > - fix up plugin header install OK. The other patches need a self-contained submission showing the proposed commit message for that version of the patch, not just a discussion from the middle of a thread that can't be understood on its own without going through the rest of the discussion (and possibly previous patch versions) and doesn't say what form of explanation is proposed as a commit message. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-10-05 9:09 Jakub Jelinek 2020-10-05 12:02 ` Nathan Sidwell 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2020-10-05 9:09 UTC (permalink / raw) To: gcc-patches; +Cc: Jeff Law, Jason Merrill, Joseph S. Myers Hi! I'd like to ping a few patches: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552451.html - allow plugins to deal with global_options layout changes https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553420.html - --enable-link-serialization{,=N} support https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553992.html - pass -gdwarf-5 to assembler for -gdwarf-5 if possible https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554845.html - PR97197 - support TARGET_MEM_REF in C/C++ error pretty-printing https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554804.html - PR97164 - reject forming arrays with elt sizes not divisible by elt alignment Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-10-05 9:09 Jakub Jelinek @ 2020-10-05 12:02 ` Nathan Sidwell 0 siblings, 0 replies; 504+ messages in thread From: Nathan Sidwell @ 2020-10-05 12:02 UTC (permalink / raw) To: Jakub Jelinek, gcc-patches; +Cc: Joseph S. Myers On 10/5/20 5:09 AM, Jakub Jelinek via Gcc-patches wrote: > Hi! > > I'd like to ping a few patches: > > https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554845.html > - PR97197 - support TARGET_MEM_REF in C/C++ error pretty-printing ok, but could you add a comment on what it's printing out. As you say, it's not the original source :) nathan -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-09-25 11:42 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2020-09-25 11:42 UTC (permalink / raw) To: Jeff Law, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping a few patches: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552451.html - allow plugins to deal with global_options layout changes https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553420.html - --enable-link-serialization{,=N} support https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553948.html - PR96994 - fix up C++ handling of default initialization with consteval default ctor https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553992.html - pass -gdwarf-5 to assembler for -gdwarf-5 if possible https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554246.html - PR97073 - fix wrong-code on double-word op expansion Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-03-10 12:28 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2020-03-10 12:28 UTC (permalink / raw) To: Jeff Law; +Cc: gcc-patches Hi! I'd like to ping the https://gcc.gnu.org/legacy-ml/gcc-patches/2020-03/msg00154.html P1 PR94015 patch, with the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94015#c5 testcase instead of the one sent in the patch, so that it FAILs without the fix on more targets and more reliably. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-02-10 9:24 Jakub Jelinek 2020-02-12 21:39 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2020-02-10 9:24 UTC (permalink / raw) To: Jeff Law, Jason Merrill, Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov Cc: gcc-patches Hi! I'd like to ping a couple of patches: PR target/91913 - arm movsi + cmpsi -> movsi_compare0 peephole2 ICE fix https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00010.html PR preprocessor/92319 - partially implement P1042R1: __VA_OPT__ wording clarifications https://gcc.gnu.org/ml/gcc-patches/2020-01/msg02104.html PR target/93069 - avx512* rejects-valid fix (rejected by assembler) http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size /maybe_warn_overflow fixes http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-02-10 9:24 Jakub Jelinek @ 2020-02-12 21:39 ` Jeff Law 2020-02-13 9:54 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2020-02-12 21:39 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov Cc: gcc-patches On Mon, 2020-02-10 at 10:24 +0100, Jakub Jelinek wrote: > Hi! > > I'd like to ping a couple of patches: > > PR target/91913 - arm movsi + cmpsi -> movsi_compare0 peephole2 ICE fix > https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00010.html Letting the ARM guys deal with this. > > PR preprocessor/92319 - partially implement P1042R1: __VA_OPT__ wording clarifications > https://gcc.gnu.org/ml/gcc-patches/2020-01/msg02104.html Jason for this one. > > PR target/93069 - avx512* rejects-valid fix (rejected by assembler) > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html This is in my queue :-) > > PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size > /maybe_warn_overflow fixes > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html Martin's patch should have addressed all the issues and should include your tests (tweaked, but supposed to be equivalent). jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-02-12 21:39 ` Jeff Law @ 2020-02-13 9:54 ` Jakub Jelinek 2020-02-13 17:42 ` Martin Sebor 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2020-02-13 9:54 UTC (permalink / raw) To: Jeff Law Cc: Jason Merrill, Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov, gcc-patches On Wed, Feb 12, 2020 at 02:39:05PM -0700, Jeff Law wrote: > On Mon, 2020-02-10 at 10:24 +0100, Jakub Jelinek wrote: > > Hi! > > > > I'd like to ping a couple of patches: > > > > PR target/91913 - arm movsi + cmpsi -> movsi_compare0 peephole2 ICE fix > > https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00010.html > Letting the ARM guys deal with this. Yes, that is resolved now (Richard E. committed his patch and I've committed the testcase). > > PR preprocessor/92319 - partially implement P1042R1: __VA_OPT__ wording clarifications > > https://gcc.gnu.org/ml/gcc-patches/2020-01/msg02104.html > Jason for this one. Of course; I just chose to send a ping for all my pending patches and add to To: all relevant maintainers. > > PR target/93069 - avx512* rejects-valid fix (rejected by assembler) > > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html > This is in my queue :-) Ok. > > PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size > > /maybe_warn_overflow fixes > > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html > Martin's patch should have addressed all the issues and should include > your tests (tweaked, but supposed to be equivalent). No, this is something different, this isn't what has been covered by the testcases, but something found by code inspection, mainly inconsistencies in the APIs, e.g. the ranges represented as sizetype most of the time, but with one exception where it could be some other type (wider or narrower), or sometimes the range being incorrect (if there is possible overflow and we punt, we didn't change the ranges effectively to VARYING, but just capped the maximum), or INTEGER_CSTs compared by pointer equality rather than operand_equal_p. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-02-13 9:54 ` Jakub Jelinek @ 2020-02-13 17:42 ` Martin Sebor 2020-02-13 19:36 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Martin Sebor @ 2020-02-13 17:42 UTC (permalink / raw) To: Jakub Jelinek, Jeff Law Cc: Jason Merrill, Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov, gcc-patches On 2/13/20 2:54 AM, Jakub Jelinek wrote: > On Wed, Feb 12, 2020 at 02:39:05PM -0700, Jeff Law wrote: >> On Mon, 2020-02-10 at 10:24 +0100, Jakub Jelinek wrote: >>> Hi! >>> >>> I'd like to ping a couple of patches: >>> >>> PR target/91913 - arm movsi + cmpsi -> movsi_compare0 peephole2 ICE fix >>> https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00010.html >> Letting the ARM guys deal with this. > > Yes, that is resolved now (Richard E. committed his patch and I've > committed the testcase). > >>> PR preprocessor/92319 - partially implement P1042R1: __VA_OPT__ wording clarifications >>> https://gcc.gnu.org/ml/gcc-patches/2020-01/msg02104.html >> Jason for this one. > > Of course; I just chose to send a ping for all my pending patches and > add to To: all relevant maintainers. > >>> PR target/93069 - avx512* rejects-valid fix (rejected by assembler) >>> http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html >> This is in my queue :-) > > Ok. > >>> PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size >>> /maybe_warn_overflow fixes >>> http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html >> Martin's patch should have addressed all the issues and should include >> your tests (tweaked, but supposed to be equivalent). > > No, this is something different, this isn't what has been covered by the > testcases, but something found by code inspection, mainly inconsistencies > in the APIs, e.g. the ranges represented as sizetype most of the time, > but with one exception where it could be some other type (wider or > narrower), or sometimes the range being incorrect (if there is possible > overflow and we punt, we didn't change the ranges effectively to VARYING, > but just capped the maximum), or INTEGER_CSTs compared by pointer equality > rather than operand_equal_p. As I said repeatedly in my comments on the patch, I'm not in favor of these changes. I don't think they hurt anything but they also don't fix anything that I can see. There's is no bug the change fixes (PR 92868 is closed as resolved) or a test case included in the patch that verifies the improvement. The changes are also not in the direction I'd like to see this code evolve. Martin ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2020-02-13 17:42 ` Martin Sebor @ 2020-02-13 19:36 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2020-02-13 19:36 UTC (permalink / raw) To: Martin Sebor, Jakub Jelinek Cc: Jason Merrill, Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov, gcc-patches On Thu, 2020-02-13 at 10:42 -0700, Martin Sebor wrote: > On 2/13/20 2:54 AM, Jakub Jelinek wrote: > > On Wed, Feb 12, 2020 at 02:39:05PM -0700, Jeff Law wrote: > > > On Mon, 2020-02-10 at 10:24 +0100, Jakub Jelinek wrote: > > > > Hi! > > > > > > > > I'd like to ping a couple of patches: > > > > > > > > PR target/91913 - arm movsi + cmpsi -> movsi_compare0 peephole2 ICE fix > > > > https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00010.html > > > Letting the ARM guys deal with this. > > > > Yes, that is resolved now (Richard E. committed his patch and I've > > committed the testcase). > > > > > > PR preprocessor/92319 - partially implement P1042R1: __VA_OPT__ wording clarifications > > > > https://gcc.gnu.org/ml/gcc-patches/2020-01/msg02104.html > > > Jason for this one. > > > > Of course; I just chose to send a ping for all my pending patches and > > add to To: all relevant maintainers. > > > > > > PR target/93069 - avx512* rejects-valid fix (rejected by assembler) > > > > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html > > > This is in my queue :-) > > > > Ok. > > > > > > PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size > > > > /maybe_warn_overflow fixes > > > > http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html > > > Martin's patch should have addressed all the issues and should include > > > your tests (tweaked, but supposed to be equivalent). > > > > No, this is something different, this isn't what has been covered by the > > testcases, but something found by code inspection, mainly inconsistencies > > in the APIs, e.g. the ranges represented as sizetype most of the time, > > but with one exception where it could be some other type (wider or > > narrower), or sometimes the range being incorrect (if there is possible > > overflow and we punt, we didn't change the ranges effectively to VARYING, > > but just capped the maximum), or INTEGER_CSTs compared by pointer equality > > rather than operand_equal_p. > > As I said repeatedly in my comments on the patch, I'm not in favor > of these changes. I don't think they hurt anything but they also > don't fix anything that I can see. There's is no bug the change > fixes (PR 92868 is closed as resolved) or a test case included in > the patch that verifies the improvement. The changes are also not > in the direction I'd like to see this code evolve. Jakub, let's defer any cleanups unless there's a reported bug. We can come back to this stuff for gcc-11. jeff > > Martin > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2020-01-07 10:20 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2020-01-07 10:20 UTC (permalink / raw) To: Jeff Law; +Cc: gcc-patches Hi! I'd like to ping a few patches: PR target/93009 - avx512* wrong-code fix http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01488.html PR target/93069 - avx512* rejects-valid fix (rejected by assembler) http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01606.html PR tree-optimization/92868 - compute_objsize/gimple_call_alloc_size /maybe_warn_overflow fixes http://gcc.gnu.org/ml/gcc-patches/2019-12/msg01164.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734) @ 2019-09-14 0:40 Jakub Jelinek 2019-09-16 6:57 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2019-09-14 0:40 UTC (permalink / raw) To: Richard Biener; +Cc: gcc-patches Hi! As mentioned in the PR, the sqrt (x) < c optimization into x < c*c sometimes breaks the boundary case, if c2=c*c is inexact then in some cases we need to optimize it into x <= c*c rather than x < c*c. The original bugreport is when c is small and c2 is 0.0, then obviously we need <= 0.0 rather than < 0.0, but the testcase includes another example where it makes a difference, plus has a >= testcase too. Bootstrapped/regtested on powerpc64le-linux, ok for trunk? 2019-09-13 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/91734 * generic-match-head.c: Include fold-const-call.h. * match.pd (sqrt(x) < c, sqrt(x) >= c): Check the boundary value and in case inexact computation of c*c affects comparison of the boundary, turn LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR. * gcc.dg/pr91734.c: New test. --- gcc/generic-match-head.c.jj 2019-07-20 21:02:09.296821929 +0200 +++ gcc/generic-match-head.c 2019-09-12 10:52:33.091366624 +0200 @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "vec-perm-indices.h" #include "fold-const.h" +#include "fold-const-call.h" #include "stor-layout.h" #include "tree-dfa.h" #include "builtins.h" --- gcc/match.pd.jj 2019-09-11 21:50:54.933504293 +0200 +++ gcc/match.pd 2019-09-12 11:12:11.150987786 +0200 @@ -3541,56 +3541,71 @@ (define_operator_list COND_TERNARY if x is negative or NaN. Due to -funsafe-math-optimizations, the results for other x follow from natural arithmetic. */ (cmp @0 @1))) - (if (cmp == GT_EXPR || cmp == GE_EXPR) + (if (cmp == LT_EXPR || cmp == LE_EXPR || cmp == GT_EXPR || cmp == GE_EXPR) (with { - REAL_VALUE_TYPE c2; + REAL_VALUE_TYPE c2; + enum tree_code ncmp = cmp; real_arithmetic (&c2, MULT_EXPR, &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); + /* See PR91734: if c2 is inexact and sqrt(c2) < c (or sqrt(c2) >= c), + then change LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR. */ + if ((cmp == LT_EXPR || cmp == GE_EXPR) && !REAL_VALUE_ISINF (c2)) + { + tree c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0), + build_real (TREE_TYPE (@0), c2)); + if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST) + ncmp = ERROR_MARK; + else if (real_less (&TREE_REAL_CST (c3), &TREE_REAL_CST (@1))) + ncmp = cmp == LT_EXPR ? LE_EXPR : GT_EXPR; + } } - (if (REAL_VALUE_ISINF (c2)) - /* sqrt(x) > y is x == +Inf, when y is very large. */ - (if (HONOR_INFINITIES (@0)) - (eq @0 { build_real (TREE_TYPE (@0), c2); }) - { constant_boolean_node (false, type); }) - /* sqrt(x) > c is the same as x > c*c. */ - (cmp @0 { build_real (TREE_TYPE (@0), c2); })))) - (if (cmp == LT_EXPR || cmp == LE_EXPR) - (with - { - REAL_VALUE_TYPE c2; - real_arithmetic (&c2, MULT_EXPR, - &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); - real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); - } - (if (REAL_VALUE_ISINF (c2)) - (switch - /* sqrt(x) < y is always true, when y is a very large - value and we don't care about NaNs or Infinities. */ - (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) - { constant_boolean_node (true, type); }) - /* sqrt(x) < y is x != +Inf when y is very large and we - don't care about NaNs. */ - (if (! HONOR_NANS (@0)) - (ne @0 { build_real (TREE_TYPE (@0), c2); })) - /* sqrt(x) < y is x >= 0 when y is very large and we - don't care about Infinities. */ - (if (! HONOR_INFINITIES (@0)) - (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) - /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ - (if (GENERIC) - (truth_andif - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) - (ne @0 { build_real (TREE_TYPE (@0), c2); })))) - /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ - (if (! HONOR_NANS (@0)) - (cmp @0 { build_real (TREE_TYPE (@0), c2); }) - /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ - (if (GENERIC) - (truth_andif - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) - (cmp @0 { build_real (TREE_TYPE (@0), c2); }))))))))) + (if (cmp == GT_EXPR || cmp == GE_EXPR) + (if (REAL_VALUE_ISINF (c2)) + /* sqrt(x) > y is x == +Inf, when y is very large. */ + (if (HONOR_INFINITIES (@0)) + (eq @0 { build_real (TREE_TYPE (@0), c2); }) + { constant_boolean_node (false, type); }) + /* sqrt(x) > c is the same as x > c*c. */ + (if (ncmp != ERROR_MARK) + (if (ncmp == GE_EXPR) + (ge @0 { build_real (TREE_TYPE (@0), c2); }) + (gt @0 { build_real (TREE_TYPE (@0), c2); })))) + /* else if (cmp == LT_EXPR || cmp == LE_EXPR) */ + (if (REAL_VALUE_ISINF (c2)) + (switch + /* sqrt(x) < y is always true, when y is a very large + value and we don't care about NaNs or Infinities. */ + (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) + { constant_boolean_node (true, type); }) + /* sqrt(x) < y is x != +Inf when y is very large and we + don't care about NaNs. */ + (if (! HONOR_NANS (@0)) + (ne @0 { build_real (TREE_TYPE (@0), c2); })) + /* sqrt(x) < y is x >= 0 when y is very large and we + don't care about Infinities. */ + (if (! HONOR_INFINITIES (@0)) + (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) + /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ + (if (GENERIC) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (ne @0 { build_real (TREE_TYPE (@0), c2); })))) + /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ + (if (ncmp != ERROR_MARK && ! HONOR_NANS (@0)) + (if (ncmp == LT_EXPR) + (lt @0 { build_real (TREE_TYPE (@0), c2); }) + (le @0 { build_real (TREE_TYPE (@0), c2); })) + /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ + (if (ncmp != ERROR_MARK && GENERIC) + (if (ncmp == LT_EXPR) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (lt @0 { build_real (TREE_TYPE (@0), c2); })) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (le @0 { build_real (TREE_TYPE (@0), c2); }))))))))))) /* Transform sqrt(x) cmp sqrt(y) -> x cmp y. */ (simplify (cmp (sq @0) (sq @1)) --- gcc/testsuite/gcc.dg/pr91734.c.jj 2019-09-12 10:52:33.094366596 +0200 +++ gcc/testsuite/gcc.dg/pr91734.c 2019-09-12 10:49:10.000000000 +0200 @@ -0,0 +1,34 @@ +/* PR tree-optimization/91734 */ +/* { dg-do run } */ +/* { dg-add-options ieee } */ +/* { dg-additional-options "-ffast-math -O2 -std=gnu99" } */ + +__attribute__((noipa)) int +foo (float x) +{ + return __builtin_sqrtf (x) < __FLT_MIN__; +} + +__attribute__((noipa)) int +bar (float x) +{ + return __builtin_sqrtf (x) < 0x1.2dd3d0p-65f; +} + +__attribute__((noipa)) int +baz (float x) +{ + return __builtin_sqrtf (x) >= 0x1.2dd3d0p-65f; +} + +int +main () +{ + if (!foo (0.0f)) + __builtin_abort (); + if (!bar (0x1.63dbc0p-130f)) + __builtin_abort (); + if (baz (0x1.63dbc0p-130f)) + __builtin_abort (); + return 0; +} Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734) 2019-09-14 0:40 [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734) Jakub Jelinek @ 2019-09-16 6:57 ` Richard Biener 2019-09-21 6:14 ` [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2019-09-16 6:57 UTC (permalink / raw) To: Jakub Jelinek, Joseph S. Myers; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 8232 bytes --] On Sat, 14 Sep 2019, Jakub Jelinek wrote: > Hi! > > As mentioned in the PR, the sqrt (x) < c optimization into x < c*c > sometimes breaks the boundary case, if c2=c*c is inexact then in some cases > we need to optimize it into x <= c*c rather than x < c*c. The original > bugreport is when c is small and c2 is 0.0, then obviously we need <= 0.0 > rather than < 0.0, but the testcase includes another example where it makes > a difference, plus has a >= testcase too. > > Bootstrapped/regtested on powerpc64le-linux, ok for trunk? I was hoping Joseph might chime in here... anyway, does this assume round-to-nearest or does it work with round to +-Inf as well? I realize this all is under flag_unsafe_math_optimizations, but this flag is notoriously underspecified... So the question is whether we should disable the transform if c*c isn't exact and flag_rounding_math? The transform also doesn't seem to guard against isnan (c) (-funsafe-math-optimizations sets -fno-trapping-math and -fno-signed-zeros but not -ffinite-math-only or disables itself on -frounding-math) Otherwise the patch looks OK to me. Thanks, Richard. > 2019-09-13 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/91734 > * generic-match-head.c: Include fold-const-call.h. > * match.pd (sqrt(x) < c, sqrt(x) >= c): Check the boundary value and > in case inexact computation of c*c affects comparison of the boundary, > turn LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR. > > * gcc.dg/pr91734.c: New test. > > --- gcc/generic-match-head.c.jj 2019-07-20 21:02:09.296821929 +0200 > +++ gcc/generic-match-head.c 2019-09-12 10:52:33.091366624 +0200 > @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. > #include "cgraph.h" > #include "vec-perm-indices.h" > #include "fold-const.h" > +#include "fold-const-call.h" > #include "stor-layout.h" > #include "tree-dfa.h" > #include "builtins.h" > --- gcc/match.pd.jj 2019-09-11 21:50:54.933504293 +0200 > +++ gcc/match.pd 2019-09-12 11:12:11.150987786 +0200 > @@ -3541,56 +3541,71 @@ (define_operator_list COND_TERNARY > if x is negative or NaN. Due to -funsafe-math-optimizations, > the results for other x follow from natural arithmetic. */ > (cmp @0 @1))) > - (if (cmp == GT_EXPR || cmp == GE_EXPR) > + (if (cmp == LT_EXPR || cmp == LE_EXPR || cmp == GT_EXPR || cmp == GE_EXPR) > (with > { > - REAL_VALUE_TYPE c2; > + REAL_VALUE_TYPE c2; > + enum tree_code ncmp = cmp; > real_arithmetic (&c2, MULT_EXPR, > &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); > real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); > + /* See PR91734: if c2 is inexact and sqrt(c2) < c (or sqrt(c2) >= c), > + then change LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR. */ > + if ((cmp == LT_EXPR || cmp == GE_EXPR) && !REAL_VALUE_ISINF (c2)) > + { > + tree c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0), > + build_real (TREE_TYPE (@0), c2)); > + if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST) > + ncmp = ERROR_MARK; > + else if (real_less (&TREE_REAL_CST (c3), &TREE_REAL_CST (@1))) > + ncmp = cmp == LT_EXPR ? LE_EXPR : GT_EXPR; > + } > } > - (if (REAL_VALUE_ISINF (c2)) > - /* sqrt(x) > y is x == +Inf, when y is very large. */ > - (if (HONOR_INFINITIES (@0)) > - (eq @0 { build_real (TREE_TYPE (@0), c2); }) > - { constant_boolean_node (false, type); }) > - /* sqrt(x) > c is the same as x > c*c. */ > - (cmp @0 { build_real (TREE_TYPE (@0), c2); })))) > - (if (cmp == LT_EXPR || cmp == LE_EXPR) > - (with > - { > - REAL_VALUE_TYPE c2; > - real_arithmetic (&c2, MULT_EXPR, > - &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); > - real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); > - } > - (if (REAL_VALUE_ISINF (c2)) > - (switch > - /* sqrt(x) < y is always true, when y is a very large > - value and we don't care about NaNs or Infinities. */ > - (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) > - { constant_boolean_node (true, type); }) > - /* sqrt(x) < y is x != +Inf when y is very large and we > - don't care about NaNs. */ > - (if (! HONOR_NANS (@0)) > - (ne @0 { build_real (TREE_TYPE (@0), c2); })) > - /* sqrt(x) < y is x >= 0 when y is very large and we > - don't care about Infinities. */ > - (if (! HONOR_INFINITIES (@0)) > - (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) > - /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ > - (if (GENERIC) > - (truth_andif > - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) > - (ne @0 { build_real (TREE_TYPE (@0), c2); })))) > - /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ > - (if (! HONOR_NANS (@0)) > - (cmp @0 { build_real (TREE_TYPE (@0), c2); }) > - /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ > - (if (GENERIC) > - (truth_andif > - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) > - (cmp @0 { build_real (TREE_TYPE (@0), c2); }))))))))) > + (if (cmp == GT_EXPR || cmp == GE_EXPR) > + (if (REAL_VALUE_ISINF (c2)) > + /* sqrt(x) > y is x == +Inf, when y is very large. */ > + (if (HONOR_INFINITIES (@0)) > + (eq @0 { build_real (TREE_TYPE (@0), c2); }) > + { constant_boolean_node (false, type); }) > + /* sqrt(x) > c is the same as x > c*c. */ > + (if (ncmp != ERROR_MARK) > + (if (ncmp == GE_EXPR) > + (ge @0 { build_real (TREE_TYPE (@0), c2); }) > + (gt @0 { build_real (TREE_TYPE (@0), c2); })))) > + /* else if (cmp == LT_EXPR || cmp == LE_EXPR) */ > + (if (REAL_VALUE_ISINF (c2)) > + (switch > + /* sqrt(x) < y is always true, when y is a very large > + value and we don't care about NaNs or Infinities. */ > + (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) > + { constant_boolean_node (true, type); }) > + /* sqrt(x) < y is x != +Inf when y is very large and we > + don't care about NaNs. */ > + (if (! HONOR_NANS (@0)) > + (ne @0 { build_real (TREE_TYPE (@0), c2); })) > + /* sqrt(x) < y is x >= 0 when y is very large and we > + don't care about Infinities. */ > + (if (! HONOR_INFINITIES (@0)) > + (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) > + /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ > + (if (GENERIC) > + (truth_andif > + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) > + (ne @0 { build_real (TREE_TYPE (@0), c2); })))) > + /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ > + (if (ncmp != ERROR_MARK && ! HONOR_NANS (@0)) > + (if (ncmp == LT_EXPR) > + (lt @0 { build_real (TREE_TYPE (@0), c2); }) > + (le @0 { build_real (TREE_TYPE (@0), c2); })) > + /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ > + (if (ncmp != ERROR_MARK && GENERIC) > + (if (ncmp == LT_EXPR) > + (truth_andif > + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) > + (lt @0 { build_real (TREE_TYPE (@0), c2); })) > + (truth_andif > + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) > + (le @0 { build_real (TREE_TYPE (@0), c2); }))))))))))) > /* Transform sqrt(x) cmp sqrt(y) -> x cmp y. */ > (simplify > (cmp (sq @0) (sq @1)) > --- gcc/testsuite/gcc.dg/pr91734.c.jj 2019-09-12 10:52:33.094366596 +0200 > +++ gcc/testsuite/gcc.dg/pr91734.c 2019-09-12 10:49:10.000000000 +0200 > @@ -0,0 +1,34 @@ > +/* PR tree-optimization/91734 */ > +/* { dg-do run } */ > +/* { dg-add-options ieee } */ > +/* { dg-additional-options "-ffast-math -O2 -std=gnu99" } */ > + > +__attribute__((noipa)) int > +foo (float x) > +{ > + return __builtin_sqrtf (x) < __FLT_MIN__; > +} > + > +__attribute__((noipa)) int > +bar (float x) > +{ > + return __builtin_sqrtf (x) < 0x1.2dd3d0p-65f; > +} > + > +__attribute__((noipa)) int > +baz (float x) > +{ > + return __builtin_sqrtf (x) >= 0x1.2dd3d0p-65f; > +} > + > +int > +main () > +{ > + if (!foo (0.0f)) > + __builtin_abort (); > + if (!bar (0x1.63dbc0p-130f)) > + __builtin_abort (); > + if (baz (0x1.63dbc0p-130f)) > + __builtin_abort (); > + return 0; > +} > > Jakub > -- Richard Biener <rguenther@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 247165 (AG MÌnchen) ^ permalink raw reply [flat|nested] 504+ messages in thread
* [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) 2019-09-16 6:57 ` Richard Biener @ 2019-09-21 6:14 ` Jakub Jelinek 2019-09-30 7:03 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2019-09-21 6:14 UTC (permalink / raw) To: Richard Biener; +Cc: Joseph S. Myers, gcc-patches [-- Attachment #1: Type: text/plain, Size: 12529 bytes --] On Mon, Sep 16, 2019 at 08:56:58AM +0200, Richard Biener wrote: > > As mentioned in the PR, the sqrt (x) < c optimization into x < c*c > > sometimes breaks the boundary case, if c2=c*c is inexact then in some cases > > we need to optimize it into x <= c*c rather than x < c*c. The original > > bugreport is when c is small and c2 is 0.0, then obviously we need <= 0.0 > > rather than < 0.0, but the testcase includes another example where it makes > > a difference, plus has a >= testcase too. > > > > Bootstrapped/regtested on powerpc64le-linux, ok for trunk? > > I was hoping Joseph might chime in here... anyway, does this assume > round-to-nearest or does it work with round to +-Inf as well? I > realize this all is under flag_unsafe_math_optimizations, but > this flag is notoriously underspecified... So the question is > whether we should disable the transform if c*c isn't exact and > flag_rounding_math? The transform also doesn't seem to guard > against isnan (c) (-funsafe-math-optimizations sets > -fno-trapping-math and -fno-signed-zeros but not -ffinite-math-only > or disables itself on -frounding-math) Here is an updated patch, which on top of the previous patch: 1) punts for -frounding-math 2) punts for sqrt comparisons against NaN constant 3) for the c*c inexact also handles the other two comparisons that apparently need to be handled too 4) for all 4 comparisons also checks nexttoward (c2, 0.0) or nexttoward (c2, inf) depending on the comparison kind, because as Joseph correctly noted, with rounding to nearest up to 3 different floating point values can have the same sqrt result, and if c2 is the middle one from them, we need to use the 1 ulp smaller or larger one in the comparison 5) had to adjust the testcase, because while it worked fine on powerpc64le, on x86_64 if the test is linked with -ffast-math/-Ofast etc., crtfastmath.o is linked in and subnormals are flushed to zero, which is not what we want for the testcase (at least for a subset of the tests). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? BTW, I've used attached programs to look for the problematic cases on random float/doubles and the cases the patch handles seem to be the only problematic ones, there is never need to go further than one nexttoward to 0 or inf. 2019-09-21 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/91734 * generic-match-head.c: Include fold-const-call.h. * match.pd (sqrt(x) cmp c): Check the boundary value and in case inexact computation of c*c affects comparison of the boundary, turn LT_EXPR into LE_EXPR, GE_EXPR into GT_EXPR, LE_EXPR into LT_EXPR or GT_EXPR into GE_EXPR. Punt for sqrt comparisons against NaN and for -frounding-math. For c2, try the next smaller or larger floating point constant depending on comparison code and if it has the same sqrt as c2, use it instead of c2. * gcc.dg/pr91734.c: New test. --- gcc/generic-match-head.c.jj 2019-09-20 12:24:56.376189996 +0200 +++ gcc/generic-match-head.c 2019-09-20 12:43:08.017273166 +0200 @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "vec-perm-indices.h" #include "fold-const.h" +#include "fold-const-call.h" #include "stor-layout.h" #include "tree-dfa.h" #include "builtins.h" --- gcc/match.pd.jj 2019-09-20 12:25:27.323710388 +0200 +++ gcc/match.pd 2019-09-20 17:20:22.974316837 +0200 @@ -3711,8 +3711,7 @@ (define_operator_list COND_TERNARY (cmp { tem; } @1))))) /* Fold comparisons against built-in math functions. */ - (if (flag_unsafe_math_optimizations - && ! flag_errno_math) + (if (flag_unsafe_math_optimizations && ! flag_errno_math) (for sq (SQRT) (simplify (cmp (sq @0) REAL_CST@1) @@ -3747,56 +3746,108 @@ (define_operator_list COND_TERNARY if x is negative or NaN. Due to -funsafe-math-optimizations, the results for other x follow from natural arithmetic. */ (cmp @0 @1))) - (if (cmp == GT_EXPR || cmp == GE_EXPR) + (if ((cmp == LT_EXPR + || cmp == LE_EXPR + || cmp == GT_EXPR + || cmp == GE_EXPR) + && !REAL_VALUE_ISNAN (TREE_REAL_CST (@1)) + /* Give up for -frounding-math. */ + && !HONOR_SIGN_DEPENDENT_ROUNDING (TREE_TYPE (@0))) (with { - REAL_VALUE_TYPE c2; + REAL_VALUE_TYPE c2; + enum tree_code ncmp = cmp; + const real_format *fmt + = REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (@0))); real_arithmetic (&c2, MULT_EXPR, &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); - real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); + real_convert (&c2, fmt, &c2); + /* See PR91734: if c2 is inexact and sqrt(c2) < c (or sqrt(c2) >= c), + then change LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR. */ + if (!REAL_VALUE_ISINF (c2)) + { + tree c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0), + build_real (TREE_TYPE (@0), c2)); + if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST) + ncmp = ERROR_MARK; + else if ((cmp == LT_EXPR || cmp == GE_EXPR) + && real_less (&TREE_REAL_CST (c3), &TREE_REAL_CST (@1))) + ncmp = cmp == LT_EXPR ? LE_EXPR : GT_EXPR; + else if ((cmp == LE_EXPR || cmp == GT_EXPR) + && real_less (&TREE_REAL_CST (@1), &TREE_REAL_CST (c3))) + ncmp = cmp == LE_EXPR ? LT_EXPR : GE_EXPR; + else + { + /* With rounding to even, sqrt of up to 3 different values + gives the same normal result, so in some cases c2 needs + to be adjusted. */ + REAL_VALUE_TYPE c2alt, tow; + if (cmp == LT_EXPR || cmp == GE_EXPR) + tow = dconst0; + else + real_inf (&tow); + real_nextafter (&c2alt, fmt, &c2, &tow); + real_convert (&c2alt, fmt, &c2alt); + if (REAL_VALUE_ISINF (c2alt)) + ncmp = ERROR_MARK; + else + { + c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0), + build_real (TREE_TYPE (@0), c2alt)); + if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST) + ncmp = ERROR_MARK; + else if (real_equal (&TREE_REAL_CST (c3), + &TREE_REAL_CST (@1))) + c2 = c2alt; + } + } + } } - (if (REAL_VALUE_ISINF (c2)) - /* sqrt(x) > y is x == +Inf, when y is very large. */ - (if (HONOR_INFINITIES (@0)) - (eq @0 { build_real (TREE_TYPE (@0), c2); }) - { constant_boolean_node (false, type); }) - /* sqrt(x) > c is the same as x > c*c. */ - (cmp @0 { build_real (TREE_TYPE (@0), c2); })))) - (if (cmp == LT_EXPR || cmp == LE_EXPR) - (with - { - REAL_VALUE_TYPE c2; - real_arithmetic (&c2, MULT_EXPR, - &TREE_REAL_CST (@1), &TREE_REAL_CST (@1)); - real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2); - } - (if (REAL_VALUE_ISINF (c2)) - (switch - /* sqrt(x) < y is always true, when y is a very large - value and we don't care about NaNs or Infinities. */ - (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) - { constant_boolean_node (true, type); }) - /* sqrt(x) < y is x != +Inf when y is very large and we - don't care about NaNs. */ - (if (! HONOR_NANS (@0)) - (ne @0 { build_real (TREE_TYPE (@0), c2); })) - /* sqrt(x) < y is x >= 0 when y is very large and we - don't care about Infinities. */ - (if (! HONOR_INFINITIES (@0)) - (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) - /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ - (if (GENERIC) - (truth_andif - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) - (ne @0 { build_real (TREE_TYPE (@0), c2); })))) - /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ - (if (! HONOR_NANS (@0)) - (cmp @0 { build_real (TREE_TYPE (@0), c2); }) - /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ - (if (GENERIC) - (truth_andif - (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) - (cmp @0 { build_real (TREE_TYPE (@0), c2); }))))))))) + (if (cmp == GT_EXPR || cmp == GE_EXPR) + (if (REAL_VALUE_ISINF (c2)) + /* sqrt(x) > y is x == +Inf, when y is very large. */ + (if (HONOR_INFINITIES (@0)) + (eq @0 { build_real (TREE_TYPE (@0), c2); }) + { constant_boolean_node (false, type); }) + /* sqrt(x) > c is the same as x > c*c. */ + (if (ncmp != ERROR_MARK) + (if (ncmp == GE_EXPR) + (ge @0 { build_real (TREE_TYPE (@0), c2); }) + (gt @0 { build_real (TREE_TYPE (@0), c2); })))) + /* else if (cmp == LT_EXPR || cmp == LE_EXPR) */ + (if (REAL_VALUE_ISINF (c2)) + (switch + /* sqrt(x) < y is always true, when y is a very large + value and we don't care about NaNs or Infinities. */ + (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0)) + { constant_boolean_node (true, type); }) + /* sqrt(x) < y is x != +Inf when y is very large and we + don't care about NaNs. */ + (if (! HONOR_NANS (@0)) + (ne @0 { build_real (TREE_TYPE (@0), c2); })) + /* sqrt(x) < y is x >= 0 when y is very large and we + don't care about Infinities. */ + (if (! HONOR_INFINITIES (@0)) + (ge @0 { build_real (TREE_TYPE (@0), dconst0); })) + /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ + (if (GENERIC) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (ne @0 { build_real (TREE_TYPE (@0), c2); })))) + /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs. */ + (if (ncmp != ERROR_MARK && ! HONOR_NANS (@0)) + (if (ncmp == LT_EXPR) + (lt @0 { build_real (TREE_TYPE (@0), c2); }) + (le @0 { build_real (TREE_TYPE (@0), c2); })) + /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ + (if (ncmp != ERROR_MARK && GENERIC) + (if (ncmp == LT_EXPR) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (lt @0 { build_real (TREE_TYPE (@0), c2); })) + (truth_andif + (ge @0 { build_real (TREE_TYPE (@0), dconst0); }) + (le @0 { build_real (TREE_TYPE (@0), c2); }))))))))))) /* Transform sqrt(x) cmp sqrt(y) -> x cmp y. */ (simplify (cmp (sq @0) (sq @1)) --- gcc/testsuite/gcc.dg/pr91734.c.jj 2019-09-20 12:43:08.019273135 +0200 +++ gcc/testsuite/gcc.dg/pr91734.c 2019-09-21 07:57:26.102273700 +0200 @@ -0,0 +1,97 @@ +/* PR tree-optimization/91734 */ +/* { dg-do run } */ +/* { dg-add-options ieee } */ +/* { dg-additional-options "-O2 -std=gnu99" } */ + +__attribute__((noipa, optimize ("Ofast"))) int +f1 (float x) +{ + return __builtin_sqrtf (x) < __FLT_MIN__; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f2 (float x) +{ + return __builtin_sqrtf (x) < 0x1.2dd3d0p-65f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f3 (float x) +{ + return __builtin_sqrtf (x) >= 0x1.2dd3d0p-65f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f4 (float x) +{ + return __builtin_sqrtf (x) >= 0x1.5642e6p+54f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f5 (float x) +{ + return __builtin_sqrtf (x) > 0x1.5642e6p+54f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f6 (float x) +{ + return __builtin_sqrtf (x) < 0x1.4da1cp-19f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f7 (float x) +{ + return __builtin_sqrtf (x) <= 0x1.4da1cp-19f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f8 (float x) +{ + return __builtin_sqrtf (x) < 0x1.50cb62p-65f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f9 (float x) +{ + return __builtin_sqrtf (x) <= 0x1.4fc00cp-73f; +} + +__attribute__((noipa, optimize ("Ofast"))) int +f10 (float x) +{ + return __builtin_sqrtf (x) < 0x1.001002p+0f; +} + +int +main () +{ + if (__FLT_RADIX__ != 2 + || __FLT_MANT_DIG__ != 24 + || __FLT_MIN_EXP__ != -125 + || __FLT_MAX_EXP__ != 128 + || __FLT_HAS_DENORM__ != 1 + || __FLT_HAS_INFINITY__ != 1) + return 0; + if (!f1 (0.0f) || f1 (0x1.0p-149f)) + __builtin_abort (); + if (!f2 (0x1.63dbc0p-130f)) + __builtin_abort (); + if (f3 (0x1.63dbc0p-130f)) + __builtin_abort (); + if (!f4 (0x1.c996d0p+108f) || !f4 (0x1.c996cep+108f) || f4 (0x1.c996ccp+108f)) + __builtin_abort (); + if (f5 (0x1.c996d0p+108f) || f5 (0x1.c996d2p+108f) || !f5 (0x1.c996d4p+108f)) + __builtin_abort (); + if (!f6 (0x1.b2ce3p-38f) || f6 (0x1.b2ce32p-38f) || f6 (0x1.b2ce34p-38f)) + __builtin_abort (); + if (!f7 (0x1.b2ce3p-38f) || !f7 (0x1.b2ce34p-38f) || !f7 (0x1.b2ce36p-38f) || f7 (0x1.b2ce38p-38f)) + __builtin_abort (); + if (!f8 (0x1.bb166p-130f) || !f8 (0x1.bb168p-130f) || f8 (0x1.bb16ap-130f) || f8 (0x1.bb16cp-130f)) + __builtin_abort (); + if (!f9 (0x1.8p-146f) || !f9 (0x1.ap-146f) || f9 (0x1.cp-146f) || f9 (0x1.ep-146f)) + __builtin_abort (); + if (f10 (0x1.002004p+0f)) + __builtin_abort (); + return 0; +} Jakub [-- Attachment #2: pr91734-3.c --] [-- Type: text/plain, Size: 2048 bytes --] #include <stdlib.h> #include <math.h> int main () { union U { float f; unsigned int i; } u; for (int i = 0; i < 10000000; i++) { u.i = ((unsigned) random () << 8) ^ random (); float c = u.f; if (!isnormal (c) || c < 0) continue; float c2 = c * c; for (int j = -15; j <= 15; j++) { float x = c2; if (j < 0) { for (int k = j; k != 0; k++) x = nexttowardf (x, -1.0f); } else if (j > 0) { for (int k = j; k != 0; k--) x = nexttowardf (x, __builtin_inff ()); } if (x < 0) continue; if (isinf (c2)) continue; float c3 = __builtin_sqrtf (c2); float c4 = c2, c5 = c2; #ifdef FIXME c4 = nexttowardf (c2, 0.0); float c4s = __builtin_sqrtf (c4); if (c3 >= c && c4s == c) ; else c4 = c2; c5 = nexttowardf (c2, __builtin_inff ()); float c5s = __builtin_sqrtf (c5); if (c3 <= c && !isinf (c5) && c5s == c) ; else c5 = c2; if (c3 < c && (__builtin_sqrtf (x) < c) == (x <= c2) && (__builtin_sqrtf (x) >= c) == (x > c2)) ; else #endif if ((__builtin_sqrtf (x) < c) != (x < c4)) { if ((__builtin_sqrtf (x) >= c) != (x >= c4)) __builtin_printf ("</>= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); else __builtin_printf ("< c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); } else if ((__builtin_sqrtf (x) >= c) != (x >= c4)) __builtin_printf (">= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); #ifdef FIXME if (c3 > c && (__builtin_sqrtf (x) <= c) == (x < c2) && (__builtin_sqrtf (x) > c) == (x >= c2)) ; else #endif if ((__builtin_sqrtf (x) <= c) != (x <= c5)) { if ((__builtin_sqrtf (x) > c) != (x > c5)) __builtin_printf ("<=/> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); else __builtin_printf ("<= c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } else if ((__builtin_sqrtf (x) > c) != (x > c5)) __builtin_printf ("> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } } return 0; } [-- Attachment #3: pr91734-4.c --] [-- Type: text/plain, Size: 2113 bytes --] #include <stdlib.h> #include <math.h> int main () { union U { double f; unsigned long long int i; } u; for (int i = 0; i < 10000000; i++) { u.i = ((unsigned long long) random () << 40) ^ ((unsigned long long) random () << 20) ^ random (); double c = u.f; if (!isnormal (c) || c < 0) continue; double c2 = c * c; for (int j = -15; j <= 15; j++) { double x = c2; if (j < 0) { for (int k = j; k != 0; k++) x = nexttoward (x, -1.0f); } else if (j > 0) { for (int k = j; k != 0; k--) x = nexttoward (x, __builtin_inf ()); } if (x < 0) continue; if (isinf (c2)) continue; double c3 = __builtin_sqrt (c2); double c4 = c2, c5 = c2; #ifdef FIXME double c4 = nexttoward (c2, 0.0); double c4s = __builtin_sqrt (c4); if (c3 >= c && c4s == c) ; else c4 = c2; double c5 = nexttoward (c2, __builtin_inf ()); double c5s = __builtin_sqrt (c5); if (c3 <= c && !isinf (c5) && c5s == c) ; else c5 = c2; if (c3 < c && (__builtin_sqrt (x) < c) == (x <= c2) && (__builtin_sqrt (x) >= c) == (x > c2)) ; else #endif if ((__builtin_sqrt (x) < c) != (x < c4)) { if ((__builtin_sqrt (x) >= c) != (x >= c4)) __builtin_printf ("</>= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); else __builtin_printf ("< c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); } else if ((__builtin_sqrt (x) >= c) != (x >= c4)) __builtin_printf (">= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); #ifdef FIXME if (c3 > c && (__builtin_sqrt (x) <= c) == (x < c2) && (__builtin_sqrt (x) > c) == (x >= c2)) ; else #endif if ((__builtin_sqrt (x) <= c) != (x <= c5)) { if ((__builtin_sqrt (x) > c) != (x > c5)) __builtin_printf ("<=/> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); else __builtin_printf ("<= c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } else if ((__builtin_sqrt (x) > c) != (x > c5)) __builtin_printf ("> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } } return 0; } ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2019-09-21 6:14 ` [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) Jakub Jelinek @ 2019-09-30 7:03 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2019-09-30 7:03 UTC (permalink / raw) To: Joseph S. Myers, Richard Biener; +Cc: gcc-patches Hi! On Sat, Sep 21, 2019 at 08:14:13AM +0200, Jakub Jelinek wrote: > 2019-09-21 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/91734 > * generic-match-head.c: Include fold-const-call.h. > * match.pd (sqrt(x) cmp c): Check the boundary value and > in case inexact computation of c*c affects comparison of the boundary, > turn LT_EXPR into LE_EXPR, GE_EXPR into GT_EXPR, LE_EXPR into LT_EXPR > or GT_EXPR into GE_EXPR. Punt for sqrt comparisons against NaN and > for -frounding-math. For c2, try the next smaller or larger floating > point constant depending on comparison code and if it has the same > sqrt as c2, use it instead of c2. > > * gcc.dg/pr91734.c: New test. I'd like to ping this patch ( https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01281.html ). Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2019-04-16 11:54 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2019-04-16 11:54 UTC (permalink / raw) To: Jason Merrill, Nathan Sidwell, Marek Polacek; +Cc: gcc-patches Hi! I'd like to ping the PR89888 patch: https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00360.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-04-30 8:43 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2018-04-30 8:43 UTC (permalink / raw) To: Richard Biener, Jeff Law, Kirill Yukhin; +Cc: gcc-patches Hi! I'd like to ping following patches for stage1: - PR78420 __builtin_early_constant_p http://gcc.gnu.org/ml/gcc-patches/2018-03/msg00355.html - use --push-state --as-needed and --pop-state around -lgcc_s http://gcc.gnu.org/ml/gcc-patches/2018-04/msg00567.html - PR85466 next{after,toward}{,f,l} constant folding http://gcc.gnu.org/ml/gcc-patches/2018-04/msg01027.html - PR85480 improve AVX512 128-bit insertion into 512-bit zero vector http://gcc.gnu.org/ml/gcc-patches/2018-04/msg01058.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-04-16 10:35 Jakub Jelinek 2018-04-17 6:14 ` Kirill Yukhin 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2018-04-16 10:35 UTC (permalink / raw) To: Kirill Yukhin; +Cc: gcc-patches Hi! I'd like to ping the http://gcc.gnu.org/ml/gcc-patches/2018-04/msg00414.html PR85281 - assorted -masm=intel fixes patch. Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-04-16 10:35 Jakub Jelinek @ 2018-04-17 6:14 ` Kirill Yukhin 0 siblings, 0 replies; 504+ messages in thread From: Kirill Yukhin @ 2018-04-17 6:14 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches Hello Jakub On 16 Ð°Ð¿Ñ 10:12, Jakub Jelinek wrote: > Hi! > > I'd like to ping the > > http://gcc.gnu.org/ml/gcc-patches/2018-04/msg00414.html > PR85281 - assorted -masm=intel fixes Sorry, for missing that. Patch is OK as far as tests beginning to pass. -- Thanks, K > > patch. Thanks. > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-04-10 13:35 Jakub Jelinek 2018-04-10 12:34 ` Kirill Yukhin 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2018-04-10 13:35 UTC (permalink / raw) To: Kirill Yukhin, Uros Bizjak; +Cc: gcc-patches Hi! I'd like to ping the http://gcc.gnu.org/ml/gcc-patches/2018-04/msg00123.html P1 PR85177 vinsert[if]{32x4,64x2} pattern fix patch. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-04-10 13:35 Jakub Jelinek @ 2018-04-10 12:34 ` Kirill Yukhin 0 siblings, 0 replies; 504+ messages in thread From: Kirill Yukhin @ 2018-04-10 12:34 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Uros Bizjak, gcc-patches Hello Jakub, Sorry for missing that. Your patch is OK. — Thanks, K > On 10 Apr 2018, at 13:59, Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > I'd like to ping the > http://gcc.gnu.org/ml/gcc-patches/2018-04/msg00123.html > P1 PR85177 vinsert[if]{32x4,64x2} pattern fix > patch. > > Thanks > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-03-12 17:35 Jakub Jelinek 2018-03-12 23:22 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2018-03-12 17:35 UTC (permalink / raw) To: Richard Biener, Jason Merrill, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping the http://gcc.gnu.org/ml/gcc-patches/2018-03/msg00238.html - PR84704 - ICE on a[({ 0; })] op= something with -g patch. Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-03-12 17:35 Jakub Jelinek @ 2018-03-12 23:22 ` Jason Merrill 0 siblings, 0 replies; 504+ messages in thread From: Jason Merrill @ 2018-03-12 23:22 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Biener, Jeff Law, gcc-patches List OK. On Mon, Mar 12, 2018 at 10:22 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping the > > http://gcc.gnu.org/ml/gcc-patches/2018-03/msg00238.html > - PR84704 - ICE on a[({ 0; })] op= something with -g > > patch. Thanks. > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-03-05 18:38 Jakub Jelinek 2018-03-05 16:19 ` Jan Hubicka 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2018-03-05 18:38 UTC (permalink / raw) To: Uros Bizjak, Jan Hubicka, H.J. Lu; +Cc: gcc-patches Hi! I'd like to ping following patch: http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01461.html PR84564 - fix ICE with -mforce-indirect-call Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-03-05 18:38 Jakub Jelinek @ 2018-03-05 16:19 ` Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2018-03-05 16:19 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Uros Bizjak, Jan Hubicka, H.J. Lu, gcc-patches Dne 2018-03-05 17:13, Jakub Jelinek napsal: > Hi! > > I'd like to ping following patch: > > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01461.html > PR84564 - fix ICE with -mforce-indirect-call OK, thanks! Honza > > Thanks > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-03-02 8:49 Jakub Jelinek 2018-03-02 17:17 ` Jeff Law 2018-03-05 15:39 ` Kirill Yukhin 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2018-03-02 8:49 UTC (permalink / raw) To: Uros Bizjak, Kirill Yukhin, Jeff Law, Rainer Orth, Mike Stump; +Cc: gcc-patches Hi! I'd like to ping 2 patches: http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01340.html - PR target/84524 avx512* wrong-code bug http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01337.html - fix c-c++-common/Warray-bounds-2.c testcase for -fpic Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-03-02 8:49 Jakub Jelinek @ 2018-03-02 17:17 ` Jeff Law 2018-03-05 15:39 ` Kirill Yukhin 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2018-03-02 17:17 UTC (permalink / raw) To: Jakub Jelinek, Uros Bizjak, Kirill Yukhin, Rainer Orth, Mike Stump Cc: gcc-patches On 03/02/2018 01:17 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping 2 patches: > > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01340.html > - PR target/84524 avx512* wrong-code bug Hoping Kirill will chime in here. > > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01337.html > - fix c-c++-common/Warray-bounds-2.c testcase for -fpic OK. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-03-02 8:49 Jakub Jelinek 2018-03-02 17:17 ` Jeff Law @ 2018-03-05 15:39 ` Kirill Yukhin 1 sibling, 0 replies; 504+ messages in thread From: Kirill Yukhin @ 2018-03-05 15:39 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Uros Bizjak, Jeff Law, Rainer Orth, Mike Stump, gcc-patches Hello Jakub, On Friday, March 2, 2018, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping 2 patches: > > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01340.html > - PR target/84524 avx512* wrong-code bug Patch is OK. > > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg01337.html > - fix c-c++-common/Warray-bounds-2.c testcase for -fpic > > Thanks > > Jakub > — Thanks, K ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-02-14 17:49 Jakub Jelinek 2018-02-19 18:15 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2018-02-14 17:49 UTC (permalink / raw) To: Richard Biener, Jeff Law, Jason Merrill, Nathan Sidwell, Tom Tromey, Joseph S. Myers, Marek Polacek Cc: gcc-patches Hi! I'd like to ping these patches: PR84146 fix -fcompare-debug issues with -mcet -fcf-protection=full http://gcc.gnu.org/ml/gcc-patches/2018-02/msg00390.html PR83708 __VA_OPT__ assorted fixes http://gcc.gnu.org/ml/gcc-patches/2018-01/msg00727.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2018-02-14 17:49 Jakub Jelinek @ 2018-02-19 18:15 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2018-02-19 18:15 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Jason Merrill, Nathan Sidwell, Tom Tromey, Joseph S. Myers, Marek Polacek Cc: gcc-patches On 02/14/2018 07:22 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping these patches: > > PR84146 fix -fcompare-debug issues with -mcet -fcf-protection=full > http://gcc.gnu.org/ml/gcc-patches/2018-02/msg00390.html OK. And FWIW, I like this much more than having it be an insn note. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2018-02-07 9:01 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2018-02-07 9:01 UTC (permalink / raw) To: Richard Biener, Jason Merrill, Nathan Sidwell, Tom Tromey, Joseph S. Myers, Marek Polacek Cc: gcc-patches Hi! I'd like to ping 2 patches: PR83659 cxx_fold_indirect_ref ICE fix http://gcc.gnu.org/ml/gcc-patches/2018-01/msg02211.html PR83708 __VA_OPT__ assorted fixes http://gcc.gnu.org/ml/gcc-patches/2018-01/msg00727.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-11-20 8:31 Jakub Jelinek 2017-11-20 18:31 ` Nathan Sidwell ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-11-20 8:31 UTC (permalink / raw) To: Jason Merrill, Nathan Sidwell; +Cc: gcc-patches Hi! I'd like to ping the following patches: http://gcc.gnu.org/ml/gcc-patches/2017-10/msg01895.html PR debug/82718 Fix DWARF5 .debug_loclist handling with hot/cold partitioning http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00851.html C++2A P0428R2 - familiar template syntax for generic lambdas http://gcc.gnu.org/ml/gcc-patches/2017-11/msg01026.html C++2A P0329R4: Designated Initialization Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-20 8:31 Jakub Jelinek @ 2017-11-20 18:31 ` Nathan Sidwell 2017-11-20 19:08 ` Nathan Sidwell 2017-11-21 0:16 ` Jim Wilson 2 siblings, 0 replies; 504+ messages in thread From: Nathan Sidwell @ 2017-11-20 18:31 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 11/20/2017 02:55 AM, Jakub Jelinek wrote: > Hi! > http://gcc.gnu.org/ml/gcc-patches/2017-11/msg01026.html > C++2A P0329R4: Designated Initialization OK, thanks -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-20 8:31 Jakub Jelinek 2017-11-20 18:31 ` Nathan Sidwell @ 2017-11-20 19:08 ` Nathan Sidwell 2017-11-21 8:53 ` Jakub Jelinek 2017-11-21 0:16 ` Jim Wilson 2 siblings, 1 reply; 504+ messages in thread From: Nathan Sidwell @ 2017-11-20 19:08 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 11/20/2017 02:55 AM, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00851.html > C++2A P0428R2 - familiar template syntax for generic lambdas Are there existing testcases checking this is permitted w/o warning under the appropriate circumstances? That seems to be the only thing missing from the patch itself. Otherwise ok. nathan -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-20 19:08 ` Nathan Sidwell @ 2017-11-21 8:53 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-11-21 8:53 UTC (permalink / raw) To: Nathan Sidwell; +Cc: Jason Merrill, gcc-patches On Mon, Nov 20, 2017 at 01:31:39PM -0500, Nathan Sidwell wrote: > On 11/20/2017 02:55 AM, Jakub Jelinek wrote: > > > http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00851.html > > C++2A P0428R2 - familiar template syntax for generic lambdas > > Are there existing testcases checking this is permitted w/o warning under > the appropriate circumstances? That seems to be the only thing missing from > the patch itself. At least for check-c++-all I believe it is mostly covered. E.g. g++.dg/cpp1y/lambda-generic-x.C has: // { dg-warning "lambda templates are only available with" "" { target c++17_down } } which checks that with -Wpedantic there is warning emitted in -std=gnu++14 and -std=gnu++17, but not with -std=gnu++20. Similarly several other testcases. And g++.dg/cpp2a/lambda-generic1.C has: // { dg-error "lambda templates are only available with" "" { target c++17_down } } that verifies that with -pedantic-errors in -std=c++14 and -std=c++17 an error is emitted and in -std=c++20 no error/warning is diagnosed. So, what isn't tested is: 1) behavior for C++98/C++11 2) -Wno-pedantic behavior 3) at least one test that would catch it even without check-c++-all for -std=c++2a Therefore, I've added 3 new small tests that are compiled by all language variants and check -pedantic-errors, -Wpedantic and -Wno-pedantic behavior and one that forces -std=c++2a into dg-options and thus works even without check-c++-all and committed. Thanks. 2017-11-21 Jakub Jelinek <jakub@redhat.com> P0428R2 - familiar template syntax for generic lambdas * parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn for cxx2a and above, reword pedwarn for C++14/C++17. * g++.dg/cpp1y/lambda-generic-x.C: Adjust warnings and limit to c++17_down target. * g++.dg/cpp1y/lambda-generic-dep.C: Likewise. * g++.dg/cpp1y/lambda-generic-77914.C: Adjust error and limit to c++17_down target. * g++.dg/cpp2a/lambda-generic1.C: New test. * g++.dg/cpp2a/lambda-generic2.C: New test. * g++.dg/cpp2a/lambda-generic3.C: New test. * g++.dg/cpp2a/lambda-generic4.C: New test. * g++.dg/cpp2a/lambda-generic5.C: New test. --- gcc/cp/parser.c.jj 2017-11-20 19:56:04.787470779 +0100 +++ gcc/cp/parser.c 2017-11-21 09:15:30.127267088 +0100 @@ -10512,9 +10512,10 @@ cp_parser_lambda_declarator_opt (cp_pars pedwarn (parser->lexer->next_token->location, 0, "lambda templates are only available with " "-std=c++14 or -std=gnu++14"); - else + else if (cxx_dialect < cxx2a) pedwarn (parser->lexer->next_token->location, OPT_Wpedantic, - "ISO C++ does not support lambda templates"); + "lambda templates are only available with " + "-std=c++2a or -std=gnu++2a"); cp_lexer_consume_token (parser->lexer); --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-x.C.jj 2017-11-10 15:42:02.371152517 +0100 +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-x.C 2017-11-21 09:15:30.147266840 +0100 @@ -6,17 +6,17 @@ int main() { - auto glambda = [] <typename A, typename B> (A a, B&& b) { return a < b; }; // { dg-warning "does not support lambda templates" } + auto glambda = [] <typename A, typename B> (A a, B&& b) { return a < b; }; // { dg-warning "lambda templates are only available with" "" { target c++17_down } } bool b = glambda(3, 3.14); // OK - auto vglambda = [] <typename P> (P printer) { // { dg-warning "does not support lambda templates" } + auto vglambda = [] <typename P> (P printer) { // { dg-warning "lambda templates are only available with" "" { target c++17_down } } return [=] <typename... T> (T&& ... ts) { // OK: ts is a function parameter pack - printer(std::forward<decltype(ts)>(ts)...); // { dg-warning "does not support lambda templates" "" { target *-*-* } .-1 } + printer(std::forward<decltype(ts)>(ts)...); // { dg-warning "lambda templates are only available with" "" { target c++17_down } .-1 } return [=]() { printer(ts ...); }; }; }; - auto p = vglambda( [] <typename A, // { dg-warning "does not support lambda templates" } + auto p = vglambda( [] <typename A, // { dg-warning "lambda templates are only available with" "" { target c++17_down } } typename B, typename C> (A v1, B v2, C v3) { std::cout << v1 << v2 << v3; } ); --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-dep.C.jj 2017-11-10 15:42:02.394152236 +0100 +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-dep.C 2017-11-21 09:15:30.161266666 +0100 @@ -27,7 +27,7 @@ struct S { int main() { - auto f = [] <typename T> (T const& s) mutable { // { dg-warning "does not support lambda templates" } + auto f = [] <typename T> (T const& s) mutable { // { dg-warning "lambda templates are only available with" "" { target c++17_down } } typename T::N x; return x.test (); }; --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-77914.C.jj 2017-11-10 15:42:02.336152944 +0100 +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-77914.C 2017-11-21 09:15:30.169266567 +0100 @@ -4,6 +4,6 @@ int main () { - auto l = [] <typename T> () {}; // { dg-error "does not support lambda templates" } + auto l = [] <typename T> () {}; // { dg-error "lambda templates are only available with" "" { target c++17_down } } l.operator () <void> (); } --- gcc/testsuite/g++.dg/cpp2a/lambda-generic1.C.jj 2017-11-21 09:15:30.169266567 +0100 +++ gcc/testsuite/g++.dg/cpp2a/lambda-generic1.C 2017-11-21 09:15:30.169266567 +0100 @@ -0,0 +1,9 @@ +// P0428R2 +// { dg-do compile { target c++14 } } + +int i = [](int i, auto a) { return i; }(3, 4); +int j = []<class T>(T t, int i) { return i; }(3, 4); // { dg-error "lambda templates are only available with" "" { target c++17_down } } +int k[2] = { 5, 6 }; +int l = []<typename T>(T *p) { return *p; }(k); // { dg-error "lambda templates are only available with" "" { target c++17_down } } +int m = []<typename T, int N>(T (&a)[N]) { return a[N - 1]; }(k); // { dg-error "lambda templates are only available with" "" { target c++17_down } } +int n = []<typename T>(T a, auto b) { return a + b; }(7, 8); // { dg-error "lambda templates are only available with" "" { target c++17_down } } --- gcc/testsuite/g++.dg/cpp2a/lambda-generic2.C.jj 2017-11-21 09:16:47.745302618 +0100 +++ gcc/testsuite/g++.dg/cpp2a/lambda-generic2.C 2017-11-21 09:20:58.655184849 +0100 @@ -0,0 +1,7 @@ +// P0428R2 +// { dg-do compile } + +int j = []<class T>(T t, int i) { return i; }(3, 4); +// { dg-error "lambda templates are only available with" "" { target c++17_down } .-1 } +// { dg-error "lambda expressions only available with" "" { target c++98_only } .-2 } +// { dg-error "invalid use of 'auto'" "" { target c++98_only } .-3 } --- gcc/testsuite/g++.dg/cpp2a/lambda-generic3.C.jj 2017-11-21 09:19:59.266922799 +0100 +++ gcc/testsuite/g++.dg/cpp2a/lambda-generic3.C 2017-11-21 09:28:13.086788078 +0100 @@ -0,0 +1,8 @@ +// P0428R2 +// { dg-do compile } +// { dg-options "-Wpedantic" } + +int j = []<class T>(T t, int i) { return i; }(3, 4); +// { dg-warning "lambda templates are only available with" "" { target c++17_down } .-1 } +// { dg-warning "lambda expressions only available with" "" { target c++98_only } .-2 } +// { dg-error "invalid use of 'auto'" "" { target c++98_only } .-3 } --- gcc/testsuite/g++.dg/cpp2a/lambda-generic4.C.jj 2017-11-21 09:28:33.928529224 +0100 +++ gcc/testsuite/g++.dg/cpp2a/lambda-generic4.C 2017-11-21 09:30:19.146222419 +0100 @@ -0,0 +1,8 @@ +// P0428R2 +// { dg-do compile } +// { dg-options "-Wno-pedantic" } + +int j = []<class T>(T t, int i) { return i; }(3, 4); +// { dg-warning "lambda templates are only available with" "" { target c++11_down } .-1 } +// { dg-warning "lambda expressions only available with" "" { target c++98_only } .-2 } +// { dg-error "invalid use of 'auto'" "" { target c++98_only } .-3 } --- gcc/testsuite/g++.dg/cpp2a/lambda-generic5.C.jj 2017-11-21 09:21:25.785847728 +0100 +++ gcc/testsuite/g++.dg/cpp2a/lambda-generic5.C 2017-11-21 09:31:02.871679348 +0100 @@ -0,0 +1,6 @@ +// P0428R2 +// { dg-do compile } +// { dg-options "-std=c++2a" } + +int j = []<class T>(T t, int i) { return i; }(3, 4); +// { dg-bogus "lambda templates are only available with" "" { target c++2a } .-1 } Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-20 8:31 Jakub Jelinek 2017-11-20 18:31 ` Nathan Sidwell 2017-11-20 19:08 ` Nathan Sidwell @ 2017-11-21 0:16 ` Jim Wilson 2017-11-21 3:01 ` Jim Wilson 2017-11-21 8:14 ` Jakub Jelinek 2 siblings, 2 replies; 504+ messages in thread From: Jim Wilson @ 2017-11-21 0:16 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, Nathan Sidwell; +Cc: gcc-patches On 11/19/2017 11:55 PM, Jakub Jelinek wrote: > I'd like to ping the following patches: > > http://gcc.gnu.org/ml/gcc-patches/2017-10/msg01895.html > PR debug/82718 > Fix DWARF5 .debug_loclist handling with hot/cold partitioning I already responded to this one. https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01268.html The dwarf2out.c patch looks good to me, though the testcase does not fail on unpatched mainline anymore. I had to go back to the 2017-10-22 snapshot to see the failure. There was a followup from Mark Wielaard mentioning that elfutils still fails on mainline, so maybe we can get a testcase from there. Jim ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-21 0:16 ` Jim Wilson @ 2017-11-21 3:01 ` Jim Wilson 2017-11-21 8:14 ` Jakub Jelinek 1 sibling, 0 replies; 504+ messages in thread From: Jim Wilson @ 2017-11-21 3:01 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, Nathan Sidwell; +Cc: gcc-patches On 11/20/2017 02:58 PM, Jim Wilson wrote: > The dwarf2out.c patch looks good to me, though the testcase does not > fail on unpatched mainline anymore. I had to go back to the 2017-10-22 > snapshot to see the failure. There was a followup from Mark Wielaard > mentioning that elfutils still fails on mainline, so maybe we can get a > testcase from there. The testcase was "broken" by Jan's big patch on Nov 3 https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00104.html It didn't seem useful to look into that, so I tried running multidelta/creduce on the elfutils sources, and managed to get a small testcase that still fails with mainline. I then fixed it to get rid of the warnings. #include <stdlib.h> extern int c (void); int a(int b) { if (c()) abort(); } There is no guarantee that this testcase will still show the problem in the future, but it seems good enough for now. OK with this testcase. And with your testcase too if you think that still has value. Jim ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-11-21 0:16 ` Jim Wilson 2017-11-21 3:01 ` Jim Wilson @ 2017-11-21 8:14 ` Jakub Jelinek 1 sibling, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-11-21 8:14 UTC (permalink / raw) To: Jim Wilson; +Cc: Jason Merrill, Nathan Sidwell, gcc-patches On Mon, Nov 20, 2017 at 02:58:22PM -0800, Jim Wilson wrote: > On 11/19/2017 11:55 PM, Jakub Jelinek wrote: > > I'd like to ping the following patches: > > > > http://gcc.gnu.org/ml/gcc-patches/2017-10/msg01895.html > > PR debug/82718 > > Fix DWARF5 .debug_loclist handling with hot/cold partitioning > > I already responded to this one. > https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01268.html Sorry for missing that. > The dwarf2out.c patch looks good to me, though the testcase does not fail on > unpatched mainline anymore. I had to go back to the 2017-10-22 snapshot to > see the failure. There was a followup from Mark Wielaard mentioning that > elfutils still fails on mainline, so maybe we can get a testcase from there. Committed both with the old and your new testcase after verifying your new one still fails without the patch. Thanks. 2017-11-21 Jakub Jelinek <jakub@redhat.com> PR debug/82718 * dwarf2out.c (dw_loc_list): If crtl->has_bb_partition, temporarily set in_cold_section_p to the partition containing loc_list->first. When seeing loc_list->last_before_switch node, update secname and perform range_across_switch second partition handling only after that. * gcc.dg/debug/dwarf2/pr82718-1.c: New test. * gcc.dg/debug/dwarf2/pr82718-2.c: New test. --- gcc/dwarf2out.c.jj 2017-10-23 22:39:27.000000000 +0200 +++ gcc/dwarf2out.c 2017-10-25 21:01:13.237929750 +0200 @@ -16333,92 +16333,111 @@ dw_loc_list (var_loc_list *loc_list, tre This means we have to special case the last node, and generate a range of [last location start, end of function label]. */ - secname = secname_for_decl (decl); + if (cfun && crtl->has_bb_partition) + { + bool save_in_cold_section_p = in_cold_section_p; + in_cold_section_p = first_function_block_is_cold; + if (loc_list->last_before_switch == NULL) + in_cold_section_p = !in_cold_section_p; + secname = secname_for_decl (decl); + in_cold_section_p = save_in_cold_section_p; + } + else + secname = secname_for_decl (decl); for (node = loc_list->first; node; node = node->next) - if (GET_CODE (node->loc) == EXPR_LIST - || NOTE_VAR_LOCATION_LOC (node->loc) != NULL_RTX) - { - if (GET_CODE (node->loc) == EXPR_LIST) - { - /* This requires DW_OP_{,bit_}piece, which is not usable - inside DWARF expressions. */ - if (want_address != 2) - continue; + { + bool range_across_switch = false; + if (GET_CODE (node->loc) == EXPR_LIST + || NOTE_VAR_LOCATION_LOC (node->loc) != NULL_RTX) + { + if (GET_CODE (node->loc) == EXPR_LIST) + { + descr = NULL; + /* This requires DW_OP_{,bit_}piece, which is not usable + inside DWARF expressions. */ + if (want_address == 2) + descr = dw_sra_loc_expr (decl, node->loc); + } + else + { + initialized = NOTE_VAR_LOCATION_STATUS (node->loc); + varloc = NOTE_VAR_LOCATION (node->loc); + descr = dw_loc_list_1 (decl, varloc, want_address, initialized); + } + if (descr) + { + /* If section switch happens in between node->label + and node->next->label (or end of function) and + we can't emit it as a single entry list, + emit two ranges, first one ending at the end + of first partition and second one starting at the + beginning of second partition. */ + if (node == loc_list->last_before_switch + && (node != loc_list->first || loc_list->first->next) + && current_function_decl) + { + endname = cfun->fde->dw_fde_end; + range_across_switch = true; + } + /* The variable has a location between NODE->LABEL and + NODE->NEXT->LABEL. */ + else if (node->next) + endname = node->next->label; + /* If the variable has a location at the last label + it keeps its location until the end of function. */ + else if (!current_function_decl) + endname = text_end_label; + else + { + ASM_GENERATE_INTERNAL_LABEL (label_id, FUNC_END_LABEL, + current_function_funcdef_no); + endname = ggc_strdup (label_id); + } + + *listp = new_loc_list (descr, node->label, endname, secname); + if (TREE_CODE (decl) == PARM_DECL + && node == loc_list->first + && NOTE_P (node->loc) + && strcmp (node->label, endname) == 0) + (*listp)->force = true; + listp = &(*listp)->dw_loc_next; + } + } + + if (cfun + && crtl->has_bb_partition + && node == loc_list->last_before_switch) + { + bool save_in_cold_section_p = in_cold_section_p; + in_cold_section_p = !first_function_block_is_cold; + secname = secname_for_decl (decl); + in_cold_section_p = save_in_cold_section_p; + } + + if (range_across_switch) + { + if (GET_CODE (node->loc) == EXPR_LIST) descr = dw_sra_loc_expr (decl, node->loc); - if (descr == NULL) - continue; - } - else - { - initialized = NOTE_VAR_LOCATION_STATUS (node->loc); - varloc = NOTE_VAR_LOCATION (node->loc); - descr = dw_loc_list_1 (decl, varloc, want_address, initialized); - } - if (descr) - { - bool range_across_switch = false; - /* If section switch happens in between node->label - and node->next->label (or end of function) and - we can't emit it as a single entry list, - emit two ranges, first one ending at the end - of first partition and second one starting at the - beginning of second partition. */ - if (node == loc_list->last_before_switch - && (node != loc_list->first || loc_list->first->next) - && current_function_decl) - { - endname = cfun->fde->dw_fde_end; - range_across_switch = true; - } - /* The variable has a location between NODE->LABEL and - NODE->NEXT->LABEL. */ - else if (node->next) - endname = node->next->label; - /* If the variable has a location at the last label - it keeps its location until the end of function. */ - else if (!current_function_decl) - endname = text_end_label; - else - { - ASM_GENERATE_INTERNAL_LABEL (label_id, FUNC_END_LABEL, - current_function_funcdef_no); - endname = ggc_strdup (label_id); - } - - *listp = new_loc_list (descr, node->label, endname, secname); - if (TREE_CODE (decl) == PARM_DECL - && node == loc_list->first - && NOTE_P (node->loc) - && strcmp (node->label, endname) == 0) - (*listp)->force = true; - listp = &(*listp)->dw_loc_next; - - if (range_across_switch) - { - if (GET_CODE (node->loc) == EXPR_LIST) - descr = dw_sra_loc_expr (decl, node->loc); - else - { - initialized = NOTE_VAR_LOCATION_STATUS (node->loc); - varloc = NOTE_VAR_LOCATION (node->loc); - descr = dw_loc_list_1 (decl, varloc, want_address, - initialized); - } - gcc_assert (descr); - /* The variable has a location between NODE->LABEL and - NODE->NEXT->LABEL. */ - if (node->next) - endname = node->next->label; - else - endname = cfun->fde->dw_fde_second_end; - *listp = new_loc_list (descr, - cfun->fde->dw_fde_second_begin, - endname, secname); - listp = &(*listp)->dw_loc_next; - } - } - } + else + { + initialized = NOTE_VAR_LOCATION_STATUS (node->loc); + varloc = NOTE_VAR_LOCATION (node->loc); + descr = dw_loc_list_1 (decl, varloc, want_address, + initialized); + } + gcc_assert (descr); + /* The variable has a location between NODE->LABEL and + NODE->NEXT->LABEL. */ + if (node->next) + endname = node->next->label; + else + endname = cfun->fde->dw_fde_second_end; + *listp = new_loc_list (descr, cfun->fde->dw_fde_second_begin, + endname, secname); + listp = &(*listp)->dw_loc_next; + } + } /* Try to avoid the overhead of a location list emitting a location expression instead, but only if we didn't have more than one --- gcc/testsuite/gcc.dg/debug/dwarf2/pr82718-1.c.jj 2017-10-25 21:10:53.324920386 +0200 +++ gcc/testsuite/gcc.dg/debug/dwarf2/pr82718-1.c 2017-10-25 21:10:25.000000000 +0200 @@ -0,0 +1,41 @@ +/* PR debug/82718 */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -gdwarf-5" } */ + +extern int e; +extern long foo (int, void *, unsigned long, unsigned long); +struct S +{ + int f; + unsigned long t, s; +}; + +static inline long +bv (int x, void *y, unsigned long z, unsigned long w) +{ + long a = 0; + do + { + long g; + do + g = (long int) (foo (x, y + a, z - a, w + a)); + while (g == -1L && e == 9959); + if (g <= 0) + return g < 0 ? g : a; + a += g; + } + while ((unsigned long) a < z); + return a; +} + +const char * +baz (struct S *x) +{ + unsigned long h = 8; + char *j = 0; + unsigned long z = x->f; + if (__builtin_expect (!!((unsigned long) bv (x->f, j, z, x->t + h + 10) != z), 0)) + return 0; + x->s = z; + return j; +} --- gcc/testsuite/gcc.dg/debug/dwarf2/pr82718-2.c.jj 2017-08-31 21:08:14.436950781 +0200 +++ gcc/testsuite/gcc.dg/debug/dwarf2/pr82718-2.c 2017-11-21 08:55:47.433967007 +0100 @@ -0,0 +1,12 @@ +/* PR debug/82718 */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -gdwarf-5" } */ + +extern int bar (void); + +int +foo (int x) +{ + if (bar ()) + __builtin_abort (); +} Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-11-06 16:22 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-11-06 16:22 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping the: http://gcc.gnu.org/ml/gcc-patches/2017-10/msg01895.html PR debug/82718 Fix DWARF5 .debug_loclist handling with hot/cold partitioning patch. Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-10-24 11:04 Jakub Jelinek 2017-10-24 18:58 ` Kirill Yukhin 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-10-24 11:04 UTC (permalink / raw) To: Kirill Yukhin, H.J. Lu; +Cc: gcc-patches Hi! I'd like to ping two patches: http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00206.html PR target/82370 - improve V?TImode shifts H.J., can you please respond whether the (set_attr "atom_unit" "sishuf") attribute just on {,v}psrldq and not on {,v}pslldq was intentional (and if so, why), or just an omission and in that case if both insns should have it or none? http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00525.html PR target/82460 - improve AVX512* vperm[ti]2* Kyrill, can you please review this one? Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-10-24 11:04 Jakub Jelinek @ 2017-10-24 18:58 ` Kirill Yukhin 0 siblings, 0 replies; 504+ messages in thread From: Kirill Yukhin @ 2017-10-24 18:58 UTC (permalink / raw) To: Jakub Jelinek; +Cc: H.J. Lu, gcc-patches Hello Jakub, On 24 Oct 13:01, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00525.html > PR target/82460 - improve AVX512* vperm[ti]2* > Kyrill, can you please review this one? Your patch is OK for trunk. -- Thanks, K > > Thanks > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-10-16 10:16 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-10-16 10:16 UTC (permalink / raw) To: Jason Merrill, Uros Bizjak, Kirill Yukhin; +Cc: gcc-patches Hi! I'd like to ping a few patches: http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01939.html PR libstdc++/81706 - omp declare simd attribute vs. builtins C++ part of the patch http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00162.html PR target/82370 - prefer shorter VEX encoding of VP{AND,OR,XOR,ANDN} over EVEX when possible http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00205.html PR target/82370 - improve AVX512 vector shift patterns http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00206.html PR target/82370 - improve V?TImode shifts http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00207.html Remove useless isa attributes from various sse.md patterns http://gcc.gnu.org/ml/gcc-patches/2017-10/msg00525.html PR target/82460 - improve AVX512* vperm[ti]2* Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-10-06 14:12 Jakub Jelinek 2017-10-06 15:25 ` Nathan Sidwell 2017-10-06 15:27 ` Nathan Sidwell 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-10-06 14:12 UTC (permalink / raw) To: Jason Merrill, nathan, Joseph S. Myers, Ian Lance Taylor, Jeff Law Cc: gcc-patches Hi! I'd like to ping a couple of patches: http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01237.html C++2a P0704R1 - fixing const-qualified pointers to members http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01939.html PR libstdc++/81706 - omp declare simd attribute vs. builtins C++ part of the patch http://gcc.gnu.org/ml/gcc-patches/2017-09/msg02006.html PR c++/82299 - invalid -Wuseless-cast on direct enum init http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01540.html libgcc __mulvDI3 fix - missed detection of overflow for 0xffffffff00000000 * 0xffffffff00000000 __builtin_mul_overflow{,_p} fix for the same Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-10-06 14:12 Jakub Jelinek @ 2017-10-06 15:25 ` Nathan Sidwell 2017-10-06 15:27 ` Nathan Sidwell 1 sibling, 0 replies; 504+ messages in thread From: Nathan Sidwell @ 2017-10-06 15:25 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, nathan, Joseph S. Myers, Ian Lance Taylor, Jeff Law Cc: gcc-patches On 10/06/2017 10:12 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping a couple of patches: > > http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01237.html > C++2a P0704R1 - fixing const-qualified pointers to members ok, thanks -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-10-06 14:12 Jakub Jelinek 2017-10-06 15:25 ` Nathan Sidwell @ 2017-10-06 15:27 ` Nathan Sidwell 1 sibling, 0 replies; 504+ messages in thread From: Nathan Sidwell @ 2017-10-06 15:27 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, nathan, Joseph S. Myers, Ian Lance Taylor, Jeff Law Cc: gcc-patches On 10/06/2017 10:12 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping a couple of patches: > > http://gcc.gnu.org/ml/gcc-patches/2017-09/msg02006.html > PR c++/82299 - invalid -Wuseless-cast on direct enum init Agreed, ok, thanks. nathan -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-09-29 9:13 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-09-29 9:13 UTC (permalink / raw) To: Joseph S. Myers, Ian Lance Taylor, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping the following patch: http://gcc.gnu.org/ml/gcc-patches/2017-09/msg01540.html libgcc __mulvDI3 fix - missed detection of overflow for 0xffffffff00000000 * 0xffffffff00000000 __builtin_mul_overflow{,_p} fix for the same Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-07-28 16:58 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-07-28 16:58 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping the following patch: - DWARF - emit DW_AT_export_symbols for inline and anon namespaces https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01349.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-07-25 9:40 Jakub Jelinek 2017-07-26 10:34 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-07-25 9:40 UTC (permalink / raw) To: Richard Biener, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping 2 patches: - UBSAN -fsanitize=pointer-overflow support - http://gcc.gnu.org/ml/gcc-patches/2017-06/msg01365.html - noipa attribute addition http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-25 9:40 Jakub Jelinek @ 2017-07-26 10:34 ` Richard Biener 2017-07-26 13:47 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2017-07-26 10:34 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches On Tue, 25 Jul 2017, Jakub Jelinek wrote: > Hi! > > I'd like to ping 2 patches: > > - UBSAN -fsanitize=pointer-overflow support > - http://gcc.gnu.org/ml/gcc-patches/2017-06/msg01365.html The probablility stuff might need updating? Can you put the TYPE_PRECISION (sizetype) != POINTER_SIZE check in option processing and inform people that pointer overflow sanitizing is not done instead? Where you handle DECL_BIT_FIELD_REPRESENTATIVE in maybe_instrument_pointer_overflow you could instead of building a new COMPONENT_REF strip the bitfield ref and just remember DECL_FIELD_OFFSET/BIT_OFFSET to be added to the get_inner_reference result? You don't seem to use 'size' anywhere. You fail to allow other handled components -- for no good reason? You fail to handle &MEM[ptr + CST] a canonical gimple invariant way of ptr +p CST, the early out bitpos == 0 will cause non-instrumentation here. (I'd just round down in the case of bitpos % BITS_PER_UNIT != 0) Otherwise looks good. > - noipa attribute addition > http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-26 10:34 ` Richard Biener @ 2017-07-26 13:47 ` Jakub Jelinek 2017-07-26 14:13 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-07-26 13:47 UTC (permalink / raw) To: Richard Biener; +Cc: Jan Hubicka, gcc-patches [-- Attachment #1: Type: text/plain, Size: 3728 bytes --] On Wed, Jul 26, 2017 at 12:34:10PM +0200, Richard Biener wrote: > On Tue, 25 Jul 2017, Jakub Jelinek wrote: > > > Hi! > > > > I'd like to ping 2 patches: > > > > - UBSAN -fsanitize=pointer-overflow support > > - http://gcc.gnu.org/ml/gcc-patches/2017-06/msg01365.html > > The probablility stuff might need updating? Yes, done in my copy. > Can you put the TYPE_PRECISION (sizetype) != POINTER_SIZE check > in option processing and inform people that pointer overflow sanitizing > is not done instead? That is problematic, because during the option processing sizetype is NULL, it is set up only much later. And that processing depends on the options being finalized and backend initialized etc. I guess I could emit a warning in the sanopt pass once or something. Or do it very late in do_compile, after lang_dependent_init (we don't handle any other option there though). But it is still just a theoretical case, because libubsan is supported only on selected subset of targets and none of those have such weird sizetype vs. pointer size setup. And without libubsan, the only thing one could do would be -fsanitize=undefined -fsanitize-undefined-trap-on-error or -fsanitize=pointer-overflow -fsanitize-undefined-trap-on-error, otherwise one would run into missing libubsan. > Where you handle DECL_BIT_FIELD_REPRESENTATIVE in > maybe_instrument_pointer_overflow you could instead of building > a new COMPONENT_REF strip the bitfield ref and just remember > DECL_FIELD_OFFSET/BIT_OFFSET to be added to the get_inner_reference > result? That is not enough, the bitfield could be in variable length structure etc. Furthermore, I need that COMPONENT_REF with the representative later in the function, so that I can compute the ptr and base_addr. > You don't seem to use 'size' anywhere. size I thought about but then decided not to do anything with it. There are two cases, one is where there is no ADDR_EXPR and it actually a memory reference. In that case in theory the size could be used, but it would need to be used only for the positive offsets, so like: if (off > 0) { if (ptr + off + size < ptr) runtime_fail; } else if (ptr + off > ptr) runtime_fail; but when it is actually a memory reference, I suppose it will fail at runtime anyway when performing such an access, so I think it is unnecessary. And for the ADDR_EXPR case, the size is irrelevant, we are just taking address of the start of the object. > You fail to allow other handled components -- for no good reason? I was trying to have a quick bail out. What other handled components might be relevant? I guess IMAGPART_EXPR. For say BIT_FIELD_REF I don't think I can tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > You fail to handle > &MEM[ptr + CST] a canonical gimple invariant way of ptr +p CST, > the early out bitpos == 0 will cause non-instrumentation here. Guess I could use: if ((offset == NULL_TREE && bitpos == 0 && (TREE_CODE (inner) != MEM_REF || integer_zerop (TREE_OPERAND (inner, 1)))) The rest of the code will handle it. > (I'd just round down in the case of bitpos % BITS_PER_UNIT != 0) But then the tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); won't work again. > > - noipa attribute addition > > http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html > > Ok. Thanks, will retest it now. Here is the -fsanitize=pointer-overflow patch untested, updated for the probability and other stuff mentioned above. Jakub [-- Attachment #2: U606m --] [-- Type: text/plain, Size: 32385 bytes --] 2017-07-26 Jakub Jelinek <jakub@redhat.com> PR sanitizer/80998 * sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise. * flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW. Or it into SANITIZER_UNDEFINED. * ubsan.c: Include gimple-fold.h and varasm.h. (ubsan_expand_ptr_ifn): New function. (instrument_pointer_overflow): New function. (maybe_instrument_pointer_overflow): New function. (instrument_object_size): Formatting fix. (pass_ubsan::execute): Call instrument_pointer_overflow and maybe_instrument_pointer_overflow. * internal-fn.c (expand_UBSAN_PTR): New function. * ubsan.h (ubsan_expand_ptr_ifn): Declare. * sanitizer.def (__ubsan_handle_pointer_overflow, __ubsan_handle_pointer_overflow_abort): New builtins. * tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR. * internal-fn.def (UBSAN_PTR): New internal function. * opts.c (sanitizer_opts): Add pointer-overflow. * lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR. * fold-const.c (build_range_check): Compute pointer range check in integral type if pointer arithmetics would be needed. Formatting fixes. gcc/testsuite/ * c-c++-common/ubsan/ptr-overflow-1.c: New test. * c-c++-common/ubsan/ptr-overflow-2.c: New test. libsanitizer/ * ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461. * ubsan/ubsan_checks.inc: Likewise. * ubsan/ubsan_handlers.h: Likewise. --- gcc/sanopt.c.jj 2017-07-04 13:51:47.781815329 +0200 +++ gcc/sanopt.c 2017-07-26 13:44:13.833204640 +0200 @@ -1062,6 +1062,9 @@ pass_sanopt::execute (function *fun) case IFN_UBSAN_OBJECT_SIZE: no_next = ubsan_expand_objsize_ifn (&gsi); break; + case IFN_UBSAN_PTR: + no_next = ubsan_expand_ptr_ifn (&gsi); + break; case IFN_UBSAN_VPTR: no_next = ubsan_expand_vptr_ifn (&gsi); break; --- gcc/tree-ssa-alias.c.jj 2017-06-19 08:26:17.274597722 +0200 +++ gcc/tree-ssa-alias.c 2017-07-26 13:44:13.834204628 +0200 @@ -1991,6 +1991,7 @@ call_may_clobber_ref_p_1 (gcall *call, a case IFN_UBSAN_BOUNDS: case IFN_UBSAN_VPTR: case IFN_UBSAN_OBJECT_SIZE: + case IFN_UBSAN_PTR: case IFN_ASAN_CHECK: return false; default: --- gcc/flag-types.h.jj 2017-06-19 08:26:17.593593662 +0200 +++ gcc/flag-types.h 2017-07-26 13:44:13.834204628 +0200 @@ -238,6 +238,7 @@ enum sanitize_code { SANITIZE_OBJECT_SIZE = 1UL << 21, SANITIZE_VPTR = 1UL << 22, SANITIZE_BOUNDS_STRICT = 1UL << 23, + SANITIZE_POINTER_OVERFLOW = 1UL << 24, SANITIZE_SHIFT = SANITIZE_SHIFT_BASE | SANITIZE_SHIFT_EXPONENT, SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN @@ -245,7 +246,8 @@ enum sanitize_code { | SANITIZE_BOUNDS | SANITIZE_ALIGNMENT | SANITIZE_NONNULL_ATTRIBUTE | SANITIZE_RETURNS_NONNULL_ATTRIBUTE - | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR, + | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR + | SANITIZE_POINTER_OVERFLOW, SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST | SANITIZE_BOUNDS_STRICT }; --- gcc/ubsan.c.jj 2017-06-30 09:49:32.306609364 +0200 +++ gcc/ubsan.c 2017-07-26 15:37:11.649228991 +0200 @@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. #include "builtins.h" #include "tree-object-size.h" #include "tree-cfg.h" +#include "gimple-fold.h" +#include "varasm.h" /* Map from a tree to a VAR_DECL tree. */ @@ -1029,6 +1031,170 @@ ubsan_expand_objsize_ifn (gimple_stmt_it return true; } +/* Expand UBSAN_PTR internal call. */ + +bool +ubsan_expand_ptr_ifn (gimple_stmt_iterator *gsip) +{ + gimple_stmt_iterator gsi = *gsip; + gimple *stmt = gsi_stmt (gsi); + location_t loc = gimple_location (stmt); + gcc_assert (gimple_call_num_args (stmt) == 2); + tree ptr = gimple_call_arg (stmt, 0); + tree off = gimple_call_arg (stmt, 1); + + if (integer_zerop (off)) + { + gsi_remove (gsip, true); + unlink_stmt_vdef (stmt); + return true; + } + + basic_block cur_bb = gsi_bb (gsi); + tree ptrplusoff = make_ssa_name (pointer_sized_int_node); + tree ptri = make_ssa_name (pointer_sized_int_node); + int pos_neg = get_range_pos_neg (off); + + /* Split the original block holding the pointer dereference. */ + edge e = split_block (cur_bb, stmt); + + /* Get a hold on the 'condition block', the 'then block' and the + 'else block'. */ + basic_block cond_bb = e->src; + basic_block fallthru_bb = e->dest; + basic_block then_bb = create_empty_bb (cond_bb); + basic_block cond_pos_bb = NULL, cond_neg_bb = NULL; + add_bb_to_loop (then_bb, cond_bb->loop_father); + loops_state_set (LOOPS_NEED_FIXUP); + + /* Set up the fallthrough basic block. */ + e->flags = EDGE_FALSE_VALUE; + if (pos_neg != 3) + { + e->count = cond_bb->count; + e->probability = profile_probability::very_likely (); + + /* Connect 'then block' with the 'else block'. This is needed + as the ubsan routines we call in the 'then block' are not noreturn. + The 'then block' only has one outcoming edge. */ + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); + + /* Make an edge coming from the 'cond block' into the 'then block'; + this edge is unlikely taken, so set up the probability + accordingly. */ + e = make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + } + else + { + profile_count count = cond_bb->count.apply_probability (PROB_EVEN); + e->count = count; + e->probability = profile_probability::even (); + + e = split_block (fallthru_bb, (gimple *) NULL); + cond_neg_bb = e->src; + fallthru_bb = e->dest; + e->count = count; + e->probability = profile_probability::very_likely (); + e->flags = EDGE_FALSE_VALUE; + + e = make_edge (cond_neg_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + + cond_pos_bb = create_empty_bb (cond_bb); + add_bb_to_loop (cond_pos_bb, cond_bb->loop_father); + + e = make_edge (cond_bb, cond_pos_bb, EDGE_TRUE_VALUE); + e->count = count; + e->probability = profile_probability::even (); + + e = make_edge (cond_pos_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + + e = make_edge (cond_pos_bb, fallthru_bb, EDGE_FALSE_VALUE); + e->count = count; + e->probability = profile_probability::very_likely (); + + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); + } + + gimple *g = gimple_build_assign (ptri, NOP_EXPR, ptr); + gimple_set_location (g, loc); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + g = gimple_build_assign (ptrplusoff, PLUS_EXPR, ptri, off); + gimple_set_location (g, loc); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + + /* Update dominance info for the newly created then_bb; note that + fallthru_bb's dominance info has already been updated by + split_block. */ + if (dom_info_available_p (CDI_DOMINATORS)) + { + set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb); + if (pos_neg == 3) + { + set_immediate_dominator (CDI_DOMINATORS, cond_pos_bb, cond_bb); + set_immediate_dominator (CDI_DOMINATORS, fallthru_bb, cond_bb); + } + } + + /* Put the ubsan builtin call into the newly created BB. */ + if (flag_sanitize_undefined_trap_on_error) + g = gimple_build_call (builtin_decl_implicit (BUILT_IN_TRAP), 0); + else + { + enum built_in_function bcode + = (flag_sanitize_recover & SANITIZE_POINTER_OVERFLOW) + ? BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW + : BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT; + tree fn = builtin_decl_implicit (bcode); + tree data + = ubsan_create_data ("__ubsan_ptrovf_data", 1, &loc, + NULL_TREE, NULL_TREE); + data = build_fold_addr_expr_loc (loc, data); + g = gimple_build_call (fn, 3, data, ptr, ptrplusoff); + } + gimple_stmt_iterator gsi2 = gsi_start_bb (then_bb); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + /* Unlink the UBSAN_PTRs vops before replacing it. */ + unlink_stmt_vdef (stmt); + + if (TREE_CODE (off) == INTEGER_CST) + g = gimple_build_cond (wi::neg_p (off) ? LT_EXPR : GE_EXPR, ptri, + fold_build1 (NEGATE_EXPR, sizetype, off), + NULL_TREE, NULL_TREE); + else if (pos_neg != 3) + g = gimple_build_cond (pos_neg == 1 ? LT_EXPR : GT_EXPR, + ptrplusoff, ptri, NULL_TREE, NULL_TREE); + else + { + gsi2 = gsi_start_bb (cond_pos_bb); + g = gimple_build_cond (LT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + gsi2 = gsi_start_bb (cond_neg_bb); + g = gimple_build_cond (GT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + gimple_seq seq = NULL; + tree t = gimple_build (&seq, loc, NOP_EXPR, ssizetype, off); + t = gimple_build (&seq, loc, GE_EXPR, boolean_type_node, + t, ssize_int (0)); + gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT); + g = gimple_build_cond (NE_EXPR, t, boolean_false_node, + NULL_TREE, NULL_TREE); + } + gimple_set_location (g, loc); + /* Replace the UBSAN_PTR with a GIMPLE_COND stmt. */ + gsi_replace (&gsi, g, false); + return false; +} + + /* Cached __ubsan_vptr_type_cache decl. */ static GTY(()) tree ubsan_vptr_type_cache_decl; @@ -1234,6 +1400,107 @@ instrument_null (gimple_stmt_iterator gs instrument_mem_ref (t, base, &gsi, is_lhs); } +/* Instrument pointer arithmetics PTR p+ OFF. */ + +static void +instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree ptr, tree off) +{ + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) + return; + gcall *g = gimple_build_call_internal (IFN_UBSAN_PTR, 2, ptr, off); + gimple_set_location (g, gimple_location (gsi_stmt (*gsi))); + gsi_insert_before (gsi, g, GSI_SAME_STMT); +} + +/* Instrument pointer arithmetics if any. */ + +static void +maybe_instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree t) +{ + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) + return; + /* Handle also e.g. &s->i. */ + if (TREE_CODE (t) == ADDR_EXPR) + t = TREE_OPERAND (t, 0); + + switch (TREE_CODE (t)) + { + case COMPONENT_REF: + if (TREE_CODE (t) == COMPONENT_REF + && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)) != NULL_TREE) + { + tree repr = DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)); + t = build3 (COMPONENT_REF, TREE_TYPE (repr), TREE_OPERAND (t, 0), + repr, TREE_OPERAND (t, 2)); + } + break; + case ARRAY_REF: + case MEM_REF: + case REALPART_EXPR: + case IMAGPART_EXPR: + break; + default: + return; + } + + HOST_WIDE_INT bitsize, bitpos; + tree offset; + machine_mode mode; + int volatilep = 0, reversep, unsignedp = 0; + tree inner = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode, + &unsignedp, &reversep, &volatilep); + + if ((offset == NULL_TREE + && bitpos == 0 + && (TREE_CODE (inner) != MEM_REF + || integer_zerop (TREE_OPERAND (inner, 1)))) + || bitpos % BITS_PER_UNIT != 0) + return; + + bool decl_p = DECL_P (inner); + tree base; + if (decl_p) + { + if (DECL_REGISTER (inner)) + return; + base = inner; + /* If BASE is a fixed size automatic variable or + global variable defined in the current TU and bitpos + fits, don't instrument anything. */ + if (offset == NULL_TREE + && bitpos > 0 + && (VAR_P (base) + || TREE_CODE (base) == PARM_DECL + || TREE_CODE (base) == RESULT_DECL) + && DECL_SIZE (base) + && TREE_CODE (DECL_SIZE (base)) == INTEGER_CST + && compare_tree_int (DECL_SIZE (base), bitpos) >= 0 + && (!is_global_var (base) || decl_binds_to_current_def_p (base))) + return; + } + else if (TREE_CODE (inner) == MEM_REF) + base = TREE_OPERAND (inner, 0); + else + return; + tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); + + if (!POINTER_TYPE_P (TREE_TYPE (base)) && !DECL_P (base)) + return; + + tree base_addr = base; + if (decl_p) + base_addr = build1 (ADDR_EXPR, + build_pointer_type (TREE_TYPE (base)), base); + t = fold_build2 (MINUS_EXPR, sizetype, + fold_convert (pointer_sized_int_node, ptr), + fold_convert (pointer_sized_int_node, base_addr)); + t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE, true, + GSI_SAME_STMT); + base_addr = force_gimple_operand_gsi (gsi, base_addr, true, NULL_TREE, true, + GSI_SAME_STMT); + instrument_pointer_overflow (gsi, base_addr, t); +} + /* Build an ubsan builtin call for the signed-integer-overflow sanitization. CODE says what kind of builtin are we building, LOC is a location, LHSTYPE is the type of LHS, OP0 and OP1 @@ -1849,7 +2116,7 @@ instrument_object_size (gimple_stmt_iter { tree rhs1 = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (rhs1) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) break; else base = rhs1; @@ -1973,7 +2240,8 @@ public: | SANITIZE_ALIGNMENT | SANITIZE_NONNULL_ATTRIBUTE | SANITIZE_RETURNS_NONNULL_ATTRIBUTE - | SANITIZE_OBJECT_SIZE)); + | SANITIZE_OBJECT_SIZE + | SANITIZE_POINTER_OVERFLOW)); } virtual unsigned int execute (function *); @@ -2064,6 +2332,32 @@ pass_ubsan::execute (function *fun) } } } + + if (sanitize_flags_p (SANITIZE_POINTER_OVERFLOW, fun->decl)) + { + if (is_gimple_assign (stmt) + && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) + instrument_pointer_overflow (&gsi, + gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt)); + if (gimple_store_p (stmt)) + maybe_instrument_pointer_overflow (&gsi, + gimple_get_lhs (stmt)); + if (gimple_assign_single_p (stmt)) + maybe_instrument_pointer_overflow (&gsi, + gimple_assign_rhs1 (stmt)); + if (is_gimple_call (stmt)) + { + unsigned args_num = gimple_call_num_args (stmt); + for (unsigned i = 0; i < args_num; ++i) + { + tree arg = gimple_call_arg (stmt, i); + if (is_gimple_reg (arg)) + continue; + maybe_instrument_pointer_overflow (&gsi, arg); + } + } + } gsi_next (&gsi); } --- gcc/internal-fn.c.jj 2017-07-17 10:08:34.923647976 +0200 +++ gcc/internal-fn.c 2017-07-26 13:44:13.837204592 +0200 @@ -402,6 +402,14 @@ expand_UBSAN_VPTR (internal_fn, gcall *) /* This should get expanded in the sanopt pass. */ static void +expand_UBSAN_PTR (internal_fn, gcall *) +{ + gcc_unreachable (); +} + +/* This should get expanded in the sanopt pass. */ + +static void expand_UBSAN_OBJECT_SIZE (internal_fn, gcall *) { gcc_unreachable (); --- gcc/ubsan.h.jj 2017-06-20 09:05:22.498654128 +0200 +++ gcc/ubsan.h 2017-07-26 13:44:13.837204592 +0200 @@ -52,6 +52,7 @@ enum ubsan_encode_value_phase { extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *); +extern bool ubsan_expand_ptr_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_vptr_ifn (gimple_stmt_iterator *); extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *); extern tree ubsan_create_data (const char *, int, const location_t *, ...); --- gcc/sanitizer.def.jj 2017-07-06 20:31:32.835082221 +0200 +++ gcc/sanitizer.def 2017-07-26 13:44:13.837204592 +0200 @@ -448,6 +448,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN "__ubsan_handle_load_invalid_value", BT_FN_VOID_PTR_PTR, ATTR_COLD_NOTHROW_LEAF_LIST) +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW, + "__ubsan_handle_pointer_overflow", + BT_FN_VOID_PTR_PTR_PTR, + ATTR_COLD_NOTHROW_LEAF_LIST) DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW_ABORT, "__ubsan_handle_divrem_overflow_abort", BT_FN_VOID_PTR_PTR_PTR, @@ -484,6 +488,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN "__ubsan_handle_load_invalid_value_abort", BT_FN_VOID_PTR_PTR, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT, + "__ubsan_handle_pointer_overflow_abort", + BT_FN_VOID_PTR_PTR_PTR, + ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW, "__ubsan_handle_float_cast_overflow", BT_FN_VOID_PTR_PTR, --- gcc/tree-ssa-tail-merge.c.jj 2017-07-03 19:03:29.467756294 +0200 +++ gcc/tree-ssa-tail-merge.c 2017-07-26 13:44:13.838204580 +0200 @@ -1241,6 +1241,7 @@ merge_stmts_p (gimple *stmt1, gimple *st case IFN_UBSAN_CHECK_SUB: case IFN_UBSAN_CHECK_MUL: case IFN_UBSAN_OBJECT_SIZE: + case IFN_UBSAN_PTR: case IFN_ASAN_CHECK: /* For these internal functions, gimple_location is an implicit parameter, which will be used explicitly after expansion. --- gcc/internal-fn.def.jj 2017-07-06 20:31:43.930946892 +0200 +++ gcc/internal-fn.def 2017-07-26 13:44:13.838204580 +0200 @@ -166,6 +166,7 @@ DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) +DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.") DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL) DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) --- gcc/opts.c.jj 2017-07-26 13:37:44.955908409 +0200 +++ gcc/opts.c 2017-07-26 13:44:13.839204567 +0200 @@ -1521,6 +1521,7 @@ const struct sanitizer_opts_s sanitizer_ true), SANITIZER_OPT (object-size, SANITIZE_OBJECT_SIZE, true), SANITIZER_OPT (vptr, SANITIZE_VPTR, true), + SANITIZER_OPT (pointer-overflow, SANITIZE_POINTER_OVERFLOW, true), SANITIZER_OPT (all, ~0U, true), #undef SANITIZER_OPT { NULL, 0U, 0UL, false } --- gcc/lto-streamer-in.c.jj 2017-06-30 09:49:28.006662098 +0200 +++ gcc/lto-streamer-in.c 2017-07-26 13:44:13.840204555 +0200 @@ -1143,6 +1143,10 @@ input_function (tree fn_decl, struct dat if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0) remove = true; break; + case IFN_UBSAN_PTR: + if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0) + remove = true; + break; case IFN_ASAN_MARK: if ((flag_sanitize & SANITIZE_ADDRESS) == 0) remove = true; --- gcc/fold-const.c.jj 2017-07-25 12:19:45.423601159 +0200 +++ gcc/fold-const.c 2017-07-26 14:59:51.908708150 +0200 @@ -4859,21 +4859,21 @@ build_range_check (location_t loc, tree if (low == 0) return fold_build2_loc (loc, LE_EXPR, type, exp, - fold_convert_loc (loc, etype, high)); + fold_convert_loc (loc, etype, high)); if (high == 0) return fold_build2_loc (loc, GE_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (operand_equal_p (low, high, 0)) return fold_build2_loc (loc, EQ_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (TREE_CODE (exp) == BIT_AND_EXPR && maskable_range_p (low, high, etype, &mask, &value)) return fold_build2_loc (loc, EQ_EXPR, type, fold_build2_loc (loc, BIT_AND_EXPR, etype, - exp, mask), + exp, mask), value); if (integer_zerop (low)) @@ -4905,7 +4905,7 @@ build_range_check (location_t loc, tree exp = fold_convert_loc (loc, etype, exp); } return fold_build2_loc (loc, GT_EXPR, type, exp, - build_int_cst (etype, 0)); + build_int_cst (etype, 0)); } } @@ -4915,25 +4915,15 @@ build_range_check (location_t loc, tree if (etype == NULL_TREE) return NULL_TREE; + if (POINTER_TYPE_P (etype)) + etype = unsigned_type_for (etype); + high = fold_convert_loc (loc, etype, high); low = fold_convert_loc (loc, etype, low); exp = fold_convert_loc (loc, etype, exp); value = const_binop (MINUS_EXPR, high, low); - - if (POINTER_TYPE_P (etype)) - { - if (value != 0 && !TREE_OVERFLOW (value)) - { - low = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (low), low); - return build_range_check (loc, type, - fold_build_pointer_plus_loc (loc, exp, low), - 1, build_int_cst (etype, 0), value); - } - return 0; - } - if (value != 0 && !TREE_OVERFLOW (value)) return build_range_check (loc, type, fold_build2_loc (loc, MINUS_EXPR, etype, exp, low), --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c.jj 2017-07-26 13:44:13.840204555 +0200 +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c 2017-07-26 13:44:13.840204555 +0200 @@ -0,0 +1,65 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -Wall" } */ + +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) char *f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char *f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char *f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char *f4 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char *f5 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char *f6 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) int *f7 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f8 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f9 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f10 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +struct S *volatile q; +char a[64]; +struct S s; +int *volatile r; + +int +main () +{ + struct S t; + p = &a[32]; + p = f1 (p); + p = f1 (p); + p = f2 (p); + p = f3 (p, 1); + p = f3 (p, -1); + p = f3 (p, 3); + p = f3 (p, -6); + p = f4 (p, 1); + p = f4 (p, -1); + p = f4 (p, 3); + p = f4 (p, -6); + p = f5 (p, 1); + p = f5 (p, 3); + p = f6 (p, 1); + p = f6 (p, 3); + if (sizeof (unsigned long) >= sizeof (char *)) + { + p = f5 (p, -1); + p = f5 (p, -6); + p = f6 (p, -1); + p = f6 (p, -6); + } + q = &s; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + q = &t; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + return 0; +} --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c.jj 2017-07-26 13:44:13.840204555 +0200 +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c 2017-07-26 13:44:13.840204555 +0200 @@ -0,0 +1,113 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -fno-ipa-icf -Wall" } */ + +__attribute__((noinline, noclone)) char * f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char * f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char * f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f4 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f5 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f6 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f7 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f8 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f9 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) char * f10 (char *p, unsigned long int i) { return p - i; } +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) int *f11 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f12 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f13 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f14 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f15 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f16 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f17 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f18 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f19 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f20 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f21 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f22 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f23 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f24 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f25 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +__UINTPTR_TYPE__ volatile u; +struct S *volatile q; +int *volatile r; + +int +main () +{ + u = ~(__UINTPTR_TYPE__) 0; + p = (char *) u; + p = f1 (p); + u = 0; + p = (char *) u; + p = f2 (p); + u = -(__UINTPTR_TYPE__) 7; + p = (char *) u; + p = f3 (p, 7); + u = 3; + p = (char *) u; + p = f4 (p, -4); + u = 23; + p = (char *) u; + p = f5 (p, 27); + u = -(__UINTPTR_TYPE__) 15; + p = (char *) u; + p = f6 (p, -15); + u = -(__UINTPTR_TYPE__) 29; + p = (char *) u; + p = f7 (p, 31); + u = 23; + p = (char *) u; + p = f9 (p, 24); + if (sizeof (unsigned long) < sizeof (char *)) + return 0; + u = 7; + p = (char *) u; + p = f8 (p, -8); + u = -(__UINTPTR_TYPE__) 25; + p = (char *) u; + p = f10 (p, -25); + u = ~(__UINTPTR_TYPE__) 0; + q = (struct S *) u; + r = f11 (q); + r = f12 (q); + r = f13 (q); + r = f14 (q, 0); + r = f15 (q, 63); + u = ~(__UINTPTR_TYPE__) 0 - (17 * sizeof (int)); + q = (struct S *) u; + r = f16 (q); + r = f17 (q); + r = f18 (q); + r = f19 (q, 0); + r = f20 (q, 63); + u = 3 * sizeof (int); + q = (struct S *) u; + r = f21 (q); + r = f22 (q); + r = f23 (q); + r = f24 (q, -2); + r = f25 (q, -6); + return 0; +} + +/* { dg-output ":5:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:6:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+ overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:7:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+9 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:8:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+3 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:9:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+\[cC](\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:10:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+1 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:11:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]3 overflowed to (0\[xX])?0\+2(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:13:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:12:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+7 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:14:\[89]\[91]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]7 overflowed to (0\[xX])?0\+" } */ +/* { dg-output "(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:17:\[67]\[82]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:18:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+107(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:19:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+7(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:20:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+103(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:23:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[cC]3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:25:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[bB]\[fF](\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:30:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+\[cC] overflowed to (0\[xX])?\[fF]\+\[cC]" { target int32 } } */ --- libsanitizer/ubsan/ubsan_handlers.cc.jj 2017-06-19 08:26:17.073600279 +0200 +++ libsanitizer/ubsan/ubsan_handlers.cc 2017-07-26 13:44:14.261199463 +0200 @@ -521,6 +521,37 @@ void __ubsan::__ubsan_handle_nonnull_arg Die(); } +static void handlePointerOverflowImpl(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result, + ReportOptions Opts) { + SourceLocation Loc = Data->Loc.acquire(); + ErrorType ET = ErrorType::PointerOverflow; + + if (ignoreReport(Loc, Opts, ET)) + return; + + ScopedReport R(Opts, Loc, ET); + + Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1") + << (void *)Base << (void*)Result; +} + +void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result) { + GET_REPORT_OPTIONS(false); + handlePointerOverflowImpl(Data, Base, Result, Opts); +} + +void __ubsan::__ubsan_handle_pointer_overflow_abort(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result) { + GET_REPORT_OPTIONS(true); + handlePointerOverflowImpl(Data, Base, Result, Opts); + Die(); +} + static void handleCFIBadIcall(CFICheckFailData *Data, ValueHandle Function, ReportOptions Opts) { if (Data->CheckKind != CFITCK_ICall) --- libsanitizer/ubsan/ubsan_checks.inc.jj 2017-06-19 08:26:17.061600432 +0200 +++ libsanitizer/ubsan/ubsan_checks.inc 2017-07-26 13:44:14.275199294 +0200 @@ -17,6 +17,7 @@ UBSAN_CHECK(GenericUB, "undefined-behavior", "undefined") UBSAN_CHECK(NullPointerUse, "null-pointer-use", "null") +UBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow") UBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment") UBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size") UBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow", --- libsanitizer/ubsan/ubsan_handlers.h.jj 2017-06-19 08:26:17.073600279 +0200 +++ libsanitizer/ubsan/ubsan_handlers.h 2017-07-26 13:44:14.282199209 +0200 @@ -146,6 +146,13 @@ struct NonNullArgData { /// \brief Handle passing null pointer to function with nonnull attribute. RECOVERABLE(nonnull_arg, NonNullArgData *Data) +struct PointerOverflowData { + SourceLocation Loc; +}; + +RECOVERABLE(pointer_overflow, PointerOverflowData *Data, ValueHandle Base, + ValueHandle Result) + /// \brief Known CFI check kinds. /// Keep in sync with the enum of the same name in CodeGenFunction.h enum CFITypeCheckKind : unsigned char { ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-26 13:47 ` Jakub Jelinek @ 2017-07-26 14:13 ` Richard Biener 2017-07-26 17:31 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2017-07-26 14:13 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches On Wed, 26 Jul 2017, Jakub Jelinek wrote: > On Wed, Jul 26, 2017 at 12:34:10PM +0200, Richard Biener wrote: > > On Tue, 25 Jul 2017, Jakub Jelinek wrote: > > > > > Hi! > > > > > > I'd like to ping 2 patches: > > > > > > - UBSAN -fsanitize=pointer-overflow support > > > - http://gcc.gnu.org/ml/gcc-patches/2017-06/msg01365.html > > > > The probablility stuff might need updating? > > Yes, done in my copy. > > > Can you put the TYPE_PRECISION (sizetype) != POINTER_SIZE check > > in option processing and inform people that pointer overflow sanitizing > > is not done instead? > > That is problematic, because during the option processing sizetype > is NULL, it is set up only much later. And that processing depends on Ah, ok - fine then as-is. > the options being finalized and backend initialized etc. > I guess I could emit a warning in the sanopt pass once or something. > Or do it very late in do_compile, after lang_dependent_init (we don't > handle any other option there though). > But it is still just a theoretical case, because libubsan is supported > only on selected subset of targets and none of those have such weird > sizetype vs. pointer size setup. And without libubsan, the only thing > one could do would be -fsanitize=undefined -fsanitize-undefined-trap-on-error > or -fsanitize=pointer-overflow -fsanitize-undefined-trap-on-error, > otherwise one would run into missing libubsan. > > > Where you handle DECL_BIT_FIELD_REPRESENTATIVE in > > maybe_instrument_pointer_overflow you could instead of building > > a new COMPONENT_REF strip the bitfield ref and just remember > > DECL_FIELD_OFFSET/BIT_OFFSET to be added to the get_inner_reference > > result? > > That is not enough, the bitfield could be in variable length structure etc. > Furthermore, I need that COMPONENT_REF with the representative later > in the function, so that I can compute the ptr and base_addr. Ok. > > You don't seem to use 'size' anywhere. > > size I thought about but then decided not to do anything with it. > There are two cases, one is where there is no ADDR_EXPR and it actually > a memory reference. > In that case in theory the size could be used, but it would need > to be used only for the positive offsets, so like: > if (off > 0) { > if (ptr + off + size < ptr) > runtime_fail; > } else if (ptr + off > ptr) > runtime_fail; > but when it is actually a memory reference, I suppose it will fail > at runtime anyway when performing such an access, so I think it is > unnecessary. And for the ADDR_EXPR case, the size is irrelevant, we > are just taking address of the start of the object. > > > You fail to allow other handled components -- for no good reason? > > I was trying to have a quick bail out. What other handled components might > be relevant? I guess IMAGPART_EXPR. For say BIT_FIELD_REF I don't think > I can > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); REALPART/IMAGPART_EXPR, yes. You can't address BIT_FIELD_REF apart those on byte boundary (&vector[4] is eventually folded to a BIT_FIELD_REF). Similar for VIEW_CONVERT_EXPR, but you are only building the address on the base? > > You fail to handle > > &MEM[ptr + CST] a canonical gimple invariant way of ptr +p CST, > > the early out bitpos == 0 will cause non-instrumentation here. > > Guess I could use: > if ((offset == NULL_TREE > && bitpos == 0 > && (TREE_CODE (inner) != MEM_REF > || integer_zerop (TREE_OPERAND (inner, 1)))) > The rest of the code will handle it. Yeah. > > > (I'd just round down in the case of bitpos % BITS_PER_UNIT != 0) > > But then the > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > won't work again. Hmm. So instead of building the address on the original tree you could build the difference based on what get_inner_reference returns in bitpos/offset? > > > - noipa attribute addition > > > http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html > > > > Ok. > > Thanks, will retest it now. > > Here is the -fsanitize=pointer-overflow patch untested, updated > for the probability and other stuff mentioned above. > > Jakub > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-26 14:13 ` Richard Biener @ 2017-07-26 17:31 ` Jakub Jelinek 2017-07-27 7:19 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-07-26 17:31 UTC (permalink / raw) To: Richard Biener; +Cc: Jan Hubicka, gcc-patches On Wed, Jul 26, 2017 at 04:13:30PM +0200, Richard Biener wrote: > > > You don't seem to use 'size' anywhere. > > > > size I thought about but then decided not to do anything with it. > > There are two cases, one is where there is no ADDR_EXPR and it actually > > a memory reference. > > In that case in theory the size could be used, but it would need > > to be used only for the positive offsets, so like: > > if (off > 0) { > > if (ptr + off + size < ptr) > > runtime_fail; > > } else if (ptr + off > ptr) > > runtime_fail; > > but when it is actually a memory reference, I suppose it will fail > > at runtime anyway when performing such an access, so I think it is > > unnecessary. And for the ADDR_EXPR case, the size is irrelevant, we > > are just taking address of the start of the object. > > > > > You fail to allow other handled components -- for no good reason? > > > > I was trying to have a quick bail out. What other handled components might > > be relevant? I guess IMAGPART_EXPR. For say BIT_FIELD_REF I don't think > > I can > > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > > REALPART/IMAGPART_EXPR, yes. You can't address BIT_FIELD_REF > apart those on byte boundary (&vector[4] is eventually folded to > a BIT_FIELD_REF). Similar for VIEW_CONVERT_EXPR, but you are > only building the address on the base? > > > > You fail to handle > > > &MEM[ptr + CST] a canonical gimple invariant way of ptr +p CST, > > > the early out bitpos == 0 will cause non-instrumentation here. > > > > Guess I could use: > > if ((offset == NULL_TREE > > && bitpos == 0 > > && (TREE_CODE (inner) != MEM_REF > > || integer_zerop (TREE_OPERAND (inner, 1)))) > > The rest of the code will handle it. > > Yeah. > > > > > > (I'd just round down in the case of bitpos % BITS_PER_UNIT != 0) > > > > But then the > > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > > won't work again. > > Hmm. So instead of building the address on the original tree you > could build the difference based on what get_inner_reference returns > in bitpos/offset? I'm building both addresses and subtracting them to get the offset. I guess the other option is to compute just the address of the base (i.e. base_addr), and add offset (if non-NULL) plus bitpos / BITS_PER_UNIT plus offset from the MEM_REF (if any). In that case it would probably handle any handled_component_p and bitfields too. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-26 17:31 ` Jakub Jelinek @ 2017-07-27 7:19 ` Richard Biener 2017-07-27 8:35 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2017-07-27 7:19 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches On Wed, 26 Jul 2017, Jakub Jelinek wrote: > On Wed, Jul 26, 2017 at 04:13:30PM +0200, Richard Biener wrote: > > > > You don't seem to use 'size' anywhere. > > > > > > size I thought about but then decided not to do anything with it. > > > There are two cases, one is where there is no ADDR_EXPR and it actually > > > a memory reference. > > > In that case in theory the size could be used, but it would need > > > to be used only for the positive offsets, so like: > > > if (off > 0) { > > > if (ptr + off + size < ptr) > > > runtime_fail; > > > } else if (ptr + off > ptr) > > > runtime_fail; > > > but when it is actually a memory reference, I suppose it will fail > > > at runtime anyway when performing such an access, so I think it is > > > unnecessary. And for the ADDR_EXPR case, the size is irrelevant, we > > > are just taking address of the start of the object. > > > > > > > You fail to allow other handled components -- for no good reason? > > > > > > I was trying to have a quick bail out. What other handled components might > > > be relevant? I guess IMAGPART_EXPR. For say BIT_FIELD_REF I don't think > > > I can > > > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > > > > REALPART/IMAGPART_EXPR, yes. You can't address BIT_FIELD_REF > > apart those on byte boundary (&vector[4] is eventually folded to > > a BIT_FIELD_REF). Similar for VIEW_CONVERT_EXPR, but you are > > only building the address on the base? > > > > > > You fail to handle > > > > &MEM[ptr + CST] a canonical gimple invariant way of ptr +p CST, > > > > the early out bitpos == 0 will cause non-instrumentation here. > > > > > > Guess I could use: > > > if ((offset == NULL_TREE > > > && bitpos == 0 > > > && (TREE_CODE (inner) != MEM_REF > > > || integer_zerop (TREE_OPERAND (inner, 1)))) > > > The rest of the code will handle it. > > > > Yeah. > > > > > > > > > (I'd just round down in the case of bitpos % BITS_PER_UNIT != 0) > > > > > > But then the > > > tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); > > > won't work again. > > > > Hmm. So instead of building the address on the original tree you > > could build the difference based on what get_inner_reference returns > > in bitpos/offset? > > I'm building both addresses and subtracting them to get the offset. > I guess the other option is to compute just the address of the base > (i.e. base_addr), and add offset (if non-NULL) plus bitpos / BITS_PER_UNIT > plus offset from the MEM_REF (if any). In that case it would probably > handle any handled_component_p and bitfields too. Yes. Can you try sth along this route? Should be a matter of adding offset and bitpos / BITS_PER_UNIT (thus rounded down) plus any MEM_REF offset on the base. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-27 7:19 ` Richard Biener @ 2017-07-27 8:35 ` Jakub Jelinek 2017-07-28 7:59 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-07-27 8:35 UTC (permalink / raw) To: Richard Biener; +Cc: Jan Hubicka, gcc-patches On Thu, Jul 27, 2017 at 09:19:34AM +0200, Richard Biener wrote: > > I'm building both addresses and subtracting them to get the offset. > > I guess the other option is to compute just the address of the base > > (i.e. base_addr), and add offset (if non-NULL) plus bitpos / BITS_PER_UNIT > > plus offset from the MEM_REF (if any). In that case it would probably > > handle any handled_component_p and bitfields too. > > Yes. Can you try sth along this route? Should be a matter of > adding offset and bitpos / BITS_PER_UNIT (thus rounded down) plus > any MEM_REF offset on the base. Here it is, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2017-07-27 Jakub Jelinek <jakub@redhat.com> PR sanitizer/80998 * sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise. * flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW. Or it into SANITIZER_UNDEFINED. * ubsan.c: Include gimple-fold.h and varasm.h. (ubsan_expand_ptr_ifn): New function. (instrument_pointer_overflow): New function. (maybe_instrument_pointer_overflow): New function. (instrument_object_size): Formatting fix. (pass_ubsan::execute): Call instrument_pointer_overflow and maybe_instrument_pointer_overflow. * internal-fn.c (expand_UBSAN_PTR): New function. * ubsan.h (ubsan_expand_ptr_ifn): Declare. * sanitizer.def (__ubsan_handle_pointer_overflow, __ubsan_handle_pointer_overflow_abort): New builtins. * tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR. * internal-fn.def (UBSAN_PTR): New internal function. * opts.c (sanitizer_opts): Add pointer-overflow. * lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR. * fold-const.c (build_range_check): Compute pointer range check in integral type if pointer arithmetics would be needed. Formatting fixes. gcc/testsuite/ * c-c++-common/ubsan/ptr-overflow-1.c: New test. * c-c++-common/ubsan/ptr-overflow-2.c: New test. libsanitizer/ * ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461. * ubsan/ubsan_checks.inc: Likewise. * ubsan/ubsan_handlers.h: Likewise. --- gcc/sanopt.c.jj 2017-07-04 13:51:47.781815329 +0200 +++ gcc/sanopt.c 2017-07-26 13:44:13.833204640 +0200 @@ -1062,6 +1062,9 @@ pass_sanopt::execute (function *fun) case IFN_UBSAN_OBJECT_SIZE: no_next = ubsan_expand_objsize_ifn (&gsi); break; + case IFN_UBSAN_PTR: + no_next = ubsan_expand_ptr_ifn (&gsi); + break; case IFN_UBSAN_VPTR: no_next = ubsan_expand_vptr_ifn (&gsi); break; --- gcc/tree-ssa-alias.c.jj 2017-06-19 08:26:17.274597722 +0200 +++ gcc/tree-ssa-alias.c 2017-07-26 13:44:13.834204628 +0200 @@ -1991,6 +1991,7 @@ call_may_clobber_ref_p_1 (gcall *call, a case IFN_UBSAN_BOUNDS: case IFN_UBSAN_VPTR: case IFN_UBSAN_OBJECT_SIZE: + case IFN_UBSAN_PTR: case IFN_ASAN_CHECK: return false; default: --- gcc/flag-types.h.jj 2017-06-19 08:26:17.593593662 +0200 +++ gcc/flag-types.h 2017-07-26 13:44:13.834204628 +0200 @@ -238,6 +238,7 @@ enum sanitize_code { SANITIZE_OBJECT_SIZE = 1UL << 21, SANITIZE_VPTR = 1UL << 22, SANITIZE_BOUNDS_STRICT = 1UL << 23, + SANITIZE_POINTER_OVERFLOW = 1UL << 24, SANITIZE_SHIFT = SANITIZE_SHIFT_BASE | SANITIZE_SHIFT_EXPONENT, SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN @@ -245,7 +246,8 @@ enum sanitize_code { | SANITIZE_BOUNDS | SANITIZE_ALIGNMENT | SANITIZE_NONNULL_ATTRIBUTE | SANITIZE_RETURNS_NONNULL_ATTRIBUTE - | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR, + | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR + | SANITIZE_POINTER_OVERFLOW, SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST | SANITIZE_BOUNDS_STRICT }; --- gcc/ubsan.c.jj 2017-06-30 09:49:32.306609364 +0200 +++ gcc/ubsan.c 2017-07-26 20:22:34.718284238 +0200 @@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. #include "builtins.h" #include "tree-object-size.h" #include "tree-cfg.h" +#include "gimple-fold.h" +#include "varasm.h" /* Map from a tree to a VAR_DECL tree. */ @@ -1029,6 +1031,170 @@ ubsan_expand_objsize_ifn (gimple_stmt_it return true; } +/* Expand UBSAN_PTR internal call. */ + +bool +ubsan_expand_ptr_ifn (gimple_stmt_iterator *gsip) +{ + gimple_stmt_iterator gsi = *gsip; + gimple *stmt = gsi_stmt (gsi); + location_t loc = gimple_location (stmt); + gcc_assert (gimple_call_num_args (stmt) == 2); + tree ptr = gimple_call_arg (stmt, 0); + tree off = gimple_call_arg (stmt, 1); + + if (integer_zerop (off)) + { + gsi_remove (gsip, true); + unlink_stmt_vdef (stmt); + return true; + } + + basic_block cur_bb = gsi_bb (gsi); + tree ptrplusoff = make_ssa_name (pointer_sized_int_node); + tree ptri = make_ssa_name (pointer_sized_int_node); + int pos_neg = get_range_pos_neg (off); + + /* Split the original block holding the pointer dereference. */ + edge e = split_block (cur_bb, stmt); + + /* Get a hold on the 'condition block', the 'then block' and the + 'else block'. */ + basic_block cond_bb = e->src; + basic_block fallthru_bb = e->dest; + basic_block then_bb = create_empty_bb (cond_bb); + basic_block cond_pos_bb = NULL, cond_neg_bb = NULL; + add_bb_to_loop (then_bb, cond_bb->loop_father); + loops_state_set (LOOPS_NEED_FIXUP); + + /* Set up the fallthrough basic block. */ + e->flags = EDGE_FALSE_VALUE; + if (pos_neg != 3) + { + e->count = cond_bb->count; + e->probability = profile_probability::very_likely (); + + /* Connect 'then block' with the 'else block'. This is needed + as the ubsan routines we call in the 'then block' are not noreturn. + The 'then block' only has one outcoming edge. */ + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); + + /* Make an edge coming from the 'cond block' into the 'then block'; + this edge is unlikely taken, so set up the probability + accordingly. */ + e = make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + } + else + { + profile_count count = cond_bb->count.apply_probability (PROB_EVEN); + e->count = count; + e->probability = profile_probability::even (); + + e = split_block (fallthru_bb, (gimple *) NULL); + cond_neg_bb = e->src; + fallthru_bb = e->dest; + e->count = count; + e->probability = profile_probability::very_likely (); + e->flags = EDGE_FALSE_VALUE; + + e = make_edge (cond_neg_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + + cond_pos_bb = create_empty_bb (cond_bb); + add_bb_to_loop (cond_pos_bb, cond_bb->loop_father); + + e = make_edge (cond_bb, cond_pos_bb, EDGE_TRUE_VALUE); + e->count = count; + e->probability = profile_probability::even (); + + e = make_edge (cond_pos_bb, then_bb, EDGE_TRUE_VALUE); + e->probability = profile_probability::very_unlikely (); + + e = make_edge (cond_pos_bb, fallthru_bb, EDGE_FALSE_VALUE); + e->count = count; + e->probability = profile_probability::very_likely (); + + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); + } + + gimple *g = gimple_build_assign (ptri, NOP_EXPR, ptr); + gimple_set_location (g, loc); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + g = gimple_build_assign (ptrplusoff, PLUS_EXPR, ptri, off); + gimple_set_location (g, loc); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + + /* Update dominance info for the newly created then_bb; note that + fallthru_bb's dominance info has already been updated by + split_block. */ + if (dom_info_available_p (CDI_DOMINATORS)) + { + set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb); + if (pos_neg == 3) + { + set_immediate_dominator (CDI_DOMINATORS, cond_pos_bb, cond_bb); + set_immediate_dominator (CDI_DOMINATORS, fallthru_bb, cond_bb); + } + } + + /* Put the ubsan builtin call into the newly created BB. */ + if (flag_sanitize_undefined_trap_on_error) + g = gimple_build_call (builtin_decl_implicit (BUILT_IN_TRAP), 0); + else + { + enum built_in_function bcode + = (flag_sanitize_recover & SANITIZE_POINTER_OVERFLOW) + ? BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW + : BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT; + tree fn = builtin_decl_implicit (bcode); + tree data + = ubsan_create_data ("__ubsan_ptrovf_data", 1, &loc, + NULL_TREE, NULL_TREE); + data = build_fold_addr_expr_loc (loc, data); + g = gimple_build_call (fn, 3, data, ptr, ptrplusoff); + } + gimple_stmt_iterator gsi2 = gsi_start_bb (then_bb); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + /* Unlink the UBSAN_PTRs vops before replacing it. */ + unlink_stmt_vdef (stmt); + + if (TREE_CODE (off) == INTEGER_CST) + g = gimple_build_cond (wi::neg_p (off) ? LT_EXPR : GE_EXPR, ptri, + fold_build1 (NEGATE_EXPR, sizetype, off), + NULL_TREE, NULL_TREE); + else if (pos_neg != 3) + g = gimple_build_cond (pos_neg == 1 ? LT_EXPR : GT_EXPR, + ptrplusoff, ptri, NULL_TREE, NULL_TREE); + else + { + gsi2 = gsi_start_bb (cond_pos_bb); + g = gimple_build_cond (LT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + gsi2 = gsi_start_bb (cond_neg_bb); + g = gimple_build_cond (GT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); + gimple_set_location (g, loc); + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); + + gimple_seq seq = NULL; + tree t = gimple_build (&seq, loc, NOP_EXPR, ssizetype, off); + t = gimple_build (&seq, loc, GE_EXPR, boolean_type_node, + t, ssize_int (0)); + gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT); + g = gimple_build_cond (NE_EXPR, t, boolean_false_node, + NULL_TREE, NULL_TREE); + } + gimple_set_location (g, loc); + /* Replace the UBSAN_PTR with a GIMPLE_COND stmt. */ + gsi_replace (&gsi, g, false); + return false; +} + + /* Cached __ubsan_vptr_type_cache decl. */ static GTY(()) tree ubsan_vptr_type_cache_decl; @@ -1234,6 +1400,111 @@ instrument_null (gimple_stmt_iterator gs instrument_mem_ref (t, base, &gsi, is_lhs); } +/* Instrument pointer arithmetics PTR p+ OFF. */ + +static void +instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree ptr, tree off) +{ + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) + return; + gcall *g = gimple_build_call_internal (IFN_UBSAN_PTR, 2, ptr, off); + gimple_set_location (g, gimple_location (gsi_stmt (*gsi))); + gsi_insert_before (gsi, g, GSI_SAME_STMT); +} + +/* Instrument pointer arithmetics if any. */ + +static void +maybe_instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree t) +{ + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) + return; + + /* Handle also e.g. &s->i. */ + if (TREE_CODE (t) == ADDR_EXPR) + t = TREE_OPERAND (t, 0); + + if (!handled_component_p (t) && TREE_CODE (t) != MEM_REF) + return; + + HOST_WIDE_INT bitsize, bitpos, bytepos; + tree offset; + machine_mode mode; + int volatilep = 0, reversep, unsignedp = 0; + tree inner = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode, + &unsignedp, &reversep, &volatilep); + tree moff = NULL_TREE; + + bool decl_p = DECL_P (inner); + tree base; + if (decl_p) + { + if (DECL_REGISTER (inner)) + return; + base = inner; + /* If BASE is a fixed size automatic variable or + global variable defined in the current TU and bitpos + fits, don't instrument anything. */ + if (offset == NULL_TREE + && bitpos > 0 + && (VAR_P (base) + || TREE_CODE (base) == PARM_DECL + || TREE_CODE (base) == RESULT_DECL) + && DECL_SIZE (base) + && TREE_CODE (DECL_SIZE (base)) == INTEGER_CST + && compare_tree_int (DECL_SIZE (base), bitpos) >= 0 + && (!is_global_var (base) || decl_binds_to_current_def_p (base))) + return; + } + else if (TREE_CODE (inner) == MEM_REF) + { + base = TREE_OPERAND (inner, 0); + if (TREE_CODE (base) == ADDR_EXPR + && DECL_P (TREE_OPERAND (base, 0)) + && !TREE_ADDRESSABLE (TREE_OPERAND (base, 0)) + && !is_global_var (TREE_OPERAND (base, 0))) + return; + moff = TREE_OPERAND (inner, 1); + if (integer_zerop (moff)) + moff = NULL_TREE; + } + else + return; + + if (!POINTER_TYPE_P (TREE_TYPE (base)) && !DECL_P (base)) + return; + bytepos = bitpos / BITS_PER_UNIT; + if (offset == NULL_TREE && bytepos == 0 && moff == NULL_TREE) + return; + + tree base_addr = base; + if (decl_p) + base_addr = build1 (ADDR_EXPR, + build_pointer_type (TREE_TYPE (base)), base); + t = offset; + if (bytepos) + { + if (t) + t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, + build_int_cst (TREE_TYPE (t), bytepos)); + else + t = size_int (bytepos); + } + if (moff) + { + if (t) + t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, + fold_convert (TREE_TYPE (t), moff)); + else + t = fold_convert (sizetype, moff); + } + t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE, true, + GSI_SAME_STMT); + base_addr = force_gimple_operand_gsi (gsi, base_addr, true, NULL_TREE, true, + GSI_SAME_STMT); + instrument_pointer_overflow (gsi, base_addr, t); +} + /* Build an ubsan builtin call for the signed-integer-overflow sanitization. CODE says what kind of builtin are we building, LOC is a location, LHSTYPE is the type of LHS, OP0 and OP1 @@ -1849,7 +2120,7 @@ instrument_object_size (gimple_stmt_iter { tree rhs1 = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (rhs1) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) break; else base = rhs1; @@ -1973,7 +2244,8 @@ public: | SANITIZE_ALIGNMENT | SANITIZE_NONNULL_ATTRIBUTE | SANITIZE_RETURNS_NONNULL_ATTRIBUTE - | SANITIZE_OBJECT_SIZE)); + | SANITIZE_OBJECT_SIZE + | SANITIZE_POINTER_OVERFLOW)); } virtual unsigned int execute (function *); @@ -2064,6 +2336,32 @@ pass_ubsan::execute (function *fun) } } } + + if (sanitize_flags_p (SANITIZE_POINTER_OVERFLOW, fun->decl)) + { + if (is_gimple_assign (stmt) + && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) + instrument_pointer_overflow (&gsi, + gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt)); + if (gimple_store_p (stmt)) + maybe_instrument_pointer_overflow (&gsi, + gimple_get_lhs (stmt)); + if (gimple_assign_single_p (stmt)) + maybe_instrument_pointer_overflow (&gsi, + gimple_assign_rhs1 (stmt)); + if (is_gimple_call (stmt)) + { + unsigned args_num = gimple_call_num_args (stmt); + for (unsigned i = 0; i < args_num; ++i) + { + tree arg = gimple_call_arg (stmt, i); + if (is_gimple_reg (arg)) + continue; + maybe_instrument_pointer_overflow (&gsi, arg); + } + } + } gsi_next (&gsi); } --- gcc/internal-fn.c.jj 2017-07-17 10:08:34.923647976 +0200 +++ gcc/internal-fn.c 2017-07-26 13:44:13.837204592 +0200 @@ -402,6 +402,14 @@ expand_UBSAN_VPTR (internal_fn, gcall *) /* This should get expanded in the sanopt pass. */ static void +expand_UBSAN_PTR (internal_fn, gcall *) +{ + gcc_unreachable (); +} + +/* This should get expanded in the sanopt pass. */ + +static void expand_UBSAN_OBJECT_SIZE (internal_fn, gcall *) { gcc_unreachable (); --- gcc/ubsan.h.jj 2017-06-20 09:05:22.498654128 +0200 +++ gcc/ubsan.h 2017-07-26 13:44:13.837204592 +0200 @@ -52,6 +52,7 @@ enum ubsan_encode_value_phase { extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *); +extern bool ubsan_expand_ptr_ifn (gimple_stmt_iterator *); extern bool ubsan_expand_vptr_ifn (gimple_stmt_iterator *); extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *); extern tree ubsan_create_data (const char *, int, const location_t *, ...); --- gcc/sanitizer.def.jj 2017-07-06 20:31:32.835082221 +0200 +++ gcc/sanitizer.def 2017-07-26 13:44:13.837204592 +0200 @@ -448,6 +448,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN "__ubsan_handle_load_invalid_value", BT_FN_VOID_PTR_PTR, ATTR_COLD_NOTHROW_LEAF_LIST) +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW, + "__ubsan_handle_pointer_overflow", + BT_FN_VOID_PTR_PTR_PTR, + ATTR_COLD_NOTHROW_LEAF_LIST) DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW_ABORT, "__ubsan_handle_divrem_overflow_abort", BT_FN_VOID_PTR_PTR_PTR, @@ -484,6 +488,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN "__ubsan_handle_load_invalid_value_abort", BT_FN_VOID_PTR_PTR, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT, + "__ubsan_handle_pointer_overflow_abort", + BT_FN_VOID_PTR_PTR_PTR, + ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW, "__ubsan_handle_float_cast_overflow", BT_FN_VOID_PTR_PTR, --- gcc/tree-ssa-tail-merge.c.jj 2017-07-03 19:03:29.467756294 +0200 +++ gcc/tree-ssa-tail-merge.c 2017-07-26 13:44:13.838204580 +0200 @@ -1241,6 +1241,7 @@ merge_stmts_p (gimple *stmt1, gimple *st case IFN_UBSAN_CHECK_SUB: case IFN_UBSAN_CHECK_MUL: case IFN_UBSAN_OBJECT_SIZE: + case IFN_UBSAN_PTR: case IFN_ASAN_CHECK: /* For these internal functions, gimple_location is an implicit parameter, which will be used explicitly after expansion. --- gcc/internal-fn.def.jj 2017-07-06 20:31:43.930946892 +0200 +++ gcc/internal-fn.def 2017-07-26 13:44:13.838204580 +0200 @@ -166,6 +166,7 @@ DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) +DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.") DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL) DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) --- gcc/opts.c.jj 2017-07-26 13:37:44.955908409 +0200 +++ gcc/opts.c 2017-07-26 13:44:13.839204567 +0200 @@ -1521,6 +1521,7 @@ const struct sanitizer_opts_s sanitizer_ true), SANITIZER_OPT (object-size, SANITIZE_OBJECT_SIZE, true), SANITIZER_OPT (vptr, SANITIZE_VPTR, true), + SANITIZER_OPT (pointer-overflow, SANITIZE_POINTER_OVERFLOW, true), SANITIZER_OPT (all, ~0U, true), #undef SANITIZER_OPT { NULL, 0U, 0UL, false } --- gcc/lto-streamer-in.c.jj 2017-06-30 09:49:28.006662098 +0200 +++ gcc/lto-streamer-in.c 2017-07-26 13:44:13.840204555 +0200 @@ -1143,6 +1143,10 @@ input_function (tree fn_decl, struct dat if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0) remove = true; break; + case IFN_UBSAN_PTR: + if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0) + remove = true; + break; case IFN_ASAN_MARK: if ((flag_sanitize & SANITIZE_ADDRESS) == 0) remove = true; --- gcc/fold-const.c.jj 2017-07-25 12:19:45.423601159 +0200 +++ gcc/fold-const.c 2017-07-26 14:59:51.908708150 +0200 @@ -4859,21 +4859,21 @@ build_range_check (location_t loc, tree if (low == 0) return fold_build2_loc (loc, LE_EXPR, type, exp, - fold_convert_loc (loc, etype, high)); + fold_convert_loc (loc, etype, high)); if (high == 0) return fold_build2_loc (loc, GE_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (operand_equal_p (low, high, 0)) return fold_build2_loc (loc, EQ_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (TREE_CODE (exp) == BIT_AND_EXPR && maskable_range_p (low, high, etype, &mask, &value)) return fold_build2_loc (loc, EQ_EXPR, type, fold_build2_loc (loc, BIT_AND_EXPR, etype, - exp, mask), + exp, mask), value); if (integer_zerop (low)) @@ -4905,7 +4905,7 @@ build_range_check (location_t loc, tree exp = fold_convert_loc (loc, etype, exp); } return fold_build2_loc (loc, GT_EXPR, type, exp, - build_int_cst (etype, 0)); + build_int_cst (etype, 0)); } } @@ -4915,25 +4915,15 @@ build_range_check (location_t loc, tree if (etype == NULL_TREE) return NULL_TREE; + if (POINTER_TYPE_P (etype)) + etype = unsigned_type_for (etype); + high = fold_convert_loc (loc, etype, high); low = fold_convert_loc (loc, etype, low); exp = fold_convert_loc (loc, etype, exp); value = const_binop (MINUS_EXPR, high, low); - - if (POINTER_TYPE_P (etype)) - { - if (value != 0 && !TREE_OVERFLOW (value)) - { - low = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (low), low); - return build_range_check (loc, type, - fold_build_pointer_plus_loc (loc, exp, low), - 1, build_int_cst (etype, 0), value); - } - return 0; - } - if (value != 0 && !TREE_OVERFLOW (value)) return build_range_check (loc, type, fold_build2_loc (loc, MINUS_EXPR, etype, exp, low), --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c.jj 2017-07-26 13:44:13.840204555 +0200 +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c 2017-07-26 13:44:13.840204555 +0200 @@ -0,0 +1,65 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -Wall" } */ + +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) char *f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char *f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char *f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char *f4 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char *f5 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char *f6 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) int *f7 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f8 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f9 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f10 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +struct S *volatile q; +char a[64]; +struct S s; +int *volatile r; + +int +main () +{ + struct S t; + p = &a[32]; + p = f1 (p); + p = f1 (p); + p = f2 (p); + p = f3 (p, 1); + p = f3 (p, -1); + p = f3 (p, 3); + p = f3 (p, -6); + p = f4 (p, 1); + p = f4 (p, -1); + p = f4 (p, 3); + p = f4 (p, -6); + p = f5 (p, 1); + p = f5 (p, 3); + p = f6 (p, 1); + p = f6 (p, 3); + if (sizeof (unsigned long) >= sizeof (char *)) + { + p = f5 (p, -1); + p = f5 (p, -6); + p = f6 (p, -1); + p = f6 (p, -6); + } + q = &s; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + q = &t; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + return 0; +} --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c.jj 2017-07-26 13:44:13.840204555 +0200 +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c 2017-07-26 13:44:13.840204555 +0200 @@ -0,0 +1,113 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -fno-ipa-icf -Wall" } */ + +__attribute__((noinline, noclone)) char * f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char * f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char * f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f4 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f5 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f6 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f7 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f8 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f9 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) char * f10 (char *p, unsigned long int i) { return p - i; } +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) int *f11 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f12 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f13 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f14 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f15 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f16 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f17 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f18 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f19 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f20 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f21 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f22 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f23 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f24 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f25 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +__UINTPTR_TYPE__ volatile u; +struct S *volatile q; +int *volatile r; + +int +main () +{ + u = ~(__UINTPTR_TYPE__) 0; + p = (char *) u; + p = f1 (p); + u = 0; + p = (char *) u; + p = f2 (p); + u = -(__UINTPTR_TYPE__) 7; + p = (char *) u; + p = f3 (p, 7); + u = 3; + p = (char *) u; + p = f4 (p, -4); + u = 23; + p = (char *) u; + p = f5 (p, 27); + u = -(__UINTPTR_TYPE__) 15; + p = (char *) u; + p = f6 (p, -15); + u = -(__UINTPTR_TYPE__) 29; + p = (char *) u; + p = f7 (p, 31); + u = 23; + p = (char *) u; + p = f9 (p, 24); + if (sizeof (unsigned long) < sizeof (char *)) + return 0; + u = 7; + p = (char *) u; + p = f8 (p, -8); + u = -(__UINTPTR_TYPE__) 25; + p = (char *) u; + p = f10 (p, -25); + u = ~(__UINTPTR_TYPE__) 0; + q = (struct S *) u; + r = f11 (q); + r = f12 (q); + r = f13 (q); + r = f14 (q, 0); + r = f15 (q, 63); + u = ~(__UINTPTR_TYPE__) 0 - (17 * sizeof (int)); + q = (struct S *) u; + r = f16 (q); + r = f17 (q); + r = f18 (q); + r = f19 (q, 0); + r = f20 (q, 63); + u = 3 * sizeof (int); + q = (struct S *) u; + r = f21 (q); + r = f22 (q); + r = f23 (q); + r = f24 (q, -2); + r = f25 (q, -6); + return 0; +} + +/* { dg-output ":5:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:6:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+ overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:7:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+9 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:8:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+3 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:9:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+\[cC](\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:10:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+1 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:11:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]3 overflowed to (0\[xX])?0\+2(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:13:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:12:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+7 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:14:\[89]\[91]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]7 overflowed to (0\[xX])?0\+" } */ +/* { dg-output "(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:17:\[67]\[82]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:18:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+107(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:19:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+7(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:20:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+103(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:23:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[cC]3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:25:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[bB]\[fF](\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:30:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+\[cC] overflowed to (0\[xX])?\[fF]\+\[cC]" { target int32 } } */ --- libsanitizer/ubsan/ubsan_handlers.cc.jj 2017-06-19 08:26:17.073600279 +0200 +++ libsanitizer/ubsan/ubsan_handlers.cc 2017-07-26 13:44:14.261199463 +0200 @@ -521,6 +521,37 @@ void __ubsan::__ubsan_handle_nonnull_arg Die(); } +static void handlePointerOverflowImpl(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result, + ReportOptions Opts) { + SourceLocation Loc = Data->Loc.acquire(); + ErrorType ET = ErrorType::PointerOverflow; + + if (ignoreReport(Loc, Opts, ET)) + return; + + ScopedReport R(Opts, Loc, ET); + + Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1") + << (void *)Base << (void*)Result; +} + +void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result) { + GET_REPORT_OPTIONS(false); + handlePointerOverflowImpl(Data, Base, Result, Opts); +} + +void __ubsan::__ubsan_handle_pointer_overflow_abort(PointerOverflowData *Data, + ValueHandle Base, + ValueHandle Result) { + GET_REPORT_OPTIONS(true); + handlePointerOverflowImpl(Data, Base, Result, Opts); + Die(); +} + static void handleCFIBadIcall(CFICheckFailData *Data, ValueHandle Function, ReportOptions Opts) { if (Data->CheckKind != CFITCK_ICall) --- libsanitizer/ubsan/ubsan_checks.inc.jj 2017-06-19 08:26:17.061600432 +0200 +++ libsanitizer/ubsan/ubsan_checks.inc 2017-07-26 13:44:14.275199294 +0200 @@ -17,6 +17,7 @@ UBSAN_CHECK(GenericUB, "undefined-behavior", "undefined") UBSAN_CHECK(NullPointerUse, "null-pointer-use", "null") +UBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow") UBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment") UBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size") UBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow", --- libsanitizer/ubsan/ubsan_handlers.h.jj 2017-06-19 08:26:17.073600279 +0200 +++ libsanitizer/ubsan/ubsan_handlers.h 2017-07-26 13:44:14.282199209 +0200 @@ -146,6 +146,13 @@ struct NonNullArgData { /// \brief Handle passing null pointer to function with nonnull attribute. RECOVERABLE(nonnull_arg, NonNullArgData *Data) +struct PointerOverflowData { + SourceLocation Loc; +}; + +RECOVERABLE(pointer_overflow, PointerOverflowData *Data, ValueHandle Base, + ValueHandle Result) + /// \brief Known CFI check kinds. /// Keep in sync with the enum of the same name in CodeGenFunction.h enum CFITypeCheckKind : unsigned char { Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-07-27 8:35 ` Jakub Jelinek @ 2017-07-28 7:59 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2017-07-28 7:59 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches On Thu, 27 Jul 2017, Jakub Jelinek wrote: > On Thu, Jul 27, 2017 at 09:19:34AM +0200, Richard Biener wrote: > > > I'm building both addresses and subtracting them to get the offset. > > > I guess the other option is to compute just the address of the base > > > (i.e. base_addr), and add offset (if non-NULL) plus bitpos / BITS_PER_UNIT > > > plus offset from the MEM_REF (if any). In that case it would probably > > > handle any handled_component_p and bitfields too. > > > > Yes. Can you try sth along this route? Should be a matter of > > adding offset and bitpos / BITS_PER_UNIT (thus rounded down) plus > > any MEM_REF offset on the base. > > Here it is, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? Ok. Thanks, Richard. > 2017-07-27 Jakub Jelinek <jakub@redhat.com> > > PR sanitizer/80998 > * sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR. > * tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise. > * flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW. > Or it into SANITIZER_UNDEFINED. > * ubsan.c: Include gimple-fold.h and varasm.h. > (ubsan_expand_ptr_ifn): New function. > (instrument_pointer_overflow): New function. > (maybe_instrument_pointer_overflow): New function. > (instrument_object_size): Formatting fix. > (pass_ubsan::execute): Call instrument_pointer_overflow > and maybe_instrument_pointer_overflow. > * internal-fn.c (expand_UBSAN_PTR): New function. > * ubsan.h (ubsan_expand_ptr_ifn): Declare. > * sanitizer.def (__ubsan_handle_pointer_overflow, > __ubsan_handle_pointer_overflow_abort): New builtins. > * tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR. > * internal-fn.def (UBSAN_PTR): New internal function. > * opts.c (sanitizer_opts): Add pointer-overflow. > * lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR. > * fold-const.c (build_range_check): Compute pointer range check in > integral type if pointer arithmetics would be needed. Formatting > fixes. > gcc/testsuite/ > * c-c++-common/ubsan/ptr-overflow-1.c: New test. > * c-c++-common/ubsan/ptr-overflow-2.c: New test. > libsanitizer/ > * ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461. > * ubsan/ubsan_checks.inc: Likewise. > * ubsan/ubsan_handlers.h: Likewise. > > --- gcc/sanopt.c.jj 2017-07-04 13:51:47.781815329 +0200 > +++ gcc/sanopt.c 2017-07-26 13:44:13.833204640 +0200 > @@ -1062,6 +1062,9 @@ pass_sanopt::execute (function *fun) > case IFN_UBSAN_OBJECT_SIZE: > no_next = ubsan_expand_objsize_ifn (&gsi); > break; > + case IFN_UBSAN_PTR: > + no_next = ubsan_expand_ptr_ifn (&gsi); > + break; > case IFN_UBSAN_VPTR: > no_next = ubsan_expand_vptr_ifn (&gsi); > break; > --- gcc/tree-ssa-alias.c.jj 2017-06-19 08:26:17.274597722 +0200 > +++ gcc/tree-ssa-alias.c 2017-07-26 13:44:13.834204628 +0200 > @@ -1991,6 +1991,7 @@ call_may_clobber_ref_p_1 (gcall *call, a > case IFN_UBSAN_BOUNDS: > case IFN_UBSAN_VPTR: > case IFN_UBSAN_OBJECT_SIZE: > + case IFN_UBSAN_PTR: > case IFN_ASAN_CHECK: > return false; > default: > --- gcc/flag-types.h.jj 2017-06-19 08:26:17.593593662 +0200 > +++ gcc/flag-types.h 2017-07-26 13:44:13.834204628 +0200 > @@ -238,6 +238,7 @@ enum sanitize_code { > SANITIZE_OBJECT_SIZE = 1UL << 21, > SANITIZE_VPTR = 1UL << 22, > SANITIZE_BOUNDS_STRICT = 1UL << 23, > + SANITIZE_POINTER_OVERFLOW = 1UL << 24, > SANITIZE_SHIFT = SANITIZE_SHIFT_BASE | SANITIZE_SHIFT_EXPONENT, > SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE > | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN > @@ -245,7 +246,8 @@ enum sanitize_code { > | SANITIZE_BOUNDS | SANITIZE_ALIGNMENT > | SANITIZE_NONNULL_ATTRIBUTE > | SANITIZE_RETURNS_NONNULL_ATTRIBUTE > - | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR, > + | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR > + | SANITIZE_POINTER_OVERFLOW, > SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST > | SANITIZE_BOUNDS_STRICT > }; > --- gcc/ubsan.c.jj 2017-06-30 09:49:32.306609364 +0200 > +++ gcc/ubsan.c 2017-07-26 20:22:34.718284238 +0200 > @@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. > #include "builtins.h" > #include "tree-object-size.h" > #include "tree-cfg.h" > +#include "gimple-fold.h" > +#include "varasm.h" > > /* Map from a tree to a VAR_DECL tree. */ > > @@ -1029,6 +1031,170 @@ ubsan_expand_objsize_ifn (gimple_stmt_it > return true; > } > > +/* Expand UBSAN_PTR internal call. */ > + > +bool > +ubsan_expand_ptr_ifn (gimple_stmt_iterator *gsip) > +{ > + gimple_stmt_iterator gsi = *gsip; > + gimple *stmt = gsi_stmt (gsi); > + location_t loc = gimple_location (stmt); > + gcc_assert (gimple_call_num_args (stmt) == 2); > + tree ptr = gimple_call_arg (stmt, 0); > + tree off = gimple_call_arg (stmt, 1); > + > + if (integer_zerop (off)) > + { > + gsi_remove (gsip, true); > + unlink_stmt_vdef (stmt); > + return true; > + } > + > + basic_block cur_bb = gsi_bb (gsi); > + tree ptrplusoff = make_ssa_name (pointer_sized_int_node); > + tree ptri = make_ssa_name (pointer_sized_int_node); > + int pos_neg = get_range_pos_neg (off); > + > + /* Split the original block holding the pointer dereference. */ > + edge e = split_block (cur_bb, stmt); > + > + /* Get a hold on the 'condition block', the 'then block' and the > + 'else block'. */ > + basic_block cond_bb = e->src; > + basic_block fallthru_bb = e->dest; > + basic_block then_bb = create_empty_bb (cond_bb); > + basic_block cond_pos_bb = NULL, cond_neg_bb = NULL; > + add_bb_to_loop (then_bb, cond_bb->loop_father); > + loops_state_set (LOOPS_NEED_FIXUP); > + > + /* Set up the fallthrough basic block. */ > + e->flags = EDGE_FALSE_VALUE; > + if (pos_neg != 3) > + { > + e->count = cond_bb->count; > + e->probability = profile_probability::very_likely (); > + > + /* Connect 'then block' with the 'else block'. This is needed > + as the ubsan routines we call in the 'then block' are not noreturn. > + The 'then block' only has one outcoming edge. */ > + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); > + > + /* Make an edge coming from the 'cond block' into the 'then block'; > + this edge is unlikely taken, so set up the probability > + accordingly. */ > + e = make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); > + e->probability = profile_probability::very_unlikely (); > + } > + else > + { > + profile_count count = cond_bb->count.apply_probability (PROB_EVEN); > + e->count = count; > + e->probability = profile_probability::even (); > + > + e = split_block (fallthru_bb, (gimple *) NULL); > + cond_neg_bb = e->src; > + fallthru_bb = e->dest; > + e->count = count; > + e->probability = profile_probability::very_likely (); > + e->flags = EDGE_FALSE_VALUE; > + > + e = make_edge (cond_neg_bb, then_bb, EDGE_TRUE_VALUE); > + e->probability = profile_probability::very_unlikely (); > + > + cond_pos_bb = create_empty_bb (cond_bb); > + add_bb_to_loop (cond_pos_bb, cond_bb->loop_father); > + > + e = make_edge (cond_bb, cond_pos_bb, EDGE_TRUE_VALUE); > + e->count = count; > + e->probability = profile_probability::even (); > + > + e = make_edge (cond_pos_bb, then_bb, EDGE_TRUE_VALUE); > + e->probability = profile_probability::very_unlikely (); > + > + e = make_edge (cond_pos_bb, fallthru_bb, EDGE_FALSE_VALUE); > + e->count = count; > + e->probability = profile_probability::very_likely (); > + > + make_single_succ_edge (then_bb, fallthru_bb, EDGE_FALLTHRU); > + } > + > + gimple *g = gimple_build_assign (ptri, NOP_EXPR, ptr); > + gimple_set_location (g, loc); > + gsi_insert_before (&gsi, g, GSI_SAME_STMT); > + g = gimple_build_assign (ptrplusoff, PLUS_EXPR, ptri, off); > + gimple_set_location (g, loc); > + gsi_insert_before (&gsi, g, GSI_SAME_STMT); > + > + /* Update dominance info for the newly created then_bb; note that > + fallthru_bb's dominance info has already been updated by > + split_block. */ > + if (dom_info_available_p (CDI_DOMINATORS)) > + { > + set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb); > + if (pos_neg == 3) > + { > + set_immediate_dominator (CDI_DOMINATORS, cond_pos_bb, cond_bb); > + set_immediate_dominator (CDI_DOMINATORS, fallthru_bb, cond_bb); > + } > + } > + > + /* Put the ubsan builtin call into the newly created BB. */ > + if (flag_sanitize_undefined_trap_on_error) > + g = gimple_build_call (builtin_decl_implicit (BUILT_IN_TRAP), 0); > + else > + { > + enum built_in_function bcode > + = (flag_sanitize_recover & SANITIZE_POINTER_OVERFLOW) > + ? BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW > + : BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT; > + tree fn = builtin_decl_implicit (bcode); > + tree data > + = ubsan_create_data ("__ubsan_ptrovf_data", 1, &loc, > + NULL_TREE, NULL_TREE); > + data = build_fold_addr_expr_loc (loc, data); > + g = gimple_build_call (fn, 3, data, ptr, ptrplusoff); > + } > + gimple_stmt_iterator gsi2 = gsi_start_bb (then_bb); > + gimple_set_location (g, loc); > + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); > + > + /* Unlink the UBSAN_PTRs vops before replacing it. */ > + unlink_stmt_vdef (stmt); > + > + if (TREE_CODE (off) == INTEGER_CST) > + g = gimple_build_cond (wi::neg_p (off) ? LT_EXPR : GE_EXPR, ptri, > + fold_build1 (NEGATE_EXPR, sizetype, off), > + NULL_TREE, NULL_TREE); > + else if (pos_neg != 3) > + g = gimple_build_cond (pos_neg == 1 ? LT_EXPR : GT_EXPR, > + ptrplusoff, ptri, NULL_TREE, NULL_TREE); > + else > + { > + gsi2 = gsi_start_bb (cond_pos_bb); > + g = gimple_build_cond (LT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); > + gimple_set_location (g, loc); > + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); > + > + gsi2 = gsi_start_bb (cond_neg_bb); > + g = gimple_build_cond (GT_EXPR, ptrplusoff, ptri, NULL_TREE, NULL_TREE); > + gimple_set_location (g, loc); > + gsi_insert_after (&gsi2, g, GSI_NEW_STMT); > + > + gimple_seq seq = NULL; > + tree t = gimple_build (&seq, loc, NOP_EXPR, ssizetype, off); > + t = gimple_build (&seq, loc, GE_EXPR, boolean_type_node, > + t, ssize_int (0)); > + gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT); > + g = gimple_build_cond (NE_EXPR, t, boolean_false_node, > + NULL_TREE, NULL_TREE); > + } > + gimple_set_location (g, loc); > + /* Replace the UBSAN_PTR with a GIMPLE_COND stmt. */ > + gsi_replace (&gsi, g, false); > + return false; > +} > + > + > /* Cached __ubsan_vptr_type_cache decl. */ > static GTY(()) tree ubsan_vptr_type_cache_decl; > > @@ -1234,6 +1400,111 @@ instrument_null (gimple_stmt_iterator gs > instrument_mem_ref (t, base, &gsi, is_lhs); > } > > +/* Instrument pointer arithmetics PTR p+ OFF. */ > + > +static void > +instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree ptr, tree off) > +{ > + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) > + return; > + gcall *g = gimple_build_call_internal (IFN_UBSAN_PTR, 2, ptr, off); > + gimple_set_location (g, gimple_location (gsi_stmt (*gsi))); > + gsi_insert_before (gsi, g, GSI_SAME_STMT); > +} > + > +/* Instrument pointer arithmetics if any. */ > + > +static void > +maybe_instrument_pointer_overflow (gimple_stmt_iterator *gsi, tree t) > +{ > + if (TYPE_PRECISION (sizetype) != POINTER_SIZE) > + return; > + > + /* Handle also e.g. &s->i. */ > + if (TREE_CODE (t) == ADDR_EXPR) > + t = TREE_OPERAND (t, 0); > + > + if (!handled_component_p (t) && TREE_CODE (t) != MEM_REF) > + return; > + > + HOST_WIDE_INT bitsize, bitpos, bytepos; > + tree offset; > + machine_mode mode; > + int volatilep = 0, reversep, unsignedp = 0; > + tree inner = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode, > + &unsignedp, &reversep, &volatilep); > + tree moff = NULL_TREE; > + > + bool decl_p = DECL_P (inner); > + tree base; > + if (decl_p) > + { > + if (DECL_REGISTER (inner)) > + return; > + base = inner; > + /* If BASE is a fixed size automatic variable or > + global variable defined in the current TU and bitpos > + fits, don't instrument anything. */ > + if (offset == NULL_TREE > + && bitpos > 0 > + && (VAR_P (base) > + || TREE_CODE (base) == PARM_DECL > + || TREE_CODE (base) == RESULT_DECL) > + && DECL_SIZE (base) > + && TREE_CODE (DECL_SIZE (base)) == INTEGER_CST > + && compare_tree_int (DECL_SIZE (base), bitpos) >= 0 > + && (!is_global_var (base) || decl_binds_to_current_def_p (base))) > + return; > + } > + else if (TREE_CODE (inner) == MEM_REF) > + { > + base = TREE_OPERAND (inner, 0); > + if (TREE_CODE (base) == ADDR_EXPR > + && DECL_P (TREE_OPERAND (base, 0)) > + && !TREE_ADDRESSABLE (TREE_OPERAND (base, 0)) > + && !is_global_var (TREE_OPERAND (base, 0))) > + return; > + moff = TREE_OPERAND (inner, 1); > + if (integer_zerop (moff)) > + moff = NULL_TREE; > + } > + else > + return; > + > + if (!POINTER_TYPE_P (TREE_TYPE (base)) && !DECL_P (base)) > + return; > + bytepos = bitpos / BITS_PER_UNIT; > + if (offset == NULL_TREE && bytepos == 0 && moff == NULL_TREE) > + return; > + > + tree base_addr = base; > + if (decl_p) > + base_addr = build1 (ADDR_EXPR, > + build_pointer_type (TREE_TYPE (base)), base); > + t = offset; > + if (bytepos) > + { > + if (t) > + t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, > + build_int_cst (TREE_TYPE (t), bytepos)); > + else > + t = size_int (bytepos); > + } > + if (moff) > + { > + if (t) > + t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, > + fold_convert (TREE_TYPE (t), moff)); > + else > + t = fold_convert (sizetype, moff); > + } > + t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE, true, > + GSI_SAME_STMT); > + base_addr = force_gimple_operand_gsi (gsi, base_addr, true, NULL_TREE, true, > + GSI_SAME_STMT); > + instrument_pointer_overflow (gsi, base_addr, t); > +} > + > /* Build an ubsan builtin call for the signed-integer-overflow > sanitization. CODE says what kind of builtin are we building, > LOC is a location, LHSTYPE is the type of LHS, OP0 and OP1 > @@ -1849,7 +2120,7 @@ instrument_object_size (gimple_stmt_iter > { > tree rhs1 = gimple_assign_rhs1 (def_stmt); > if (TREE_CODE (rhs1) == SSA_NAME > - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) > + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) > break; > else > base = rhs1; > @@ -1973,7 +2244,8 @@ public: > | SANITIZE_ALIGNMENT > | SANITIZE_NONNULL_ATTRIBUTE > | SANITIZE_RETURNS_NONNULL_ATTRIBUTE > - | SANITIZE_OBJECT_SIZE)); > + | SANITIZE_OBJECT_SIZE > + | SANITIZE_POINTER_OVERFLOW)); > } > > virtual unsigned int execute (function *); > @@ -2064,6 +2336,32 @@ pass_ubsan::execute (function *fun) > } > } > } > + > + if (sanitize_flags_p (SANITIZE_POINTER_OVERFLOW, fun->decl)) > + { > + if (is_gimple_assign (stmt) > + && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) > + instrument_pointer_overflow (&gsi, > + gimple_assign_rhs1 (stmt), > + gimple_assign_rhs2 (stmt)); > + if (gimple_store_p (stmt)) > + maybe_instrument_pointer_overflow (&gsi, > + gimple_get_lhs (stmt)); > + if (gimple_assign_single_p (stmt)) > + maybe_instrument_pointer_overflow (&gsi, > + gimple_assign_rhs1 (stmt)); > + if (is_gimple_call (stmt)) > + { > + unsigned args_num = gimple_call_num_args (stmt); > + for (unsigned i = 0; i < args_num; ++i) > + { > + tree arg = gimple_call_arg (stmt, i); > + if (is_gimple_reg (arg)) > + continue; > + maybe_instrument_pointer_overflow (&gsi, arg); > + } > + } > + } > > gsi_next (&gsi); > } > --- gcc/internal-fn.c.jj 2017-07-17 10:08:34.923647976 +0200 > +++ gcc/internal-fn.c 2017-07-26 13:44:13.837204592 +0200 > @@ -402,6 +402,14 @@ expand_UBSAN_VPTR (internal_fn, gcall *) > /* This should get expanded in the sanopt pass. */ > > static void > +expand_UBSAN_PTR (internal_fn, gcall *) > +{ > + gcc_unreachable (); > +} > + > +/* This should get expanded in the sanopt pass. */ > + > +static void > expand_UBSAN_OBJECT_SIZE (internal_fn, gcall *) > { > gcc_unreachable (); > --- gcc/ubsan.h.jj 2017-06-20 09:05:22.498654128 +0200 > +++ gcc/ubsan.h 2017-07-26 13:44:13.837204592 +0200 > @@ -52,6 +52,7 @@ enum ubsan_encode_value_phase { > extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *); > extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *); > extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *); > +extern bool ubsan_expand_ptr_ifn (gimple_stmt_iterator *); > extern bool ubsan_expand_vptr_ifn (gimple_stmt_iterator *); > extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *); > extern tree ubsan_create_data (const char *, int, const location_t *, ...); > --- gcc/sanitizer.def.jj 2017-07-06 20:31:32.835082221 +0200 > +++ gcc/sanitizer.def 2017-07-26 13:44:13.837204592 +0200 > @@ -448,6 +448,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN > "__ubsan_handle_load_invalid_value", > BT_FN_VOID_PTR_PTR, > ATTR_COLD_NOTHROW_LEAF_LIST) > +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW, > + "__ubsan_handle_pointer_overflow", > + BT_FN_VOID_PTR_PTR_PTR, > + ATTR_COLD_NOTHROW_LEAF_LIST) > DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW_ABORT, > "__ubsan_handle_divrem_overflow_abort", > BT_FN_VOID_PTR_PTR_PTR, > @@ -484,6 +488,10 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN > "__ubsan_handle_load_invalid_value_abort", > BT_FN_VOID_PTR_PTR, > ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) > +DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_POINTER_OVERFLOW_ABORT, > + "__ubsan_handle_pointer_overflow_abort", > + BT_FN_VOID_PTR_PTR_PTR, > + ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) > DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW, > "__ubsan_handle_float_cast_overflow", > BT_FN_VOID_PTR_PTR, > --- gcc/tree-ssa-tail-merge.c.jj 2017-07-03 19:03:29.467756294 +0200 > +++ gcc/tree-ssa-tail-merge.c 2017-07-26 13:44:13.838204580 +0200 > @@ -1241,6 +1241,7 @@ merge_stmts_p (gimple *stmt1, gimple *st > case IFN_UBSAN_CHECK_SUB: > case IFN_UBSAN_CHECK_MUL: > case IFN_UBSAN_OBJECT_SIZE: > + case IFN_UBSAN_PTR: > case IFN_ASAN_CHECK: > /* For these internal functions, gimple_location is an implicit > parameter, which will be used explicitly after expansion. > --- gcc/internal-fn.def.jj 2017-07-06 20:31:43.930946892 +0200 > +++ gcc/internal-fn.def 2017-07-26 13:44:13.838204580 +0200 > @@ -166,6 +166,7 @@ DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | > DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) > DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) > DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) > +DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.") > DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL) > DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL) > DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) > --- gcc/opts.c.jj 2017-07-26 13:37:44.955908409 +0200 > +++ gcc/opts.c 2017-07-26 13:44:13.839204567 +0200 > @@ -1521,6 +1521,7 @@ const struct sanitizer_opts_s sanitizer_ > true), > SANITIZER_OPT (object-size, SANITIZE_OBJECT_SIZE, true), > SANITIZER_OPT (vptr, SANITIZE_VPTR, true), > + SANITIZER_OPT (pointer-overflow, SANITIZE_POINTER_OVERFLOW, true), > SANITIZER_OPT (all, ~0U, true), > #undef SANITIZER_OPT > { NULL, 0U, 0UL, false } > --- gcc/lto-streamer-in.c.jj 2017-06-30 09:49:28.006662098 +0200 > +++ gcc/lto-streamer-in.c 2017-07-26 13:44:13.840204555 +0200 > @@ -1143,6 +1143,10 @@ input_function (tree fn_decl, struct dat > if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0) > remove = true; > break; > + case IFN_UBSAN_PTR: > + if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0) > + remove = true; > + break; > case IFN_ASAN_MARK: > if ((flag_sanitize & SANITIZE_ADDRESS) == 0) > remove = true; > --- gcc/fold-const.c.jj 2017-07-25 12:19:45.423601159 +0200 > +++ gcc/fold-const.c 2017-07-26 14:59:51.908708150 +0200 > @@ -4859,21 +4859,21 @@ build_range_check (location_t loc, tree > > if (low == 0) > return fold_build2_loc (loc, LE_EXPR, type, exp, > - fold_convert_loc (loc, etype, high)); > + fold_convert_loc (loc, etype, high)); > > if (high == 0) > return fold_build2_loc (loc, GE_EXPR, type, exp, > - fold_convert_loc (loc, etype, low)); > + fold_convert_loc (loc, etype, low)); > > if (operand_equal_p (low, high, 0)) > return fold_build2_loc (loc, EQ_EXPR, type, exp, > - fold_convert_loc (loc, etype, low)); > + fold_convert_loc (loc, etype, low)); > > if (TREE_CODE (exp) == BIT_AND_EXPR > && maskable_range_p (low, high, etype, &mask, &value)) > return fold_build2_loc (loc, EQ_EXPR, type, > fold_build2_loc (loc, BIT_AND_EXPR, etype, > - exp, mask), > + exp, mask), > value); > > if (integer_zerop (low)) > @@ -4905,7 +4905,7 @@ build_range_check (location_t loc, tree > exp = fold_convert_loc (loc, etype, exp); > } > return fold_build2_loc (loc, GT_EXPR, type, exp, > - build_int_cst (etype, 0)); > + build_int_cst (etype, 0)); > } > } > > @@ -4915,25 +4915,15 @@ build_range_check (location_t loc, tree > if (etype == NULL_TREE) > return NULL_TREE; > > + if (POINTER_TYPE_P (etype)) > + etype = unsigned_type_for (etype); > + > high = fold_convert_loc (loc, etype, high); > low = fold_convert_loc (loc, etype, low); > exp = fold_convert_loc (loc, etype, exp); > > value = const_binop (MINUS_EXPR, high, low); > > - > - if (POINTER_TYPE_P (etype)) > - { > - if (value != 0 && !TREE_OVERFLOW (value)) > - { > - low = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (low), low); > - return build_range_check (loc, type, > - fold_build_pointer_plus_loc (loc, exp, low), > - 1, build_int_cst (etype, 0), value); > - } > - return 0; > - } > - > if (value != 0 && !TREE_OVERFLOW (value)) > return build_range_check (loc, type, > fold_build2_loc (loc, MINUS_EXPR, etype, exp, low), > --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c.jj 2017-07-26 13:44:13.840204555 +0200 > +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c 2017-07-26 13:44:13.840204555 +0200 > @@ -0,0 +1,65 @@ > +/* PR sanitizer/80998 */ > +/* { dg-do run } */ > +/* { dg-options "-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -Wall" } */ > + > +struct S { int a; int b; int c[64]; }; > +__attribute__((noinline, noclone)) char *f1 (char *p) { return p + 1; } > +__attribute__((noinline, noclone)) char *f2 (char *p) { return p - 1; } > +__attribute__((noinline, noclone)) char *f3 (char *p, int i) { return p + i; } > +__attribute__((noinline, noclone)) char *f4 (char *p, int i) { return p - i; } > +__attribute__((noinline, noclone)) char *f5 (char *p, unsigned long int i) { return p + i; } > +__attribute__((noinline, noclone)) char *f6 (char *p, unsigned long int i) { return p - i; } > +__attribute__((noinline, noclone)) int *f7 (struct S *p) { return &p->a; } > +__attribute__((noinline, noclone)) int *f8 (struct S *p) { return &p->b; } > +__attribute__((noinline, noclone)) int *f9 (struct S *p) { return &p->c[64]; } > +__attribute__((noinline, noclone)) int *f10 (struct S *p, int i) { return &p->c[i]; } > + > +char *volatile p; > +struct S *volatile q; > +char a[64]; > +struct S s; > +int *volatile r; > + > +int > +main () > +{ > + struct S t; > + p = &a[32]; > + p = f1 (p); > + p = f1 (p); > + p = f2 (p); > + p = f3 (p, 1); > + p = f3 (p, -1); > + p = f3 (p, 3); > + p = f3 (p, -6); > + p = f4 (p, 1); > + p = f4 (p, -1); > + p = f4 (p, 3); > + p = f4 (p, -6); > + p = f5 (p, 1); > + p = f5 (p, 3); > + p = f6 (p, 1); > + p = f6 (p, 3); > + if (sizeof (unsigned long) >= sizeof (char *)) > + { > + p = f5 (p, -1); > + p = f5 (p, -6); > + p = f6 (p, -1); > + p = f6 (p, -6); > + } > + q = &s; > + r = f7 (q); > + r = f8 (q); > + r = f9 (q); > + r = f10 (q, 0); > + r = f10 (q, 10); > + r = f10 (q, 64); > + q = &t; > + r = f7 (q); > + r = f8 (q); > + r = f9 (q); > + r = f10 (q, 0); > + r = f10 (q, 10); > + r = f10 (q, 64); > + return 0; > +} > --- gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c.jj 2017-07-26 13:44:13.840204555 +0200 > +++ gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c 2017-07-26 13:44:13.840204555 +0200 > @@ -0,0 +1,113 @@ > +/* PR sanitizer/80998 */ > +/* { dg-do run } */ > +/* { dg-options "-fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -fno-ipa-icf -Wall" } */ > + > +__attribute__((noinline, noclone)) char * f1 (char *p) { return p + 1; } > +__attribute__((noinline, noclone)) char * f2 (char *p) { return p - 1; } > +__attribute__((noinline, noclone)) char * f3 (char *p, int i) { return p + i; } > +__attribute__((noinline, noclone)) char * f4 (char *p, int i) { return p + i; } > +__attribute__((noinline, noclone)) char * f5 (char *p, int i) { return p - i; } > +__attribute__((noinline, noclone)) char * f6 (char *p, int i) { return p - i; } > +__attribute__((noinline, noclone)) char * f7 (char *p, unsigned long int i) { return p + i; } > +__attribute__((noinline, noclone)) char * f8 (char *p, unsigned long int i) { return p + i; } > +__attribute__((noinline, noclone)) char * f9 (char *p, unsigned long int i) { return p - i; } > +__attribute__((noinline, noclone)) char * f10 (char *p, unsigned long int i) { return p - i; } > +struct S { int a; int b; int c[64]; }; > +__attribute__((noinline, noclone)) int *f11 (struct S *p) { return &p->a; } > +__attribute__((noinline, noclone)) int *f12 (struct S *p) { return &p->b; } > +__attribute__((noinline, noclone)) int *f13 (struct S *p) { return &p->c[64]; } > +__attribute__((noinline, noclone)) int *f14 (struct S *p, int i) { return &p->c[i]; } > +__attribute__((noinline, noclone)) int *f15 (struct S *p, int i) { return &p->c[i]; } > +__attribute__((noinline, noclone)) int *f16 (struct S *p) { return &p->a; } > +__attribute__((noinline, noclone)) int *f17 (struct S *p) { return &p->b; } > +__attribute__((noinline, noclone)) int *f18 (struct S *p) { return &p->c[64]; } > +__attribute__((noinline, noclone)) int *f19 (struct S *p, int i) { return &p->c[i]; } > +__attribute__((noinline, noclone)) int *f20 (struct S *p, int i) { return &p->c[i]; } > +__attribute__((noinline, noclone)) int *f21 (struct S *p) { return &p->a; } > +__attribute__((noinline, noclone)) int *f22 (struct S *p) { return &p->b; } > +__attribute__((noinline, noclone)) int *f23 (struct S *p) { return &p->c[64]; } > +__attribute__((noinline, noclone)) int *f24 (struct S *p, int i) { return &p->c[i]; } > +__attribute__((noinline, noclone)) int *f25 (struct S *p, int i) { return &p->c[i]; } > + > +char *volatile p; > +__UINTPTR_TYPE__ volatile u; > +struct S *volatile q; > +int *volatile r; > + > +int > +main () > +{ > + u = ~(__UINTPTR_TYPE__) 0; > + p = (char *) u; > + p = f1 (p); > + u = 0; > + p = (char *) u; > + p = f2 (p); > + u = -(__UINTPTR_TYPE__) 7; > + p = (char *) u; > + p = f3 (p, 7); > + u = 3; > + p = (char *) u; > + p = f4 (p, -4); > + u = 23; > + p = (char *) u; > + p = f5 (p, 27); > + u = -(__UINTPTR_TYPE__) 15; > + p = (char *) u; > + p = f6 (p, -15); > + u = -(__UINTPTR_TYPE__) 29; > + p = (char *) u; > + p = f7 (p, 31); > + u = 23; > + p = (char *) u; > + p = f9 (p, 24); > + if (sizeof (unsigned long) < sizeof (char *)) > + return 0; > + u = 7; > + p = (char *) u; > + p = f8 (p, -8); > + u = -(__UINTPTR_TYPE__) 25; > + p = (char *) u; > + p = f10 (p, -25); > + u = ~(__UINTPTR_TYPE__) 0; > + q = (struct S *) u; > + r = f11 (q); > + r = f12 (q); > + r = f13 (q); > + r = f14 (q, 0); > + r = f15 (q, 63); > + u = ~(__UINTPTR_TYPE__) 0 - (17 * sizeof (int)); > + q = (struct S *) u; > + r = f16 (q); > + r = f17 (q); > + r = f18 (q); > + r = f19 (q, 0); > + r = f20 (q, 63); > + u = 3 * sizeof (int); > + q = (struct S *) u; > + r = f21 (q); > + r = f22 (q); > + r = f23 (q); > + r = f24 (q, -2); > + r = f25 (q, -6); > + return 0; > +} > + > +/* { dg-output ":5:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:6:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+ overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:7:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+9 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:8:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+3 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:9:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+\[cC](\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:10:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+1 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:11:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]3 overflowed to (0\[xX])?0\+2(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:13:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:12:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+7 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*:14:\[89]\[91]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]7 overflowed to (0\[xX])?0\+" } */ > +/* { dg-output "(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:17:\[67]\[82]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+3(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:18:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+107(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:19:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+7(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:20:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+103(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:23:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[cC]3(\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:25:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[bB]\[fF](\n|\r\n|\r)" { target int32 } } */ > +/* { dg-output "\[^\n\r]*:30:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+\[cC] overflowed to (0\[xX])?\[fF]\+\[cC]" { target int32 } } */ > --- libsanitizer/ubsan/ubsan_handlers.cc.jj 2017-06-19 08:26:17.073600279 +0200 > +++ libsanitizer/ubsan/ubsan_handlers.cc 2017-07-26 13:44:14.261199463 +0200 > @@ -521,6 +521,37 @@ void __ubsan::__ubsan_handle_nonnull_arg > Die(); > } > > +static void handlePointerOverflowImpl(PointerOverflowData *Data, > + ValueHandle Base, > + ValueHandle Result, > + ReportOptions Opts) { > + SourceLocation Loc = Data->Loc.acquire(); > + ErrorType ET = ErrorType::PointerOverflow; > + > + if (ignoreReport(Loc, Opts, ET)) > + return; > + > + ScopedReport R(Opts, Loc, ET); > + > + Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1") > + << (void *)Base << (void*)Result; > +} > + > +void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, > + ValueHandle Base, > + ValueHandle Result) { > + GET_REPORT_OPTIONS(false); > + handlePointerOverflowImpl(Data, Base, Result, Opts); > +} > + > +void __ubsan::__ubsan_handle_pointer_overflow_abort(PointerOverflowData *Data, > + ValueHandle Base, > + ValueHandle Result) { > + GET_REPORT_OPTIONS(true); > + handlePointerOverflowImpl(Data, Base, Result, Opts); > + Die(); > +} > + > static void handleCFIBadIcall(CFICheckFailData *Data, ValueHandle Function, > ReportOptions Opts) { > if (Data->CheckKind != CFITCK_ICall) > --- libsanitizer/ubsan/ubsan_checks.inc.jj 2017-06-19 08:26:17.061600432 +0200 > +++ libsanitizer/ubsan/ubsan_checks.inc 2017-07-26 13:44:14.275199294 +0200 > @@ -17,6 +17,7 @@ > > UBSAN_CHECK(GenericUB, "undefined-behavior", "undefined") > UBSAN_CHECK(NullPointerUse, "null-pointer-use", "null") > +UBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow") > UBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment") > UBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size") > UBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow", > --- libsanitizer/ubsan/ubsan_handlers.h.jj 2017-06-19 08:26:17.073600279 +0200 > +++ libsanitizer/ubsan/ubsan_handlers.h 2017-07-26 13:44:14.282199209 +0200 > @@ -146,6 +146,13 @@ struct NonNullArgData { > /// \brief Handle passing null pointer to function with nonnull attribute. > RECOVERABLE(nonnull_arg, NonNullArgData *Data) > > +struct PointerOverflowData { > + SourceLocation Loc; > +}; > + > +RECOVERABLE(pointer_overflow, PointerOverflowData *Data, ValueHandle Base, > + ValueHandle Result) > + > /// \brief Known CFI check kinds. > /// Keep in sync with the enum of the same name in CodeGenFunction.h > enum CFITypeCheckKind : unsigned char { > > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-04-10 12:18 Jakub Jelinek 2017-04-10 12:41 ` Nathan Sidwell 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-04-10 12:18 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping 2 patches: P2 PR c++/80176 http://gcc.gnu.org/ml/gcc-patches/2017-04/msg00027.html reference binding to static member function PR debug/80263 http://gcc.gnu.org/ml/gcc-patches/2017-04/msg00004.html avoid emitting sizetype artificial name into debug info Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-04-10 12:18 Jakub Jelinek @ 2017-04-10 12:41 ` Nathan Sidwell 2017-04-10 13:22 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Nathan Sidwell @ 2017-04-10 12:41 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 04/10/2017 08:18 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping 2 patches: > > P2 PR c++/80176 > http://gcc.gnu.org/ml/gcc-patches/2017-04/msg00027.html > reference binding to static member function This smells fishy. There's no reason one cannot have an overload set containing both static and non-static functions, in any order. So it'll be 'random' as to which member of the set OVL_CURRENT looks at. You at least want '&& !OVL_NEXT (..)' there to make sure you just have a single static fn (if that's what you want?) nathan -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-04-10 12:41 ` Nathan Sidwell @ 2017-04-10 13:22 ` Jakub Jelinek 2017-04-10 14:39 ` Nathan Sidwell 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-04-10 13:22 UTC (permalink / raw) To: Nathan Sidwell; +Cc: Jason Merrill, gcc-patches On Mon, Apr 10, 2017 at 08:41:28AM -0400, Nathan Sidwell wrote: > On 04/10/2017 08:18 AM, Jakub Jelinek wrote: > > Hi! > > > > I'd like to ping 2 patches: > > > > P2 PR c++/80176 > > http://gcc.gnu.org/ml/gcc-patches/2017-04/msg00027.html > > reference binding to static member function > > This smells fishy. There's no reason one cannot have an overload set > containing both static and non-static functions, in any order. So it'll be > 'random' as to which member of the set OVL_CURRENT looks at. I actually don't know if I need the OVL_CURRENT thing, maybe not. On the testcase there is an overloaded static member function and I don't get an error on that, just on the non-overloaded one. I've tried: struct X { static void foo(); static void baz(int); static int baz(double); void m(int); void n(int); int n(float); } x; void X::foo() {} static void bar() {} void (&r1)() = x.foo; void (&r2)() = X::foo; void (&r3)() = bar; void (&r4)(int) = x.baz; int (&r5)(double) = x.baz; void (&r6)(int) = X::baz; int (&r7)(double) = X::baz; void (&r8)(int) = x.m; void (&r9)(int) = x.n; int (&r10)(float) = x.n; and there I see COMPONENT_REF with BASELINK second operand with BASELINK_FUNCTIONS being an overload only for the methods. And even if I try overload with mixed methods and static member functions, lvalue_kind with that is only called when seeing the invalid binding to method: struct X { void o(unsigned char); static void o(int); void o(double); } x; void (&r12)(int) = x.o; void (&r13)(double) = x.o; Thus, would it be acceptable to omit the OVL_CURRENT as in (tested so far just on the updated ref23.C with additional test from the above r12 snippet, of course would perform full bootstrap/regtest with that)? 2017-04-08 Jakub Jelinek <jakub@redhat.com> PR c++/80176 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second operand, if it is a static member function, recurse on the BASELINK. * g++.dg/init/ref23.C: New test. --- gcc/cp/tree.c.jj 2017-04-07 21:17:57.078208891 +0200 +++ gcc/cp/tree.c 2017-04-10 15:18:57.941508441 +0200 @@ -105,6 +105,14 @@ lvalue_kind (const_tree ref) return op1_lvalue_kind; case COMPONENT_REF: + if (BASELINK_P (TREE_OPERAND (ref, 1))) + { + tree fn = BASELINK_FUNCTIONS (TREE_OPERAND (ref, 1)); + + /* For static member function recurse on the BASELINK. */ + if (TREE_CODE (fn) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (fn)) + return lvalue_kind (TREE_OPERAND (ref, 1)); + } op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); /* Look at the member designator. */ if (!op1_lvalue_kind) --- gcc/testsuite/g++.dg/init/ref23.C.jj 2017-04-10 15:17:04.823911276 +0200 +++ gcc/testsuite/g++.dg/init/ref23.C 2017-04-10 15:18:07.504133944 +0200 @@ -0,0 +1,15 @@ +// PR c++/80176 +// { dg-do compile } + +struct X { static void foo(); static void baz(int); static int baz(double); } x; +struct Y { void o(unsigned char); static void o(int); void o(double); } y; +void X::foo() {} +static void bar() {} +void (&r1)() = x.foo; +void (&r2)() = X::foo; +void (&r3)() = bar; +void (&r4)(int) = x.baz; +int (&r5)(double) = x.baz; +void (&r6)(int) = X::baz; +int (&r7)(double) = X::baz; +void (&r8)(int) = y.o; Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-04-10 13:22 ` Jakub Jelinek @ 2017-04-10 14:39 ` Nathan Sidwell 0 siblings, 0 replies; 504+ messages in thread From: Nathan Sidwell @ 2017-04-10 14:39 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches On 04/10/2017 09:22 AM, Jakub Jelinek wrote: > and there I see COMPONENT_REF with BASELINK second operand with > BASELINK_FUNCTIONS being an overload only for the methods. > And even if I try overload with mixed methods and static member functions, > lvalue_kind with that is only called when seeing the invalid binding > to method: > struct X { void o(unsigned char); static void o(int); void o(double); } x; > void (&r12)(int) = x.o; > void (&r13)(double) = x.o; Ok, that makes sense. This patch is ok, with ... > + /* For static member function recurse on the BASELINK. */ Mention that overloads of more than one function go via a different path. nathan -- Nathan Sidwell ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-04-05 10:45 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-04-05 10:45 UTC (permalink / raw) To: Jason Merrill, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping 2 patches: P1 PR debug/80234 http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01489.html Fix dwarf2out ICE with C++17 inline static data members with redundant redeclaration PR c/80163 http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01324.html Fix EXPAND_INITIALIZER expansion of extensions Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-03-31 8:34 Jakub Jelinek 2017-03-31 15:14 ` Jeff Law 2017-03-31 15:15 ` Jeff Law 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-03-31 8:34 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping two patches: PR c++/79572 - ubsan instrumentation of reference binding to NULL if the reference is folded into INTEGER_CST with REFERENCE_TYPE http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01255.html PR debug/79255 - dwarf2out profiledbootstrap ICE while building gnat; either the posted patch http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01257.html or in gen_decl_die: case FUNCTION_DECL: + /* decl is NULL only if when processing a function declaration in + BLOCK_NONLOCALIZED_VARS. It is a normal declaration, not an + abstract copy of something, so make sure we don't handle it + like function inlined into something. */ + if (decl == NULL_TREE) + { + decl = origin; + origin = NULL_TREE; + } or something else (another possibility is to replace all decl uses in case FUNCTION_DECL with decl_or_origin and - if (!origin) - origin = decl_class_context (decl); + if (!decl || !origin) + origin = decl_class_context (decl_or_origin); )? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-03-31 8:34 Jakub Jelinek @ 2017-03-31 15:14 ` Jeff Law 2017-03-31 18:50 ` Jakub Jelinek 2017-03-31 15:15 ` Jeff Law 1 sibling, 1 reply; 504+ messages in thread From: Jeff Law @ 2017-03-31 15:14 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 03/31/2017 12:36 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping two patches: > > PR c++/79572 > - ubsan instrumentation of reference binding to NULL if the reference > is folded into INTEGER_CST with REFERENCE_TYPE > http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01255.html Just one question here -- we're working with pure trees or perhaps generic, not gimple here, right? Assuming that is true, this is OK. If instead we are working with gimple, then consider renaming "stmt" in ubsan_maybe_instrument_reference -- when I see "stmt" I think a gimple statement, not a tree:-) jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-03-31 15:14 ` Jeff Law @ 2017-03-31 18:50 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-03-31 18:50 UTC (permalink / raw) To: Jeff Law; +Cc: Jason Merrill, gcc-patches On Fri, Mar 31, 2017 at 09:07:14AM -0600, Jeff Law wrote: > On 03/31/2017 12:36 AM, Jakub Jelinek wrote: > > Hi! > > > > I'd like to ping two patches: > > > > PR c++/79572 > > - ubsan instrumentation of reference binding to NULL if the reference > > is folded into INTEGER_CST with REFERENCE_TYPE > > http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01255.html > Just one question here -- we're working with pure trees or perhaps generic, > not gimple here, right? Assuming that is true, this is OK. It is invoked during genericization, i.e. when the C++ FE trees are lowered into generic. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-03-31 8:34 Jakub Jelinek 2017-03-31 15:14 ` Jeff Law @ 2017-03-31 15:15 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2017-03-31 15:15 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 03/31/2017 12:36 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping two patches: > > PR c++/79572 > - ubsan instrumentation of reference binding to NULL if the reference > is folded into INTEGER_CST with REFERENCE_TYPE > http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01255.html > > PR debug/79255 > - dwarf2out profiledbootstrap ICE while building gnat; > either the posted patch > http://gcc.gnu.org/ml/gcc-patches/2017-03/msg01257.html > or in gen_decl_die: > case FUNCTION_DECL: > + /* decl is NULL only if when processing a function declaration in > + BLOCK_NONLOCALIZED_VARS. It is a normal declaration, not an > + abstract copy of something, so make sure we don't handle it > + like function inlined into something. */ > + if (decl == NULL_TREE) > + { > + decl = origin; > + origin = NULL_TREE; > + } > or something else (another possibility is to replace all decl > uses in case FUNCTION_DECL with decl_or_origin and > - if (!origin) > - origin = decl_class_context (decl); > + if (!decl || !origin) > + origin = decl_class_context (decl_or_origin); I think I prefer your original approach -- pass in the original FUNCTION_DECL. It seems to me like the other approaches are just papering over the issue. Original approach is OK for the trunk. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-02-07 15:11 Jakub Jelinek 2017-02-07 15:22 ` Uros Bizjak 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-02-07 15:11 UTC (permalink / raw) To: Uros Bizjak, Kirill Yukhin; +Cc: gcc-patches Hi! I'd like to ping: - P1 PR79299 AVX512{F,VL} -masm=intel v*gather* fixes http://gcc.gnu.org/ml/gcc-patches/2017-01/msg02409.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-02-07 15:11 Jakub Jelinek @ 2017-02-07 15:22 ` Uros Bizjak 0 siblings, 0 replies; 504+ messages in thread From: Uros Bizjak @ 2017-02-07 15:22 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Kirill Yukhin, gcc-patches On Tue, Feb 7, 2017 at 4:11 PM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping: > > - P1 PR79299 AVX512{F,VL} -masm=intel v*gather* fixes > http://gcc.gnu.org/ml/gcc-patches/2017-01/msg02409.html LGTM. Thanks, Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-02-02 10:13 Jakub Jelinek 2017-02-02 10:15 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2017-02-02 10:13 UTC (permalink / raw) To: Richard Biener, Rainer Orth, Mike Stump, Dodji Seketeli; +Cc: gcc-patches Hi! I'd like to ping the http://gcc.gnu.org/ml/gcc-patches/2017-01/msg02026.html patch, asan testsuite fixes not to use explicit -O* options in testsuite that iterates over all -O*, but instead dg-skip-if etc. As discussed later in the thread, either as is for pr69276.C: -/* { dg-additional-options "-O0 -fno-lto" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ +/* { dg-additional-options "-fno-lto" } */ or just: -/* { dg-additional-options "-O0 -fno-lto" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ or: -/* { dg-additional-options "-O0 -fno-lto" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2017-02-02 10:13 Jakub Jelinek @ 2017-02-02 10:15 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2017-02-02 10:15 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Rainer Orth, Mike Stump, Dodji Seketeli, gcc-patches On Thu, 2 Feb 2017, Jakub Jelinek wrote: > Hi! > > I'd like to ping the > http://gcc.gnu.org/ml/gcc-patches/2017-01/msg02026.html > patch, asan testsuite fixes not to use explicit -O* options > in testsuite that iterates over all -O*, but instead dg-skip-if > etc. > > As discussed later in the thread, either as is for pr69276.C: > -/* { dg-additional-options "-O0 -fno-lto" } */ > +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ > +/* { dg-additional-options "-fno-lto" } */ > or just: > -/* { dg-additional-options "-O0 -fno-lto" } */ > +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ Ok with this variant. Richard. > or: > -/* { dg-additional-options "-O0 -fno-lto" } */ > +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ > +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-01-26 20:42 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-01-26 20:42 UTC (permalink / raw) To: Jason Merrill, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping 3 patches: PR debug/78835 P1 -fdebug-types-section fix http://gcc.gnu.org/ml/gcc-patches/2017-01/msg01316.html PR debug/79129 P1 another -fdebug-types-section fix http://gcc.gnu.org/ml/gcc-patches/2017-01/msg01478.html noipa attribute addition http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2017-01-10 7:27 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2017-01-10 7:27 UTC (permalink / raw) To: Jason Merrill, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping 2 patches: - DWARF5 - adjust for 161031.2 resolution - remove padding from unit headers http://gcc.gnu.org/ml/gcc-patches/2017-01/msg00138.html - Introduce the noipa attribute http://gcc.gnu.org/ml/gcc-patches/2016-12/msg01501.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-11-18 17:08 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-11-18 17:08 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping 2 patches: http://gcc.gnu.org/ml/gcc-patches/2016-11/msg01074.html - C++ ABI - mangling of TLS aux symbols; either the posted patch or one with if (abi_version_at_least (11)) http://gcc.gnu.org/ml/gcc-patches/2016-11/msg00351.html - DWARF Solaris bootstrap fix Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* [C++ PATCH] Fix -Wimplicit-fallthrough in templates (PR c++/77886) @ 2016-10-08 6:15 Jakub Jelinek 2016-10-17 17:37 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-10-08 6:15 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! As the testcase shows, we weren't copying over FALLTHROUGH_LABEL_P during instantiations, which means that // FALLTHROUGH comments in templates were ignored (while [[fallthrough]];, being represented as internal calls, worked fine). Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-10-08 Jakub Jelinek <jakub@redhat.com> PR c++/77886 * pt.c (tsubst_expr) <case CASE_LABEL_EXPR> Copy over FALLTHROUGH_LABEL_P flag to the new LABEL_DECL. (tsubst_expr) <case LABEL_EXPR>: Likewise. * g++.dg/warn/Wimplicit-fallthrough-2.C: New test. --- gcc/cp/pt.c.jj 2016-10-07 21:36:47.000000000 +0200 +++ gcc/cp/pt.c 2016-10-07 23:51:53.244510627 +0200 @@ -15456,7 +15456,10 @@ tsubst_expr (tree t, tree args, tsubst_f { tree low = RECUR (CASE_LOW (t)); tree high = RECUR (CASE_HIGH (t)); - finish_case_label (EXPR_LOCATION (t), low, high); + tree l = finish_case_label (EXPR_LOCATION (t), low, high); + if (l && TREE_CODE (l) == CASE_LABEL_EXPR) + FALLTHROUGH_LABEL_P (CASE_LABEL (l)) + = FALLTHROUGH_LABEL_P (CASE_LABEL (t)); } break; @@ -15466,6 +15469,8 @@ tsubst_expr (tree t, tree args, tsubst_f tree label; label = finish_label_stmt (DECL_NAME (decl)); + if (TREE_CODE (label) == LABEL_DECL) + FALLTHROUGH_LABEL_P (label) = FALLTHROUGH_LABEL_P (decl); if (DECL_ATTRIBUTES (decl) != NULL_TREE) cplus_decl_attributes (&label, DECL_ATTRIBUTES (decl), 0); } --- gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-2.C.jj 2016-10-07 23:59:03.851102742 +0200 +++ gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-2.C 2016-10-08 00:04:25.759058055 +0200 @@ -0,0 +1,66 @@ +// PR c++/77886 +// { dg-do compile } +// { dg-options "-Wimplicit-fallthrough" } + +template <int N> +int +foo (int x, int y) +{ + switch (x) + { + case 1: + x++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + // FALLTHROUGH + case 2: + x++; + break; + case 3: + x++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + // FALLTHROUGH + lab: + case 4: + x++; + break; + case 5: + x++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + // FALLTHROUGH + default: + x++; + break; + case 26: + goto lab; + } +#if __cplusplus >= 201103L + switch (y) + { + case 1: + y++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + [[fallthrough]]; + case 2: + y++; + break; + case 3: + y++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + [[fallthrough]]; + lab2: + case 4: + y++; + break; + case 5: + y++; // { dg-bogus "this statement may f\[ahlotu\]*gh" } + [[fallthrough]]; + default: + y++; + break; + case 26: + goto lab2; + } +#endif + return x + y; +} + +int +bar (int x, int y) +{ + return foo<0> (x, y); +} Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2016-10-08 6:15 [C++ PATCH] Fix -Wimplicit-fallthrough in templates (PR c++/77886) Jakub Jelinek @ 2016-10-17 17:37 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-10-17 17:37 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping the [C++ PATCH] Fix -Wimplicit-fallthrough in templates (PR c++/77886) patch: On Sat, Oct 08, 2016 at 08:13:50AM +0200, Jakub Jelinek wrote: > 2016-10-08 Jakub Jelinek <jakub@redhat.com> > > PR c++/77886 > * pt.c (tsubst_expr) <case CASE_LABEL_EXPR> Copy over > FALLTHROUGH_LABEL_P flag to the new LABEL_DECL. > (tsubst_expr) <case LABEL_EXPR>: Likewise. > > * g++.dg/warn/Wimplicit-fallthrough-2.C: New test. Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping @ 2016-09-28 21:18 Bernd Edlinger 0 siblings, 0 replies; 504+ messages in thread From: Bernd Edlinger @ 2016-09-28 21:18 UTC (permalink / raw) To: Jakub Jelinek, Bernd Schmidt; +Cc: Jeff Law, gcc-patches Hi, I too personally always prefer to write the code as the variable at the left side and the constant at the right side of the comparison, because that is how I would also say it naturally in an English or German sentence. Like for instance "my son is more than 7 years old". I think nobody would ever say it the other way round. Maybe, except when it is a mathematical "a < b < c" relation, I would write it in C as "a < b && b < c", even if b is the variable part and a and c the constants. Hope that does not add more confusion... Having that said, the patch looks good to me. Thanks Bernd. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-09-28 19:31 Jakub Jelinek 2016-09-28 19:35 ` Bernd Schmidt 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-28 19:31 UTC (permalink / raw) To: Jeff Law, Bernd Schmidt; +Cc: gcc-patches Hi! I'd like to ping the http://gcc.gnu.org/ml/gcc-patches/2016-09/msg01436.html patch, containing various fixes for gimple-ssa-sprintf.c. If the 0 < var to var > 0 changes are deemed too controversial, I can separate them from the other changes. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 19:31 Jakub Jelinek @ 2016-09-28 19:35 ` Bernd Schmidt 2016-09-28 19:55 ` Jakub Jelinek 2016-09-28 20:19 ` Jakub Jelinek 0 siblings, 2 replies; 504+ messages in thread From: Bernd Schmidt @ 2016-09-28 19:35 UTC (permalink / raw) To: Jakub Jelinek, Jeff Law; +Cc: gcc-patches On 09/28/2016 09:24 PM, Jakub Jelinek wrote: > I'd like to ping the > > http://gcc.gnu.org/ml/gcc-patches/2016-09/msg01436.html > > patch, containing various fixes for gimple-ssa-sprintf.c. > If the 0 < var to var > 0 changes are deemed too controversial, I can > separate them from the other changes. I'd like to see them separated because they are obvious and good, so please install them first. Bernd ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 19:35 ` Bernd Schmidt @ 2016-09-28 19:55 ` Jakub Jelinek 2016-09-28 20:19 ` Jakub Jelinek 1 sibling, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-09-28 19:55 UTC (permalink / raw) To: Bernd Schmidt; +Cc: Jeff Law, gcc-patches On Wed, Sep 28, 2016 at 09:28:14PM +0200, Bernd Schmidt wrote: > On 09/28/2016 09:24 PM, Jakub Jelinek wrote: > >I'd like to ping the > > > >http://gcc.gnu.org/ml/gcc-patches/2016-09/msg01436.html > > > >patch, containing various fixes for gimple-ssa-sprintf.c. > >If the 0 < var to var > 0 changes are deemed too controversial, I can > >separate them from the other changes. > > I'd like to see them separated because they are obvious and good, so please > install them first. Ok, so here is the separated patch I've installed: 2016-09-28 Jakub Jelinek <jakub@redhat.com> * gimple-ssa-sprintf.c: Fix comment formatting. (format_integer): Use is_gimple_assign. (pass_sprintf_length::handle_gimple_call): Use gimple_call_builtin_p and gimple_call_fndecl. Reorder case BUILT_IN_SPRINTF_CHK. Fix up BUILT_IN_SNPRINTF_CHK comment. Replace "to to" with "to" in comment. (pass_sprintf_length::execute): Use is_gimple_call. --- gcc/gimple-ssa-sprintf.c.jj 2016-09-21 08:54:15.000000000 +0200 +++ gcc/gimple-ssa-sprintf.c 2016-09-21 15:09:02.209261013 +0200 @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. The pass handles all forms standard sprintf format directives, including character, integer, floating point, pointer, and strings, - with the standard C flags, widths, and precisions. For integers + with the standard C flags, widths, and precisions. For integers and strings it computes the length of output itself. For floating point it uses MPFR to fornmat known constants with up and down rounding and uses the resulting range of output lengths. For @@ -464,7 +464,7 @@ struct conversion_spec /* Format conversion function that given a conversion specification and an argument returns the formatting result. */ - fmtresult (*fmtfunc) (const conversion_spec &, tree); + fmtresult (*fmtfunc) (const conversion_spec &, tree); /* Return True when a the format flag CHR has been used. */ bool get_flag (char chr) const @@ -1032,10 +1032,10 @@ format_integer (const conversion_spec &s { /* The argument here may be the result of promoting the actual argument to int. Try to determine the type of the actual - argument before promotion and narrow down its range that + argument before promotion and narrow down its range that way. */ gimple *def = SSA_NAME_DEF_STMT (arg); - if (gimple_code (def) == GIMPLE_ASSIGN) + if (is_gimple_assign (def)) { tree_code code = gimple_assign_rhs_code (def); if (code == NOP_EXPR) @@ -2449,18 +2449,10 @@ pass_sprintf_length::handle_gimple_call call_info info = call_info (); info.callstmt = gsi_stmt (gsi); - info.func = gimple_call_fn (info.callstmt); - if (!info.func) - return; - - if (TREE_CODE (info.func) == ADDR_EXPR) - info.func = TREE_OPERAND (info.func, 0); - - if (TREE_CODE (info.func) != FUNCTION_DECL - || !DECL_BUILT_IN(info.func) - || DECL_BUILT_IN_CLASS (info.func) != BUILT_IN_NORMAL) + if (!gimple_call_builtin_p (info.callstmt, BUILT_IN_NORMAL)) return; + info.func = gimple_call_fndecl (info.callstmt); info.fncode = DECL_FUNCTION_CODE (info.func); /* The size of the destination as in snprintf(dest, size, ...). */ @@ -2487,6 +2479,14 @@ pass_sprintf_length::handle_gimple_call info.argidx = 2; break; + case BUILT_IN_SPRINTF_CHK: + // Signature: + // __builtin___sprintf_chk (dst, ost, objsize, format, ...) + idx_objsize = 2; + idx_format = 3; + info.argidx = 4; + break; + case BUILT_IN_SNPRINTF: // Signature: // __builtin_snprintf (dst, size, format, ...) @@ -2498,7 +2498,7 @@ pass_sprintf_length::handle_gimple_call case BUILT_IN_SNPRINTF_CHK: // Signature: - // __builtin___sprintf_chk (dst, size, ost, objsize, format, ...) + // __builtin___snprintf_chk (dst, size, ost, objsize, format, ...) idx_dstsize = 1; idx_objsize = 3; idx_format = 4; @@ -2506,14 +2506,6 @@ pass_sprintf_length::handle_gimple_call info.bounded = true; break; - case BUILT_IN_SPRINTF_CHK: - // Signature: - // __builtin___sprintf_chk (dst, ost, objsize, format, ...) - idx_objsize = 2; - idx_format = 3; - info.argidx = 4; - break; - case BUILT_IN_VSNPRINTF: // Signature: // __builtin_vsprintf (dst, size, format, va) @@ -2556,7 +2548,7 @@ pass_sprintf_length::handle_gimple_call if (idx_dstsize == HOST_WIDE_INT_M1U) { - // For non-bounded functions like sprintf, to to determine + // For non-bounded functions like sprintf, to determine // the size of the destination from the object or pointer // passed to it as the first argument. dstsize = get_destination_size (gimple_call_arg (info.callstmt, 0)); @@ -2667,7 +2660,7 @@ pass_sprintf_length::execute (function * /* Iterate over statements, looking for function calls. */ gimple *stmt = gsi_stmt (si); - if (gimple_code (stmt) == GIMPLE_CALL) + if (is_gimple_call (stmt)) handle_gimple_call (si); } } Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 19:35 ` Bernd Schmidt 2016-09-28 19:55 ` Jakub Jelinek @ 2016-09-28 20:19 ` Jakub Jelinek 2016-09-28 21:41 ` Bernd Schmidt 1 sibling, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-28 20:19 UTC (permalink / raw) To: Bernd Schmidt; +Cc: Jeff Law, gcc-patches On Wed, Sep 28, 2016 at 09:28:14PM +0200, Bernd Schmidt wrote: > On 09/28/2016 09:24 PM, Jakub Jelinek wrote: > >I'd like to ping the > > > >http://gcc.gnu.org/ml/gcc-patches/2016-09/msg01436.html > > > >patch, containing various fixes for gimple-ssa-sprintf.c. > >If the 0 < var to var > 0 changes are deemed too controversial, I can > >separate them from the other changes. > > I'd like to see them separated because they are obvious and good, so please > install them first. And here are the 0 < var to var > 0 changes. Thoughts on those? 2016-09-28 Jakub Jelinek <jakub@redhat.com> * gimple-ssa-sprintf.c (pass_sprintf_length::gate): Use x > 0 instead of 0 < x. (format_floating, format_string, format_directive, get_destination_size, pass_sprintf_length::handle_gimple_call): Likewise. --- gcc/gimple-ssa-sprintf.c.jj 2016-09-21 08:54:15.000000000 +0200 +++ gcc/gimple-ssa-sprintf.c 2016-09-21 15:09:02.209261013 +0200 @@ -130,8 +130,8 @@ pass_sprintf_length::gate (function *) not optimizing and the pass is being invoked early, or when optimizing and the pass is being invoked during optimization (i.e., "late"). */ - return ((0 < warn_format_length || flag_printf_return_value) - && (0 < optimize) == fold_return_value); + return ((warn_format_length > 0 || flag_printf_return_value) + && (optimize > 0) == fold_return_value); } /* The result of a call to a formatted function. */ @@ -1188,7 +1188,7 @@ format_floating (const conversion_spec & case 'a': { /* The minimum output is "0x.p+0". */ - res.range.min = 6 + (0 < prec ? prec : 0); + res.range.min = 6 + (prec > 0 ? prec : 0); /* Compute the maximum just once. */ static const int a_max[] = { @@ -1249,7 +1249,7 @@ format_floating (const conversion_spec & gcc_unreachable (); } - if (0 < width) + if (width > 0) { if (res.range.min < (unsigned)width) res.range.min = width; @@ -1440,7 +1440,7 @@ get_string_length (tree str) static fmtresult format_string (const conversion_spec &spec, tree arg) { - unsigned width = spec.have_width && 0 < spec.width ? spec.width : 0; + unsigned width = spec.have_width && spec.width > 0 ? spec.width : 0; int prec = spec.have_precision ? spec.precision : -1; if (spec.star_width) @@ -1756,7 +1756,7 @@ format_directive (const pass_sprintf_len } else { - if (!res->warned && 0 < fmtres.range.min && navail < fmtres.range.min) + if (!res->warned && fmtres.range.min > 0 && navail < fmtres.range.min) { const char* fmtstr = (info.bounded @@ -2332,7 +2332,7 @@ get_destination_size (tree dest) a member array as opposed to the whole enclosing object), otherwise use type-zero object size to determine the size of the enclosing object (the function fails without optimization in this type). */ - int ost = 0 < optimize; + int ost = optimize > 0; unsigned HOST_WIDE_INT size; if (compute_builtin_object_size (dest, ost, &size)) return size; @@ -2648,7 +2640,8 @@ pass_sprintf_length::handle_gimple_call attempt to substitute the computed result for the return value of the call. Avoid this optimization when -frounding-math is in effect and the format string contains a floating point directive. */ - if (0 < optimize && flag_printf_return_value + if (optimize > 0 + && flag_printf_return_value && (!flag_rounding_math || !res.floating)) try_substitute_return_value (gsi, info, res); } Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 20:19 ` Jakub Jelinek @ 2016-09-28 21:41 ` Bernd Schmidt 2016-09-28 21:51 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Bernd Schmidt @ 2016-09-28 21:41 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jeff Law, gcc-patches On 09/28/2016 09:47 PM, Jakub Jelinek wrote: > And here are the 0 < var to var > 0 changes. Thoughts on those? I kind of meant it the other way round, so yeah, please install. Bernd ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 21:41 ` Bernd Schmidt @ 2016-09-28 21:51 ` Jakub Jelinek 2016-09-29 0:32 ` Bernd Schmidt 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-28 21:51 UTC (permalink / raw) To: Bernd Schmidt; +Cc: Jeff Law, gcc-patches On Wed, Sep 28, 2016 at 11:17:55PM +0200, Bernd Schmidt wrote: > On 09/28/2016 09:47 PM, Jakub Jelinek wrote: > >And here are the 0 < var to var > 0 changes. Thoughts on those? > > I kind of meant it the other way round, so yeah, please install. Oops, sorry, shall I revert what I've committed then? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-28 21:51 ` Jakub Jelinek @ 2016-09-29 0:32 ` Bernd Schmidt 2016-09-29 0:41 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Bernd Schmidt @ 2016-09-29 0:32 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jeff Law, gcc-patches On 09/28/2016 11:40 PM, Jakub Jelinek wrote: > On Wed, Sep 28, 2016 at 11:17:55PM +0200, Bernd Schmidt wrote: >> On 09/28/2016 09:47 PM, Jakub Jelinek wrote: >>> And here are the 0 < var to var > 0 changes. Thoughts on those? >> >> I kind of meant it the other way round, so yeah, please install. > > Oops, sorry, shall I revert what I've committed then? No, I think it looks fine too, although I can't figure out why that one block of code was moved. Bernd ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-29 0:32 ` Bernd Schmidt @ 2016-09-29 0:41 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-09-29 0:41 UTC (permalink / raw) To: Bernd Schmidt; +Cc: Jeff Law, gcc-patches On Wed, Sep 28, 2016 at 11:46:59PM +0200, Bernd Schmidt wrote: > On 09/28/2016 11:40 PM, Jakub Jelinek wrote: > >On Wed, Sep 28, 2016 at 11:17:55PM +0200, Bernd Schmidt wrote: > >>On 09/28/2016 09:47 PM, Jakub Jelinek wrote: > >>>And here are the 0 < var to var > 0 changes. Thoughts on those? > >> > >>I kind of meant it the other way round, so yeah, please install. > > > >Oops, sorry, shall I revert what I've committed then? > > No, I think it looks fine too, although I can't figure out why that one > block of code was moved. The intent was that each of the non-__*_chk builtins is followed by its __*_chk counterpart; without the patch that was almost the case except for that one exception. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-09-14 21:55 Jakub Jelinek 2016-09-15 11:01 ` Bernd Schmidt 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-14 21:55 UTC (permalink / raw) To: Jason Merrill, Uros Bizjak, Jeff Law, Bernd Schmidt; +Cc: gcc-patches Hi! I'd like to ping a couple of patches: C++ === http://gcc.gnu.org/ml/gcc-patches/2016-08/msg01995.html - PR77375 - wrong-code with mutable members in base classes http://gcc.gnu.org/ml/gcc-patches/2016-08/msg01998.html - PR77338 - fix constexpr ICE on PARM_DECL with incomplete type http://gcc.gnu.org/ml/gcc-patches/2016-08/msg02002.html - PR77379 - fix testcase mangling regexps for 32-bit targets http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00228.html - PR77467 - fix constexpr switch handling http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00230.html - PR77482 - fix ICE in cp/error.c x86 === http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00339.html - PR77475 - i386 backend part of the spellcheck option changes sched ===== http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00088.html - PR77425 - fix UB in sd_iterator_cond Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-09-14 21:55 Jakub Jelinek @ 2016-09-15 11:01 ` Bernd Schmidt 0 siblings, 0 replies; 504+ messages in thread From: Bernd Schmidt @ 2016-09-15 11:01 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill, Uros Bizjak, Jeff Law; +Cc: gcc-patches On 09/14/2016 11:47 PM, Jakub Jelinek wrote: > > http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00088.html > - PR77425 - fix UB in sd_iterator_cond Ok. Bernd ^ permalink raw reply [flat|nested] 504+ messages in thread
* [C++ PATCH] Fix constexpr switch handling (PR c++/77467) @ 2016-09-05 17:14 Jakub Jelinek 2016-09-16 20:00 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-05 17:14 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! cxx_eval_switch_expr assumes that SWITCH_EXPR's body is always a STATEMENT_LIST, but that doesn't have to be the case. As the testcase shows, if there are any variable declarations in the switch body, it can be also a BIND_EXPR, which cxx_eval_constant_expression handles properly, and as bar in the testcase shows, it can be also just a single statement (as try isn't allowed in constexpr functions, I think we just want to do what cxx_eval_statement_list would do on such a statement if it was wrapped into a STATEMENT_LIST - ignore it, as the case NNN: or default: is not present. Bootstrapped/regtested on x86_64-linux and i686-linux? What about older branches? 2016-09-05 Jakub Jelinek <jakub@redhat.com> PR c++/77467 * constexpr.c (cxx_eval_switch_expr): Call cxx_eval_constant_expression instead of cxx_eval_statement_list, for body other than STATEMENT_LIST or BIND_EXPR don't evaluate the body at all. * g++.dg/cpp1y/constexpr-77467.C: New test. --- gcc/cp/constexpr.c.jj 2016-08-30 08:42:06.000000000 +0200 +++ gcc/cp/constexpr.c 2016-09-05 11:34:30.185518395 +0200 @@ -3572,8 +3572,12 @@ cxx_eval_switch_expr (const constexpr_ct *jump_target = cond; tree body = TREE_OPERAND (t, 1); - cxx_eval_statement_list (ctx, body, - non_constant_p, overflow_p, jump_target); + /* If body is a statement other than STATEMENT_LIST or BIND_EXPR, + it should be skipped. E.g. switch (a) b = a; */ + if (TREE_CODE (body) == STATEMENT_LIST + || TREE_CODE (body) == BIND_EXPR) + cxx_eval_constant_expression (ctx, body, false, + non_constant_p, overflow_p, jump_target); if (breaks (jump_target) || switches (jump_target)) *jump_target = NULL_TREE; return NULL_TREE; --- gcc/testsuite/g++.dg/cpp1y/constexpr-77467.C.jj 2016-09-05 11:19:30.593750642 +0200 +++ gcc/testsuite/g++.dg/cpp1y/constexpr-77467.C 2016-09-05 11:37:11.929477518 +0200 @@ -0,0 +1,33 @@ +// PR c++/77467 +// { dg-do compile { target c++14 } } + +constexpr int +foo (const int x, const unsigned n) noexcept +{ + switch (n) + { + case 0: + return 1; + case 1: + return x; + default: + const auto m = (n >> 1); + const auto y = foo (x, m); + return ((m << 1) == n) ? y * y : x * y * y; + } +} + +static_assert (foo (3, 2) == 9, ""); +static_assert (foo (2, 3) == 8, ""); + +constexpr int +bar (int x) +{ + int a = x; + switch (x) + a = x + 1; + return a; +} + +static_assert (bar (0) == 0, ""); +static_assert (bar (1) == 1, ""); Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: [C++ PATCH] Fix constexpr switch handling (PR c++/77467) 2016-09-05 17:14 [C++ PATCH] Fix constexpr switch handling (PR c++/77467) Jakub Jelinek @ 2016-09-16 20:00 ` Jason Merrill 2016-09-16 20:51 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jason Merrill @ 2016-09-16 20:00 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches List On Mon, Sep 5, 2016 at 1:11 PM, Jakub Jelinek <jakub@redhat.com> wrote: > + /* If body is a statement other than STATEMENT_LIST or BIND_EXPR, > + it should be skipped. E.g. switch (a) b = a; */ > + if (TREE_CODE (body) == STATEMENT_LIST > + || TREE_CODE (body) == BIND_EXPR) I'm nervous about this optimization for useless code breaking other things that might (one day) wrap a case label; I think I'd prefer to drop the condition. OK with that change, for trunk and 6. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: [C++ PATCH] Fix constexpr switch handling (PR c++/77467) 2016-09-16 20:00 ` Jason Merrill @ 2016-09-16 20:51 ` Jakub Jelinek 2016-09-19 18:49 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-16 20:51 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List On Fri, Sep 16, 2016 at 03:51:11PM -0400, Jason Merrill wrote: > On Mon, Sep 5, 2016 at 1:11 PM, Jakub Jelinek <jakub@redhat.com> wrote: > > + /* If body is a statement other than STATEMENT_LIST or BIND_EXPR, > > + it should be skipped. E.g. switch (a) b = a; */ > > + if (TREE_CODE (body) == STATEMENT_LIST > > + || TREE_CODE (body) == BIND_EXPR) > > I'm nervous about this optimization for useless code breaking other > things that might (one day) wrap a case label; I think I'd prefer to > drop the condition. By droping the condition you mean unconditionally call cxx_eval_constant_expression (ctx, body, false, non_constant_p, overflow_p, jump_target); ? That is known not to work, that breaks the +constexpr int +bar (int x) +{ + int a = x; + switch (x) + a = x + 1; + return a; +} handling in the testcase, where body is the MODIFY_EXPR which doesn't have the label and thus needs to be skipped. The problem is that all the logic for skipping statements until the label is found is in cxx_eval_statement_list only. For STATEMENT_LIST that is called by cxx_eval_constant_expression, for BIND_EXPR if we are lucky enough that BIND_EXPR_BODY is a STATEMENT_LIST too (otherwise I assume even my patch doesn't fix it, it would need to verify that). If body is some other statement, then it really should be skipped, but it isn't, because cxx_eval_constant_expression ignores it. I wonder if we e.g. cxx_eval_constant_expression couldn't early in the function for if (*jump_target) return immediately unless code is something like STATEMENT_LIST or BIND_EXPR with BIND_EXPR_BODY being STATEMENT_LIST, or perhaps in the future other construct containing other stmts. I've beeing thinking about TRY block, but at least on the testcases I've tried it has been rejected in constexpr functions, I think one can't branch into statement expressions, so that should be fine, OpenMP/OpenACC constructs are hopefully also rejected in constexpr, what else? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: [C++ PATCH] Fix constexpr switch handling (PR c++/77467) 2016-09-16 20:51 ` Jakub Jelinek @ 2016-09-19 18:49 ` Jason Merrill 2016-09-20 16:29 ` [C++ PATCH] Fix constexpr switch handling (PR c++/77467, take 2) Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jason Merrill @ 2016-09-19 18:49 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches List On Fri, Sep 16, 2016 at 4:44 PM, Jakub Jelinek <jakub@redhat.com> wrote: > On Fri, Sep 16, 2016 at 03:51:11PM -0400, Jason Merrill wrote: >> On Mon, Sep 5, 2016 at 1:11 PM, Jakub Jelinek <jakub@redhat.com> wrote: >> > + /* If body is a statement other than STATEMENT_LIST or BIND_EXPR, >> > + it should be skipped. E.g. switch (a) b = a; */ >> > + if (TREE_CODE (body) == STATEMENT_LIST >> > + || TREE_CODE (body) == BIND_EXPR) >> >> I'm nervous about this optimization for useless code breaking other >> things that might (one day) wrap a case label; I think I'd prefer to >> drop the condition. > > By droping the condition you mean unconditionally call > cxx_eval_constant_expression (ctx, body, false, > non_constant_p, overflow_p, jump_target); > ? That is known not to work, that breaks the > +constexpr int > +bar (int x) > +{ > + int a = x; > + switch (x) > + a = x + 1; > + return a; > +} > handling in the testcase, where body is the MODIFY_EXPR which doesn't have > the label and thus needs to be skipped. The problem is that all the logic for > skipping statements until the label is found is in cxx_eval_statement_list > only. Ah, right. > For STATEMENT_LIST that is called by cxx_eval_constant_expression, > for BIND_EXPR if we are lucky enough that BIND_EXPR_BODY is a STATEMENT_LIST > too (otherwise I assume even my patch doesn't fix it, it would need to > verify that). If body is some other statement, then it really should be > skipped, but it isn't, because cxx_eval_constant_expression ignores it. > I wonder if we e.g. cxx_eval_constant_expression couldn't early in the > function for if (*jump_target) return immediately unless code is something > like STATEMENT_LIST or BIND_EXPR with BIND_EXPR_BODY being STATEMENT_LIST, > or perhaps in the future other construct containing other stmts. We might assert !jump_target before the call to cxx_eval_store_expression, to make sure we don't accidentally evaluate one when we're trying to jump. > I've beeing thinking about TRY block, but at least on the testcases I've > tried it has been rejected in constexpr functions, I think one can't branch > into statement expressions, so that should be fine, OpenMP/OpenACC > constructs are hopefully also rejected in constexpr, what else? LOOP_EXPR, COND_EXPR? Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* [C++ PATCH] Fix constexpr switch handling (PR c++/77467, take 2) 2016-09-19 18:49 ` Jason Merrill @ 2016-09-20 16:29 ` Jakub Jelinek 2016-09-27 21:33 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-09-20 16:29 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List On Mon, Sep 19, 2016 at 02:34:17PM -0400, Jason Merrill wrote: > > For STATEMENT_LIST that is called by cxx_eval_constant_expression, > > for BIND_EXPR if we are lucky enough that BIND_EXPR_BODY is a STATEMENT_LIST > > too (otherwise I assume even my patch doesn't fix it, it would need to > > verify that). If body is some other statement, then it really should be > > skipped, but it isn't, because cxx_eval_constant_expression ignores it. > > > I wonder if we e.g. cxx_eval_constant_expression couldn't early in the > > function for if (*jump_target) return immediately unless code is something > > like STATEMENT_LIST or BIND_EXPR with BIND_EXPR_BODY being STATEMENT_LIST, > > or perhaps in the future other construct containing other stmts. > > We might assert !jump_target before the call to > cxx_eval_store_expression, to make sure we don't accidentally evaluate > one when we're trying to jump. I've done that. > > I've beeing thinking about TRY block, but at least on the testcases I've > > tried it has been rejected in constexpr functions, I think one can't branch > > into statement expressions, so that should be fine, OpenMP/OpenACC > > constructs are hopefully also rejected in constexpr, what else? > > LOOP_EXPR, COND_EXPR? Looking at those and adding further testcases revealed lots of other issues, which the following patch attempts to deal with. One is that handling the CASE_LABEL_EXPR or LABEL_EXPR only inside of cxx_eval_statement_list doesn't really work well, because as the testcase shows, for labeled null statements inside say if then block or else block there is no STATEMENT_LIST wrapping it up. Another is that the default: label can be arbitrarily nested (in inner STATEMENT_LIST, or LOOP_EXPR body, or COND_EXPR then or else block, so trying to handle it in cxx_eval_statement_list also works only in the simplest switch case, we really need to process (with initial skipping mode) the whole SWITCH_EXPR body and if we get through everything and (as optimization) determine there has been a default: label, restart processing it again with a flag to satisfy switches (jump_target) with the default: label of the current switch. Another thing is that the skipping of statements in cxx_eval_statement_list didn't really work correctly for COND_EXPR/LOOP_EXPR, so the patch pretty much removes all the skip/label/etc. handling from cxx_eval_statement_list. And, lastly the handling of LOOP_EXPR and COND_EXPR when initially skipping had to be changed. For COND_EXPR, we don't want to evaluate the condition in that case (one can't goto into the condition expression), and need to process then block with skipping and, if it isn't skipped at its end, not process else block, otherwise process it. And for LOOP_EXPR, if still skipping we'd need not to iterate again on the body, as the whole loop has been bypassed in that case. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-09-20 Jakub Jelinek <jakub@redhat.com> PR c++/77467 * constexpr.c (enum constexpr_switch_state): New. (struct constexpr_ctx): Add css_state field. (label_matches): Add CTX and STMT arguments, remove I and DEFAULT_LABEL. For CASE_LABEL_EXPR assert ctx->css_state != NULL, handle default labels according to css_state. (cxx_eval_statement_list): Remove statement skipping, label_matches and default_label handling code. (cxx_eval_loop_expr): Exit after first iteration even if switches (jump_target). (cxx_eval_switch_expr): Set up css_state field in ctx, if default label has been seen in the body, but no cases matched, evaluate the body second time. (cxx_eval_constant_expression): Handle stmt skipping and label_matches here. Handle PREDICT_EXPR. For MODIFY_EXPR or INIT_EXPR, assert statement is not skipped. For COND_EXPR during skipping, don't evaluate condition, just the then block and if still skipping at the end also the else block. (cxx_eval_outermost_constant_expr): Adjust constexpr_ctx initializer. (is_sub_constant_expr): Likewise. * g++.dg/cpp1y/constexpr-77467.C: New test. --- gcc/cp/constexpr.c.jj 2016-09-19 16:35:32.835574406 +0200 +++ gcc/cp/constexpr.c 2016-09-20 12:51:48.270305879 +0200 @@ -900,6 +900,18 @@ struct constexpr_call_hasher : ggc_ptr_h static bool equal (constexpr_call *, constexpr_call *); }; +enum constexpr_switch_state { + /* Used when processing a switch for the first time by cxx_eval_switch_expr + and default: label for that switch has not been seen yet. */ + css_default_not_seen, + /* Used when processing a switch for the first time by cxx_eval_switch_expr + and default: label for that switch has been seen already. */ + css_default_seen, + /* Used when processing a switch for the second time by + cxx_eval_switch_expr, where default: label should match. */ + css_default_processing +}; + /* The constexpr expansion context. CALL is the current function expansion, CTOR is the current aggregate initializer, OBJECT is the object being initialized by CTOR, either a VAR_DECL or a _REF. VALUES @@ -919,6 +931,8 @@ struct constexpr_ctx { tree ctor; /* The object we're building the CONSTRUCTOR for. */ tree object; + /* If inside SWITCH_EXPR. */ + constexpr_switch_state *css_state; /* Whether we should error on a non-constant expression or fail quietly. */ bool quiet; /* Whether we are strictly conforming to constant expression rules or @@ -3487,14 +3501,12 @@ switches (tree *jump_target) } /* Subroutine of cxx_eval_statement_list. Determine whether the statement - at I matches *jump_target. If we're looking for a case label and we see - the default label, copy I into DEFAULT_LABEL. */ + STMT matches *jump_target. If we're looking for a case label and we see + the default label, note it in ctx->css_state. */ static bool -label_matches (tree *jump_target, tree_stmt_iterator i, - tree_stmt_iterator& default_label) +label_matches (const constexpr_ctx *ctx, tree *jump_target, tree stmt) { - tree stmt = tsi_stmt (i); switch (TREE_CODE (*jump_target)) { case LABEL_DECL: @@ -3506,8 +3518,18 @@ label_matches (tree *jump_target, tree_s case INTEGER_CST: if (TREE_CODE (stmt) == CASE_LABEL_EXPR) { + gcc_assert (ctx->css_state != NULL); if (!CASE_LOW (stmt)) - default_label = i; + { + /* default: should appear just once in a SWITCH_EXPR + body (excluding nested SWITCH_EXPR). */ + gcc_assert (*ctx->css_state != css_default_seen); + /* When evaluating SWITCH_EXPR body for the second time, + return true for the default: label. */ + if (*ctx->css_state == css_default_processing) + return true; + *ctx->css_state = css_default_seen; + } else if (CASE_HIGH (stmt)) { if (tree_int_cst_le (CASE_LOW (stmt), *jump_target) @@ -3534,7 +3556,6 @@ cxx_eval_statement_list (const constexpr tree *jump_target) { tree_stmt_iterator i; - tree_stmt_iterator default_label = tree_stmt_iterator(); tree local_target; /* In a statement-expression we want to return the last value. */ tree r = NULL_TREE; @@ -3545,18 +3566,7 @@ cxx_eval_statement_list (const constexpr } for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i)) { - reenter: tree stmt = tsi_stmt (i); - if (*jump_target) - { - if (TREE_CODE (stmt) == STATEMENT_LIST) - /* The label we want might be inside. */; - else if (label_matches (jump_target, i, default_label)) - /* Found it. */ - *jump_target = NULL_TREE; - else - continue; - } r = cxx_eval_constant_expression (ctx, stmt, false, non_constant_p, overflow_p, jump_target); @@ -3565,12 +3575,6 @@ cxx_eval_statement_list (const constexpr if (returns (jump_target) || breaks (jump_target)) break; } - if (switches (jump_target) && !tsi_end_p (default_label)) - { - i = default_label; - *jump_target = NULL_TREE; - goto reenter; - } return r; } @@ -3609,7 +3613,10 @@ cxx_eval_loop_expr (const constexpr_ctx break; } } - while (!returns (jump_target) && !breaks (jump_target) && !*non_constant_p); + while (!returns (jump_target) + && !breaks (jump_target) + && !switches (jump_target) + && !*non_constant_p); if (breaks (jump_target)) *jump_target = NULL_TREE; @@ -3632,8 +3639,20 @@ cxx_eval_switch_expr (const constexpr_ct *jump_target = cond; tree body = TREE_OPERAND (t, 1); - cxx_eval_statement_list (ctx, body, - non_constant_p, overflow_p, jump_target); + constexpr_ctx new_ctx = *ctx; + constexpr_switch_state css = css_default_not_seen; + new_ctx.css_state = &css; + cxx_eval_constant_expression (&new_ctx, body, false, + non_constant_p, overflow_p, jump_target); + if (switches (jump_target) && css == css_default_seen) + { + /* If the SWITCH_EXPR body has default: label, process it once again, + this time instructing label_matches to return true for default: + label on switches (jump_target). */ + css = css_default_processing; + cxx_eval_constant_expression (&new_ctx, body, false, + non_constant_p, overflow_p, jump_target); + } if (breaks (jump_target) || switches (jump_target)) *jump_target = NULL_TREE; return NULL_TREE; @@ -3653,6 +3672,27 @@ cxx_eval_constant_expression (const cons constexpr_ctx new_ctx; tree r = t; + if (jump_target && *jump_target) + { + /* If we are jumping, ignore all statements/expressions except those + that could have LABEL_EXPR or CASE_LABEL_EXPR in their bodies. */ + switch (TREE_CODE (t)) + { + case BIND_EXPR: + case STATEMENT_LIST: + case LOOP_EXPR: + case COND_EXPR: + break; + case LABEL_EXPR: + case CASE_LABEL_EXPR: + if (label_matches (ctx, jump_target, t)) + /* Found it. */ + *jump_target = NULL_TREE; + return NULL_TREE; + default: + return NULL_TREE; + } + } if (t == error_mark_node) { *non_constant_p = true; @@ -3733,6 +3773,7 @@ cxx_eval_constant_expression (const cons case LABEL_DECL: case LABEL_EXPR: case CASE_LABEL_EXPR: + case PREDICT_EXPR: return t; case PARM_DECL: @@ -3838,6 +3879,7 @@ cxx_eval_constant_expression (const cons case INIT_EXPR: case MODIFY_EXPR: + gcc_assert (jump_target == NULL || *jump_target == NULL_TREE); r = cxx_eval_store_expression (ctx, t, lval, non_constant_p, overflow_p); break; @@ -4068,6 +4110,22 @@ cxx_eval_constant_expression (const cons break; case COND_EXPR: + if (jump_target && *jump_target) + { + /* When jumping to a label, the label might be either in the + then or else blocks, so process then block first in skipping + mode first, and if we are still in the skipping mode at its end, + process the else block too. */ + r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1), + lval, non_constant_p, overflow_p, + jump_target); + if (*jump_target) + r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 2), + lval, non_constant_p, overflow_p, + jump_target); + break; + } + /* FALLTHRU */ case VEC_COND_EXPR: r = cxx_eval_conditional_expression (ctx, t, lval, non_constant_p, overflow_p, @@ -4343,7 +4401,7 @@ cxx_eval_outermost_constant_expr (tree t bool overflow_p = false; hash_map<tree,tree> map; - constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, + constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, NULL, allow_non_constant, strict }; tree type = initialized_type (t); @@ -4463,7 +4521,7 @@ is_sub_constant_expr (tree t) bool overflow_p = false; hash_map <tree, tree> map; - constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, true, true }; + constexpr_ctx ctx = { NULL, &map, NULL, NULL, NULL, NULL, true, true }; cxx_eval_constant_expression (&ctx, t, false, &non_constant_p, &overflow_p); --- gcc/testsuite/g++.dg/cpp1y/constexpr-77467.C.jj 2016-09-20 10:26:51.226148386 +0200 +++ gcc/testsuite/g++.dg/cpp1y/constexpr-77467.C 2016-09-20 12:35:44.507603391 +0200 @@ -0,0 +1,128 @@ +// PR c++/77467 +// { dg-do compile { target c++14 } } + +constexpr int +foo (const int x, const unsigned n) noexcept +{ + switch (n) + { + case 0: + return 1; + case 1: + return x; + default: + const auto m = (n >> 1); + const auto y = foo (x, m); + return ((m << 1) == n) ? y * y : x * y * y; + } +} + +static_assert (foo (3, 2) == 9, ""); +static_assert (foo (2, 3) == 8, ""); + +constexpr int +bar (int x) +{ + int a = x; + switch (x) + a = x + 1; + return a; +} + +static_assert (bar (0) == 0, ""); +static_assert (bar (1) == 1, ""); + +constexpr int +baz (const int x, int y) noexcept +{ + switch (x) + { + case 0: + return 1; + case 1: + return x; + case 2: + if ((y += 2) == 0) + { + case 3: + y += 4; + break; + } + else + { + case 4: + y += 8; + break; + } + break; + case 5: + for (y = 0; y < 3; y++) + { + case 7: + if (y == -4) + y += 3; + if (y == -3) + continue; + if (y == -2) + { + y += 18; + break; + } + if (y == 2) + { + case 6: + y += 12; + default: + y++; + break; + } + } + break; + case -1: + case -2: + switch (y) + { + case 19: + y += 2; + break; + case 20: + y += 3; + if (x == 2) + case 21:; + y += 2; + if (x == 3) + default:; + y += 4; + break; + } + return x + y + 1; + } + return x + y; +} + +static_assert (baz (0, 7) == 1, ""); +static_assert (baz (1, 7) == 1, ""); +static_assert (baz (2, -2) == 6, ""); +static_assert (baz (2, 0) == 12, ""); +static_assert (baz (3, 1) == 8, ""); +static_assert (baz (4, 2) == 14, ""); +static_assert (baz (5, -20) == 20, ""); +static_assert (baz (6, 5) == 24, ""); +static_assert (baz (7, -5) == 22, ""); +static_assert (baz (7, -4) == 22, ""); +static_assert (baz (7, -3) == 23, ""); +static_assert (baz (7, -2) == 23, ""); +static_assert (baz (7, -1) == 22, ""); +static_assert (baz (7, 0) == 22, ""); +static_assert (baz (7, 2) == 22, ""); +static_assert (baz (7, 6) == 14, ""); +static_assert (baz (8, 9) == 18, ""); +static_assert (baz (8, -2) == 7, ""); +static_assert (baz (-1, 19) == 21, ""); +static_assert (baz (-1, 20) == 29, ""); +static_assert (baz (-1, 21) == 27, ""); +static_assert (baz (-1, 5) == 9, ""); +static_assert (baz (-2, 19) == 20, ""); +static_assert (baz (-2, 20) == 28, ""); +static_assert (baz (-2, 21) == 26, ""); +static_assert (baz (-2, 5) == 8, ""); Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2016-09-20 16:29 ` [C++ PATCH] Fix constexpr switch handling (PR c++/77467, take 2) Jakub Jelinek @ 2016-09-27 21:33 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-09-27 21:33 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List Hi! On Tue, Sep 20, 2016 at 06:12:26PM +0200, Jakub Jelinek wrote: > 2016-09-20 Jakub Jelinek <jakub@redhat.com> > > PR c++/77467 > * constexpr.c (enum constexpr_switch_state): New. > (struct constexpr_ctx): Add css_state field. > (label_matches): Add CTX and STMT arguments, remove I and > DEFAULT_LABEL. For CASE_LABEL_EXPR assert ctx->css_state != NULL, > handle default labels according to css_state. > (cxx_eval_statement_list): Remove statement skipping, label_matches > and default_label handling code. > (cxx_eval_loop_expr): Exit after first iteration even if > switches (jump_target). > (cxx_eval_switch_expr): Set up css_state field in ctx, if default > label has been seen in the body, but no cases matched, evaluate > the body second time. > (cxx_eval_constant_expression): Handle stmt skipping and label_matches > here. Handle PREDICT_EXPR. For MODIFY_EXPR or INIT_EXPR, assert > statement is not skipped. For COND_EXPR during skipping, don't > evaluate condition, just the then block and if still skipping at the > end also the else block. > (cxx_eval_outermost_constant_expr): Adjust constexpr_ctx initializer. > (is_sub_constant_expr): Likewise. > > * g++.dg/cpp1y/constexpr-77467.C: New test. I'd like to ping this patch. Ok for trunk? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-08-15 8:50 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-08-15 8:50 UTC (permalink / raw) To: gcc-patches Hi! I'd like to ping following fix: PR71910 - http://gcc.gnu.org/ml/gcc-patches/2016-08/msg00624.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-07-22 14:16 Cesar Philippidis 0 siblings, 0 replies; 504+ messages in thread From: Cesar Philippidis @ 2016-07-22 14:16 UTC (permalink / raw) To: gcc-patches, Fortran List, Jakub Jelinek The following patches still need to be reviewed: * Change an LTO wrapper assert failure to an error when it detects missing symbols. This situation can arise in offloading code, e.g. when the user forgets to declare a global variable as offloadable. https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00043.html * Add support for OpenACC routine clauses in fortran modules. Also, allow the routine directive to be applied to intrinsic procedures. https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00063.html Thanks, Cesar ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-07-18 18:08 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-07-18 18:08 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping a couple of C++ patches: - PR70869 - change fix from cp_genericize_r tweak to cp_walk_subtrees http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00568.html - PR71835 - fix diagnostic ICE http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00567.html - PR71828 - fix *PART_EXPR handling in constexpr http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00565.html - PR71826 - fix error recovery in tsubst_baselink http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00530.html - PR71822 - fix ICE with VEC_INIT_EXPR http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00528.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-07-11 13:14 Jakub Jelinek 2016-07-12 8:54 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-07-11 13:14 UTC (permalink / raw) To: Richard Biener; +Cc: gcc-patches Hi! I'd like to ping PR71716 - fix hang with long double atomics http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00045.html Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-07-11 13:14 Jakub Jelinek @ 2016-07-12 8:54 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2016-07-12 8:54 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Mon, 11 Jul 2016, Jakub Jelinek wrote: > Hi! > > I'd like to ping > PR71716 - fix hang with long double atomics > http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00045.html Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-06-02 9:47 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-06-02 9:47 UTC (permalink / raw) To: Uros Bizjak, Kirill Yukhin; +Cc: gcc-patches Hi! I'd like to ping 3 XMM16+ patches: 1) avx_vec_concat<mode> http://gcc.gnu.org/ml/gcc-patches/2016-05/msg01826.html 2) *vec_concatv4si http://gcc.gnu.org/ml/gcc-patches/2016-05/msg02115.html 3) *vec_concatv2si_sse4_1 http://gcc.gnu.org/ml/gcc-patches/2016-05/msg02129.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-03-18 9:23 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-03-18 9:23 UTC (permalink / raw) To: Jason Merrill, Alexandre Oliva; +Cc: gcc-patches Hi! I'd like to ping 2 patches, one mine: P2 PR70001 http://gcc.gnu.org/ml/gcc-patches/2016-03/msg00710.html and one from Alex, which hasn't been pinged for quite a while, but is P1: P1 PR69315 https://gcc.gnu.org/ml/gcc-patches/2016-01/msg02010.html Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-03-17 14:24 Jakub Jelinek 2016-03-17 15:48 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-03-17 14:24 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping a C++ PR70144 patch: http://gcc.gnu.org/ml/gcc-patches/2016-03/msg00653.html Since then, Zdenek has filed another PR with __builtin_constant_p (foo) where foo is FUNCTION_DECL, and only the above version fixes that, not the other one. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-03-17 14:24 Jakub Jelinek @ 2016-03-17 15:48 ` Jason Merrill 0 siblings, 0 replies; 504+ messages in thread From: Jason Merrill @ 2016-03-17 15:48 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches OK. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-03-04 7:30 Jakub Jelinek 2016-03-04 7:38 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-03-04 7:30 UTC (permalink / raw) To: Joseph S. Myers, Gerald Pfeifer, Sandra Loosemore; +Cc: gcc-patches Hi! I'd like to ping a texinfo fix for __builtin_alloca*: http://gcc.gnu.org/ml/gcc-patches/2016-02/msg01842.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-03-04 7:30 Jakub Jelinek @ 2016-03-04 7:38 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2016-03-04 7:38 UTC (permalink / raw) To: Jakub Jelinek, Joseph S. Myers, Gerald Pfeifer, Sandra Loosemore Cc: gcc-patches On 03/04/2016 12:30 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping a texinfo fix for __builtin_alloca*: > http://gcc.gnu.org/ml/gcc-patches/2016-02/msg01842.html OK. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-03-03 14:36 Jakub Jelinek 2016-03-04 7:10 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-03-03 14:36 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping fix for P1 PR69947: https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01743.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-03-03 14:36 Jakub Jelinek @ 2016-03-04 7:10 ` Jeff Law 2016-03-04 7:23 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2016-03-04 7:10 UTC (permalink / raw) To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches On 03/03/2016 07:35 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping fix for P1 PR69947: > https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01743.html So essentially this is just marking more things so that we don't prune them away, right? It's similar conceptually to one of Pierre-Marie's patches where he removed the switch and recursed anytime the operand's val_class matched dw_val_class_die_ref and was !external. Yours just explicitly adds the new DW_OP_ things to the switch and has a slightly looser check (dropping the !external part of the check). I could argue for either approach. Yours AFAICT is safer in that it won't recurse on unexpected DW_OP_<whatever> things. Of course, it may require more long term maintenance to keep the list of things to recurse on up-to-date. Either approach is OK with me, given you're a lot more familiar with our dwarf writer than I, I'll go with your judgment on which is the best approach to address the problem. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-03-04 7:10 ` Jeff Law @ 2016-03-04 7:23 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-03-04 7:23 UTC (permalink / raw) To: Jeff Law; +Cc: Jason Merrill, gcc-patches On Fri, Mar 04, 2016 at 12:10:26AM -0700, Jeff Law wrote: > On 03/03/2016 07:35 AM, Jakub Jelinek wrote: > >Hi! > > > >I'd like to ping fix for P1 PR69947: > >https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01743.html > So essentially this is just marking more things so that we don't prune them > away, right? > > It's similar conceptually to one of Pierre-Marie's patches where he removed > the switch and recursed anytime the operand's val_class matched > dw_val_class_die_ref and was !external. Yours just explicitly adds the new > DW_OP_ things to the switch and has a slightly looser check (dropping the > !external part of the check). The !external part is IMHO not needed, as we only set external for attributes, not for operands of DWARF expression opcodes. And, while checking both operands for dw_val_class_die_ref is possible, it is not enough, it doesn't cover the DW_OP_GNU_entry_value case where it is a val_loc, and that case really depends on the context, other val_locs shouldn't be traversed. So, I think it is better to list the opcodes explicitly, as that gives the needed context to what the arguments are, perhaps at some point we'll refer to DIEs that we want to do something different for. When adding new DW_OP_* values, one has to change dozens of other places anyway, so one further one doesn't matter, one has to search for all the spots anyway. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-02-11 18:14 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2016-02-11 18:14 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping a C++ P1 fix for PR69658: http://gcc.gnu.org/ml/gcc-patches/2016-02/msg00352.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2016-02-10 14:12 Jakub Jelinek 2016-02-10 14:21 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2016-02-10 14:12 UTC (permalink / raw) To: Richard Biener, Jason Merrill, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping a P1 patch: PR ipa/69241, PR c++/69649 https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00192.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2016-02-10 14:12 Jakub Jelinek @ 2016-02-10 14:21 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2016-02-10 14:21 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Jan Hubicka, gcc-patches On Wed, 10 Feb 2016, Jakub Jelinek wrote: > Hi! > > I'd like to ping a P1 patch: > PR ipa/69241, PR c++/69649 > https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00192.html Ok. Thanks, Richard. > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-05-05 18:52 Jakub Jelinek 2015-05-05 19:10 ` Andreas Krebbel 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-05-05 18:52 UTC (permalink / raw) To: Andreas Krebbel; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2015-04/msg01432.html - this got approved for arm and aarch64, but not for s390{,x} Ok for trunk? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-05-05 18:52 Jakub Jelinek @ 2015-05-05 19:10 ` Andreas Krebbel 0 siblings, 0 replies; 504+ messages in thread From: Andreas Krebbel @ 2015-05-05 19:10 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On 05/05/2015 08:52 PM, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2015-04/msg01432.html > - this got approved for arm and aarch64, but not for s390{,x} > Ok for trunk? Yes. Thanks! -Andreas- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-04-17 8:47 Jakub Jelinek 2015-04-17 15:32 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-04-17 8:47 UTC (permalink / raw) To: Richard Biener, Eric Botcazou, Jeff Law; +Cc: gcc-patches Hi! I'd like to ping PR target/65689 - P2 - http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00358.html patch (perhaps with the code[?] == ' ' -> ISSPACE (code[?]) changes or strstr, as discussed in the following thread). At this point of course for trunk only, and perhaps after a while for 5.2. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-04-17 8:47 Jakub Jelinek @ 2015-04-17 15:32 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2015-04-17 15:32 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Eric Botcazou; +Cc: gcc-patches On 04/17/2015 01:59 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping > > PR target/65689 - P2 - http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00358.html > > patch (perhaps with the code[?] == ' ' -> ISSPACE (code[?]) changes or > strstr, as discussed in the following thread). > At this point of course for trunk only, and perhaps after a while for 5.2. For the comment in compute_maybe_allows, "This should be conservative" could be interpreted as setting both bits or setting neither bit. The code clearly does the former and with the background from reading the patch thread I know why, but someone reading the code may not get it without having to either look in the archives or follow how it gets used. Consider updating the comment. I'd tend to prefer strstr; I don't think this is performance sensitive code. OK for the trunk with the comment fixed and your call on how to handle the whitespace issues. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2015-04-11 22:27 Bernhard Reutner-Fischer 2015-04-13 13:12 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Bernhard Reutner-Fischer @ 2015-04-11 22:27 UTC (permalink / raw) To: GCC Patches, Jakub Jelinek Hi, I'd like to ask an RM or global reviewer to kindly consider the following patches preventing one or the other target in config-list.mk to build: [PATCH, bfin] handle BFIN_CPU_UNKNOWN in TARGET_CPU_CPP_BUILTINS https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00034.html [PATCH, c6x] handle unk_isa in TARGET_CPU_CPP_BUILTINS https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00089.html Cosmetic patchlets pending but probably for stage 1 now: Remove redundant guard in emit_bss() https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00337.html tree-tailcall: Commentary typo fix, remove fwd declaration https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00342.html s/ ;/;/g Makefile.tpl https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00380.html ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2015-04-11 22:27 patch ping Bernhard Reutner-Fischer @ 2015-04-13 13:12 ` Jeff Law 2015-04-22 19:47 ` Bernhard Reutner-Fischer 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2015-04-13 13:12 UTC (permalink / raw) To: Bernhard Reutner-Fischer, GCC Patches, Jakub Jelinek On 04/11/2015 04:27 PM, Bernhard Reutner-Fischer wrote: > Hi, > > I'd like to ask an RM or global reviewer to kindly consider the > following patches preventing one or the other target in config-list.mk > to build: > > [PATCH, bfin] handle BFIN_CPU_UNKNOWN in TARGET_CPU_CPP_BUILTINS > https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00034.html OK. > > [PATCH, c6x] handle unk_isa in TARGET_CPU_CPP_BUILTINS > https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00089.html OK. > > > Cosmetic patchlets pending but probably for stage 1 now: > > Remove redundant guard in emit_bss() > https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00337.html OK. > > tree-tailcall: Commentary typo fix, remove fwd declaration > https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00342.html OK. > > s/ ;/;/g Makefile.tpl > https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00380.html OK Note there is a policy that requires all patches to be bootstrapped and regression tested. These are trivial enough that I'll approve them as-is. However, in the future, please bootstrap and regression test changes whenever possible. Thanks, Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2015-04-13 13:12 ` Jeff Law @ 2015-04-22 19:47 ` Bernhard Reutner-Fischer 0 siblings, 0 replies; 504+ messages in thread From: Bernhard Reutner-Fischer @ 2015-04-22 19:47 UTC (permalink / raw) To: Jeff Law, GCC Patches On April 13, 2015 3:12:48 PM GMT+02:00, Jeff Law <law@redhat.com> wrote: >On 04/11/2015 04:27 PM, Bernhard Reutner-Fischer wrote: >> Hi, >> >> I'd like to ask an RM or global reviewer to kindly consider the >> following patches preventing one or the other target in >config-list.mk >> to build: >> >> [PATCH, bfin] handle BFIN_CPU_UNKNOWN in TARGET_CPU_CPP_BUILTINS >> https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00034.html >OK. > >> >> [PATCH, c6x] handle unk_isa in TARGET_CPU_CPP_BUILTINS >> https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00089.html >OK. > >> >> >> Cosmetic patchlets pending but probably for stage 1 now: >> >> Remove redundant guard in emit_bss() >> https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00337.html >OK. > >> >> tree-tailcall: Commentary typo fix, remove fwd declaration >> https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00342.html >OK. > >> >> s/ ;/;/g Makefile.tpl >> https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00380.html >OK > >Note there is a policy that requires all patches to be bootstrapped and > >regression tested. These are trivial enough that I'll approve them >as-is. However, in the future, please bootstrap and regression test >changes whenever possible. I'm aware of this policy. I did my best not to break other configs. By now all of the above were pushed including the erroneously committed https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01270.html to fix PR target/47122 vax-*-openbsd* config.gcc typo that Jakub was kind enough to confirm to be obvious on IRC. Thanks for your reviews! Since I touched Makefile.tpl and there was at least one other patch against it in GCC, i would be grateful if someone could synch Makefile.tpl back to binutils-gdb in two days or three so I can sleep well again a couple of days after that :) cheers, ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-03-18 14:01 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-03-18 14:01 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Marek Polacek, Dodji Seketeli, Tom Tromey Cc: gcc-patches Hi! I'd like to ping following patch: PR65238 - P1 - http://gcc.gnu.org/ml/gcc-patches/2015-03/msg00647.html - fix __has_{,cpp_}attribute() with -traditional-cpp Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-02-12 15:37 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-02-12 15:37 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping following patch: http://gcc.gnu.org/ml/gcc-patches/2015-02/msg00367.html - PR55541 - P2 - C++ debug info fix Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2015-02-09 23:06 Trevor Saunders 2015-02-09 23:15 ` Jan Hubicka 0 siblings, 1 reply; 504+ messages in thread From: Trevor Saunders @ 2015-02-09 23:06 UTC (permalink / raw) To: gcc-patches; +Cc: hubicka Hi, I'd like to ping these patches http://gcc.gnu.org/ml/gcc-patches/2015-01/msg02716.html pr 61889 - p1 don't require ftw.h in gcov-tool.c http://gcc.gnu.org/ml/gcc-patches/2015-01/msg01869.html pr 64076 - p2 - don't ICE on invalid code that has ironly and not ironly thunks thanks! Trev ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2015-02-09 23:06 patch ping Trevor Saunders @ 2015-02-09 23:15 ` Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2015-02-09 23:15 UTC (permalink / raw) To: Trevor Saunders; +Cc: gcc-patches, hubicka > Hi, > > I'd like to ping these patches > > http://gcc.gnu.org/ml/gcc-patches/2015-01/msg02716.html > pr 61889 - p1 don't require ftw.h in gcov-tool.c Looks good enough. Hopefully eventually someone will write mingw implementation. OK > > http://gcc.gnu.org/ml/gcc-patches/2015-01/msg01869.html > pr 64076 - p2 - don't ICE on invalid code that has ironly and not ironly > thunks OK. Please add me to CC for patches that I can aprove. Honza > > thanks! > > Trev ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-02-04 19:30 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-02-04 19:30 UTC (permalink / raw) To: Jason Merrill, Cary Coutant, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping 2 patches: http://gcc.gnu.org/ml/gcc-patches/2015-01/msg02530.html - P2 - PR61925 - fix x86 #pragma GCC target handling http://gcc.gnu.org/ml/gcc-patches/2015-01/msg02432.html - emit DW_LANG_Fortran{03,08} for -gdwarf-5 Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping... @ 2015-01-14 6:29 Jan Hubicka 2015-01-14 21:42 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2015-01-14 6:29 UTC (permalink / raw) To: gcc-patches, jason Hi, I would like to ping the patch to fix divergence between a type and its main variant introduced by C++ FE. https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01202.html Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2015-01-14 6:29 Jan Hubicka @ 2015-01-14 21:42 ` Jason Merrill 0 siblings, 0 replies; 504+ messages in thread From: Jason Merrill @ 2015-01-14 21:42 UTC (permalink / raw) To: Jan Hubicka, gcc-patches On 01/14/2015 12:30 AM, Jan Hubicka wrote: > I would like to ping the patch to fix divergence between a type and its main variant introduced by C++ FE. OK. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2015-01-05 13:53 Jakub Jelinek 2015-01-05 21:27 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-01-05 13:53 UTC (permalink / raw) To: Dodji Seketeli, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping 3 patches: http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01519.html - PR64344 - -fsanitize=float-cast-overflow fix - the C FE part is approved, but not the sanitizer bits outside of the FE http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01271.html - PR64265 - tsan support for exceptions http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html - -fsanitize=vptr support Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-01-05 13:53 Jakub Jelinek @ 2015-01-05 21:27 ` Jeff Law 2015-01-05 21:39 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2015-01-05 21:27 UTC (permalink / raw) To: Jakub Jelinek, Dodji Seketeli, Jason Merrill; +Cc: gcc-patches On 01/05/15 06:53, Jakub Jelinek wrote: > Hi! > > I'd like to ping 3 patches: > > http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01519.html > - PR64344 - -fsanitize=float-cast-overflow fix - the C FE part > is approved, but not the sanitizer bits outside of the FE OK. > > http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01271.html > - PR64265 - tsan support for exceptions OK. > > http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html > - -fsanitize=vptr support How is this different from vtable pointer verification that we already support? Is there some reason we can't just use that instead? jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-01-05 21:27 ` Jeff Law @ 2015-01-05 21:39 ` Jakub Jelinek 2015-01-06 8:23 ` Jakub Jelinek 2015-01-09 5:34 ` Jeff Law 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-01-05 21:39 UTC (permalink / raw) To: Jeff Law; +Cc: Dodji Seketeli, Jason Merrill, gcc-patches On Mon, Jan 05, 2015 at 02:27:41PM -0700, Jeff Law wrote: > On 01/05/15 06:53, Jakub Jelinek wrote: > >Hi! > > > >I'd like to ping 3 patches: > > > >http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01519.html > > - PR64344 - -fsanitize=float-cast-overflow fix - the C FE part > > is approved, but not the sanitizer bits outside of the FE > OK. > > > > >http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01271.html > > - PR64265 - tsan support for exceptions > OK. > > > > >http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html > > - -fsanitize=vptr support > How is this different from vtable pointer verification that we already > support? Is there some reason we can't just use that instead? I don't now the current vtable pointer verification too much, but my understanding of it is that it is hardly usable, because e.g. it requires libstdc++ to be rebuilt with the verification enabled, otherwise you can't verify stuff, and that means a performance penalty even for code you don't want to verify. Unlike that, -fsanitize=vptr is lightweight, and you only rebuild with it what you want and can have other code kept as is, not recompiled. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-01-05 21:39 ` Jakub Jelinek @ 2015-01-06 8:23 ` Jakub Jelinek 2015-01-09 5:34 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-01-06 8:23 UTC (permalink / raw) To: Jeff Law; +Cc: Dodji Seketeli, Jason Merrill, gcc-patches On Mon, Jan 05, 2015 at 10:39:03PM +0100, Jakub Jelinek wrote: > > >http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html > > > - -fsanitize=vptr support > > How is this different from vtable pointer verification that we already > > support? Is there some reason we can't just use that instead? > > I don't now the current vtable pointer verification too much, but my > understanding of it is that it is hardly usable, because e.g. it requires > libstdc++ to be rebuilt with the verification enabled, otherwise you can't > verify stuff, and that means a performance penalty even for code you don't > want to verify. Unlike that, -fsanitize=vptr is lightweight, and you only > rebuild with it what you want and can have other code kept as is, not > recompiled. Also, it seems to verify significantly less than -fsanitize=vptr does, only method calls, while -fsanitize=vptr also verifies member accesses and downcasts/upcasts. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-01-05 21:39 ` Jakub Jelinek 2015-01-06 8:23 ` Jakub Jelinek @ 2015-01-09 5:34 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2015-01-09 5:34 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Dodji Seketeli, Jason Merrill, gcc-patches On 01/05/15 14:39, Jakub Jelinek wrote: > On Mon, Jan 05, 2015 at 02:27:41PM -0700, Jeff Law wrote: >> On 01/05/15 06:53, Jakub Jelinek wrote: >>> Hi! >>> >>> I'd like to ping 3 patches: >>> >>> http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01519.html >>> - PR64344 - -fsanitize=float-cast-overflow fix - the C FE part >>> is approved, but not the sanitizer bits outside of the FE >> OK. >> >>> >>> http://gcc.gnu.org/ml/gcc-patches/2014-12/msg01271.html >>> - PR64265 - tsan support for exceptions >> OK. >> >>> >>> http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html >>> - -fsanitize=vptr support >> How is this different from vtable pointer verification that we already >> support? Is there some reason we can't just use that instead? > > I don't now the current vtable pointer verification too much, but my > understanding of it is that it is hardly usable, because e.g. it requires > libstdc++ to be rebuilt with the verification enabled, otherwise you can't > verify stuff, and that means a performance penalty even for code you don't > want to verify. Unlike that, -fsanitize=vptr is lightweight, and you only > rebuild with it what you want and can have other code kept as is, not > recompiled. OK. I'd forgotten about the "recompile libstdc++" aspect. Sigh. The language independent stuff looks reasonable to me -- you know this code better than I, so it was just a cursory look. Jason should ack the C++ bits. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-12-12 8:23 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-12-12 8:23 UTC (permalink / raw) To: Jason Merrill, Jeff Law, Paolo Bonzini, Alexandre Oliva; +Cc: gcc-patches Hi! I'd like to ping 3 patches: http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00546.html PR63831 - P1 - fix __has_attribute/__has_cpp_attribute handling http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00568.html PR64023 - P3 - fix flags passed to non-bootstrapped host modules during bootstrap http://gcc.gnu.org/ml/gcc-patches/2014-12/msg00297.html -fsanitize=vptr support, 3rd iteration Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* nvptx offloading patches [3/n], RFD @ 2014-11-01 11:58 Bernd Schmidt 2015-02-04 11:38 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Bernd Schmidt @ 2014-11-01 11:58 UTC (permalink / raw) To: GCC Patches; +Cc: Ilya Verbin [-- Attachment #1: Type: text/plain, Size: 881 bytes --] This is not against current trunk; it applies to gomp-4_0-branch where it is one of the necessary parts to make offloading x86->nvptx work. The issue is that the LTO file format depends on the machine_modes enum, it needs to match between host and offload target. The easiest way to do this is to just use the host-modes.def when compiling an offload compiler. Ports that want to be hosts for offloading may need to modify their modes.def. The patch below contains changes to i386-modes.def which modifies XFmode depending on a target switch. I'm not actually entirely sure what to do about this. Do we want to make this flag an error when offloading is enabled? Or maybe add float format support to the -foffload-abi option? Thoughts? Ok for the first part of the patch once the other offloading patches have gone in (bootstrapped and tested on x86_64-linux)? Bernd [-- Attachment #2: modes.diff --] [-- Type: text/x-patch, Size: 2263 bytes --] * config.gcc (offload_host_cpu_type): Compute. (extra_modes): Use it to pick the offload host CPU's modes.def when building an offload target. * config/i386/i386-modes.def (XF): Skip adjustments when building an offload compiler. Index: gomp-4_0-branch/gcc/config.gcc =================================================================== --- gomp-4_0-branch.orig/gcc/config.gcc +++ gomp-4_0-branch/gcc/config.gcc @@ -483,15 +483,26 @@ tilepro*-*-*) ;; esac +offload_host_cpu_type=${cpu_type} +if test "x${enable_as_accelerator}" != "xno" +then + offload_host_cpu_type=`echo ${enable_as_accelerator_for} | sed 's/-.*$//'` +fi +case ${offload_host_cpu_type} in +x86_64) + offload_host_cpu_type=i386 + ;; +esac + tm_file=${cpu_type}/${cpu_type}.h if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h then tm_p_file=${cpu_type}/${cpu_type}-protos.h fi extra_modes= -if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def +if test -f ${srcdir}/config/${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def then - extra_modes=${cpu_type}/${cpu_type}-modes.def + extra_modes=${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def fi if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt then Index: gomp-4_0-branch/gcc/config/i386/i386-modes.def =================================================================== --- gomp-4_0-branch.orig/gcc/config/i386/i386-modes.def +++ gomp-4_0-branch/gcc/config/i386/i386-modes.def @@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. FRACTIONAL_FLOAT_MODE (XF, 80, 12, ieee_extended_intel_96_format); FLOAT_MODE (TF, 16, ieee_quad_format); +/* This file may be used when building a compiler for an offload target. + Assume that no special floating point options are used. */ +#ifndef ACCEL_COMPILER /* In ILP32 mode, XFmode has size 12 and alignment 4. In LP64 mode, XFmode has size and alignment 16. */ ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE @@ -33,6 +36,7 @@ ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_ : &ieee_extended_intel_96_format)); ADJUST_BYTESIZE (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12); ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4); +#endif /* Add any extra modes needed to represent the condition code. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2014-11-01 11:58 nvptx offloading patches [3/n], RFD Bernd Schmidt @ 2015-02-04 11:38 ` Jakub Jelinek 2015-02-09 10:20 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-02-04 11:38 UTC (permalink / raw) To: Bernd Schmidt; +Cc: GCC Patches, Ilya Verbin On Sat, Nov 01, 2014 at 12:57:45PM +0100, Bernd Schmidt wrote: > This is not against current trunk; it applies to gomp-4_0-branch where it is > one of the necessary parts to make offloading x86->nvptx work. The issue is > that the LTO file format depends on the machine_modes enum, it needs to > match between host and offload target. The easiest way to do this is to just > use the host-modes.def when compiling an offload compiler. > > Ports that want to be hosts for offloading may need to modify their > modes.def. The patch below contains changes to i386-modes.def which modifies > XFmode depending on a target switch. I'm not actually entirely sure what to > do about this. Do we want to make this flag an error when offloading is > enabled? Or maybe add float format support to the -foffload-abi option? > > Thoughts? Ok for the first part of the patch once the other offloading > patches have gone in (bootstrapped and tested on x86_64-linux)? I don't like this at all. IMHO instead we should stream in the offloading LTO sections some kind of mode description table (perhaps limited to the modes actually ever streamed), and when reading back the offloading LTO sections, let the offloading compiler remap the modes to its own modes where there is a mapping in between the two, choose some other mapping (e.g. map various vector modes the host has but offloading target does not to say BLKmode), or give up otherwise with offloading (say if you attempt to stream floating point modes the offloading target doesn't support etc.). So perhaps stream for each used mode the mode value, corresponding mode class, size, precision, inner mode, nunits, and for floating point modes supposedly somehow encode the real_format (perhaps just add a name <-> struct real_format mapping for the real.c modes, and map anything else to "unknown"). Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-04 11:38 ` Jakub Jelinek @ 2015-02-09 10:20 ` Richard Biener 2015-02-16 21:08 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2015-02-09 10:20 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Bernd Schmidt, GCC Patches, Ilya Verbin On Wed, Feb 4, 2015 at 12:38 PM, Jakub Jelinek <jakub@redhat.com> wrote: > On Sat, Nov 01, 2014 at 12:57:45PM +0100, Bernd Schmidt wrote: >> This is not against current trunk; it applies to gomp-4_0-branch where it is >> one of the necessary parts to make offloading x86->nvptx work. The issue is >> that the LTO file format depends on the machine_modes enum, it needs to >> match between host and offload target. The easiest way to do this is to just >> use the host-modes.def when compiling an offload compiler. >> >> Ports that want to be hosts for offloading may need to modify their >> modes.def. The patch below contains changes to i386-modes.def which modifies >> XFmode depending on a target switch. I'm not actually entirely sure what to >> do about this. Do we want to make this flag an error when offloading is >> enabled? Or maybe add float format support to the -foffload-abi option? >> >> Thoughts? Ok for the first part of the patch once the other offloading >> patches have gone in (bootstrapped and tested on x86_64-linux)? > > I don't like this at all. > > IMHO instead we should stream in the offloading LTO sections some kind of mode > description table (perhaps limited to the modes actually ever streamed), > and when reading back the offloading LTO sections, let the offloading > compiler remap the modes to its own modes where there is a mapping in > between the two, choose some other mapping (e.g. map various vector modes > the host has but offloading target does not to say BLKmode), or give up > otherwise with offloading (say if you attempt to stream floating point modes > the offloading target doesn't support etc.). > > So perhaps stream for each used mode the mode value, corresponding mode > class, size, precision, inner mode, nunits, and for floating point modes > supposedly somehow encode the real_format (perhaps just add a name <-> > struct real_format mapping for the real.c modes, and map anything else > to "unknown"). I think (also communicated that on IRC) we should instead try not streaming machine-modes at all but generating them at stream-in time via layout_type or layout_decl. Richard. > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-09 10:20 ` Richard Biener @ 2015-02-16 21:08 ` Jakub Jelinek 2015-02-16 21:35 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-02-16 21:08 UTC (permalink / raw) To: Richard Biener, Jan Hubicka, Ilya Verbin, Bernd Schmidt, Thomas Schwinge Cc: gcc-patches Hi! On Mon, Feb 09, 2015 at 11:20:00AM +0100, Richard Biener wrote: > I think (also communicated that on IRC) we should instead try not streaming > machine-modes at all but generating them at stream-in time via layout_type > or layout_decl. Here is a WIP prototype for being able to stream a machine mode description table and streaming it back in. In the end, I'd like to stream this out only for lto_stream_offload_p and stream it in only for ACCEL_COMPILER reading in when available, but wanted to see what it does even for native LTO. For that it doesn't work very well, because it seems that wpa phase doesn't stream in some sections and stream them out again, but instead somehow copies them directly to the output object, so the mode table isn't aware of the modes used in there that were bypassed this way. Anyway, the question is if for offloading we use wpa stage at all these days or not at all, if there is a way for ACCEL_COMPILER to differentiate somehow between LTO sections written by the host compiler and LTO sections perhaps created by the offloading compiler when trying to LTO the thing (if it does it at all). Because obviously the host compiler written LTO (in .gnu.offload_lto_*) would need the machine modes translated, while LTO streamed already by the ACCEL_COMPILER (if any) generally would already use the offloading target machine modes and therefore should be treated as native lto (.gnu.lto_*). If we don't try to write .gnu.offload_lto_* again, I think following patch with additionally not calling lto_write_mode_table for !lto_stream_offload_p and not calling lto_input_mode_table for !ACCEL_COMPILER - instead build a single shared identity table - might actually work. Thoughts on this? Bernd/Thomas, do you plan to commit the other approved patches soon? --- gcc/passes.c.jj 2015-02-16 20:14:09.477345693 +0100 +++ gcc/passes.c 2015-02-16 20:26:23.659299189 +0100 @@ -2460,6 +2460,7 @@ ipa_write_summaries_1 (lto_symtab_encode struct lto_out_decl_state *state = lto_new_out_decl_state (); state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); gcc_assert (!flag_wpa); @@ -2581,6 +2582,7 @@ ipa_write_optimization_summaries (lto_sy lto_symtab_encoder_iterator lsei; state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) --- gcc/tree-streamer.h.jj 2015-02-16 20:14:09.446346202 +0100 +++ gcc/tree-streamer.h 2015-02-16 21:14:50.701615850 +0100 @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. #include "streamer-hooks.h" #include "lto-streamer.h" +#include "data-streamer.h" #include "hash-map.h" /* Cache of pickled nodes. Used to avoid writing the same node more @@ -91,6 +92,7 @@ void streamer_write_integer_cst (struct void streamer_write_builtin (struct output_block *, tree); /* In tree-streamer.c. */ +extern unsigned char streamer_mode_table[1 << 8]; void streamer_check_handled_ts_structures (void); bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, hashval_t, unsigned *); @@ -119,5 +121,19 @@ streamer_tree_cache_get_hash (struct str return cache->hashes[ix]; } +static inline void +bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) +{ + streamer_mode_table[mode] = 1; + bp_pack_enum (bp, machine_mode, 1 << 8, mode); +} + +static inline machine_mode +bp_unpack_machine_mode (struct bitpack_d *bp) +{ + return (machine_mode) + ((struct lto_input_block *) + bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << 8)]; +} #endif /* GCC_TREE_STREAMER_H */ --- gcc/lto-streamer-out.c.jj 2015-02-16 20:14:09.046352765 +0100 +++ gcc/lto-streamer-out.c 2015-02-16 20:26:23.665299091 +0100 @@ -2642,6 +2642,96 @@ produce_symtab (struct output_block *ob) } +/* Init the streamer_mode_table for output, where we collect info on what + machine_mode values have been streamed. */ +void +lto_output_init_mode_table (void) +{ + memset (streamer_mode_table, '\0', MAX_MACHINE_MODE); +} + + +/* Write the mode table. */ +static void +lto_write_mode_table (void) +{ + struct output_block *ob; + ob = create_output_block (LTO_section_mode_table); + bitpack_d bp = bitpack_create (ob->main_stream); + + /* Ensure that for GET_MODE_INNER (m) != VOIDmode we have + also the inner mode marked. */ + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i]) + { + machine_mode m = (machine_mode) i; + if (GET_MODE_INNER (m) != VOIDmode) + streamer_mode_table[(int) GET_MODE_INNER (m)] = 1; + } + /* First stream modes that have GET_MODE_INNER (m) == VOIDmode, + so that we can refer to them afterwards. */ + for (int pass = 0; pass < 2; pass++) + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i] && i != (int) VOIDmode && i != (int) BLKmode) + { + machine_mode m = (machine_mode) i; + if ((GET_MODE_INNER (m) == VOIDmode) ^ (pass == 0)) + continue; + bp_pack_value (&bp, m, 8); + bp_pack_enum (&bp, mode_class, MAX_MODE_CLASS, GET_MODE_CLASS (m)); + bp_pack_value (&bp, GET_MODE_SIZE (m), 8); + bp_pack_value (&bp, GET_MODE_PRECISION (m), 16); + bp_pack_value (&bp, GET_MODE_INNER (m), 8); + bp_pack_value (&bp, GET_MODE_NUNITS (m), 8); + switch (GET_MODE_CLASS (m)) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + bp_pack_value (&bp, GET_MODE_IBIT (m), 8); + bp_pack_value (&bp, GET_MODE_FBIT (m), 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + bp_pack_string (ob, &bp, REAL_MODE_FORMAT (m)->name, true); + break; + default: + break; + } + bp_pack_string (ob, &bp, GET_MODE_NAME (m), true); + } + bp_pack_value (&bp, VOIDmode, 8); + + streamer_write_bitpack (&bp); + + char *section_name + = lto_get_section_name (LTO_section_mode_table, NULL, NULL); + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* The entire header stream is computed here. */ + struct lto_simple_header_with_strings header; + memset (&header, 0, sizeof (header)); + + /* Write the header. */ + header.major_version = LTO_major_version; + header.minor_version = LTO_minor_version; + + header.main_size = ob->main_stream->total_size; + header.string_size = ob->string_stream->total_size; + lto_write_data (&header, sizeof header); + + /* Put all of the gimple and the string table out the asm file as a + block of text. */ + lto_write_stream (ob->main_stream); + lto_write_stream (ob->string_stream); + + lto_end_section (); + destroy_output_block (ob); +} + + /* This pass is run after all of the functions are serialized and all of the IPA passes have written their serialized forms. This pass causes the vector of all of the global decls and types used from @@ -2749,4 +2839,5 @@ produce_asm_for_decls (void) lto_symtab_encoder_delete (ob->decl_state->symtab_node_encoder); lto_function_decl_states.release (); destroy_output_block (ob); + lto_write_mode_table (); } --- gcc/lto-section-in.c.jj 2015-02-16 20:14:09.567344217 +0100 +++ gcc/lto-section-in.c 2015-02-16 20:26:23.655299255 +0100 @@ -89,7 +89,8 @@ const char *lto_section_name[LTO_N_SECTI "inline", "ipcp_trans", "icf", - "offload_table" + "offload_table", + "mode_table" }; @@ -262,7 +263,8 @@ lto_create_simple_input_block (struct lt return NULL; *datar = data; - return new lto_input_block (data + main_offset, header->main_size); + return new lto_input_block (data + main_offset, header->main_size, + file_data->mode_table); } --- gcc/tree-streamer-out.c.jj 2015-02-16 20:14:09.248349451 +0100 +++ gcc/tree-streamer-out.c 2015-02-16 20:26:23.661299156 +0100 @@ -190,7 +190,7 @@ static void pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { struct fixed_value fv = TREE_FIXED_CST (expr); - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, fv.mode); + bp_pack_machine_mode (bp, fv.mode); bp_pack_var_len_int (bp, fv.data.low); bp_pack_var_len_int (bp, fv.data.high); } @@ -201,7 +201,7 @@ pack_ts_fixed_cst_value_fields (struct b static void pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); + bp_pack_machine_mode (bp, DECL_MODE (expr)); bp_pack_value (bp, DECL_NONLOCAL (expr), 1); bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); bp_pack_value (bp, DECL_IGNORED_P (expr), 1); @@ -325,7 +325,7 @@ pack_ts_function_decl_value_fields (stru static void pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, TYPE_MODE (expr)); + bp_pack_machine_mode (bp, TYPE_MODE (expr)); bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); --- gcc/real.h.jj 2015-02-16 20:14:09.278348958 +0100 +++ gcc/real.h 2015-02-16 20:26:23.666299074 +0100 @@ -155,6 +155,7 @@ struct real_format bool has_signed_zero; bool qnan_msb_set; bool canonical_nan_lsbs_set; + const char *name; }; --- gcc/lto-streamer.h.jj 2015-02-16 20:14:09.390347121 +0100 +++ gcc/lto-streamer.h 2015-02-16 20:26:23.658299206 +0100 @@ -248,6 +248,7 @@ enum lto_section_type LTO_section_ipcp_transform, LTO_section_ipa_icf, LTO_section_offload_table, + LTO_section_mode_table, LTO_N_SECTION_TYPES /* Must be last. */ }; @@ -312,12 +313,15 @@ class lto_input_block public: /* Special constructor for the string table, it abuses this to do random access but use the uhwi decoder. */ - lto_input_block (const char *data_, unsigned int p_, unsigned int len_) - : data (data_), p (p_), len (len_) {} - lto_input_block (const char *data_, unsigned int len_) - : data (data_), p (0), len (len_) {} + lto_input_block (const char *data_, unsigned int p_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (p_), len (len_) {} + lto_input_block (const char *data_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (0), len (len_) {} const char *data; + const unsigned char *mode_table; unsigned int p; unsigned int len; }; @@ -527,6 +531,9 @@ struct GTY(()) lto_file_decl_data /* Map assigning declarations their resolutions. */ hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map; + + /* Mode translation table. */ + const unsigned char *mode_table; }; typedef struct lto_file_decl_data *lto_file_decl_data_ptr; @@ -775,6 +782,7 @@ extern void lto_input_variable_construct extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, const char *); extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); +extern void lto_input_mode_table (struct lto_file_decl_data *); extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, const char *, unsigned, vec<ld_plugin_symbol_resolution_t> ); @@ -807,6 +815,7 @@ void lto_output_decl_state_refs (struct struct lto_output_stream *, struct lto_out_decl_state *); void lto_output_location (struct output_block *, struct bitpack_d *, location_t); +void lto_output_init_mode_table (void); /* In lto-cgraph.c */ --- gcc/ipa-prop.c.jj 2015-02-16 20:14:09.832339869 +0100 +++ gcc/ipa-prop.c 2015-02-16 20:26:23.663299123 +0100 @@ -4868,7 +4868,7 @@ ipa_prop_read_section (struct lto_file_d unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, @@ -5089,7 +5089,7 @@ read_replacements_section (struct lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, header->string_size, vNULL); --- gcc/data-streamer-in.c.jj 2015-02-16 20:14:09.800340394 +0100 +++ gcc/data-streamer-in.c 2015-02-16 20:26:23.654299271 +0100 @@ -70,7 +70,7 @@ string_for_index (struct data_in *data_i } /* Get the string stored at location LOC in DATA_IN->STRINGS. */ - lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len); + lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len, NULL); len = streamer_read_uhwi (&str_tab); *rlen = len; --- gcc/tree-streamer-in.c.jj 2015-02-16 20:14:09.524344922 +0100 +++ gcc/tree-streamer-in.c 2015-02-16 20:26:23.661299156 +0100 @@ -224,7 +224,7 @@ static void unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> (); - fp->mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + fp->mode = bp_unpack_machine_mode (bp); fp->data.low = bp_unpack_var_len_int (bp); fp->data.high = bp_unpack_var_len_int (bp); TREE_FIXED_CST_PTR (expr) = fp; @@ -236,7 +236,7 @@ unpack_ts_fixed_cst_value_fields (struct static void unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + DECL_MODE (expr) = bp_unpack_machine_mode (bp); DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); @@ -373,7 +373,7 @@ unpack_ts_type_common_value_fields (stru { machine_mode mode; - mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + mode = bp_unpack_machine_mode (bp); SET_TYPE_MODE (expr, mode); TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); --- gcc/ipa-inline-analysis.c.jj 2015-02-16 20:14:09.777340771 +0100 +++ gcc/ipa-inline-analysis.c 2015-02-16 20:26:23.655299255 +0100 @@ -4190,7 +4190,8 @@ inline_read_section (struct lto_file_dec unsigned int i, count2, j; unsigned int f_count; - lto_input_block ib ((const char *) data + main_offset, header->main_size); + lto_input_block ib ((const char *) data + main_offset, header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/ipa-icf.c.jj 2015-02-16 20:14:09.306348499 +0100 +++ gcc/ipa-icf.c 2015-02-16 20:26:23.663299123 +0100 @@ -1500,7 +1500,7 @@ sem_item_optimizer::read_section (lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, 0, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/tree-streamer.c.jj 2015-02-16 20:14:09.440346300 +0100 +++ gcc/tree-streamer.c 2015-02-16 20:26:23.660299173 +0100 @@ -53,6 +53,14 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "tree-streamer.h" +/* Table indexed by machine_mode, used for 2 different purposes. + During streaming out we record there non-zero value for all modes + that were streamed out. + During streaming in, we translate the on the disk mode using this + table. For normal LTO it is set to identity, for ACCEL_COMPILER + depending on the mode_table content. */ +unsigned char streamer_mode_table[1 << 8]; + /* Check that all the TS_* structures handled by the streamer_write_* and streamer_read_* routines are exactly ALL the structures defined in treestruct.def. */ --- gcc/lto/lto.c.jj 2015-02-16 20:14:09.133351338 +0100 +++ gcc/lto/lto.c 2015-02-16 20:26:23.666299074 +0100 @@ -1877,7 +1877,7 @@ lto_read_decls (struct lto_file_decl_dat uint32_t num_decl_states; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, decl_data->mode_table); data_in = lto_data_in_create (decl_data, (const char *) data + string_offset, header->string_size, resolutions); @@ -2219,6 +2219,7 @@ lto_file_finalize (struct lto_file_decl_ file_data->renaming_hash_table = lto_create_renaming_table (); file_data->file_name = file->filename; + lto_input_mode_table (file_data); data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); if (data == NULL) { --- gcc/lto-cgraph.c.jj 2015-02-16 20:14:09.099351895 +0100 +++ gcc/lto-cgraph.c 2015-02-16 20:26:23.664299107 +0100 @@ -2113,7 +2113,7 @@ input_cgraph_opt_section (struct lto_fil unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/lto-streamer-in.c.jj 2015-02-16 20:14:09.346347843 +0100 +++ gcc/lto-streamer-in.c 2015-02-16 21:15:42.033774537 +0100 @@ -1116,10 +1116,12 @@ lto_read_body_or_constructor (struct lto /* Set up the struct function. */ from = data_in->reader_cache->nodes.length (); - lto_input_block ib_main (data + main_offset, header->main_size); + lto_input_block ib_main (data + main_offset, header->main_size, + file_data->mode_table); if (TREE_CODE (node->decl) == FUNCTION_DECL) { - lto_input_block ib_cfg (data + cfg_offset, header->cfg_size); + lto_input_block ib_cfg (data + cfg_offset, header->cfg_size, + file_data->mode_table); input_function (fn_decl, data_in, &ib_main, &ib_cfg); } else @@ -1384,7 +1386,8 @@ lto_input_toplevel_asms (struct lto_file string_offset = sizeof (*header) + header->main_size; - lto_input_block ib (data + sizeof (*header), header->main_size); + lto_input_block ib (data + sizeof (*header), header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, data + string_offset, header->string_size, vNULL); @@ -1403,6 +1406,124 @@ lto_input_toplevel_asms (struct lto_file } +/* Input mode table. */ + +void +lto_input_mode_table (struct lto_file_decl_data *file_data) +{ + size_t len; + const char *data = lto_get_section_data (file_data, LTO_section_mode_table, + NULL, &len); + unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << 8); + + file_data->mode_table = table; + if (! data) + { + for (unsigned int m = 0; m < MAX_MACHINE_MODE; m++) + table[m] = m; + return; + } + + const struct lto_simple_header_with_strings *header + = (const struct lto_simple_header_with_strings *) data; + int string_offset; + struct data_in *data_in; + string_offset = sizeof (*header) + header->main_size; + + lto_input_block ib (data + sizeof (*header), header->main_size, NULL); + data_in = lto_data_in_create (file_data, data + string_offset, + header->string_size, vNULL); + bitpack_d bp = streamer_read_bitpack (&ib); + + table[VOIDmode] = VOIDmode; + table[BLKmode] = BLKmode; + unsigned int m; + while ((m = bp_unpack_value (&bp, 8)) != VOIDmode) + { + enum mode_class mclass + = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS); + unsigned int size = bp_unpack_value (&bp, 8); + unsigned int prec = bp_unpack_value (&bp, 16); + machine_mode inner = (machine_mode) table[bp_unpack_value (&bp, 8)]; + unsigned int nunits = bp_unpack_value (&bp, 8); + unsigned int ibit = 0, fbit = 0; + unsigned int real_fmt_len = 0; + const char *real_fmt_name = NULL; + switch (mclass) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + ibit = bp_unpack_value (&bp, 8); + fbit = bp_unpack_value (&bp, 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + real_fmt_name = bp_unpack_indexed_string (data_in, &bp, + &real_fmt_len); + break; + default: + break; + } + /* First search just the GET_CLASS_NARROWEST_MODE to wider modes, + if not found, fallback to all modes. */ + int pass; + for (pass = 0; pass < 2; pass++) + for (machine_mode mr = pass ? VOIDmode + : GET_CLASS_NARROWEST_MODE (mclass); + pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode; + pass ? mr = (machine_mode) (m + 1) + : mr = GET_MODE_WIDER_MODE (mr)) + if (GET_MODE_CLASS (mr) != mclass + || GET_MODE_SIZE (mr) != size + || GET_MODE_PRECISION (mr) != prec + || GET_MODE_INNER (mr) != inner + || GET_MODE_IBIT (mr) != ibit + || GET_MODE_FBIT (mr) != fbit + || GET_MODE_NUNITS (mr) != nunits) + continue; + else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT) + && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0) + continue; + else + { + table[m] = mr; + pass = 2; + break; + } + unsigned int len; + const char *mname = bp_unpack_indexed_string (data_in, &bp, &len); + if (pass == 2) + { + switch (mclass) + { + case MODE_VECTOR_INT: + case MODE_VECTOR_FLOAT: + case MODE_VECTOR_FRACT: + case MODE_VECTOR_UFRACT: + case MODE_VECTOR_ACCUM: + case MODE_VECTOR_UACCUM: + /* For unsupported vector modes just use BLKmode, + if the scalar mode is supported. */ + if (inner != VOIDmode) + { + table[m] = BLKmode; + break; + } + /* FALLTHRU */ + default: + error ("unsupported mode %s\n", mname); + break; + } + } + } + lto_data_in_delete (data_in); + + lto_free_section_data (file_data, LTO_section_asm, NULL, data, len); +} + + /* Initialization for the LTO reader. */ void --- gcc/config/pdp11/pdp11.c.jj 2015-02-16 20:14:09.818340098 +0100 +++ gcc/config/pdp11/pdp11.c 2015-02-16 20:26:23.653299288 +0100 @@ -107,7 +107,8 @@ const struct real_format pdp11_f_format false, false, false, - false + false, + "pdp11_f" }; const struct real_format pdp11_d_format = @@ -128,7 +129,8 @@ const struct real_format pdp11_d_format false, false, false, - false + false, + "pdp11_d" }; static void --- gcc/real.c.jj 2015-02-16 20:14:09.208350107 +0100 +++ gcc/real.c 2015-02-16 20:26:23.657299222 +0100 @@ -3031,7 +3031,8 @@ const struct real_format ieee_single_for true, true, true, - false + false, + "ieee_single" }; const struct real_format mips_single_format = @@ -3052,7 +3053,8 @@ const struct real_format mips_single_for true, true, false, - true + true, + "mips_single" }; const struct real_format motorola_single_format = @@ -3073,7 +3075,8 @@ const struct real_format motorola_single true, true, true, - true + true, + "motorola_single" }; /* SPU Single Precision (Extended-Range Mode) format is the same as IEEE @@ -3105,7 +3108,8 @@ const struct real_format spu_single_form true, true, false, - false + false, + "spu_single" }; \f /* IEEE double-precision format. */ @@ -3314,7 +3318,8 @@ const struct real_format ieee_double_for true, true, true, - false + false, + "ieee_double" }; const struct real_format mips_double_format = @@ -3335,7 +3340,8 @@ const struct real_format mips_double_for true, true, false, - true + true, + "mips_double" }; const struct real_format motorola_double_format = @@ -3356,7 +3362,8 @@ const struct real_format motorola_double true, true, true, - true + true, + "motorola_double" }; \f /* IEEE extended real format. This comes in three flavors: Intel's as @@ -3700,7 +3707,8 @@ const struct real_format ieee_extended_m true, true, true, - true + true, + "ieee_extended_motorola" }; const struct real_format ieee_extended_intel_96_format = @@ -3721,7 +3729,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96" }; const struct real_format ieee_extended_intel_128_format = @@ -3742,7 +3751,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_128" }; /* The following caters to i386 systems that set the rounding precision @@ -3765,7 +3775,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96_round_53" }; \f /* IBM 128-bit extended precision format: a pair of IEEE double precision @@ -3853,7 +3864,8 @@ const struct real_format ibm_extended_fo true, true, true, - false + false, + "ibm_extended" }; const struct real_format mips_extended_format = @@ -3874,7 +3886,8 @@ const struct real_format mips_extended_f true, true, false, - true + true, + "mips_extended" }; \f @@ -4137,7 +4150,8 @@ const struct real_format ieee_quad_forma true, true, true, - false + false, + "ieee_quad" }; const struct real_format mips_quad_format = @@ -4158,7 +4172,8 @@ const struct real_format mips_quad_forma true, true, false, - true + true, + "mips_quad" }; \f /* Descriptions of VAX floating point formats can be found beginning at @@ -4458,7 +4473,8 @@ const struct real_format vax_f_format = false, false, false, - false + false, + "vax_f" }; const struct real_format vax_d_format = @@ -4479,7 +4495,8 @@ const struct real_format vax_d_format = false, false, false, - false + false, + "vax_d" }; const struct real_format vax_g_format = @@ -4500,7 +4517,8 @@ const struct real_format vax_g_format = false, false, false, - false + false, + "vax_g" }; \f /* Encode real R into a single precision DFP value in BUF. */ @@ -4576,7 +4594,8 @@ const struct real_format decimal_single_ true, true, true, - false + false, + "decimal_single" }; /* Double precision decimal floating point (IEEE 754). */ @@ -4598,7 +4617,8 @@ const struct real_format decimal_double_ true, true, true, - false + false, + "decimal_double" }; /* Quad precision decimal floating point (IEEE 754). */ @@ -4620,7 +4640,8 @@ const struct real_format decimal_quad_fo true, true, true, - false + false, + "decimal_quad" }; \f /* Encode half-precision floats. This routine is used both for the IEEE @@ -4757,7 +4778,8 @@ const struct real_format ieee_half_forma true, true, true, - false + false, + "ieee_half" }; /* ARM's alternative half-precision format, similar to IEEE but with @@ -4781,7 +4803,8 @@ const struct real_format arm_half_format true, true, false, - false + false, + "arm_half" }; \f /* A synthetic "format" for internal arithmetic. It's the size of the @@ -4826,7 +4849,8 @@ const struct real_format real_internal_f false, true, true, - false + false, + "real_internal" }; \f /* Calculate X raised to the integer exponent N in mode MODE and store Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-16 21:08 ` Jakub Jelinek @ 2015-02-16 21:35 ` Richard Biener 2015-02-16 21:44 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2015-02-16 21:35 UTC (permalink / raw) To: Jakub Jelinek, Jan Hubicka, Ilya Verbin, Bernd Schmidt, Thomas Schwinge Cc: gcc-patches On February 16, 2015 10:08:12 PM CET, Jakub Jelinek <jakub@redhat.com> wrote: >Hi! > >On Mon, Feb 09, 2015 at 11:20:00AM +0100, Richard Biener wrote: >> I think (also communicated that on IRC) we should instead try not >streaming >> machine-modes at all but generating them at stream-in time via >layout_type >> or layout_decl. > >Here is a WIP prototype for being able to stream a machine mode >description >table and streaming it back in. >In the end, I'd like to stream this out only for lto_stream_offload_p >and >stream it in only for ACCEL_COMPILER reading in when available, but >wanted >to see what it does even for native LTO. >For that it doesn't work very well, because it seems that wpa phase >doesn't stream in some sections and stream them out again, but instead >somehow copies them directly to the output object, so the mode table >isn't aware of the modes used in there that were bypassed this way. > >Anyway, the question is if for offloading we use wpa stage at all these >days >or not at all, if there is a way for ACCEL_COMPILER to differentiate >somehow between LTO sections written by the host compiler and LTO >sections >perhaps created by the offloading compiler when trying to LTO the thing >(if >it does it at all). Because obviously the host compiler written LTO >(in .gnu.offload_lto_*) would need the machine modes translated, while >LTO streamed already by the ACCEL_COMPILER (if any) generally would >already >use the offloading target machine modes and therefore should be treated >as >native lto (.gnu.lto_*). > >If we don't try to write .gnu.offload_lto_* again, I think following >patch >with additionally not calling lto_write_mode_table for >!lto_stream_offload_p >and not calling lto_input_mode_table for !ACCEL_COMPILER - instead >build >a single shared identity table - might actually work. > >Thoughts on this? Seeing the real format string you introduce I wonder if identifying modes by their names wouldn't work in 99% of all cases (apart from PSImode maybe). Also for most cases we can construct the machine mode from the type. Or where that is not possible stream the extra info that is necessary instead. Overall feels like a hack BTW :) can't we assign machine mode enum IDs in a target independent way? I mean, it doesn't have to be densely allocated? Richard. >Bernd/Thomas, do you plan to commit the other approved patches soon? > >--- gcc/passes.c.jj 2015-02-16 20:14:09.477345693 +0100 >+++ gcc/passes.c 2015-02-16 20:26:23.659299189 +0100 >@@ -2460,6 +2460,7 @@ ipa_write_summaries_1 (lto_symtab_encode > struct lto_out_decl_state *state = lto_new_out_decl_state (); > state->symtab_node_encoder = encoder; > >+ lto_output_init_mode_table (); > lto_push_out_decl_state (state); > > gcc_assert (!flag_wpa); >@@ -2581,6 +2582,7 @@ ipa_write_optimization_summaries (lto_sy > lto_symtab_encoder_iterator lsei; > state->symtab_node_encoder = encoder; > >+ lto_output_init_mode_table (); > lto_push_out_decl_state (state); > for (lsei = lsei_start_function_in_partition (encoder); > !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) >--- gcc/tree-streamer.h.jj 2015-02-16 20:14:09.446346202 +0100 >+++ gcc/tree-streamer.h 2015-02-16 21:14:50.701615850 +0100 >@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. > > #include "streamer-hooks.h" > #include "lto-streamer.h" >+#include "data-streamer.h" > #include "hash-map.h" > > /* Cache of pickled nodes. Used to avoid writing the same node more >@@ -91,6 +92,7 @@ void streamer_write_integer_cst (struct > void streamer_write_builtin (struct output_block *, tree); > > /* In tree-streamer.c. */ >+extern unsigned char streamer_mode_table[1 << 8]; > void streamer_check_handled_ts_structures (void); > bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, > hashval_t, unsigned *); >@@ -119,5 +121,19 @@ streamer_tree_cache_get_hash (struct str > return cache->hashes[ix]; > } > >+static inline void >+bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) >+{ >+ streamer_mode_table[mode] = 1; >+ bp_pack_enum (bp, machine_mode, 1 << 8, mode); >+} >+ >+static inline machine_mode >+bp_unpack_machine_mode (struct bitpack_d *bp) >+{ >+ return (machine_mode) >+ ((struct lto_input_block *) >+ bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << >8)]; >+} > > #endif /* GCC_TREE_STREAMER_H */ >--- gcc/lto-streamer-out.c.jj 2015-02-16 20:14:09.046352765 +0100 >+++ gcc/lto-streamer-out.c 2015-02-16 20:26:23.665299091 +0100 >@@ -2642,6 +2642,96 @@ produce_symtab (struct output_block *ob) > } > > >+/* Init the streamer_mode_table for output, where we collect info on >what >+ machine_mode values have been streamed. */ >+void >+lto_output_init_mode_table (void) >+{ >+ memset (streamer_mode_table, '\0', MAX_MACHINE_MODE); >+} >+ >+ >+/* Write the mode table. */ >+static void >+lto_write_mode_table (void) >+{ >+ struct output_block *ob; >+ ob = create_output_block (LTO_section_mode_table); >+ bitpack_d bp = bitpack_create (ob->main_stream); >+ >+ /* Ensure that for GET_MODE_INNER (m) != VOIDmode we have >+ also the inner mode marked. */ >+ for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) >+ if (streamer_mode_table[i]) >+ { >+ machine_mode m = (machine_mode) i; >+ if (GET_MODE_INNER (m) != VOIDmode) >+ streamer_mode_table[(int) GET_MODE_INNER (m)] = 1; >+ } >+ /* First stream modes that have GET_MODE_INNER (m) == VOIDmode, >+ so that we can refer to them afterwards. */ >+ for (int pass = 0; pass < 2; pass++) >+ for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) >+ if (streamer_mode_table[i] && i != (int) VOIDmode && i != (int) >BLKmode) >+ { >+ machine_mode m = (machine_mode) i; >+ if ((GET_MODE_INNER (m) == VOIDmode) ^ (pass == 0)) >+ continue; >+ bp_pack_value (&bp, m, 8); >+ bp_pack_enum (&bp, mode_class, MAX_MODE_CLASS, GET_MODE_CLASS (m)); >+ bp_pack_value (&bp, GET_MODE_SIZE (m), 8); >+ bp_pack_value (&bp, GET_MODE_PRECISION (m), 16); >+ bp_pack_value (&bp, GET_MODE_INNER (m), 8); >+ bp_pack_value (&bp, GET_MODE_NUNITS (m), 8); >+ switch (GET_MODE_CLASS (m)) >+ { >+ case MODE_FRACT: >+ case MODE_UFRACT: >+ case MODE_ACCUM: >+ case MODE_UACCUM: >+ bp_pack_value (&bp, GET_MODE_IBIT (m), 8); >+ bp_pack_value (&bp, GET_MODE_FBIT (m), 8); >+ break; >+ case MODE_FLOAT: >+ case MODE_DECIMAL_FLOAT: >+ bp_pack_string (ob, &bp, REAL_MODE_FORMAT (m)->name, true); >+ break; >+ default: >+ break; >+ } >+ bp_pack_string (ob, &bp, GET_MODE_NAME (m), true); >+ } >+ bp_pack_value (&bp, VOIDmode, 8); >+ >+ streamer_write_bitpack (&bp); >+ >+ char *section_name >+ = lto_get_section_name (LTO_section_mode_table, NULL, NULL); >+ lto_begin_section (section_name, !flag_wpa); >+ free (section_name); >+ >+ /* The entire header stream is computed here. */ >+ struct lto_simple_header_with_strings header; >+ memset (&header, 0, sizeof (header)); >+ >+ /* Write the header. */ >+ header.major_version = LTO_major_version; >+ header.minor_version = LTO_minor_version; >+ >+ header.main_size = ob->main_stream->total_size; >+ header.string_size = ob->string_stream->total_size; >+ lto_write_data (&header, sizeof header); >+ >+ /* Put all of the gimple and the string table out the asm file as a >+ block of text. */ >+ lto_write_stream (ob->main_stream); >+ lto_write_stream (ob->string_stream); >+ >+ lto_end_section (); >+ destroy_output_block (ob); >+} >+ >+ > /* This pass is run after all of the functions are serialized and all > of the IPA passes have written their serialized forms. This pass > causes the vector of all of the global decls and types used from >@@ -2749,4 +2839,5 @@ produce_asm_for_decls (void) > lto_symtab_encoder_delete (ob->decl_state->symtab_node_encoder); > lto_function_decl_states.release (); > destroy_output_block (ob); >+ lto_write_mode_table (); > } >--- gcc/lto-section-in.c.jj 2015-02-16 20:14:09.567344217 +0100 >+++ gcc/lto-section-in.c 2015-02-16 20:26:23.655299255 +0100 >@@ -89,7 +89,8 @@ const char *lto_section_name[LTO_N_SECTI > "inline", > "ipcp_trans", > "icf", >- "offload_table" >+ "offload_table", >+ "mode_table" > }; > > >@@ -262,7 +263,8 @@ lto_create_simple_input_block (struct lt > return NULL; > > *datar = data; >- return new lto_input_block (data + main_offset, header->main_size); >+ return new lto_input_block (data + main_offset, header->main_size, >+ file_data->mode_table); > } > > >--- gcc/tree-streamer-out.c.jj 2015-02-16 20:14:09.248349451 +0100 >+++ gcc/tree-streamer-out.c 2015-02-16 20:26:23.661299156 +0100 >@@ -190,7 +190,7 @@ static void > pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) > { > struct fixed_value fv = TREE_FIXED_CST (expr); >- bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, fv.mode); >+ bp_pack_machine_mode (bp, fv.mode); > bp_pack_var_len_int (bp, fv.data.low); > bp_pack_var_len_int (bp, fv.data.high); > } >@@ -201,7 +201,7 @@ pack_ts_fixed_cst_value_fields (struct b > static void > pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) > { >- bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); >+ bp_pack_machine_mode (bp, DECL_MODE (expr)); > bp_pack_value (bp, DECL_NONLOCAL (expr), 1); > bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); > bp_pack_value (bp, DECL_IGNORED_P (expr), 1); >@@ -325,7 +325,7 @@ pack_ts_function_decl_value_fields (stru > static void > pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) > { >- bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, TYPE_MODE (expr)); >+ bp_pack_machine_mode (bp, TYPE_MODE (expr)); > bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); > bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); > bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); >--- gcc/real.h.jj 2015-02-16 20:14:09.278348958 +0100 >+++ gcc/real.h 2015-02-16 20:26:23.666299074 +0100 >@@ -155,6 +155,7 @@ struct real_format > bool has_signed_zero; > bool qnan_msb_set; > bool canonical_nan_lsbs_set; >+ const char *name; > }; > > >--- gcc/lto-streamer.h.jj 2015-02-16 20:14:09.390347121 +0100 >+++ gcc/lto-streamer.h 2015-02-16 20:26:23.658299206 +0100 >@@ -248,6 +248,7 @@ enum lto_section_type > LTO_section_ipcp_transform, > LTO_section_ipa_icf, > LTO_section_offload_table, >+ LTO_section_mode_table, > LTO_N_SECTION_TYPES /* Must be last. */ > }; > >@@ -312,12 +313,15 @@ class lto_input_block > public: > /* Special constructor for the string table, it abuses this to > do random access but use the uhwi decoder. */ >- lto_input_block (const char *data_, unsigned int p_, unsigned int >len_) >- : data (data_), p (p_), len (len_) {} >- lto_input_block (const char *data_, unsigned int len_) >- : data (data_), p (0), len (len_) {} >+ lto_input_block (const char *data_, unsigned int p_, unsigned int >len_, >+ const unsigned char *mode_table_) >+ : data (data_), mode_table (mode_table_), p (p_), len (len_) {} >+ lto_input_block (const char *data_, unsigned int len_, >+ const unsigned char *mode_table_) >+ : data (data_), mode_table (mode_table_), p (0), len (len_) {} > > const char *data; >+ const unsigned char *mode_table; > unsigned int p; > unsigned int len; > }; >@@ -527,6 +531,9 @@ struct GTY(()) lto_file_decl_data > > /* Map assigning declarations their resolutions. */ >hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) >resolution_map; >+ >+ /* Mode translation table. */ >+ const unsigned char *mode_table; > }; > > typedef struct lto_file_decl_data *lto_file_decl_data_ptr; >@@ -775,6 +782,7 @@ extern void lto_input_variable_construct >extern void lto_input_constructors_and_inits (struct lto_file_decl_data >*, > const char *); >extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); >+extern void lto_input_mode_table (struct lto_file_decl_data *); >extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, > const char *, unsigned, > vec<ld_plugin_symbol_resolution_t> ); >@@ -807,6 +815,7 @@ void lto_output_decl_state_refs (struct > struct lto_output_stream *, > struct lto_out_decl_state *); >void lto_output_location (struct output_block *, struct bitpack_d *, >location_t); >+void lto_output_init_mode_table (void); > > > /* In lto-cgraph.c */ >--- gcc/ipa-prop.c.jj 2015-02-16 20:14:09.832339869 +0100 >+++ gcc/ipa-prop.c 2015-02-16 20:26:23.663299123 +0100 >@@ -4868,7 +4868,7 @@ ipa_prop_read_section (struct lto_file_d > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, >- header->main_size); >+ header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, >@@ -5089,7 +5089,7 @@ read_replacements_section (struct lto_fi > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, >- header->main_size); >+ header->main_size, file_data->mode_table); > >data_in = lto_data_in_create (file_data, (const char *) data + >string_offset, > header->string_size, vNULL); >--- gcc/data-streamer-in.c.jj 2015-02-16 20:14:09.800340394 +0100 >+++ gcc/data-streamer-in.c 2015-02-16 20:26:23.654299271 +0100 >@@ -70,7 +70,7 @@ string_for_index (struct data_in *data_i > } > > /* Get the string stored at location LOC in DATA_IN->STRINGS. */ >- lto_input_block str_tab (data_in->strings, loc - 1, >data_in->strings_len); >+ lto_input_block str_tab (data_in->strings, loc - 1, >data_in->strings_len, NULL); > len = streamer_read_uhwi (&str_tab); > *rlen = len; > >--- gcc/tree-streamer-in.c.jj 2015-02-16 20:14:09.524344922 +0100 >+++ gcc/tree-streamer-in.c 2015-02-16 20:26:23.661299156 +0100 >@@ -224,7 +224,7 @@ static void > unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) > { > FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> (); >- fp->mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); >+ fp->mode = bp_unpack_machine_mode (bp); > fp->data.low = bp_unpack_var_len_int (bp); > fp->data.high = bp_unpack_var_len_int (bp); > TREE_FIXED_CST_PTR (expr) = fp; >@@ -236,7 +236,7 @@ unpack_ts_fixed_cst_value_fields (struct > static void > unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) > { >- DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, >MAX_MACHINE_MODE); >+ DECL_MODE (expr) = bp_unpack_machine_mode (bp); > DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); > DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); > DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); >@@ -373,7 +373,7 @@ unpack_ts_type_common_value_fields (stru > { > machine_mode mode; > >- mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); >+ mode = bp_unpack_machine_mode (bp); > SET_TYPE_MODE (expr, mode); > TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); > TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); >--- gcc/ipa-inline-analysis.c.jj 2015-02-16 20:14:09.777340771 +0100 >+++ gcc/ipa-inline-analysis.c 2015-02-16 20:26:23.655299255 +0100 >@@ -4190,7 +4190,8 @@ inline_read_section (struct lto_file_dec > unsigned int i, count2, j; > unsigned int f_count; > >- lto_input_block ib ((const char *) data + main_offset, >header->main_size); >+ lto_input_block ib ((const char *) data + main_offset, >header->main_size, >+ file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, >--- gcc/ipa-icf.c.jj 2015-02-16 20:14:09.306348499 +0100 >+++ gcc/ipa-icf.c 2015-02-16 20:26:23.663299123 +0100 >@@ -1500,7 +1500,7 @@ sem_item_optimizer::read_section (lto_fi > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, 0, >- header->main_size); >+ header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, >--- gcc/tree-streamer.c.jj 2015-02-16 20:14:09.440346300 +0100 >+++ gcc/tree-streamer.c 2015-02-16 20:26:23.660299173 +0100 >@@ -53,6 +53,14 @@ along with GCC; see the file COPYING3. > #include "cgraph.h" > #include "tree-streamer.h" > >+/* Table indexed by machine_mode, used for 2 different purposes. >+ During streaming out we record there non-zero value for all modes >+ that were streamed out. >+ During streaming in, we translate the on the disk mode using this >+ table. For normal LTO it is set to identity, for ACCEL_COMPILER >+ depending on the mode_table content. */ >+unsigned char streamer_mode_table[1 << 8]; >+ >/* Check that all the TS_* structures handled by the streamer_write_* >and > streamer_read_* routines are exactly ALL the structures defined in > treestruct.def. */ >--- gcc/lto/lto.c.jj 2015-02-16 20:14:09.133351338 +0100 >+++ gcc/lto/lto.c 2015-02-16 20:26:23.666299074 +0100 >@@ -1877,7 +1877,7 @@ lto_read_decls (struct lto_file_decl_dat > uint32_t num_decl_states; > > lto_input_block ib_main ((const char *) data + main_offset, >- header->main_size); >+ header->main_size, decl_data->mode_table); > >data_in = lto_data_in_create (decl_data, (const char *) data + >string_offset, > header->string_size, resolutions); >@@ -2219,6 +2219,7 @@ lto_file_finalize (struct lto_file_decl_ > > file_data->renaming_hash_table = lto_create_renaming_table (); > file_data->file_name = file->filename; >+ lto_input_mode_table (file_data); >data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); > if (data == NULL) > { >--- gcc/lto-cgraph.c.jj 2015-02-16 20:14:09.099351895 +0100 >+++ gcc/lto-cgraph.c 2015-02-16 20:26:23.664299107 +0100 >@@ -2113,7 +2113,7 @@ input_cgraph_opt_section (struct lto_fil > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, >- header->main_size); >+ header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, >--- gcc/lto-streamer-in.c.jj 2015-02-16 20:14:09.346347843 +0100 >+++ gcc/lto-streamer-in.c 2015-02-16 21:15:42.033774537 +0100 >@@ -1116,10 +1116,12 @@ lto_read_body_or_constructor (struct lto > > /* Set up the struct function. */ > from = data_in->reader_cache->nodes.length (); >- lto_input_block ib_main (data + main_offset, header->main_size); >+ lto_input_block ib_main (data + main_offset, header->main_size, >+ file_data->mode_table); > if (TREE_CODE (node->decl) == FUNCTION_DECL) > { >- lto_input_block ib_cfg (data + cfg_offset, header->cfg_size); >+ lto_input_block ib_cfg (data + cfg_offset, header->cfg_size, >+ file_data->mode_table); > input_function (fn_decl, data_in, &ib_main, &ib_cfg); > } > else >@@ -1384,7 +1386,8 @@ lto_input_toplevel_asms (struct lto_file > > string_offset = sizeof (*header) + header->main_size; > >- lto_input_block ib (data + sizeof (*header), header->main_size); >+ lto_input_block ib (data + sizeof (*header), header->main_size, >+ file_data->mode_table); > > data_in = lto_data_in_create (file_data, data + string_offset, > header->string_size, vNULL); >@@ -1403,6 +1406,124 @@ lto_input_toplevel_asms (struct lto_file > } > > >+/* Input mode table. */ >+ >+void >+lto_input_mode_table (struct lto_file_decl_data *file_data) >+{ >+ size_t len; >+ const char *data = lto_get_section_data (file_data, >LTO_section_mode_table, >+ NULL, &len); >+ unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << >8); >+ >+ file_data->mode_table = table; >+ if (! data) >+ { >+ for (unsigned int m = 0; m < MAX_MACHINE_MODE; m++) >+ table[m] = m; >+ return; >+ } >+ >+ const struct lto_simple_header_with_strings *header >+ = (const struct lto_simple_header_with_strings *) data; >+ int string_offset; >+ struct data_in *data_in; >+ string_offset = sizeof (*header) + header->main_size; >+ >+ lto_input_block ib (data + sizeof (*header), header->main_size, >NULL); >+ data_in = lto_data_in_create (file_data, data + string_offset, >+ header->string_size, vNULL); >+ bitpack_d bp = streamer_read_bitpack (&ib); >+ >+ table[VOIDmode] = VOIDmode; >+ table[BLKmode] = BLKmode; >+ unsigned int m; >+ while ((m = bp_unpack_value (&bp, 8)) != VOIDmode) >+ { >+ enum mode_class mclass >+ = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS); >+ unsigned int size = bp_unpack_value (&bp, 8); >+ unsigned int prec = bp_unpack_value (&bp, 16); >+ machine_mode inner = (machine_mode) table[bp_unpack_value (&bp, >8)]; >+ unsigned int nunits = bp_unpack_value (&bp, 8); >+ unsigned int ibit = 0, fbit = 0; >+ unsigned int real_fmt_len = 0; >+ const char *real_fmt_name = NULL; >+ switch (mclass) >+ { >+ case MODE_FRACT: >+ case MODE_UFRACT: >+ case MODE_ACCUM: >+ case MODE_UACCUM: >+ ibit = bp_unpack_value (&bp, 8); >+ fbit = bp_unpack_value (&bp, 8); >+ break; >+ case MODE_FLOAT: >+ case MODE_DECIMAL_FLOAT: >+ real_fmt_name = bp_unpack_indexed_string (data_in, &bp, >+ &real_fmt_len); >+ break; >+ default: >+ break; >+ } >+ /* First search just the GET_CLASS_NARROWEST_MODE to wider >modes, >+ if not found, fallback to all modes. */ >+ int pass; >+ for (pass = 0; pass < 2; pass++) >+ for (machine_mode mr = pass ? VOIDmode >+ : GET_CLASS_NARROWEST_MODE (mclass); >+ pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode; >+ pass ? mr = (machine_mode) (m + 1) >+ : mr = GET_MODE_WIDER_MODE (mr)) >+ if (GET_MODE_CLASS (mr) != mclass >+ || GET_MODE_SIZE (mr) != size >+ || GET_MODE_PRECISION (mr) != prec >+ || GET_MODE_INNER (mr) != inner >+ || GET_MODE_IBIT (mr) != ibit >+ || GET_MODE_FBIT (mr) != fbit >+ || GET_MODE_NUNITS (mr) != nunits) >+ continue; >+ else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT) >+ && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0) >+ continue; >+ else >+ { >+ table[m] = mr; >+ pass = 2; >+ break; >+ } >+ unsigned int len; >+ const char *mname = bp_unpack_indexed_string (data_in, &bp, >&len); >+ if (pass == 2) >+ { >+ switch (mclass) >+ { >+ case MODE_VECTOR_INT: >+ case MODE_VECTOR_FLOAT: >+ case MODE_VECTOR_FRACT: >+ case MODE_VECTOR_UFRACT: >+ case MODE_VECTOR_ACCUM: >+ case MODE_VECTOR_UACCUM: >+ /* For unsupported vector modes just use BLKmode, >+ if the scalar mode is supported. */ >+ if (inner != VOIDmode) >+ { >+ table[m] = BLKmode; >+ break; >+ } >+ /* FALLTHRU */ >+ default: >+ error ("unsupported mode %s\n", mname); >+ break; >+ } >+ } >+ } >+ lto_data_in_delete (data_in); >+ >+ lto_free_section_data (file_data, LTO_section_asm, NULL, data, len); >+} >+ >+ > /* Initialization for the LTO reader. */ > > void >--- gcc/config/pdp11/pdp11.c.jj 2015-02-16 20:14:09.818340098 +0100 >+++ gcc/config/pdp11/pdp11.c 2015-02-16 20:26:23.653299288 +0100 >@@ -107,7 +107,8 @@ const struct real_format pdp11_f_format > false, > false, > false, >- false >+ false, >+ "pdp11_f" > }; > > const struct real_format pdp11_d_format = >@@ -128,7 +129,8 @@ const struct real_format pdp11_d_format > false, > false, > false, >- false >+ false, >+ "pdp11_d" > }; > > static void >--- gcc/real.c.jj 2015-02-16 20:14:09.208350107 +0100 >+++ gcc/real.c 2015-02-16 20:26:23.657299222 +0100 >@@ -3031,7 +3031,8 @@ const struct real_format ieee_single_for > true, > true, > true, >- false >+ false, >+ "ieee_single" > }; > > const struct real_format mips_single_format = >@@ -3052,7 +3053,8 @@ const struct real_format mips_single_for > true, > true, > false, >- true >+ true, >+ "mips_single" > }; > > const struct real_format motorola_single_format = >@@ -3073,7 +3075,8 @@ const struct real_format motorola_single > true, > true, > true, >- true >+ true, >+ "motorola_single" > }; > >/* SPU Single Precision (Extended-Range Mode) format is the same as >IEEE >@@ -3105,7 +3108,8 @@ const struct real_format spu_single_form > true, > true, > false, >- false >+ false, >+ "spu_single" > }; > \f> > /* IEEE double-precision format. */ >@@ -3314,7 +3318,8 @@ const struct real_format ieee_double_for > true, > true, > true, >- false >+ false, >+ "ieee_double" > }; > > const struct real_format mips_double_format = >@@ -3335,7 +3340,8 @@ const struct real_format mips_double_for > true, > true, > false, >- true >+ true, >+ "mips_double" > }; > > const struct real_format motorola_double_format = >@@ -3356,7 +3362,8 @@ const struct real_format motorola_double > true, > true, > true, >- true >+ true, >+ "motorola_double" > }; > \f> > /* IEEE extended real format. This comes in three flavors: Intel's as >@@ -3700,7 +3707,8 @@ const struct real_format ieee_extended_m > true, > true, > true, >- true >+ true, >+ "ieee_extended_motorola" > }; > > const struct real_format ieee_extended_intel_96_format = >@@ -3721,7 +3729,8 @@ const struct real_format ieee_extended_i > true, > true, > true, >- false >+ false, >+ "ieee_extended_intel_96" > }; > > const struct real_format ieee_extended_intel_128_format = >@@ -3742,7 +3751,8 @@ const struct real_format ieee_extended_i > true, > true, > true, >- false >+ false, >+ "ieee_extended_intel_128" > }; > >/* The following caters to i386 systems that set the rounding precision >@@ -3765,7 +3775,8 @@ const struct real_format ieee_extended_i > true, > true, > true, >- false >+ false, >+ "ieee_extended_intel_96_round_53" > }; > \f> >/* IBM 128-bit extended precision format: a pair of IEEE double >precision >@@ -3853,7 +3864,8 @@ const struct real_format ibm_extended_fo > true, > true, > true, >- false >+ false, >+ "ibm_extended" > }; > > const struct real_format mips_extended_format = >@@ -3874,7 +3886,8 @@ const struct real_format mips_extended_f > true, > true, > false, >- true >+ true, >+ "mips_extended" > }; > > \f> >@@ -4137,7 +4150,8 @@ const struct real_format ieee_quad_forma > true, > true, > true, >- false >+ false, >+ "ieee_quad" > }; > > const struct real_format mips_quad_format = >@@ -4158,7 +4172,8 @@ const struct real_format mips_quad_forma > true, > true, > false, >- true >+ true, >+ "mips_quad" > }; > \f> >/* Descriptions of VAX floating point formats can be found beginning at >@@ -4458,7 +4473,8 @@ const struct real_format vax_f_format = > false, > false, > false, >- false >+ false, >+ "vax_f" > }; > > const struct real_format vax_d_format = >@@ -4479,7 +4495,8 @@ const struct real_format vax_d_format = > false, > false, > false, >- false >+ false, >+ "vax_d" > }; > > const struct real_format vax_g_format = >@@ -4500,7 +4517,8 @@ const struct real_format vax_g_format = > false, > false, > false, >- false >+ false, >+ "vax_g" > }; > \f> > /* Encode real R into a single precision DFP value in BUF. */ >@@ -4576,7 +4594,8 @@ const struct real_format decimal_single_ > true, > true, > true, >- false >+ false, >+ "decimal_single" > }; > > /* Double precision decimal floating point (IEEE 754). */ >@@ -4598,7 +4617,8 @@ const struct real_format decimal_double_ > true, > true, > true, >- false >+ false, >+ "decimal_double" > }; > > /* Quad precision decimal floating point (IEEE 754). */ >@@ -4620,7 +4640,8 @@ const struct real_format decimal_quad_fo > true, > true, > true, >- false >+ false, >+ "decimal_quad" > }; > \f> >/* Encode half-precision floats. This routine is used both for the >IEEE >@@ -4757,7 +4778,8 @@ const struct real_format ieee_half_forma > true, > true, > true, >- false >+ false, >+ "ieee_half" > }; > > /* ARM's alternative half-precision format, similar to IEEE but with >@@ -4781,7 +4803,8 @@ const struct real_format arm_half_format > true, > true, > false, >- false >+ false, >+ "arm_half" > }; > \f> > /* A synthetic "format" for internal arithmetic. It's the size of the >@@ -4826,7 +4849,8 @@ const struct real_format real_internal_f > false, > true, > true, >- false >+ false, >+ "real_internal" > }; > \f> > /* Calculate X raised to the integer exponent N in mode MODE and store > > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-16 21:35 ` Richard Biener @ 2015-02-16 21:44 ` Jakub Jelinek 2015-02-17 10:00 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-02-16 21:44 UTC (permalink / raw) To: Richard Biener Cc: Jan Hubicka, Ilya Verbin, Bernd Schmidt, Thomas Schwinge, gcc-patches On Mon, Feb 16, 2015 at 10:35:30PM +0100, Richard Biener wrote: > Seeing the real format string you introduce I wonder if identifying modes > by their names wouldn't work in 99% of all cases (apart from PSImode > maybe). There are various corner cases. Plus of course sometimes insignificant, but sometimes very significant, floating mode changes. SFmode on one target might be completely different from another target. > Also for most cases we can construct the machine mode from the type. Or > where that is not possible stream the extra info that is necessary > instead. I thought we've discussed that already on IRC. E.g. decimal modes are identified only by mode and nothing else, and it doesn't look like it can be easily derived from types in many cases (spent quite some time on that). > Overall feels like a hack BTW :) can't we assign machine mode enum IDs in > a target independent way? I mean, it doesn't have to be densely > allocated? We iterate over modes, we have tons of tables indexed by modes, so if we introduce gaps, we'll make the compiler bigger and slower. If this is limited to the offloading path, like in the attached updated patch, the overhead for native LTO should be not measurable. --- gcc/passes.c.jj 2015-02-16 22:18:33.219702315 +0100 +++ gcc/passes.c 2015-02-16 22:19:20.842917807 +0100 @@ -2460,6 +2460,7 @@ ipa_write_summaries_1 (lto_symtab_encode struct lto_out_decl_state *state = lto_new_out_decl_state (); state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); gcc_assert (!flag_wpa); @@ -2581,6 +2582,7 @@ ipa_write_optimization_summaries (lto_sy lto_symtab_encoder_iterator lsei; state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) --- gcc/tree-streamer.h.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/tree-streamer.h 2015-02-16 22:19:20.843917791 +0100 @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. #include "streamer-hooks.h" #include "lto-streamer.h" +#include "data-streamer.h" #include "hash-map.h" /* Cache of pickled nodes. Used to avoid writing the same node more @@ -91,6 +92,7 @@ void streamer_write_integer_cst (struct void streamer_write_builtin (struct output_block *, tree); /* In tree-streamer.c. */ +extern unsigned char streamer_mode_table[1 << 8]; void streamer_check_handled_ts_structures (void); bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, hashval_t, unsigned *); @@ -119,5 +121,19 @@ streamer_tree_cache_get_hash (struct str return cache->hashes[ix]; } +static inline void +bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) +{ + streamer_mode_table[mode] = 1; + bp_pack_enum (bp, machine_mode, 1 << 8, mode); +} + +static inline machine_mode +bp_unpack_machine_mode (struct bitpack_d *bp) +{ + return (machine_mode) + ((struct lto_input_block *) + bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << 8)]; +} #endif /* GCC_TREE_STREAMER_H */ --- gcc/lto-streamer-out.c.jj 2015-02-16 22:18:33.204702562 +0100 +++ gcc/lto-streamer-out.c 2015-02-16 22:20:06.659163066 +0100 @@ -2642,6 +2642,96 @@ produce_symtab (struct output_block *ob) } +/* Init the streamer_mode_table for output, where we collect info on what + machine_mode values have been streamed. */ +void +lto_output_init_mode_table (void) +{ + memset (streamer_mode_table, '\0', MAX_MACHINE_MODE); +} + + +/* Write the mode table. */ +static void +lto_write_mode_table (void) +{ + struct output_block *ob; + ob = create_output_block (LTO_section_mode_table); + bitpack_d bp = bitpack_create (ob->main_stream); + + /* Ensure that for GET_MODE_INNER (m) != VOIDmode we have + also the inner mode marked. */ + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i]) + { + machine_mode m = (machine_mode) i; + if (GET_MODE_INNER (m) != VOIDmode) + streamer_mode_table[(int) GET_MODE_INNER (m)] = 1; + } + /* First stream modes that have GET_MODE_INNER (m) == VOIDmode, + so that we can refer to them afterwards. */ + for (int pass = 0; pass < 2; pass++) + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i] && i != (int) VOIDmode && i != (int) BLKmode) + { + machine_mode m = (machine_mode) i; + if ((GET_MODE_INNER (m) == VOIDmode) ^ (pass == 0)) + continue; + bp_pack_value (&bp, m, 8); + bp_pack_enum (&bp, mode_class, MAX_MODE_CLASS, GET_MODE_CLASS (m)); + bp_pack_value (&bp, GET_MODE_SIZE (m), 8); + bp_pack_value (&bp, GET_MODE_PRECISION (m), 16); + bp_pack_value (&bp, GET_MODE_INNER (m), 8); + bp_pack_value (&bp, GET_MODE_NUNITS (m), 8); + switch (GET_MODE_CLASS (m)) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + bp_pack_value (&bp, GET_MODE_IBIT (m), 8); + bp_pack_value (&bp, GET_MODE_FBIT (m), 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + bp_pack_string (ob, &bp, REAL_MODE_FORMAT (m)->name, true); + break; + default: + break; + } + bp_pack_string (ob, &bp, GET_MODE_NAME (m), true); + } + bp_pack_value (&bp, VOIDmode, 8); + + streamer_write_bitpack (&bp); + + char *section_name + = lto_get_section_name (LTO_section_mode_table, NULL, NULL); + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* The entire header stream is computed here. */ + struct lto_simple_header_with_strings header; + memset (&header, 0, sizeof (header)); + + /* Write the header. */ + header.major_version = LTO_major_version; + header.minor_version = LTO_minor_version; + + header.main_size = ob->main_stream->total_size; + header.string_size = ob->string_stream->total_size; + lto_write_data (&header, sizeof header); + + /* Put all of the gimple and the string table out the asm file as a + block of text. */ + lto_write_stream (ob->main_stream); + lto_write_stream (ob->string_stream); + + lto_end_section (); + destroy_output_block (ob); +} + + /* This pass is run after all of the functions are serialized and all of the IPA passes have written their serialized forms. This pass causes the vector of all of the global decls and types used from @@ -2749,4 +2839,6 @@ produce_asm_for_decls (void) lto_symtab_encoder_delete (ob->decl_state->symtab_node_encoder); lto_function_decl_states.release (); destroy_output_block (ob); + if (lto_stream_offload_p) + lto_write_mode_table (); } --- gcc/config/pdp11/pdp11.c.jj 2015-02-16 22:18:33.209702480 +0100 +++ gcc/config/pdp11/pdp11.c 2015-02-16 22:19:20.845917758 +0100 @@ -107,7 +107,8 @@ const struct real_format pdp11_f_format false, false, false, - false + false, + "pdp11_f" }; const struct real_format pdp11_d_format = @@ -128,7 +129,8 @@ const struct real_format pdp11_d_format false, false, false, - false + false, + "pdp11_d" }; static void --- gcc/lto-section-in.c.jj 2015-02-16 22:18:33.202702595 +0100 +++ gcc/lto-section-in.c 2015-02-16 22:19:20.845917758 +0100 @@ -89,7 +89,8 @@ const char *lto_section_name[LTO_N_SECTI "inline", "ipcp_trans", "icf", - "offload_table" + "offload_table", + "mode_table" }; @@ -262,7 +263,8 @@ lto_create_simple_input_block (struct lt return NULL; *datar = data; - return new lto_input_block (data + main_offset, header->main_size); + return new lto_input_block (data + main_offset, header->main_size, + file_data->mode_table); } --- gcc/tree-streamer-out.c.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/tree-streamer-out.c 2015-02-16 22:19:20.845917758 +0100 @@ -190,7 +190,7 @@ static void pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { struct fixed_value fv = TREE_FIXED_CST (expr); - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, fv.mode); + bp_pack_machine_mode (bp, fv.mode); bp_pack_var_len_int (bp, fv.data.low); bp_pack_var_len_int (bp, fv.data.high); } @@ -201,7 +201,7 @@ pack_ts_fixed_cst_value_fields (struct b static void pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); + bp_pack_machine_mode (bp, DECL_MODE (expr)); bp_pack_value (bp, DECL_NONLOCAL (expr), 1); bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); bp_pack_value (bp, DECL_IGNORED_P (expr), 1); @@ -325,7 +325,7 @@ pack_ts_function_decl_value_fields (stru static void pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, TYPE_MODE (expr)); + bp_pack_machine_mode (bp, TYPE_MODE (expr)); bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); --- gcc/real.h.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/real.h 2015-02-16 22:19:20.846917741 +0100 @@ -155,6 +155,7 @@ struct real_format bool has_signed_zero; bool qnan_msb_set; bool canonical_nan_lsbs_set; + const char *name; }; --- gcc/lto-streamer.h.jj 2015-02-16 22:18:33.211702447 +0100 +++ gcc/lto-streamer.h 2015-02-16 22:19:20.846917741 +0100 @@ -248,6 +248,7 @@ enum lto_section_type LTO_section_ipcp_transform, LTO_section_ipa_icf, LTO_section_offload_table, + LTO_section_mode_table, LTO_N_SECTION_TYPES /* Must be last. */ }; @@ -312,12 +313,15 @@ class lto_input_block public: /* Special constructor for the string table, it abuses this to do random access but use the uhwi decoder. */ - lto_input_block (const char *data_, unsigned int p_, unsigned int len_) - : data (data_), p (p_), len (len_) {} - lto_input_block (const char *data_, unsigned int len_) - : data (data_), p (0), len (len_) {} + lto_input_block (const char *data_, unsigned int p_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (p_), len (len_) {} + lto_input_block (const char *data_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (0), len (len_) {} const char *data; + const unsigned char *mode_table; unsigned int p; unsigned int len; }; @@ -527,6 +531,9 @@ struct GTY(()) lto_file_decl_data /* Map assigning declarations their resolutions. */ hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map; + + /* Mode translation table. */ + const unsigned char *mode_table; }; typedef struct lto_file_decl_data *lto_file_decl_data_ptr; @@ -775,6 +782,7 @@ extern void lto_input_variable_construct extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, const char *); extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); +extern void lto_input_mode_table (struct lto_file_decl_data *); extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, const char *, unsigned, vec<ld_plugin_symbol_resolution_t> ); @@ -807,6 +815,7 @@ void lto_output_decl_state_refs (struct struct lto_output_stream *, struct lto_out_decl_state *); void lto_output_location (struct output_block *, struct bitpack_d *, location_t); +void lto_output_init_mode_table (void); /* In lto-cgraph.c */ --- gcc/ipa-prop.c.jj 2015-02-16 22:18:33.219702315 +0100 +++ gcc/ipa-prop.c 2015-02-16 22:19:20.848917709 +0100 @@ -4868,7 +4868,7 @@ ipa_prop_read_section (struct lto_file_d unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, @@ -5089,7 +5089,7 @@ read_replacements_section (struct lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, header->string_size, vNULL); --- gcc/data-streamer-in.c.jj 2015-02-16 22:18:33.224702233 +0100 +++ gcc/data-streamer-in.c 2015-02-16 22:19:20.848917709 +0100 @@ -70,7 +70,7 @@ string_for_index (struct data_in *data_i } /* Get the string stored at location LOC in DATA_IN->STRINGS. */ - lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len); + lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len, NULL); len = streamer_read_uhwi (&str_tab); *rlen = len; --- gcc/tree-streamer-in.c.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/tree-streamer-in.c 2015-02-16 22:19:20.849917692 +0100 @@ -224,7 +224,7 @@ static void unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> (); - fp->mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + fp->mode = bp_unpack_machine_mode (bp); fp->data.low = bp_unpack_var_len_int (bp); fp->data.high = bp_unpack_var_len_int (bp); TREE_FIXED_CST_PTR (expr) = fp; @@ -236,7 +236,7 @@ unpack_ts_fixed_cst_value_fields (struct static void unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + DECL_MODE (expr) = bp_unpack_machine_mode (bp); DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); @@ -373,7 +373,7 @@ unpack_ts_type_common_value_fields (stru { machine_mode mode; - mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + mode = bp_unpack_machine_mode (bp); SET_TYPE_MODE (expr, mode); TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); --- gcc/ipa-inline-analysis.c.jj 2015-02-16 22:18:33.223702249 +0100 +++ gcc/ipa-inline-analysis.c 2015-02-16 22:19:20.850917676 +0100 @@ -4190,7 +4190,8 @@ inline_read_section (struct lto_file_dec unsigned int i, count2, j; unsigned int f_count; - lto_input_block ib ((const char *) data + main_offset, header->main_size); + lto_input_block ib ((const char *) data + main_offset, header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/ipa-icf.c.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/ipa-icf.c 2015-02-16 22:19:20.851917659 +0100 @@ -1500,7 +1500,7 @@ sem_item_optimizer::read_section (lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, 0, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/real.c.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/real.c 2015-02-16 22:19:20.853917626 +0100 @@ -3031,7 +3031,8 @@ const struct real_format ieee_single_for true, true, true, - false + false, + "ieee_single" }; const struct real_format mips_single_format = @@ -3052,7 +3053,8 @@ const struct real_format mips_single_for true, true, false, - true + true, + "mips_single" }; const struct real_format motorola_single_format = @@ -3073,7 +3075,8 @@ const struct real_format motorola_single true, true, true, - true + true, + "motorola_single" }; /* SPU Single Precision (Extended-Range Mode) format is the same as IEEE @@ -3105,7 +3108,8 @@ const struct real_format spu_single_form true, true, false, - false + false, + "spu_single" }; \f /* IEEE double-precision format. */ @@ -3314,7 +3318,8 @@ const struct real_format ieee_double_for true, true, true, - false + false, + "ieee_double" }; const struct real_format mips_double_format = @@ -3335,7 +3340,8 @@ const struct real_format mips_double_for true, true, false, - true + true, + "mips_double" }; const struct real_format motorola_double_format = @@ -3356,7 +3362,8 @@ const struct real_format motorola_double true, true, true, - true + true, + "motorola_double" }; \f /* IEEE extended real format. This comes in three flavors: Intel's as @@ -3700,7 +3707,8 @@ const struct real_format ieee_extended_m true, true, true, - true + true, + "ieee_extended_motorola" }; const struct real_format ieee_extended_intel_96_format = @@ -3721,7 +3729,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96" }; const struct real_format ieee_extended_intel_128_format = @@ -3742,7 +3751,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_128" }; /* The following caters to i386 systems that set the rounding precision @@ -3765,7 +3775,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96_round_53" }; \f /* IBM 128-bit extended precision format: a pair of IEEE double precision @@ -3853,7 +3864,8 @@ const struct real_format ibm_extended_fo true, true, true, - false + false, + "ibm_extended" }; const struct real_format mips_extended_format = @@ -3874,7 +3886,8 @@ const struct real_format mips_extended_f true, true, false, - true + true, + "mips_extended" }; \f @@ -4137,7 +4150,8 @@ const struct real_format ieee_quad_forma true, true, true, - false + false, + "ieee_quad" }; const struct real_format mips_quad_format = @@ -4158,7 +4172,8 @@ const struct real_format mips_quad_forma true, true, false, - true + true, + "mips_quad" }; \f /* Descriptions of VAX floating point formats can be found beginning at @@ -4458,7 +4473,8 @@ const struct real_format vax_f_format = false, false, false, - false + false, + "vax_f" }; const struct real_format vax_d_format = @@ -4479,7 +4495,8 @@ const struct real_format vax_d_format = false, false, false, - false + false, + "vax_d" }; const struct real_format vax_g_format = @@ -4500,7 +4517,8 @@ const struct real_format vax_g_format = false, false, false, - false + false, + "vax_g" }; \f /* Encode real R into a single precision DFP value in BUF. */ @@ -4576,7 +4594,8 @@ const struct real_format decimal_single_ true, true, true, - false + false, + "decimal_single" }; /* Double precision decimal floating point (IEEE 754). */ @@ -4598,7 +4617,8 @@ const struct real_format decimal_double_ true, true, true, - false + false, + "decimal_double" }; /* Quad precision decimal floating point (IEEE 754). */ @@ -4620,7 +4640,8 @@ const struct real_format decimal_quad_fo true, true, true, - false + false, + "decimal_quad" }; \f /* Encode half-precision floats. This routine is used both for the IEEE @@ -4757,7 +4778,8 @@ const struct real_format ieee_half_forma true, true, true, - false + false, + "ieee_half" }; /* ARM's alternative half-precision format, similar to IEEE but with @@ -4781,7 +4803,8 @@ const struct real_format arm_half_format true, true, false, - false + false, + "arm_half" }; \f /* A synthetic "format" for internal arithmetic. It's the size of the @@ -4826,7 +4849,8 @@ const struct real_format real_internal_f false, true, true, - false + false, + "real_internal" }; \f /* Calculate X raised to the integer exponent N in mode MODE and store --- gcc/tree-streamer.c.jj 2015-02-16 22:18:33.221702282 +0100 +++ gcc/tree-streamer.c 2015-02-16 22:19:20.853917626 +0100 @@ -53,6 +53,14 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "tree-streamer.h" +/* Table indexed by machine_mode, used for 2 different purposes. + During streaming out we record there non-zero value for all modes + that were streamed out. + During streaming in, we translate the on the disk mode using this + table. For normal LTO it is set to identity, for ACCEL_COMPILER + depending on the mode_table content. */ +unsigned char streamer_mode_table[1 << 8]; + /* Check that all the TS_* structures handled by the streamer_write_* and streamer_read_* routines are exactly ALL the structures defined in treestruct.def. */ --- gcc/lto/lto.c.jj 2015-02-16 22:18:33.221702282 +0100 +++ gcc/lto/lto.c 2015-02-16 22:35:56.213523202 +0100 @@ -85,6 +85,8 @@ static int lto_parallelism; static GTY(()) tree first_personality_decl; +static GTY(()) const unsigned char *lto_mode_identity_table; + /* Returns a hash code for P. */ static hashval_t @@ -1877,7 +1879,7 @@ lto_read_decls (struct lto_file_decl_dat uint32_t num_decl_states; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, decl_data->mode_table); data_in = lto_data_in_create (decl_data, (const char *) data + string_offset, header->string_size, resolutions); @@ -2219,6 +2221,11 @@ lto_file_finalize (struct lto_file_decl_ file_data->renaming_hash_table = lto_create_renaming_table (); file_data->file_name = file->filename; +#ifdef ACCEL_COMPILER + lto_input_mode_table (file_data); +#else + file_data->mode_table = lto_mode_identity_table; +#endif data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); if (data == NULL) { @@ -3394,6 +3401,13 @@ lto_init (void) memset (<o_stats, 0, sizeof (lto_stats)); bitmap_obstack_initialize (NULL); gimple_register_cfg_hooks (); +#ifndef ACCEL_COMPILER + unsigned char *table + = ggc_vec_alloc<unsigned char> (MAX_MACHINE_MODE); + for (int m = 0; m < MAX_MACHINE_MODE; m++) + table[m] = m; + lto_mode_identity_table = table; +#endif } --- gcc/lto-cgraph.c.jj 2015-02-16 22:18:33.211702447 +0100 +++ gcc/lto-cgraph.c 2015-02-16 22:19:20.855917593 +0100 @@ -2113,7 +2113,7 @@ input_cgraph_opt_section (struct lto_fil unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/lto-streamer-in.c.jj 2015-02-16 22:18:33.204702562 +0100 +++ gcc/lto-streamer-in.c 2015-02-16 22:26:53.355464202 +0100 @@ -1116,10 +1116,12 @@ lto_read_body_or_constructor (struct lto /* Set up the struct function. */ from = data_in->reader_cache->nodes.length (); - lto_input_block ib_main (data + main_offset, header->main_size); + lto_input_block ib_main (data + main_offset, header->main_size, + file_data->mode_table); if (TREE_CODE (node->decl) == FUNCTION_DECL) { - lto_input_block ib_cfg (data + cfg_offset, header->cfg_size); + lto_input_block ib_cfg (data + cfg_offset, header->cfg_size, + file_data->mode_table); input_function (fn_decl, data_in, &ib_main, &ib_cfg); } else @@ -1384,7 +1386,8 @@ lto_input_toplevel_asms (struct lto_file string_offset = sizeof (*header) + header->main_size; - lto_input_block ib (data + sizeof (*header), header->main_size); + lto_input_block ib (data + sizeof (*header), header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, data + string_offset, header->string_size, vNULL); @@ -1403,6 +1406,123 @@ lto_input_toplevel_asms (struct lto_file } +/* Input mode table. */ + +void +lto_input_mode_table (struct lto_file_decl_data *file_data) +{ + size_t len; + const char *data = lto_get_section_data (file_data, LTO_section_mode_table, + NULL, &len); + if (! data) + { + internal_error ("cannot read LTO mode table from %s", + file_data->file_name); + return; + } + + unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << 8); + file_data->mode_table = table; + const struct lto_simple_header_with_strings *header + = (const struct lto_simple_header_with_strings *) data; + int string_offset; + struct data_in *data_in; + string_offset = sizeof (*header) + header->main_size; + + lto_input_block ib (data + sizeof (*header), header->main_size, NULL); + data_in = lto_data_in_create (file_data, data + string_offset, + header->string_size, vNULL); + bitpack_d bp = streamer_read_bitpack (&ib); + + table[VOIDmode] = VOIDmode; + table[BLKmode] = BLKmode; + unsigned int m; + while ((m = bp_unpack_value (&bp, 8)) != VOIDmode) + { + enum mode_class mclass + = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS); + unsigned int size = bp_unpack_value (&bp, 8); + unsigned int prec = bp_unpack_value (&bp, 16); + machine_mode inner = (machine_mode) table[bp_unpack_value (&bp, 8)]; + unsigned int nunits = bp_unpack_value (&bp, 8); + unsigned int ibit = 0, fbit = 0; + unsigned int real_fmt_len = 0; + const char *real_fmt_name = NULL; + switch (mclass) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + ibit = bp_unpack_value (&bp, 8); + fbit = bp_unpack_value (&bp, 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + real_fmt_name = bp_unpack_indexed_string (data_in, &bp, + &real_fmt_len); + break; + default: + break; + } + /* First search just the GET_CLASS_NARROWEST_MODE to wider modes, + if not found, fallback to all modes. */ + int pass; + for (pass = 0; pass < 2; pass++) + for (machine_mode mr = pass ? VOIDmode + : GET_CLASS_NARROWEST_MODE (mclass); + pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode; + pass ? mr = (machine_mode) (m + 1) + : mr = GET_MODE_WIDER_MODE (mr)) + if (GET_MODE_CLASS (mr) != mclass + || GET_MODE_SIZE (mr) != size + || GET_MODE_PRECISION (mr) != prec + || GET_MODE_INNER (mr) != inner + || GET_MODE_IBIT (mr) != ibit + || GET_MODE_FBIT (mr) != fbit + || GET_MODE_NUNITS (mr) != nunits) + continue; + else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT) + && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0) + continue; + else + { + table[m] = mr; + pass = 2; + break; + } + unsigned int mname_len; + const char *mname = bp_unpack_indexed_string (data_in, &bp, &mname_len); + if (pass == 2) + { + switch (mclass) + { + case MODE_VECTOR_INT: + case MODE_VECTOR_FLOAT: + case MODE_VECTOR_FRACT: + case MODE_VECTOR_UFRACT: + case MODE_VECTOR_ACCUM: + case MODE_VECTOR_UACCUM: + /* For unsupported vector modes just use BLKmode, + if the scalar mode is supported. */ + if (inner != VOIDmode) + { + table[m] = BLKmode; + break; + } + /* FALLTHRU */ + default: + error ("unsupported mode %s\n", mname); + break; + } + } + } + lto_data_in_delete (data_in); + + lto_free_section_data (file_data, LTO_section_mode_table, NULL, data, len); +} + + /* Initialization for the LTO reader. */ void Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-16 21:44 ` Jakub Jelinek @ 2015-02-17 10:00 ` Richard Biener 2015-02-18 10:00 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2015-02-17 10:00 UTC (permalink / raw) To: Jakub Jelinek Cc: Jan Hubicka, Ilya Verbin, Bernd Schmidt, Thomas Schwinge, GCC Patches On Mon, Feb 16, 2015 at 10:43 PM, Jakub Jelinek <jakub@redhat.com> wrote: > On Mon, Feb 16, 2015 at 10:35:30PM +0100, Richard Biener wrote: >> Seeing the real format string you introduce I wonder if identifying modes >> by their names wouldn't work in 99% of all cases (apart from PSImode >> maybe). > > There are various corner cases. Plus of course sometimes insignificant, but > sometimes very significant, floating mode changes. SFmode on one target > might be completely different from another target. But we can't deal with arbitrary target differences anyway - otherwise we have generated wrong code already. >> Also for most cases we can construct the machine mode from the type. Or >> where that is not possible stream the extra info that is necessary >> instead. > > I thought we've discussed that already on IRC. E.g. decimal modes are > identified only by mode and nothing else, and it doesn't look like it > can be easily derived from types in many cases (spent quite some time on > that). Sure, still modes and types have quite some overlap in information so we might be able to do more compact streaming (and at the same time not rely on the machine-mode enum). The machine-modes of course are very compact to stream (they are basically a common set of all possible types), and your mapping introduces kind of a cache for common type properties. I know that Honza wanted to make trees slimmer by taking into account more (redundant) information from the modes associated with trees. I'm just looking for a way to make this less of a hack (and the LTO IL less target dependent). Not for GCC 5 for which something like your patch is probably ok, but for the future. >> Overall feels like a hack BTW :) can't we assign machine mode enum IDs in >> a target independent way? I mean, it doesn't have to be densely >> allocated? > > We iterate over modes, we have tons of tables indexed by modes, so if we > introduce gaps, we'll make the compiler bigger and slower. > If this is limited to the offloading path, like in the attached updated > patch, the overhead for native LTO should be not measurable. Sure. Thanks, Richard. > --- gcc/passes.c.jj 2015-02-16 22:18:33.219702315 +0100 > +++ gcc/passes.c 2015-02-16 22:19:20.842917807 +0100 > @@ -2460,6 +2460,7 @@ ipa_write_summaries_1 (lto_symtab_encode > struct lto_out_decl_state *state = lto_new_out_decl_state (); > state->symtab_node_encoder = encoder; > > + lto_output_init_mode_table (); > lto_push_out_decl_state (state); > > gcc_assert (!flag_wpa); > @@ -2581,6 +2582,7 @@ ipa_write_optimization_summaries (lto_sy > lto_symtab_encoder_iterator lsei; > state->symtab_node_encoder = encoder; > > + lto_output_init_mode_table (); > lto_push_out_decl_state (state); > for (lsei = lsei_start_function_in_partition (encoder); > !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) > --- gcc/tree-streamer.h.jj 2015-02-16 22:18:33.222702266 +0100 > +++ gcc/tree-streamer.h 2015-02-16 22:19:20.843917791 +0100 > @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. > > #include "streamer-hooks.h" > #include "lto-streamer.h" > +#include "data-streamer.h" > #include "hash-map.h" > > /* Cache of pickled nodes. Used to avoid writing the same node more > @@ -91,6 +92,7 @@ void streamer_write_integer_cst (struct > void streamer_write_builtin (struct output_block *, tree); > > /* In tree-streamer.c. */ > +extern unsigned char streamer_mode_table[1 << 8]; > void streamer_check_handled_ts_structures (void); > bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, > hashval_t, unsigned *); > @@ -119,5 +121,19 @@ streamer_tree_cache_get_hash (struct str > return cache->hashes[ix]; > } > > +static inline void > +bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) > +{ > + streamer_mode_table[mode] = 1; > + bp_pack_enum (bp, machine_mode, 1 << 8, mode); > +} > + > +static inline machine_mode > +bp_unpack_machine_mode (struct bitpack_d *bp) > +{ > + return (machine_mode) > + ((struct lto_input_block *) > + bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << 8)]; > +} > > #endif /* GCC_TREE_STREAMER_H */ > --- gcc/lto-streamer-out.c.jj 2015-02-16 22:18:33.204702562 +0100 > +++ gcc/lto-streamer-out.c 2015-02-16 22:20:06.659163066 +0100 > @@ -2642,6 +2642,96 @@ produce_symtab (struct output_block *ob) > } > > > +/* Init the streamer_mode_table for output, where we collect info on what > + machine_mode values have been streamed. */ > +void > +lto_output_init_mode_table (void) > +{ > + memset (streamer_mode_table, '\0', MAX_MACHINE_MODE); > +} > + > + > +/* Write the mode table. */ > +static void > +lto_write_mode_table (void) > +{ > + struct output_block *ob; > + ob = create_output_block (LTO_section_mode_table); > + bitpack_d bp = bitpack_create (ob->main_stream); > + > + /* Ensure that for GET_MODE_INNER (m) != VOIDmode we have > + also the inner mode marked. */ > + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) > + if (streamer_mode_table[i]) > + { > + machine_mode m = (machine_mode) i; > + if (GET_MODE_INNER (m) != VOIDmode) > + streamer_mode_table[(int) GET_MODE_INNER (m)] = 1; > + } > + /* First stream modes that have GET_MODE_INNER (m) == VOIDmode, > + so that we can refer to them afterwards. */ > + for (int pass = 0; pass < 2; pass++) > + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) > + if (streamer_mode_table[i] && i != (int) VOIDmode && i != (int) BLKmode) > + { > + machine_mode m = (machine_mode) i; > + if ((GET_MODE_INNER (m) == VOIDmode) ^ (pass == 0)) > + continue; > + bp_pack_value (&bp, m, 8); > + bp_pack_enum (&bp, mode_class, MAX_MODE_CLASS, GET_MODE_CLASS (m)); > + bp_pack_value (&bp, GET_MODE_SIZE (m), 8); > + bp_pack_value (&bp, GET_MODE_PRECISION (m), 16); > + bp_pack_value (&bp, GET_MODE_INNER (m), 8); > + bp_pack_value (&bp, GET_MODE_NUNITS (m), 8); > + switch (GET_MODE_CLASS (m)) > + { > + case MODE_FRACT: > + case MODE_UFRACT: > + case MODE_ACCUM: > + case MODE_UACCUM: > + bp_pack_value (&bp, GET_MODE_IBIT (m), 8); > + bp_pack_value (&bp, GET_MODE_FBIT (m), 8); > + break; > + case MODE_FLOAT: > + case MODE_DECIMAL_FLOAT: > + bp_pack_string (ob, &bp, REAL_MODE_FORMAT (m)->name, true); > + break; > + default: > + break; > + } > + bp_pack_string (ob, &bp, GET_MODE_NAME (m), true); > + } > + bp_pack_value (&bp, VOIDmode, 8); > + > + streamer_write_bitpack (&bp); > + > + char *section_name > + = lto_get_section_name (LTO_section_mode_table, NULL, NULL); > + lto_begin_section (section_name, !flag_wpa); > + free (section_name); > + > + /* The entire header stream is computed here. */ > + struct lto_simple_header_with_strings header; > + memset (&header, 0, sizeof (header)); > + > + /* Write the header. */ > + header.major_version = LTO_major_version; > + header.minor_version = LTO_minor_version; > + > + header.main_size = ob->main_stream->total_size; > + header.string_size = ob->string_stream->total_size; > + lto_write_data (&header, sizeof header); > + > + /* Put all of the gimple and the string table out the asm file as a > + block of text. */ > + lto_write_stream (ob->main_stream); > + lto_write_stream (ob->string_stream); > + > + lto_end_section (); > + destroy_output_block (ob); > +} > + > + > /* This pass is run after all of the functions are serialized and all > of the IPA passes have written their serialized forms. This pass > causes the vector of all of the global decls and types used from > @@ -2749,4 +2839,6 @@ produce_asm_for_decls (void) > lto_symtab_encoder_delete (ob->decl_state->symtab_node_encoder); > lto_function_decl_states.release (); > destroy_output_block (ob); > + if (lto_stream_offload_p) > + lto_write_mode_table (); > } > --- gcc/config/pdp11/pdp11.c.jj 2015-02-16 22:18:33.209702480 +0100 > +++ gcc/config/pdp11/pdp11.c 2015-02-16 22:19:20.845917758 +0100 > @@ -107,7 +107,8 @@ const struct real_format pdp11_f_format > false, > false, > false, > - false > + false, > + "pdp11_f" > }; > > const struct real_format pdp11_d_format = > @@ -128,7 +129,8 @@ const struct real_format pdp11_d_format > false, > false, > false, > - false > + false, > + "pdp11_d" > }; > > static void > --- gcc/lto-section-in.c.jj 2015-02-16 22:18:33.202702595 +0100 > +++ gcc/lto-section-in.c 2015-02-16 22:19:20.845917758 +0100 > @@ -89,7 +89,8 @@ const char *lto_section_name[LTO_N_SECTI > "inline", > "ipcp_trans", > "icf", > - "offload_table" > + "offload_table", > + "mode_table" > }; > > > @@ -262,7 +263,8 @@ lto_create_simple_input_block (struct lt > return NULL; > > *datar = data; > - return new lto_input_block (data + main_offset, header->main_size); > + return new lto_input_block (data + main_offset, header->main_size, > + file_data->mode_table); > } > > > --- gcc/tree-streamer-out.c.jj 2015-02-16 22:18:33.222702266 +0100 > +++ gcc/tree-streamer-out.c 2015-02-16 22:19:20.845917758 +0100 > @@ -190,7 +190,7 @@ static void > pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) > { > struct fixed_value fv = TREE_FIXED_CST (expr); > - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, fv.mode); > + bp_pack_machine_mode (bp, fv.mode); > bp_pack_var_len_int (bp, fv.data.low); > bp_pack_var_len_int (bp, fv.data.high); > } > @@ -201,7 +201,7 @@ pack_ts_fixed_cst_value_fields (struct b > static void > pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) > { > - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); > + bp_pack_machine_mode (bp, DECL_MODE (expr)); > bp_pack_value (bp, DECL_NONLOCAL (expr), 1); > bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); > bp_pack_value (bp, DECL_IGNORED_P (expr), 1); > @@ -325,7 +325,7 @@ pack_ts_function_decl_value_fields (stru > static void > pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) > { > - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, TYPE_MODE (expr)); > + bp_pack_machine_mode (bp, TYPE_MODE (expr)); > bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); > bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); > bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); > --- gcc/real.h.jj 2015-02-16 22:18:33.220702299 +0100 > +++ gcc/real.h 2015-02-16 22:19:20.846917741 +0100 > @@ -155,6 +155,7 @@ struct real_format > bool has_signed_zero; > bool qnan_msb_set; > bool canonical_nan_lsbs_set; > + const char *name; > }; > > > --- gcc/lto-streamer.h.jj 2015-02-16 22:18:33.211702447 +0100 > +++ gcc/lto-streamer.h 2015-02-16 22:19:20.846917741 +0100 > @@ -248,6 +248,7 @@ enum lto_section_type > LTO_section_ipcp_transform, > LTO_section_ipa_icf, > LTO_section_offload_table, > + LTO_section_mode_table, > LTO_N_SECTION_TYPES /* Must be last. */ > }; > > @@ -312,12 +313,15 @@ class lto_input_block > public: > /* Special constructor for the string table, it abuses this to > do random access but use the uhwi decoder. */ > - lto_input_block (const char *data_, unsigned int p_, unsigned int len_) > - : data (data_), p (p_), len (len_) {} > - lto_input_block (const char *data_, unsigned int len_) > - : data (data_), p (0), len (len_) {} > + lto_input_block (const char *data_, unsigned int p_, unsigned int len_, > + const unsigned char *mode_table_) > + : data (data_), mode_table (mode_table_), p (p_), len (len_) {} > + lto_input_block (const char *data_, unsigned int len_, > + const unsigned char *mode_table_) > + : data (data_), mode_table (mode_table_), p (0), len (len_) {} > > const char *data; > + const unsigned char *mode_table; > unsigned int p; > unsigned int len; > }; > @@ -527,6 +531,9 @@ struct GTY(()) lto_file_decl_data > > /* Map assigning declarations their resolutions. */ > hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map; > + > + /* Mode translation table. */ > + const unsigned char *mode_table; > }; > > typedef struct lto_file_decl_data *lto_file_decl_data_ptr; > @@ -775,6 +782,7 @@ extern void lto_input_variable_construct > extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, > const char *); > extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); > +extern void lto_input_mode_table (struct lto_file_decl_data *); > extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, > const char *, unsigned, > vec<ld_plugin_symbol_resolution_t> ); > @@ -807,6 +815,7 @@ void lto_output_decl_state_refs (struct > struct lto_output_stream *, > struct lto_out_decl_state *); > void lto_output_location (struct output_block *, struct bitpack_d *, location_t); > +void lto_output_init_mode_table (void); > > > /* In lto-cgraph.c */ > --- gcc/ipa-prop.c.jj 2015-02-16 22:18:33.219702315 +0100 > +++ gcc/ipa-prop.c 2015-02-16 22:19:20.848917709 +0100 > @@ -4868,7 +4868,7 @@ ipa_prop_read_section (struct lto_file_d > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, > - header->main_size); > + header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, > @@ -5089,7 +5089,7 @@ read_replacements_section (struct lto_fi > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, > - header->main_size); > + header->main_size, file_data->mode_table); > > data_in = lto_data_in_create (file_data, (const char *) data + string_offset, > header->string_size, vNULL); > --- gcc/data-streamer-in.c.jj 2015-02-16 22:18:33.224702233 +0100 > +++ gcc/data-streamer-in.c 2015-02-16 22:19:20.848917709 +0100 > @@ -70,7 +70,7 @@ string_for_index (struct data_in *data_i > } > > /* Get the string stored at location LOC in DATA_IN->STRINGS. */ > - lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len); > + lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len, NULL); > len = streamer_read_uhwi (&str_tab); > *rlen = len; > > --- gcc/tree-streamer-in.c.jj 2015-02-16 22:18:33.220702299 +0100 > +++ gcc/tree-streamer-in.c 2015-02-16 22:19:20.849917692 +0100 > @@ -224,7 +224,7 @@ static void > unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) > { > FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> (); > - fp->mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); > + fp->mode = bp_unpack_machine_mode (bp); > fp->data.low = bp_unpack_var_len_int (bp); > fp->data.high = bp_unpack_var_len_int (bp); > TREE_FIXED_CST_PTR (expr) = fp; > @@ -236,7 +236,7 @@ unpack_ts_fixed_cst_value_fields (struct > static void > unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) > { > - DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); > + DECL_MODE (expr) = bp_unpack_machine_mode (bp); > DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); > DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); > DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); > @@ -373,7 +373,7 @@ unpack_ts_type_common_value_fields (stru > { > machine_mode mode; > > - mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); > + mode = bp_unpack_machine_mode (bp); > SET_TYPE_MODE (expr, mode); > TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); > TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); > --- gcc/ipa-inline-analysis.c.jj 2015-02-16 22:18:33.223702249 +0100 > +++ gcc/ipa-inline-analysis.c 2015-02-16 22:19:20.850917676 +0100 > @@ -4190,7 +4190,8 @@ inline_read_section (struct lto_file_dec > unsigned int i, count2, j; > unsigned int f_count; > > - lto_input_block ib ((const char *) data + main_offset, header->main_size); > + lto_input_block ib ((const char *) data + main_offset, header->main_size, > + file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, > --- gcc/ipa-icf.c.jj 2015-02-16 22:18:33.222702266 +0100 > +++ gcc/ipa-icf.c 2015-02-16 22:19:20.851917659 +0100 > @@ -1500,7 +1500,7 @@ sem_item_optimizer::read_section (lto_fi > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, 0, > - header->main_size); > + header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, > --- gcc/real.c.jj 2015-02-16 22:18:33.220702299 +0100 > +++ gcc/real.c 2015-02-16 22:19:20.853917626 +0100 > @@ -3031,7 +3031,8 @@ const struct real_format ieee_single_for > true, > true, > true, > - false > + false, > + "ieee_single" > }; > > const struct real_format mips_single_format = > @@ -3052,7 +3053,8 @@ const struct real_format mips_single_for > true, > true, > false, > - true > + true, > + "mips_single" > }; > > const struct real_format motorola_single_format = > @@ -3073,7 +3075,8 @@ const struct real_format motorola_single > true, > true, > true, > - true > + true, > + "motorola_single" > }; > > /* SPU Single Precision (Extended-Range Mode) format is the same as IEEE > @@ -3105,7 +3108,8 @@ const struct real_format spu_single_form > true, > true, > false, > - false > + false, > + "spu_single" > }; > > /* IEEE double-precision format. */ > @@ -3314,7 +3318,8 @@ const struct real_format ieee_double_for > true, > true, > true, > - false > + false, > + "ieee_double" > }; > > const struct real_format mips_double_format = > @@ -3335,7 +3340,8 @@ const struct real_format mips_double_for > true, > true, > false, > - true > + true, > + "mips_double" > }; > > const struct real_format motorola_double_format = > @@ -3356,7 +3362,8 @@ const struct real_format motorola_double > true, > true, > true, > - true > + true, > + "motorola_double" > }; > > /* IEEE extended real format. This comes in three flavors: Intel's as > @@ -3700,7 +3707,8 @@ const struct real_format ieee_extended_m > true, > true, > true, > - true > + true, > + "ieee_extended_motorola" > }; > > const struct real_format ieee_extended_intel_96_format = > @@ -3721,7 +3729,8 @@ const struct real_format ieee_extended_i > true, > true, > true, > - false > + false, > + "ieee_extended_intel_96" > }; > > const struct real_format ieee_extended_intel_128_format = > @@ -3742,7 +3751,8 @@ const struct real_format ieee_extended_i > true, > true, > true, > - false > + false, > + "ieee_extended_intel_128" > }; > > /* The following caters to i386 systems that set the rounding precision > @@ -3765,7 +3775,8 @@ const struct real_format ieee_extended_i > true, > true, > true, > - false > + false, > + "ieee_extended_intel_96_round_53" > }; > > /* IBM 128-bit extended precision format: a pair of IEEE double precision > @@ -3853,7 +3864,8 @@ const struct real_format ibm_extended_fo > true, > true, > true, > - false > + false, > + "ibm_extended" > }; > > const struct real_format mips_extended_format = > @@ -3874,7 +3886,8 @@ const struct real_format mips_extended_f > true, > true, > false, > - true > + true, > + "mips_extended" > }; > > > @@ -4137,7 +4150,8 @@ const struct real_format ieee_quad_forma > true, > true, > true, > - false > + false, > + "ieee_quad" > }; > > const struct real_format mips_quad_format = > @@ -4158,7 +4172,8 @@ const struct real_format mips_quad_forma > true, > true, > false, > - true > + true, > + "mips_quad" > }; > > /* Descriptions of VAX floating point formats can be found beginning at > @@ -4458,7 +4473,8 @@ const struct real_format vax_f_format = > false, > false, > false, > - false > + false, > + "vax_f" > }; > > const struct real_format vax_d_format = > @@ -4479,7 +4495,8 @@ const struct real_format vax_d_format = > false, > false, > false, > - false > + false, > + "vax_d" > }; > > const struct real_format vax_g_format = > @@ -4500,7 +4517,8 @@ const struct real_format vax_g_format = > false, > false, > false, > - false > + false, > + "vax_g" > }; > > /* Encode real R into a single precision DFP value in BUF. */ > @@ -4576,7 +4594,8 @@ const struct real_format decimal_single_ > true, > true, > true, > - false > + false, > + "decimal_single" > }; > > /* Double precision decimal floating point (IEEE 754). */ > @@ -4598,7 +4617,8 @@ const struct real_format decimal_double_ > true, > true, > true, > - false > + false, > + "decimal_double" > }; > > /* Quad precision decimal floating point (IEEE 754). */ > @@ -4620,7 +4640,8 @@ const struct real_format decimal_quad_fo > true, > true, > true, > - false > + false, > + "decimal_quad" > }; > > /* Encode half-precision floats. This routine is used both for the IEEE > @@ -4757,7 +4778,8 @@ const struct real_format ieee_half_forma > true, > true, > true, > - false > + false, > + "ieee_half" > }; > > /* ARM's alternative half-precision format, similar to IEEE but with > @@ -4781,7 +4803,8 @@ const struct real_format arm_half_format > true, > true, > false, > - false > + false, > + "arm_half" > }; > > /* A synthetic "format" for internal arithmetic. It's the size of the > @@ -4826,7 +4849,8 @@ const struct real_format real_internal_f > false, > true, > true, > - false > + false, > + "real_internal" > }; > > /* Calculate X raised to the integer exponent N in mode MODE and store > --- gcc/tree-streamer.c.jj 2015-02-16 22:18:33.221702282 +0100 > +++ gcc/tree-streamer.c 2015-02-16 22:19:20.853917626 +0100 > @@ -53,6 +53,14 @@ along with GCC; see the file COPYING3. > #include "cgraph.h" > #include "tree-streamer.h" > > +/* Table indexed by machine_mode, used for 2 different purposes. > + During streaming out we record there non-zero value for all modes > + that were streamed out. > + During streaming in, we translate the on the disk mode using this > + table. For normal LTO it is set to identity, for ACCEL_COMPILER > + depending on the mode_table content. */ > +unsigned char streamer_mode_table[1 << 8]; > + > /* Check that all the TS_* structures handled by the streamer_write_* and > streamer_read_* routines are exactly ALL the structures defined in > treestruct.def. */ > --- gcc/lto/lto.c.jj 2015-02-16 22:18:33.221702282 +0100 > +++ gcc/lto/lto.c 2015-02-16 22:35:56.213523202 +0100 > @@ -85,6 +85,8 @@ static int lto_parallelism; > > static GTY(()) tree first_personality_decl; > > +static GTY(()) const unsigned char *lto_mode_identity_table; > + > /* Returns a hash code for P. */ > > static hashval_t > @@ -1877,7 +1879,7 @@ lto_read_decls (struct lto_file_decl_dat > uint32_t num_decl_states; > > lto_input_block ib_main ((const char *) data + main_offset, > - header->main_size); > + header->main_size, decl_data->mode_table); > > data_in = lto_data_in_create (decl_data, (const char *) data + string_offset, > header->string_size, resolutions); > @@ -2219,6 +2221,11 @@ lto_file_finalize (struct lto_file_decl_ > > file_data->renaming_hash_table = lto_create_renaming_table (); > file_data->file_name = file->filename; > +#ifdef ACCEL_COMPILER > + lto_input_mode_table (file_data); > +#else > + file_data->mode_table = lto_mode_identity_table; > +#endif > data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); > if (data == NULL) > { > @@ -3394,6 +3401,13 @@ lto_init (void) > memset (<o_stats, 0, sizeof (lto_stats)); > bitmap_obstack_initialize (NULL); > gimple_register_cfg_hooks (); > +#ifndef ACCEL_COMPILER > + unsigned char *table > + = ggc_vec_alloc<unsigned char> (MAX_MACHINE_MODE); > + for (int m = 0; m < MAX_MACHINE_MODE; m++) > + table[m] = m; > + lto_mode_identity_table = table; > +#endif > } > > > --- gcc/lto-cgraph.c.jj 2015-02-16 22:18:33.211702447 +0100 > +++ gcc/lto-cgraph.c 2015-02-16 22:19:20.855917593 +0100 > @@ -2113,7 +2113,7 @@ input_cgraph_opt_section (struct lto_fil > unsigned int count; > > lto_input_block ib_main ((const char *) data + main_offset, > - header->main_size); > + header->main_size, file_data->mode_table); > > data_in = > lto_data_in_create (file_data, (const char *) data + string_offset, > --- gcc/lto-streamer-in.c.jj 2015-02-16 22:18:33.204702562 +0100 > +++ gcc/lto-streamer-in.c 2015-02-16 22:26:53.355464202 +0100 > @@ -1116,10 +1116,12 @@ lto_read_body_or_constructor (struct lto > > /* Set up the struct function. */ > from = data_in->reader_cache->nodes.length (); > - lto_input_block ib_main (data + main_offset, header->main_size); > + lto_input_block ib_main (data + main_offset, header->main_size, > + file_data->mode_table); > if (TREE_CODE (node->decl) == FUNCTION_DECL) > { > - lto_input_block ib_cfg (data + cfg_offset, header->cfg_size); > + lto_input_block ib_cfg (data + cfg_offset, header->cfg_size, > + file_data->mode_table); > input_function (fn_decl, data_in, &ib_main, &ib_cfg); > } > else > @@ -1384,7 +1386,8 @@ lto_input_toplevel_asms (struct lto_file > > string_offset = sizeof (*header) + header->main_size; > > - lto_input_block ib (data + sizeof (*header), header->main_size); > + lto_input_block ib (data + sizeof (*header), header->main_size, > + file_data->mode_table); > > data_in = lto_data_in_create (file_data, data + string_offset, > header->string_size, vNULL); > @@ -1403,6 +1406,123 @@ lto_input_toplevel_asms (struct lto_file > } > > > +/* Input mode table. */ > + > +void > +lto_input_mode_table (struct lto_file_decl_data *file_data) > +{ > + size_t len; > + const char *data = lto_get_section_data (file_data, LTO_section_mode_table, > + NULL, &len); > + if (! data) > + { > + internal_error ("cannot read LTO mode table from %s", > + file_data->file_name); > + return; > + } > + > + unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << 8); > + file_data->mode_table = table; > + const struct lto_simple_header_with_strings *header > + = (const struct lto_simple_header_with_strings *) data; > + int string_offset; > + struct data_in *data_in; > + string_offset = sizeof (*header) + header->main_size; > + > + lto_input_block ib (data + sizeof (*header), header->main_size, NULL); > + data_in = lto_data_in_create (file_data, data + string_offset, > + header->string_size, vNULL); > + bitpack_d bp = streamer_read_bitpack (&ib); > + > + table[VOIDmode] = VOIDmode; > + table[BLKmode] = BLKmode; > + unsigned int m; > + while ((m = bp_unpack_value (&bp, 8)) != VOIDmode) > + { > + enum mode_class mclass > + = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS); > + unsigned int size = bp_unpack_value (&bp, 8); > + unsigned int prec = bp_unpack_value (&bp, 16); > + machine_mode inner = (machine_mode) table[bp_unpack_value (&bp, 8)]; > + unsigned int nunits = bp_unpack_value (&bp, 8); > + unsigned int ibit = 0, fbit = 0; > + unsigned int real_fmt_len = 0; > + const char *real_fmt_name = NULL; > + switch (mclass) > + { > + case MODE_FRACT: > + case MODE_UFRACT: > + case MODE_ACCUM: > + case MODE_UACCUM: > + ibit = bp_unpack_value (&bp, 8); > + fbit = bp_unpack_value (&bp, 8); > + break; > + case MODE_FLOAT: > + case MODE_DECIMAL_FLOAT: > + real_fmt_name = bp_unpack_indexed_string (data_in, &bp, > + &real_fmt_len); > + break; > + default: > + break; > + } > + /* First search just the GET_CLASS_NARROWEST_MODE to wider modes, > + if not found, fallback to all modes. */ > + int pass; > + for (pass = 0; pass < 2; pass++) > + for (machine_mode mr = pass ? VOIDmode > + : GET_CLASS_NARROWEST_MODE (mclass); > + pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode; > + pass ? mr = (machine_mode) (m + 1) > + : mr = GET_MODE_WIDER_MODE (mr)) > + if (GET_MODE_CLASS (mr) != mclass > + || GET_MODE_SIZE (mr) != size > + || GET_MODE_PRECISION (mr) != prec > + || GET_MODE_INNER (mr) != inner > + || GET_MODE_IBIT (mr) != ibit > + || GET_MODE_FBIT (mr) != fbit > + || GET_MODE_NUNITS (mr) != nunits) > + continue; > + else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT) > + && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0) > + continue; > + else > + { > + table[m] = mr; > + pass = 2; > + break; > + } > + unsigned int mname_len; > + const char *mname = bp_unpack_indexed_string (data_in, &bp, &mname_len); > + if (pass == 2) > + { > + switch (mclass) > + { > + case MODE_VECTOR_INT: > + case MODE_VECTOR_FLOAT: > + case MODE_VECTOR_FRACT: > + case MODE_VECTOR_UFRACT: > + case MODE_VECTOR_ACCUM: > + case MODE_VECTOR_UACCUM: > + /* For unsupported vector modes just use BLKmode, > + if the scalar mode is supported. */ > + if (inner != VOIDmode) > + { > + table[m] = BLKmode; > + break; > + } > + /* FALLTHRU */ > + default: > + error ("unsupported mode %s\n", mname); > + break; > + } > + } > + } > + lto_data_in_delete (data_in); > + > + lto_free_section_data (file_data, LTO_section_mode_table, NULL, data, len); > +} > + > + > /* Initialization for the LTO reader. */ > > void > > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: nvptx offloading patches [3/n], RFD 2015-02-17 10:00 ` Richard Biener @ 2015-02-18 10:00 ` Jakub Jelinek 2015-02-25 8:51 ` Patch ping Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-02-18 10:00 UTC (permalink / raw) To: Richard Biener Cc: Jan Hubicka, Ilya Verbin, Bernd Schmidt, Thomas Schwinge, GCC Patches On Tue, Feb 17, 2015 at 11:00:14AM +0100, Richard Biener wrote: > I'm just looking for a way to make this less of a hack (and the LTO IL > less target dependent). Not for GCC 5 for which something like your > patch is probably ok, but for the future. So, given Ilya's and Thomas' testing, is this acceptable for now, and perhaps we can try to do something better for GCC 6? Here is the patch with full ChangeLog: 2015-02-18 Jakub Jelinek <jakub@redhat.com> * passes.c (ipa_write_summaries_1): Call lto_output_init_mode_table. (ipa_write_optimization_summaries): Likewise. * tree-streamer.h: Include data-streamer.h. (streamer_mode_table): Declare extern variable. (bp_pack_machine_mode, bp_unpack_machine_mode): New inline functions. * lto-streamer-out.c (lto_output_init_mode_table, lto_write_mode_table): New functions. (produce_asm_for_decls): Call lto_write_mode_table when streaming offloading LTO. * lto-section-in.c (lto_section_name): Add "mode_table" entry. (lto_create_simple_input_block): Add mode_table argument to the lto_input_block constructors. * ipa-prop.c (ipa_prop_read_section, read_replacements_section): Likewise. * data-streamer-in.c (string_for_index): Likewise. * ipa-inline-analysis.c (inline_read_section): Likewise. * ipa-icf.c (sem_item_optimizer::read_section): Likewise. * lto-cgraph.c (input_cgraph_opt_section): Likewise. * lto-streamer-in.c (lto_read_body_or_constructor, lto_input_toplevel_asms): Likewise. (lto_input_mode_table): New function. * tree-streamer-out.c (pack_ts_fixed_cst_value_fields, pack_ts_decl_common_value_fields, pack_ts_type_common_value_fields): Use bp_pack_machine_mode. * real.h (struct real_format): Add name field. * lto-streamer.h (enum lto_section_type): Add LTO_section_mode_table. (class lto_input_block): Add mode_table member. (lto_input_block::lto_input_block): Add mode_table_ argument, initialize mode_table. (struct lto_file_decl_data): Add mode_table field. (lto_input_mode_table, lto_output_init_mode_table): New prototypes. * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields, unpack_ts_decl_common_value_fields, unpack_ts_type_common_value_fields): Call bp_unpack_machine_mode. * tree-streamer.c (streamer_mode_table): New variable. * real.c (ieee_single_format, mips_single_format, motorola_single_format, spu_single_format, ieee_double_format, mips_double_format, motorola_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format, decimal_single_format, decimal_double_format, decimal_quad_format, ieee_half_format, arm_half_format, real_internal_format): Add name field. * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. lto/ * lto.c (lto_mode_identity_table): New variable. (lto_read_decls): Add mode_table argument to the lto_input_block constructor. (lto_file_finalize): Initialize mode_table. (lto_init): Initialize lto_mode_identity_table. --- gcc/passes.c.jj 2015-02-16 22:18:33.219702315 +0100 +++ gcc/passes.c 2015-02-16 22:19:20.842917807 +0100 @@ -2460,6 +2460,7 @@ ipa_write_summaries_1 (lto_symtab_encode struct lto_out_decl_state *state = lto_new_out_decl_state (); state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); gcc_assert (!flag_wpa); @@ -2581,6 +2582,7 @@ ipa_write_optimization_summaries (lto_sy lto_symtab_encoder_iterator lsei; state->symtab_node_encoder = encoder; + lto_output_init_mode_table (); lto_push_out_decl_state (state); for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) --- gcc/tree-streamer.h.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/tree-streamer.h 2015-02-16 22:19:20.843917791 +0100 @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. #include "streamer-hooks.h" #include "lto-streamer.h" +#include "data-streamer.h" #include "hash-map.h" /* Cache of pickled nodes. Used to avoid writing the same node more @@ -91,6 +92,7 @@ void streamer_write_integer_cst (struct void streamer_write_builtin (struct output_block *, tree); /* In tree-streamer.c. */ +extern unsigned char streamer_mode_table[1 << 8]; void streamer_check_handled_ts_structures (void); bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, hashval_t, unsigned *); @@ -119,5 +121,19 @@ streamer_tree_cache_get_hash (struct str return cache->hashes[ix]; } +static inline void +bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) +{ + streamer_mode_table[mode] = 1; + bp_pack_enum (bp, machine_mode, 1 << 8, mode); +} + +static inline machine_mode +bp_unpack_machine_mode (struct bitpack_d *bp) +{ + return (machine_mode) + ((struct lto_input_block *) + bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << 8)]; +} #endif /* GCC_TREE_STREAMER_H */ --- gcc/lto-streamer-out.c.jj 2015-02-16 22:18:33.204702562 +0100 +++ gcc/lto-streamer-out.c 2015-02-16 22:20:06.659163066 +0100 @@ -2642,6 +2642,96 @@ produce_symtab (struct output_block *ob) } +/* Init the streamer_mode_table for output, where we collect info on what + machine_mode values have been streamed. */ +void +lto_output_init_mode_table (void) +{ + memset (streamer_mode_table, '\0', MAX_MACHINE_MODE); +} + + +/* Write the mode table. */ +static void +lto_write_mode_table (void) +{ + struct output_block *ob; + ob = create_output_block (LTO_section_mode_table); + bitpack_d bp = bitpack_create (ob->main_stream); + + /* Ensure that for GET_MODE_INNER (m) != VOIDmode we have + also the inner mode marked. */ + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i]) + { + machine_mode m = (machine_mode) i; + if (GET_MODE_INNER (m) != VOIDmode) + streamer_mode_table[(int) GET_MODE_INNER (m)] = 1; + } + /* First stream modes that have GET_MODE_INNER (m) == VOIDmode, + so that we can refer to them afterwards. */ + for (int pass = 0; pass < 2; pass++) + for (int i = 0; i < (int) MAX_MACHINE_MODE; i++) + if (streamer_mode_table[i] && i != (int) VOIDmode && i != (int) BLKmode) + { + machine_mode m = (machine_mode) i; + if ((GET_MODE_INNER (m) == VOIDmode) ^ (pass == 0)) + continue; + bp_pack_value (&bp, m, 8); + bp_pack_enum (&bp, mode_class, MAX_MODE_CLASS, GET_MODE_CLASS (m)); + bp_pack_value (&bp, GET_MODE_SIZE (m), 8); + bp_pack_value (&bp, GET_MODE_PRECISION (m), 16); + bp_pack_value (&bp, GET_MODE_INNER (m), 8); + bp_pack_value (&bp, GET_MODE_NUNITS (m), 8); + switch (GET_MODE_CLASS (m)) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + bp_pack_value (&bp, GET_MODE_IBIT (m), 8); + bp_pack_value (&bp, GET_MODE_FBIT (m), 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + bp_pack_string (ob, &bp, REAL_MODE_FORMAT (m)->name, true); + break; + default: + break; + } + bp_pack_string (ob, &bp, GET_MODE_NAME (m), true); + } + bp_pack_value (&bp, VOIDmode, 8); + + streamer_write_bitpack (&bp); + + char *section_name + = lto_get_section_name (LTO_section_mode_table, NULL, NULL); + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* The entire header stream is computed here. */ + struct lto_simple_header_with_strings header; + memset (&header, 0, sizeof (header)); + + /* Write the header. */ + header.major_version = LTO_major_version; + header.minor_version = LTO_minor_version; + + header.main_size = ob->main_stream->total_size; + header.string_size = ob->string_stream->total_size; + lto_write_data (&header, sizeof header); + + /* Put all of the gimple and the string table out the asm file as a + block of text. */ + lto_write_stream (ob->main_stream); + lto_write_stream (ob->string_stream); + + lto_end_section (); + destroy_output_block (ob); +} + + /* This pass is run after all of the functions are serialized and all of the IPA passes have written their serialized forms. This pass causes the vector of all of the global decls and types used from @@ -2749,4 +2839,6 @@ produce_asm_for_decls (void) lto_symtab_encoder_delete (ob->decl_state->symtab_node_encoder); lto_function_decl_states.release (); destroy_output_block (ob); + if (lto_stream_offload_p) + lto_write_mode_table (); } --- gcc/lto-section-in.c.jj 2015-02-16 22:18:33.202702595 +0100 +++ gcc/lto-section-in.c 2015-02-16 22:19:20.845917758 +0100 @@ -89,7 +89,8 @@ const char *lto_section_name[LTO_N_SECTI "inline", "ipcp_trans", "icf", - "offload_table" + "offload_table", + "mode_table" }; @@ -262,7 +263,8 @@ lto_create_simple_input_block (struct lt return NULL; *datar = data; - return new lto_input_block (data + main_offset, header->main_size); + return new lto_input_block (data + main_offset, header->main_size, + file_data->mode_table); } --- gcc/tree-streamer-out.c.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/tree-streamer-out.c 2015-02-16 22:19:20.845917758 +0100 @@ -190,7 +190,7 @@ static void pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { struct fixed_value fv = TREE_FIXED_CST (expr); - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, fv.mode); + bp_pack_machine_mode (bp, fv.mode); bp_pack_var_len_int (bp, fv.data.low); bp_pack_var_len_int (bp, fv.data.high); } @@ -201,7 +201,7 @@ pack_ts_fixed_cst_value_fields (struct b static void pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); + bp_pack_machine_mode (bp, DECL_MODE (expr)); bp_pack_value (bp, DECL_NONLOCAL (expr), 1); bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); bp_pack_value (bp, DECL_IGNORED_P (expr), 1); @@ -325,7 +325,7 @@ pack_ts_function_decl_value_fields (stru static void pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, TYPE_MODE (expr)); + bp_pack_machine_mode (bp, TYPE_MODE (expr)); bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); --- gcc/real.h.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/real.h 2015-02-16 22:19:20.846917741 +0100 @@ -155,6 +155,7 @@ struct real_format bool has_signed_zero; bool qnan_msb_set; bool canonical_nan_lsbs_set; + const char *name; }; --- gcc/lto-streamer.h.jj 2015-02-16 22:18:33.211702447 +0100 +++ gcc/lto-streamer.h 2015-02-16 22:19:20.846917741 +0100 @@ -248,6 +248,7 @@ enum lto_section_type LTO_section_ipcp_transform, LTO_section_ipa_icf, LTO_section_offload_table, + LTO_section_mode_table, LTO_N_SECTION_TYPES /* Must be last. */ }; @@ -312,12 +313,15 @@ class lto_input_block public: /* Special constructor for the string table, it abuses this to do random access but use the uhwi decoder. */ - lto_input_block (const char *data_, unsigned int p_, unsigned int len_) - : data (data_), p (p_), len (len_) {} - lto_input_block (const char *data_, unsigned int len_) - : data (data_), p (0), len (len_) {} + lto_input_block (const char *data_, unsigned int p_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (p_), len (len_) {} + lto_input_block (const char *data_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (0), len (len_) {} const char *data; + const unsigned char *mode_table; unsigned int p; unsigned int len; }; @@ -527,6 +531,9 @@ struct GTY(()) lto_file_decl_data /* Map assigning declarations their resolutions. */ hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map; + + /* Mode translation table. */ + const unsigned char *mode_table; }; typedef struct lto_file_decl_data *lto_file_decl_data_ptr; @@ -775,6 +782,7 @@ extern void lto_input_variable_construct extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, const char *); extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); +extern void lto_input_mode_table (struct lto_file_decl_data *); extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, const char *, unsigned, vec<ld_plugin_symbol_resolution_t> ); @@ -807,6 +815,7 @@ void lto_output_decl_state_refs (struct struct lto_output_stream *, struct lto_out_decl_state *); void lto_output_location (struct output_block *, struct bitpack_d *, location_t); +void lto_output_init_mode_table (void); /* In lto-cgraph.c */ --- gcc/ipa-prop.c.jj 2015-02-16 22:18:33.219702315 +0100 +++ gcc/ipa-prop.c 2015-02-16 22:19:20.848917709 +0100 @@ -4868,7 +4868,7 @@ ipa_prop_read_section (struct lto_file_d unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, @@ -5089,7 +5089,7 @@ read_replacements_section (struct lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, header->string_size, vNULL); --- gcc/data-streamer-in.c.jj 2015-02-16 22:18:33.224702233 +0100 +++ gcc/data-streamer-in.c 2015-02-16 22:19:20.848917709 +0100 @@ -70,7 +70,7 @@ string_for_index (struct data_in *data_i } /* Get the string stored at location LOC in DATA_IN->STRINGS. */ - lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len); + lto_input_block str_tab (data_in->strings, loc - 1, data_in->strings_len, NULL); len = streamer_read_uhwi (&str_tab); *rlen = len; --- gcc/tree-streamer-in.c.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/tree-streamer-in.c 2015-02-16 22:19:20.849917692 +0100 @@ -224,7 +224,7 @@ static void unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> (); - fp->mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + fp->mode = bp_unpack_machine_mode (bp); fp->data.low = bp_unpack_var_len_int (bp); fp->data.high = bp_unpack_var_len_int (bp); TREE_FIXED_CST_PTR (expr) = fp; @@ -236,7 +236,7 @@ unpack_ts_fixed_cst_value_fields (struct static void unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + DECL_MODE (expr) = bp_unpack_machine_mode (bp); DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); @@ -373,7 +373,7 @@ unpack_ts_type_common_value_fields (stru { machine_mode mode; - mode = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); + mode = bp_unpack_machine_mode (bp); SET_TYPE_MODE (expr, mode); TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); --- gcc/ipa-inline-analysis.c.jj 2015-02-16 22:18:33.223702249 +0100 +++ gcc/ipa-inline-analysis.c 2015-02-16 22:19:20.850917676 +0100 @@ -4190,7 +4190,8 @@ inline_read_section (struct lto_file_dec unsigned int i, count2, j; unsigned int f_count; - lto_input_block ib ((const char *) data + main_offset, header->main_size); + lto_input_block ib ((const char *) data + main_offset, header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/ipa-icf.c.jj 2015-02-16 22:18:33.222702266 +0100 +++ gcc/ipa-icf.c 2015-02-16 22:19:20.851917659 +0100 @@ -1500,7 +1500,7 @@ sem_item_optimizer::read_section (lto_fi unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, 0, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/tree-streamer.c.jj 2015-02-16 22:18:33.221702282 +0100 +++ gcc/tree-streamer.c 2015-02-16 22:19:20.853917626 +0100 @@ -53,6 +53,14 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "tree-streamer.h" +/* Table indexed by machine_mode, used for 2 different purposes. + During streaming out we record there non-zero value for all modes + that were streamed out. + During streaming in, we translate the on the disk mode using this + table. For normal LTO it is set to identity, for ACCEL_COMPILER + depending on the mode_table content. */ +unsigned char streamer_mode_table[1 << 8]; + /* Check that all the TS_* structures handled by the streamer_write_* and streamer_read_* routines are exactly ALL the structures defined in treestruct.def. */ --- gcc/lto-cgraph.c.jj 2015-02-16 22:18:33.211702447 +0100 +++ gcc/lto-cgraph.c 2015-02-16 22:19:20.855917593 +0100 @@ -2113,7 +2113,7 @@ input_cgraph_opt_section (struct lto_fil unsigned int count; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, file_data->mode_table); data_in = lto_data_in_create (file_data, (const char *) data + string_offset, --- gcc/lto-streamer-in.c.jj 2015-02-16 22:18:33.204702562 +0100 +++ gcc/lto-streamer-in.c 2015-02-16 22:26:53.355464202 +0100 @@ -1116,10 +1116,12 @@ lto_read_body_or_constructor (struct lto /* Set up the struct function. */ from = data_in->reader_cache->nodes.length (); - lto_input_block ib_main (data + main_offset, header->main_size); + lto_input_block ib_main (data + main_offset, header->main_size, + file_data->mode_table); if (TREE_CODE (node->decl) == FUNCTION_DECL) { - lto_input_block ib_cfg (data + cfg_offset, header->cfg_size); + lto_input_block ib_cfg (data + cfg_offset, header->cfg_size, + file_data->mode_table); input_function (fn_decl, data_in, &ib_main, &ib_cfg); } else @@ -1384,7 +1386,8 @@ lto_input_toplevel_asms (struct lto_file string_offset = sizeof (*header) + header->main_size; - lto_input_block ib (data + sizeof (*header), header->main_size); + lto_input_block ib (data + sizeof (*header), header->main_size, + file_data->mode_table); data_in = lto_data_in_create (file_data, data + string_offset, header->string_size, vNULL); @@ -1403,6 +1406,123 @@ lto_input_toplevel_asms (struct lto_file } +/* Input mode table. */ + +void +lto_input_mode_table (struct lto_file_decl_data *file_data) +{ + size_t len; + const char *data = lto_get_section_data (file_data, LTO_section_mode_table, + NULL, &len); + if (! data) + { + internal_error ("cannot read LTO mode table from %s", + file_data->file_name); + return; + } + + unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << 8); + file_data->mode_table = table; + const struct lto_simple_header_with_strings *header + = (const struct lto_simple_header_with_strings *) data; + int string_offset; + struct data_in *data_in; + string_offset = sizeof (*header) + header->main_size; + + lto_input_block ib (data + sizeof (*header), header->main_size, NULL); + data_in = lto_data_in_create (file_data, data + string_offset, + header->string_size, vNULL); + bitpack_d bp = streamer_read_bitpack (&ib); + + table[VOIDmode] = VOIDmode; + table[BLKmode] = BLKmode; + unsigned int m; + while ((m = bp_unpack_value (&bp, 8)) != VOIDmode) + { + enum mode_class mclass + = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS); + unsigned int size = bp_unpack_value (&bp, 8); + unsigned int prec = bp_unpack_value (&bp, 16); + machine_mode inner = (machine_mode) table[bp_unpack_value (&bp, 8)]; + unsigned int nunits = bp_unpack_value (&bp, 8); + unsigned int ibit = 0, fbit = 0; + unsigned int real_fmt_len = 0; + const char *real_fmt_name = NULL; + switch (mclass) + { + case MODE_FRACT: + case MODE_UFRACT: + case MODE_ACCUM: + case MODE_UACCUM: + ibit = bp_unpack_value (&bp, 8); + fbit = bp_unpack_value (&bp, 8); + break; + case MODE_FLOAT: + case MODE_DECIMAL_FLOAT: + real_fmt_name = bp_unpack_indexed_string (data_in, &bp, + &real_fmt_len); + break; + default: + break; + } + /* First search just the GET_CLASS_NARROWEST_MODE to wider modes, + if not found, fallback to all modes. */ + int pass; + for (pass = 0; pass < 2; pass++) + for (machine_mode mr = pass ? VOIDmode + : GET_CLASS_NARROWEST_MODE (mclass); + pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode; + pass ? mr = (machine_mode) (m + 1) + : mr = GET_MODE_WIDER_MODE (mr)) + if (GET_MODE_CLASS (mr) != mclass + || GET_MODE_SIZE (mr) != size + || GET_MODE_PRECISION (mr) != prec + || GET_MODE_INNER (mr) != inner + || GET_MODE_IBIT (mr) != ibit + || GET_MODE_FBIT (mr) != fbit + || GET_MODE_NUNITS (mr) != nunits) + continue; + else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT) + && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0) + continue; + else + { + table[m] = mr; + pass = 2; + break; + } + unsigned int mname_len; + const char *mname = bp_unpack_indexed_string (data_in, &bp, &mname_len); + if (pass == 2) + { + switch (mclass) + { + case MODE_VECTOR_INT: + case MODE_VECTOR_FLOAT: + case MODE_VECTOR_FRACT: + case MODE_VECTOR_UFRACT: + case MODE_VECTOR_ACCUM: + case MODE_VECTOR_UACCUM: + /* For unsupported vector modes just use BLKmode, + if the scalar mode is supported. */ + if (inner != VOIDmode) + { + table[m] = BLKmode; + break; + } + /* FALLTHRU */ + default: + error ("unsupported mode %s\n", mname); + break; + } + } + } + lto_data_in_delete (data_in); + + lto_free_section_data (file_data, LTO_section_mode_table, NULL, data, len); +} + + /* Initialization for the LTO reader. */ void --- gcc/real.c.jj 2015-02-16 22:18:33.220702299 +0100 +++ gcc/real.c 2015-02-16 22:19:20.853917626 +0100 @@ -3031,7 +3031,8 @@ const struct real_format ieee_single_for true, true, true, - false + false, + "ieee_single" }; const struct real_format mips_single_format = @@ -3052,7 +3053,8 @@ const struct real_format mips_single_for true, true, false, - true + true, + "mips_single" }; const struct real_format motorola_single_format = @@ -3073,7 +3075,8 @@ const struct real_format motorola_single true, true, true, - true + true, + "motorola_single" }; /* SPU Single Precision (Extended-Range Mode) format is the same as IEEE @@ -3105,7 +3108,8 @@ const struct real_format spu_single_form true, true, false, - false + false, + "spu_single" }; \f /* IEEE double-precision format. */ @@ -3314,7 +3318,8 @@ const struct real_format ieee_double_for true, true, true, - false + false, + "ieee_double" }; const struct real_format mips_double_format = @@ -3335,7 +3340,8 @@ const struct real_format mips_double_for true, true, false, - true + true, + "mips_double" }; const struct real_format motorola_double_format = @@ -3356,7 +3362,8 @@ const struct real_format motorola_double true, true, true, - true + true, + "motorola_double" }; \f /* IEEE extended real format. This comes in three flavors: Intel's as @@ -3700,7 +3707,8 @@ const struct real_format ieee_extended_m true, true, true, - true + true, + "ieee_extended_motorola" }; const struct real_format ieee_extended_intel_96_format = @@ -3721,7 +3729,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96" }; const struct real_format ieee_extended_intel_128_format = @@ -3742,7 +3751,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_128" }; /* The following caters to i386 systems that set the rounding precision @@ -3765,7 +3775,8 @@ const struct real_format ieee_extended_i true, true, true, - false + false, + "ieee_extended_intel_96_round_53" }; \f /* IBM 128-bit extended precision format: a pair of IEEE double precision @@ -3853,7 +3864,8 @@ const struct real_format ibm_extended_fo true, true, true, - false + false, + "ibm_extended" }; const struct real_format mips_extended_format = @@ -3874,7 +3886,8 @@ const struct real_format mips_extended_f true, true, false, - true + true, + "mips_extended" }; \f @@ -4137,7 +4150,8 @@ const struct real_format ieee_quad_forma true, true, true, - false + false, + "ieee_quad" }; const struct real_format mips_quad_format = @@ -4158,7 +4172,8 @@ const struct real_format mips_quad_forma true, true, false, - true + true, + "mips_quad" }; \f /* Descriptions of VAX floating point formats can be found beginning at @@ -4458,7 +4473,8 @@ const struct real_format vax_f_format = false, false, false, - false + false, + "vax_f" }; const struct real_format vax_d_format = @@ -4479,7 +4495,8 @@ const struct real_format vax_d_format = false, false, false, - false + false, + "vax_d" }; const struct real_format vax_g_format = @@ -4500,7 +4517,8 @@ const struct real_format vax_g_format = false, false, false, - false + false, + "vax_g" }; \f /* Encode real R into a single precision DFP value in BUF. */ @@ -4576,7 +4594,8 @@ const struct real_format decimal_single_ true, true, true, - false + false, + "decimal_single" }; /* Double precision decimal floating point (IEEE 754). */ @@ -4598,7 +4617,8 @@ const struct real_format decimal_double_ true, true, true, - false + false, + "decimal_double" }; /* Quad precision decimal floating point (IEEE 754). */ @@ -4620,7 +4640,8 @@ const struct real_format decimal_quad_fo true, true, true, - false + false, + "decimal_quad" }; \f /* Encode half-precision floats. This routine is used both for the IEEE @@ -4757,7 +4778,8 @@ const struct real_format ieee_half_forma true, true, true, - false + false, + "ieee_half" }; /* ARM's alternative half-precision format, similar to IEEE but with @@ -4781,7 +4803,8 @@ const struct real_format arm_half_format true, true, false, - false + false, + "arm_half" }; \f /* A synthetic "format" for internal arithmetic. It's the size of the @@ -4826,7 +4849,8 @@ const struct real_format real_internal_f false, true, true, - false + false, + "real_internal" }; \f /* Calculate X raised to the integer exponent N in mode MODE and store --- gcc/config/pdp11/pdp11.c.jj 2015-02-16 22:18:33.209702480 +0100 +++ gcc/config/pdp11/pdp11.c 2015-02-16 22:19:20.845917758 +0100 @@ -107,7 +107,8 @@ const struct real_format pdp11_f_format false, false, false, - false + false, + "pdp11_f" }; const struct real_format pdp11_d_format = @@ -128,7 +129,8 @@ const struct real_format pdp11_d_format false, false, false, - false + false, + "pdp11_d" }; static void --- gcc/lto/lto.c.jj 2015-02-16 22:18:33.221702282 +0100 +++ gcc/lto/lto.c 2015-02-16 22:35:56.213523202 +0100 @@ -85,6 +85,8 @@ static int lto_parallelism; static GTY(()) tree first_personality_decl; +static GTY(()) const unsigned char *lto_mode_identity_table; + /* Returns a hash code for P. */ static hashval_t @@ -1877,7 +1879,7 @@ lto_read_decls (struct lto_file_decl_dat uint32_t num_decl_states; lto_input_block ib_main ((const char *) data + main_offset, - header->main_size); + header->main_size, decl_data->mode_table); data_in = lto_data_in_create (decl_data, (const char *) data + string_offset, header->string_size, resolutions); @@ -2219,6 +2221,11 @@ lto_file_finalize (struct lto_file_decl_ file_data->renaming_hash_table = lto_create_renaming_table (); file_data->file_name = file->filename; +#ifdef ACCEL_COMPILER + lto_input_mode_table (file_data); +#else + file_data->mode_table = lto_mode_identity_table; +#endif data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); if (data == NULL) { @@ -3394,6 +3401,13 @@ lto_init (void) memset (<o_stats, 0, sizeof (lto_stats)); bitmap_obstack_initialize (NULL); gimple_register_cfg_hooks (); +#ifndef ACCEL_COMPILER + unsigned char *table + = ggc_vec_alloc<unsigned char> (MAX_MACHINE_MODE); + for (int m = 0; m < MAX_MACHINE_MODE; m++) + table[m] = m; + lto_mode_identity_table = table; +#endif } Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2015-02-18 10:00 ` Jakub Jelinek @ 2015-02-25 8:51 ` Jakub Jelinek 2015-02-25 9:30 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2015-02-25 8:51 UTC (permalink / raw) To: Richard Biener; +Cc: gcc-patches On Wed, Feb 18, 2015 at 11:00:35AM +0100, Jakub Jelinek wrote: > On Tue, Feb 17, 2015 at 11:00:14AM +0100, Richard Biener wrote: > > I'm just looking for a way to make this less of a hack (and the LTO IL > > less target dependent). Not for GCC 5 for which something like your > > patch is probably ok, but for the future. > > So, given Ilya's and Thomas' testing, is this acceptable for now, and > perhaps we can try to do something better for GCC 6? > > Here is the patch with full ChangeLog: I'd like to ping following patch: http://gcc.gnu.org/ml/gcc-patches/2015-02/msg01080.html > 2015-02-18 Jakub Jelinek <jakub@redhat.com> > > * passes.c (ipa_write_summaries_1): Call lto_output_init_mode_table. > (ipa_write_optimization_summaries): Likewise. > * tree-streamer.h: Include data-streamer.h. > (streamer_mode_table): Declare extern variable. > (bp_pack_machine_mode, bp_unpack_machine_mode): New inline functions. > * lto-streamer-out.c (lto_output_init_mode_table, > lto_write_mode_table): New functions. > (produce_asm_for_decls): Call lto_write_mode_table when streaming > offloading LTO. > * lto-section-in.c (lto_section_name): Add "mode_table" entry. > (lto_create_simple_input_block): Add mode_table argument to the > lto_input_block constructors. > * ipa-prop.c (ipa_prop_read_section, read_replacements_section): > Likewise. > * data-streamer-in.c (string_for_index): Likewise. > * ipa-inline-analysis.c (inline_read_section): Likewise. > * ipa-icf.c (sem_item_optimizer::read_section): Likewise. > * lto-cgraph.c (input_cgraph_opt_section): Likewise. > * lto-streamer-in.c (lto_read_body_or_constructor, > lto_input_toplevel_asms): Likewise. > (lto_input_mode_table): New function. > * tree-streamer-out.c (pack_ts_fixed_cst_value_fields, > pack_ts_decl_common_value_fields, pack_ts_type_common_value_fields): > Use bp_pack_machine_mode. > * real.h (struct real_format): Add name field. > * lto-streamer.h (enum lto_section_type): Add LTO_section_mode_table. > (class lto_input_block): Add mode_table member. > (lto_input_block::lto_input_block): Add mode_table_ argument, > initialize mode_table. > (struct lto_file_decl_data): Add mode_table field. > (lto_input_mode_table, lto_output_init_mode_table): New prototypes. > * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields, > unpack_ts_decl_common_value_fields, > unpack_ts_type_common_value_fields): Call bp_unpack_machine_mode. > * tree-streamer.c (streamer_mode_table): New variable. > * real.c (ieee_single_format, mips_single_format, > motorola_single_format, spu_single_format, ieee_double_format, > mips_double_format, motorola_double_format, > ieee_extended_motorola_format, ieee_extended_intel_96_format, > ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, > ibm_extended_format, mips_extended_format, ieee_quad_format, > mips_quad_format, vax_f_format, vax_d_format, vax_g_format, > decimal_single_format, decimal_double_format, decimal_quad_format, > ieee_half_format, arm_half_format, real_internal_format): Add name > field. > * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. > lto/ > * lto.c (lto_mode_identity_table): New variable. > (lto_read_decls): Add mode_table argument to the lto_input_block > constructor. > (lto_file_finalize): Initialize mode_table. > (lto_init): Initialize lto_mode_identity_table. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-02-25 8:51 ` Patch ping Jakub Jelinek @ 2015-02-25 9:30 ` Richard Biener 2015-02-25 16:51 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2015-02-25 9:30 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Wed, 25 Feb 2015, Jakub Jelinek wrote: > On Wed, Feb 18, 2015 at 11:00:35AM +0100, Jakub Jelinek wrote: > > On Tue, Feb 17, 2015 at 11:00:14AM +0100, Richard Biener wrote: > > > I'm just looking for a way to make this less of a hack (and the LTO IL > > > less target dependent). Not for GCC 5 for which something like your > > > patch is probably ok, but for the future. > > > > So, given Ilya's and Thomas' testing, is this acceptable for now, and > > perhaps we can try to do something better for GCC 6? > > > > Here is the patch with full ChangeLog: > > I'd like to ping following patch: > http://gcc.gnu.org/ml/gcc-patches/2015-02/msg01080.html Oops, totally forgot about this one. Shouldn't + default: + error ("unsupported mode %s\n", mname); be a fatal_error ()? After all if we hit this but continue we'll stream random crap. I also think we should be a bit more user-centric here and maybe report "for host / offload target combination". +static GTY(()) const unsigned char *lto_mode_identity_table; why in GC memory? Ok with changes along these lines. Thanks, Richard. > > 2015-02-18 Jakub Jelinek <jakub@redhat.com> > > > > * passes.c (ipa_write_summaries_1): Call lto_output_init_mode_table. > > (ipa_write_optimization_summaries): Likewise. > > * tree-streamer.h: Include data-streamer.h. > > (streamer_mode_table): Declare extern variable. > > (bp_pack_machine_mode, bp_unpack_machine_mode): New inline functions. > > * lto-streamer-out.c (lto_output_init_mode_table, > > lto_write_mode_table): New functions. > > (produce_asm_for_decls): Call lto_write_mode_table when streaming > > offloading LTO. > > * lto-section-in.c (lto_section_name): Add "mode_table" entry. > > (lto_create_simple_input_block): Add mode_table argument to the > > lto_input_block constructors. > > * ipa-prop.c (ipa_prop_read_section, read_replacements_section): > > Likewise. > > * data-streamer-in.c (string_for_index): Likewise. > > * ipa-inline-analysis.c (inline_read_section): Likewise. > > * ipa-icf.c (sem_item_optimizer::read_section): Likewise. > > * lto-cgraph.c (input_cgraph_opt_section): Likewise. > > * lto-streamer-in.c (lto_read_body_or_constructor, > > lto_input_toplevel_asms): Likewise. > > (lto_input_mode_table): New function. > > * tree-streamer-out.c (pack_ts_fixed_cst_value_fields, > > pack_ts_decl_common_value_fields, pack_ts_type_common_value_fields): > > Use bp_pack_machine_mode. > > * real.h (struct real_format): Add name field. > > * lto-streamer.h (enum lto_section_type): Add LTO_section_mode_table. > > (class lto_input_block): Add mode_table member. > > (lto_input_block::lto_input_block): Add mode_table_ argument, > > initialize mode_table. > > (struct lto_file_decl_data): Add mode_table field. > > (lto_input_mode_table, lto_output_init_mode_table): New prototypes. > > * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields, > > unpack_ts_decl_common_value_fields, > > unpack_ts_type_common_value_fields): Call bp_unpack_machine_mode. > > * tree-streamer.c (streamer_mode_table): New variable. > > * real.c (ieee_single_format, mips_single_format, > > motorola_single_format, spu_single_format, ieee_double_format, > > mips_double_format, motorola_double_format, > > ieee_extended_motorola_format, ieee_extended_intel_96_format, > > ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, > > ibm_extended_format, mips_extended_format, ieee_quad_format, > > mips_quad_format, vax_f_format, vax_d_format, vax_g_format, > > decimal_single_format, decimal_double_format, decimal_quad_format, > > ieee_half_format, arm_half_format, real_internal_format): Add name > > field. > > * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. > > lto/ > > * lto.c (lto_mode_identity_table): New variable. > > (lto_read_decls): Add mode_table argument to the lto_input_block > > constructor. > > (lto_file_finalize): Initialize mode_table. > > (lto_init): Initialize lto_mode_identity_table. > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-02-25 9:30 ` Richard Biener @ 2015-02-25 16:51 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2015-02-25 16:51 UTC (permalink / raw) To: Richard Biener; +Cc: gcc-patches On Wed, Feb 25, 2015 at 10:10:52AM +0100, Richard Biener wrote: > Oops, totally forgot about this one. > > Shouldn't > > + default: > + error ("unsupported mode %s\n", mname); > > be a fatal_error ()? After all if we hit this but continue we'll Ok, I'll change it. > stream random crap. I also think we should be a bit more user-centric > here and maybe report "for host / offload target combination". Eventually, sure, we should be able (based on options) either turn all the errors from the offloading compiler into warnings that just disable the offloading for some particular offloading target. > +static GTY(()) const unsigned char *lto_mode_identity_table; > > why in GC memory? The reason for that is that it is referenced from GC structure, and in the offloading path they should be GC allocated, so that they can be released when the corresponding GC structure holding pointer to that goes away. In the non-offloading LTO, all those GC structures will contain the same value, lto_mode_identity_table, but if that would be heap allocated, GC would be upset. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-07-19 10:12 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-07-19 10:12 UTC (permalink / raw) To: Jeff Law, Jason Merrill, Joseph S. Myers; +Cc: gcc-patches Hi! I'd like to ping the -fsanitize=alignment patch: http://gcc.gnu.org/ml/gcc-patches/2014-07/msg00334.html Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-04-09 13:07 Jakub Jelinek 2014-04-09 22:29 ` DJ Delorie 2014-04-10 4:24 ` Jeff Law 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-04-09 13:07 UTC (permalink / raw) To: Paolo Bonzini, DJ Delorie, Alexandre Oliva, Ralf Wildenhues, Richard Biener Cc: gcc-patches Hi! I'd like to ping: - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01370.html PR sanitizer/56781 fix --with-build-config=bootstrap-ubsan bootstrap of lto-plugin - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01433.html PR sanitizer/56781 fix --with-build-config=bootstrap-asan bootstrap of lto-plugin Thanks Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-09 13:07 Jakub Jelinek @ 2014-04-09 22:29 ` DJ Delorie 2014-04-10 5:59 ` Jakub Jelinek 2014-04-10 4:24 ` Jeff Law 1 sibling, 1 reply; 504+ messages in thread From: DJ Delorie @ 2014-04-09 22:29 UTC (permalink / raw) To: Jakub Jelinek; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01370.html > PR sanitizer/56781 > fix --with-build-config=bootstrap-ubsan bootstrap of lto-plugin I have no particular problem with this patch, although the build has gotten beyond my full understanding these days... However, does this fix a regression? If not, it should wait for stage1. > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01433.html > PR sanitizer/56781 > fix --with-build-config=bootstrap-asan bootstrap of lto-plugin Are we really going to multilib libiberty for every "useful" option we think of? For the build/host, we have a generic way of providing CFLAGS, and for the target we already have a multilib structure. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-09 22:29 ` DJ Delorie @ 2014-04-10 5:59 ` Jakub Jelinek 2014-04-10 16:01 ` DJ Delorie 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2014-04-10 5:59 UTC (permalink / raw) To: DJ Delorie; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches On Wed, Apr 09, 2014 at 06:29:48PM -0400, DJ Delorie wrote: > > > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01370.html > > PR sanitizer/56781 > > fix --with-build-config=bootstrap-ubsan bootstrap of lto-plugin > > I have no particular problem with this patch, although the build has > gotten beyond my full understanding these days... > > However, does this fix a regression? If not, it should wait for > stage1. But ubsan is a new feature in 4.9, and it is a bootstrap failure with that feature. > > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01433.html > > PR sanitizer/56781 > > fix --with-build-config=bootstrap-asan bootstrap of lto-plugin > > Are we really going to multilib libiberty for every "useful" option we > think of? For the build/host, we have a generic way of providing > CFLAGS, and for the target we already have a multilib structure. This is for the host libiberty only, and only when gcc is configured a certain way. The intent is to have libiberty that is going to be linked into all the build and host tools instrumented, so that we actually catch bugs in libiberty or bugs in host/build tools calling libiberty functions as much as possible, but for the lto-plugin, which is dlopened by the linker which we don't have a control on, we need host libiberty without the address sanitization because otherwise it would only work properly if the linker itself has been address sanitized. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-10 5:59 ` Jakub Jelinek @ 2014-04-10 16:01 ` DJ Delorie 2014-04-10 18:42 ` Tobias Burnus 2014-04-14 11:02 ` Jakub Jelinek 0 siblings, 2 replies; 504+ messages in thread From: DJ Delorie @ 2014-04-10 16:01 UTC (permalink / raw) To: Jakub Jelinek; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches > But ubsan is a new feature in 4.9, and it is a bootstrap failure > with that feature. I will leave it up to the release manager to decide if they want this non-regression patch applied before the branch, then. > This is for the host libiberty only, and only when gcc is configured > a certain way. The intent is to have libiberty that is going to be > linked into all the build and host tools instrumented, so that we > actually catch bugs in libiberty or bugs in host/build tools calling > libiberty functions as much as possible, but for the lto-plugin, > which is dlopened by the linker which we don't have a control on, we > need host libiberty without the address sanitization because > otherwise it would only work properly if the linker itself has been > address sanitized. So, if libiberty isn't built with sanitization, it would still *work* but not be instrumented? ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-10 16:01 ` DJ Delorie @ 2014-04-10 18:42 ` Tobias Burnus 2014-04-14 11:02 ` Jakub Jelinek 1 sibling, 0 replies; 504+ messages in thread From: Tobias Burnus @ 2014-04-10 18:42 UTC (permalink / raw) To: DJ Delorie, Jakub Jelinek Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches DJ Delorie wrote: >> >This is for the host libiberty only, and only when gcc is configured >> >a certain way. The intent is to have libiberty that is going to be >> >linked into all the build and host tools instrumented, so that we >> >actually catch bugs in libiberty or bugs in host/build tools calling >> >libiberty functions as much as possible, but for the lto-plugin, >> >which is dlopened by the linker which we don't have a control on, we >> >need host libiberty without the address sanitization because >> >otherwise it would only work properly if the linker itself has been >> >address sanitized. > > So, if libiberty isn't built with sanitization, it would still*work* > but not be instrumented? That's my understanding. However, currently, without the patch the sanitizer is also used with the LTO plugin, which breaks the build with --with-build-config=bootstrap-ubsan,bootstrap-asan. Always building libiberty without UBSAN/ASAN even when the bootstrap-asan/ubsan option has been used, would be an option. However, if one also sanitizes libiberty, one has the chance to find bugs also in that library. Tobias PS: I found the out-of-bounds checking of ASAN and the integer overflow checks of UBSAN very helpful for the program I use at work. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-10 16:01 ` DJ Delorie 2014-04-10 18:42 ` Tobias Burnus @ 2014-04-14 11:02 ` Jakub Jelinek 2014-04-16 18:45 ` Toon Moene 2014-04-16 19:13 ` DJ Delorie 1 sibling, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-04-14 11:02 UTC (permalink / raw) To: DJ Delorie; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches On Thu, Apr 10, 2014 at 12:01:31PM -0400, DJ Delorie wrote: > > But ubsan is a new feature in 4.9, and it is a bootstrap failure > > with that feature. > > I will leave it up to the release manager to decide if they want this > non-regression patch applied before the branch, then. > > > This is for the host libiberty only, and only when gcc is configured > > a certain way. The intent is to have libiberty that is going to be > > linked into all the build and host tools instrumented, so that we > > actually catch bugs in libiberty or bugs in host/build tools calling > > libiberty functions as much as possible, but for the lto-plugin, > > which is dlopened by the linker which we don't have a control on, we > > need host libiberty without the address sanitization because > > otherwise it would only work properly if the linker itself has been > > address sanitized. > > So, if libiberty isn't built with sanitization, it would still *work* > but not be instrumented? Certainly. If libiberty isn't built with sanitization (that is the normal case), then even nothing changes in the way it is built. The problem is only when it is built with sanitization that we actually for the lto-plugin (and whatever else is built as an dlopenable module, not an application) need a variant of the host libiberty that isn't built with sanitization (talking about asan only here, ubsan can handle this). So, now that 4.9 has branched, are both patches ok for trunk, or just the first one? The first one fixes --with-build-config=bootstrap-ubsan fully and --with-build-config=bootstrap-asan partially, the second one --with-build-config=bootstrap-asan fully. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-14 11:02 ` Jakub Jelinek @ 2014-04-16 18:45 ` Toon Moene 2014-04-16 19:13 ` DJ Delorie 1 sibling, 0 replies; 504+ messages in thread From: Toon Moene @ 2014-04-16 18:45 UTC (permalink / raw) To: Jakub Jelinek, DJ Delorie Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches On 04/14/2014 01:02 PM, Jakub Jelinek wrote: > On Thu, Apr 10, 2014 at 12:01:31PM -0400, DJ Delorie wrote: > So, now that 4.9 has branched, are both patches ok for trunk, or just the > first one? The first one fixes --with-build-config=bootstrap-ubsan > fully and --with-build-config=bootstrap-asan partially, the second one > --with-build-config=bootstrap-asan fully. Now that the 4.9 branch happened, I sincerely hope this goes in (both parts of it) - my bootstrap-asan run this morning still failed. I'm quite sure regular asan/ubsan bootstraps on various platforms (mine is only the most common x86-64 one) would be helpful to find bugs in the compilers' frontends, middle end and libraries ... Kind regards, -- Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/ Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-14 11:02 ` Jakub Jelinek 2014-04-16 18:45 ` Toon Moene @ 2014-04-16 19:13 ` DJ Delorie 2014-04-17 12:21 ` Jakub Jelinek 1 sibling, 1 reply; 504+ messages in thread From: DJ Delorie @ 2014-04-16 19:13 UTC (permalink / raw) To: Jakub Jelinek; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches I'll approve both patches, if you agree to think about a way to solve this problem without module-specific configury changes for each such command line option. I understand the usefulness of having instrumentation, but the configure hack is a hack. Note that in a combined tree this isn't a problem, because we'd just instrument the linker at the same time. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-16 19:13 ` DJ Delorie @ 2014-04-17 12:21 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-04-17 12:21 UTC (permalink / raw) To: DJ Delorie; +Cc: bonzini, aoliva, Ralf.Wildenhues, rguenther, gcc-patches On Wed, Apr 16, 2014 at 02:45:37PM -0400, DJ Delorie wrote: > I'll approve both patches, if you agree to think about a way to solve > this problem without module-specific configury changes for each such > command line option. I understand the usefulness of having > instrumentation, but the configure hack is a hack. Only the second patch I'd consider a hack, the first patch merely makes sure the POSTSTAGE1_LDFLAGS stuff actually isn't eaten by libtool. I'll think about other options for the second patch. > Note that in a combined tree this isn't a problem, because we'd just > instrument the linker at the same time. Only if you never use the plugin from the combined tree build with any other linker. Add -B ../ to some other linker and suddenly it will crash. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-09 13:07 Jakub Jelinek 2014-04-09 22:29 ` DJ Delorie @ 2014-04-10 4:24 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2014-04-10 4:24 UTC (permalink / raw) To: Jakub Jelinek, Paolo Bonzini, DJ Delorie, Alexandre Oliva, Ralf Wildenhues, Richard Biener Cc: gcc-patches On 04/09/14 07:07, Jakub Jelinek wrote: > Hi! > > I'd like to ping: > > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01370.html > PR sanitizer/56781 > fix --with-build-config=bootstrap-ubsan bootstrap of lto-plugin > > - http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01433.html > PR sanitizer/56781 > fix --with-build-config=bootstrap-asan bootstrap of lto-plugin Like DJ, I think these should wait until the next stage1. They're primarily of interest to GCC developers and they don't fix a regression AFAIK. Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-02-06 12:12 Jakub Jelinek 2015-04-17 15:46 ` Richard Earnshaw 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2014-02-06 12:12 UTC (permalink / raw) To: Richard Earnshaw, Ramana Radhakrishnan, Nick Clifton, Alexandre Oliva, Richard Henderson Cc: gcc-patches Hi! I'd like to ping a few outstanding patches: - PR59575 P1 ARM dwarf2cfi ICEs fix http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01997.html - PR59992 P1 var-tracking improvement http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01962.html - PR60030 P1 ubsan expansion fix http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00167.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-02-06 12:12 Jakub Jelinek @ 2015-04-17 15:46 ` Richard Earnshaw 2015-04-17 15:47 ` Richard Earnshaw 0 siblings, 1 reply; 504+ messages in thread From: Richard Earnshaw @ 2015-04-17 15:46 UTC (permalink / raw) To: Jakub Jelinek, Richard Earnshaw, Ramana Radhakrishnan, nickc, Alexandre Oliva, Richard Henderson Cc: gcc-patches On 06/02/14 12:12, Jakub Jelinek wrote: > Hi! > > I'd like to ping a few outstanding patches: > > - PR59575 P1 ARM dwarf2cfi ICEs fix > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01997.html > Wasn't this already approved (with comment fix)? https://gcc.gnu.org/ml/gcc-patches/2014-02/msg00392.html R. > - PR59992 P1 var-tracking improvement > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01962.html > > - PR60030 P1 ubsan expansion fix > http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00167.html > > Jakub > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2015-04-17 15:46 ` Richard Earnshaw @ 2015-04-17 15:47 ` Richard Earnshaw 0 siblings, 0 replies; 504+ messages in thread From: Richard Earnshaw @ 2015-04-17 15:47 UTC (permalink / raw) To: Jakub Jelinek, Richard Earnshaw, Ramana Radhakrishnan, nickc, Alexandre Oliva, Richard Henderson Cc: gcc-patches On 17/04/15 16:46, Richard Earnshaw wrote: > On 06/02/14 12:12, Jakub Jelinek wrote: >> Hi! >> >> I'd like to ping a few outstanding patches: >> >> - PR59575 P1 ARM dwarf2cfi ICEs fix >> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01997.html >> > > Wasn't this already approved (with comment fix)? > > https://gcc.gnu.org/ml/gcc-patches/2014-02/msg00392.html > Never mind. Old mail popped back to the top of my list due to Jeff's other response. R. > R. > >> - PR59992 P1 var-tracking improvement >> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01962.html >> >> - PR60030 P1 ubsan expansion fix >> http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00167.html >> >> Jakub >> > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-01-13 8:07 Jakub Jelinek 2014-01-13 8:15 ` Uros Bizjak ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-01-13 8:07 UTC (permalink / raw) To: Richard Biener, Kirill Yukhin, Uros Bizjak; +Cc: gcc-patches Hi! I'd like to ping 2 patches: http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html - Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than memory load after optimization (I'd like to keep the current <MODE_SIZE> patch for the reasons mentioned there, but also add this patch) http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html - PR target/59617 handle gather loads for AVX512 (at least non-masked ones, masked ones will need to wait for 5.0 and we need to find how to represent it in GIMPLE) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:07 Jakub Jelinek @ 2014-01-13 8:15 ` Uros Bizjak 2014-01-13 8:35 ` Jakub Jelinek 2014-01-13 15:15 ` Jeff Law 2014-04-16 21:35 ` Jeff Law 2 siblings, 1 reply; 504+ messages in thread From: Uros Bizjak @ 2014-01-13 8:15 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Biener, Kirill Yukhin, gcc-patches On Mon, Jan 13, 2014 at 9:07 AM, Jakub Jelinek <jakub@redhat.com> wrote: > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html > - PR target/59617 > handle gather loads for AVX512 (at least non-masked ones, masked ones > will need to wait for 5.0 and we need to find how to represent it in > GIMPLE) This one needs tree-optimization approval first. Kirill, is it possible for you to test the patch in the simulator? Do we have a testcase in gcc's testsuite that can be used to check this patch? Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:15 ` Uros Bizjak @ 2014-01-13 8:35 ` Jakub Jelinek 2014-01-13 10:23 ` Richard Biener 2014-01-13 18:26 ` Kirill Yukhin 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-01-13 8:35 UTC (permalink / raw) To: Uros Bizjak; +Cc: Richard Biener, Kirill Yukhin, gcc-patches On Mon, Jan 13, 2014 at 09:15:14AM +0100, Uros Bizjak wrote: > On Mon, Jan 13, 2014 at 9:07 AM, Jakub Jelinek <jakub@redhat.com> wrote: > > > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html > > - PR target/59617 > > handle gather loads for AVX512 (at least non-masked ones, masked ones > > will need to wait for 5.0 and we need to find how to represent it in > > GIMPLE) > > This one needs tree-optimization approval first. Sure, that is why Richard was on To line too ;) > Kirill, is it possible for you to test the patch in the simulator? Do > we have a testcase in gcc's testsuite that can be used to check this > patch? E.g. gcc.target/i386/avx2-gather* and avx512f-gather*. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:35 ` Jakub Jelinek @ 2014-01-13 10:23 ` Richard Biener 2014-01-13 18:26 ` Kirill Yukhin 1 sibling, 0 replies; 504+ messages in thread From: Richard Biener @ 2014-01-13 10:23 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Uros Bizjak, Kirill Yukhin, gcc-patches On Mon, 13 Jan 2014, Jakub Jelinek wrote: > On Mon, Jan 13, 2014 at 09:15:14AM +0100, Uros Bizjak wrote: > > On Mon, Jan 13, 2014 at 9:07 AM, Jakub Jelinek <jakub@redhat.com> wrote: > > > > > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html > > > - PR target/59617 > > > handle gather loads for AVX512 (at least non-masked ones, masked ones > > > will need to wait for 5.0 and we need to find how to represent it in > > > GIMPLE) > > > > This one needs tree-optimization approval first. > > Sure, that is why Richard was on To line too ;) The vectorizer parts are ok. Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:35 ` Jakub Jelinek 2014-01-13 10:23 ` Richard Biener @ 2014-01-13 18:26 ` Kirill Yukhin 2014-01-13 18:33 ` Uros Bizjak 2014-01-13 18:40 ` Uros Bizjak 1 sibling, 2 replies; 504+ messages in thread From: Kirill Yukhin @ 2014-01-13 18:26 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Uros Bizjak, Richard Biener, gcc-patches Hello, On 13 Jan 09:35, Jakub Jelinek wrote: > On Mon, Jan 13, 2014 at 09:15:14AM +0100, Uros Bizjak wrote: > > On Mon, Jan 13, 2014 at 9:07 AM, Jakub Jelinek <jakub@redhat.com> wrote: > > Kirill, is it possible for you to test the patch in the simulator? Do > > we have a testcase in gcc's testsuite that can be used to check this > > patch? > > E.g. gcc.target/i386/avx2-gather* and avx512f-gather*. This tests are for built-in generation. The issue is connected to auto code gen. It seems to be working, we have for hss2a.fppized.f: .L402: vmovdqu64 (%rdi,%rax), %zmm1 kmovw %k1, %k3 kmovw %k1, %k2 kmovw %k1, %k4 kmovw %k1, %k5 addl $1, %esi vpgatherdd npwrx.4971-4(,%zmm1,4), %zmm0{%k3} vpgatherdd (%r10,%zmm1,4), %zmm2{%k2} vpmulld %zmm3, %zmm0, %zmm0 vpaddd %zmm7, %zmm0, %zmm0 vmovdqu32 %zmm0, (%r11,%rax) vpgatherdd npwry.4973-4(,%zmm1,4), %zmm0{%k4} vpmulld %zmm3, %zmm0, %zmm0 vpaddd %zmm6, %zmm0, %zmm0 vmovdqu32 %zmm0, (%r9,%rax) vpgatherdd npwrz.4975-4(,%zmm1,4), %zmm0{%k5} vpmulld %zmm3, %zmm0, %zmm0 vpaddd %zmm5, %zmm0, %zmm0 vmovdqu32 %zmm0, (%r14,%rax) vpaddd %zmm2, %zmm4, %zmm0 vmovdqa64 %zmm0, (%r15,%rax) addq $64, %rax cmpl %esi, %edx ja .L402 So, I vote that patch is working. -- Thanks, K ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 18:26 ` Kirill Yukhin @ 2014-01-13 18:33 ` Uros Bizjak 2014-01-13 18:40 ` Uros Bizjak 1 sibling, 0 replies; 504+ messages in thread From: Uros Bizjak @ 2014-01-13 18:33 UTC (permalink / raw) To: Kirill Yukhin; +Cc: Jakub Jelinek, Richard Biener, gcc-patches On Mon, Jan 13, 2014 at 7:26 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote: >> On Mon, Jan 13, 2014 at 09:15:14AM +0100, Uros Bizjak wrote: >> > On Mon, Jan 13, 2014 at 9:07 AM, Jakub Jelinek <jakub@redhat.com> wrote: >> > Kirill, is it possible for you to test the patch in the simulator? Do >> > we have a testcase in gcc's testsuite that can be used to check this >> > patch? >> >> E.g. gcc.target/i386/avx2-gather* and avx512f-gather*. > This tests are for built-in generation. The issue is connected to > auto code gen. > > It seems to be working, we have for hss2a.fppized.f: > .L402: > vmovdqu64 (%rdi,%rax), %zmm1 > kmovw %k1, %k3 > kmovw %k1, %k2 > kmovw %k1, %k4 > kmovw %k1, %k5 > addl $1, %esi > vpgatherdd npwrx.4971-4(,%zmm1,4), %zmm0{%k3} > vpgatherdd (%r10,%zmm1,4), %zmm2{%k2} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm7, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r11,%rax) > vpgatherdd npwry.4973-4(,%zmm1,4), %zmm0{%k4} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm6, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r9,%rax) > vpgatherdd npwrz.4975-4(,%zmm1,4), %zmm0{%k5} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm5, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r14,%rax) > vpaddd %zmm2, %zmm4, %zmm0 > vmovdqa64 %zmm0, (%r15,%rax) > addq $64, %rax > cmpl %esi, %edx > ja .L402 > > So, I vote that patch is working. Well, OK for mainline, then. Thanks, Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 18:26 ` Kirill Yukhin 2014-01-13 18:33 ` Uros Bizjak @ 2014-01-13 18:40 ` Uros Bizjak 2014-01-13 18:59 ` Jakub Jelinek 1 sibling, 1 reply; 504+ messages in thread From: Uros Bizjak @ 2014-01-13 18:40 UTC (permalink / raw) To: Kirill Yukhin; +Cc: Jakub Jelinek, Richard Biener, gcc-patches On Mon, Jan 13, 2014 at 7:26 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote: >> > Kirill, is it possible for you to test the patch in the simulator? Do >> > we have a testcase in gcc's testsuite that can be used to check this >> > patch? >> >> E.g. gcc.target/i386/avx2-gather* and avx512f-gather*. > This tests are for built-in generation. The issue is connected to > auto code gen. > > It seems to be working, we have for hss2a.fppized.f: > .L402: > vmovdqu64 (%rdi,%rax), %zmm1 > kmovw %k1, %k3 > kmovw %k1, %k2 > kmovw %k1, %k4 > kmovw %k1, %k5 > addl $1, %esi > vpgatherdd npwrx.4971-4(,%zmm1,4), %zmm0{%k3} > vpgatherdd (%r10,%zmm1,4), %zmm2{%k2} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm7, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r11,%rax) > vpgatherdd npwry.4973-4(,%zmm1,4), %zmm0{%k4} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm6, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r9,%rax) > vpgatherdd npwrz.4975-4(,%zmm1,4), %zmm0{%k5} > vpmulld %zmm3, %zmm0, %zmm0 > vpaddd %zmm5, %zmm0, %zmm0 > vmovdqu32 %zmm0, (%r14,%rax) > vpaddd %zmm2, %zmm4, %zmm0 > vmovdqa64 %zmm0, (%r15,%rax) > addq $64, %rax > cmpl %esi, %edx > ja .L402 An unrelated observation: gcc should figure out that %k1 mask register can be used in all gather insns and avoid unnecessary copies at the beginning of the loop. Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 18:40 ` Uros Bizjak @ 2014-01-13 18:59 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-01-13 18:59 UTC (permalink / raw) To: Uros Bizjak; +Cc: Kirill Yukhin, Richard Biener, gcc-patches On Mon, Jan 13, 2014 at 07:40:16PM +0100, Uros Bizjak wrote: > An unrelated observation: gcc should figure out that %k1 mask register > can be used in all gather insns and avoid unnecessary copies at the > beginning of the loop. I thought about that too, even started modifying sse.md, but then I read the spec and the AVX512F gather insns overwrite the mask register (like it does for the vector mask register in AVX2 case). Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:07 Jakub Jelinek 2014-01-13 8:15 ` Uros Bizjak @ 2014-01-13 15:15 ` Jeff Law 2014-01-13 16:26 ` Jakub Jelinek 2014-04-16 21:35 ` Jeff Law 2 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2014-01-13 15:15 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Kirill Yukhin, Uros Bizjak; +Cc: gcc-patches On 01/13/14 01:07, Jakub Jelinek wrote: > Hi! > > I'd like to ping 2 patches: > > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html > - Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than > memory load after optimization (I'd like to keep the current <MODE_SIZE> > patch for the reasons mentioned there, but also add this patch) I'd tend to think this is 4.10/5.0 material. Unless (for example), you've got a PR where this makes a significant difference in compile time. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 15:15 ` Jeff Law @ 2014-01-13 16:26 ` Jakub Jelinek 2014-01-13 15:22 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2014-01-13 16:26 UTC (permalink / raw) To: Jeff Law; +Cc: Richard Biener, Kirill Yukhin, Uros Bizjak, gcc-patches On Mon, Jan 13, 2014 at 08:15:11AM -0700, Jeff Law wrote: > On 01/13/14 01:07, Jakub Jelinek wrote: > >I'd like to ping 2 patches: > > > >http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html > >- Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than > > memory load after optimization (I'd like to keep the current <MODE_SIZE> > > patch for the reasons mentioned there, but also add this patch) > I'd tend to think this is 4.10/5.0 material. Unless (for example), > you've got a PR where this makes a significant difference in compile > time. Ok, will defer it then. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 16:26 ` Jakub Jelinek @ 2014-01-13 15:22 ` Jeff Law 2014-04-14 10:56 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2014-01-13 15:22 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Biener, Kirill Yukhin, Uros Bizjak, gcc-patches On 01/13/14 08:20, Jakub Jelinek wrote: > On Mon, Jan 13, 2014 at 08:15:11AM -0700, Jeff Law wrote: >> On 01/13/14 01:07, Jakub Jelinek wrote: >>> I'd like to ping 2 patches: >>> >>> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html >>> - Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than >>> memory load after optimization (I'd like to keep the current <MODE_SIZE> >>> patch for the reasons mentioned there, but also add this patch) >> I'd tend to think this is 4.10/5.0 material. Unless (for example), >> you've got a PR where this makes a significant difference in compile >> time. > > Ok, will defer it then. THanks. I've put in my queued folder as well ;-) jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 15:22 ` Jeff Law @ 2014-04-14 10:56 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-04-14 10:56 UTC (permalink / raw) To: Jeff Law; +Cc: Richard Biener, Kirill Yukhin, Uros Bizjak, gcc-patches On Mon, Jan 13, 2014 at 08:22:47AM -0700, Jeff Law wrote: > On 01/13/14 08:20, Jakub Jelinek wrote: > >On Mon, Jan 13, 2014 at 08:15:11AM -0700, Jeff Law wrote: > >>On 01/13/14 01:07, Jakub Jelinek wrote: > >>>I'd like to ping 2 patches: > >>> > >>>http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html > >>>- Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than > >>> memory load after optimization (I'd like to keep the current <MODE_SIZE> > >>> patch for the reasons mentioned there, but also add this patch) > >>I'd tend to think this is 4.10/5.0 material. Unless (for example), > >>you've got a PR where this makes a significant difference in compile > >>time. > > > >Ok, will defer it then. > THanks. I've put in my queued folder as well ;-) Is this ok now for stage1? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-01-13 8:07 Jakub Jelinek 2014-01-13 8:15 ` Uros Bizjak 2014-01-13 15:15 ` Jeff Law @ 2014-04-16 21:35 ` Jeff Law 2014-04-17 21:56 ` Uros Bizjak 2 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2014-04-16 21:35 UTC (permalink / raw) To: Jakub Jelinek, Richard Biener, Kirill Yukhin, Uros Bizjak; +Cc: gcc-patches On 01/13/14 01:07, Jakub Jelinek wrote: > Hi! > > I'd like to ping 2 patches: > > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html > - Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than > memory load after optimization (I'd like to keep the current <MODE_SIZE> > patch for the reasons mentioned there, but also add this patch) This is fine. Per the follow-up discussion, I think you can mark it was resolving 36109 as well. > > http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html > - PR target/59617 > handle gather loads for AVX512 (at least non-masked ones, masked ones > will need to wait for 5.0 and we need to find how to represent it in > GIMPLE) I'll leave this to Uros :-) jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2014-04-16 21:35 ` Jeff Law @ 2014-04-17 21:56 ` Uros Bizjak 0 siblings, 0 replies; 504+ messages in thread From: Uros Bizjak @ 2014-04-17 21:56 UTC (permalink / raw) To: Jeff Law; +Cc: Jakub Jelinek, Richard Biener, Kirill Yukhin, gcc-patches On Wed, Apr 16, 2014 at 11:35 PM, Jeff Law <law@redhat.com> wrote: > >> I'd like to ping 2 patches: >> >> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00140.html >> - Ensure GET_MODE_{SIZE,INNER,NUNITS} (const) is constant rather than >> memory load after optimization (I'd like to keep the current >> <MODE_SIZE> >> patch for the reasons mentioned there, but also add this patch) > > This is fine. Per the follow-up discussion, I think you can mark it was > resolving 36109 as well. > > >> >> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00131.html >> - PR target/59617 >> handle gather loads for AVX512 (at least non-masked ones, masked ones >> will need to wait for 5.0 and we need to find how to represent it in >> GIMPLE) > > I'll leave this to Uros :-) IIRC, this patch was already committed to 4.9 some time ago. Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2014-01-06 9:52 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2014-01-06 9:52 UTC (permalink / raw) To: gcc-patches Cc: Richard Biener, Dodji Seketeli, Eric Botcazou, Steven Bosscher, Konstantin Serebryany Hi! I'd like to ping a few unreviewed patches: - use libbacktrace in libsanitizer symbolization - PR sanitizer/59136 http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00558.html - allow building libsanitizer against older kernel headers http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00963.html - use cp-demangle as libsanitizer+libbacktrace demangler http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00964.html (note, Gary has already committed his fix, so the demangler is now really malloc/calloc/realloc call free) - ifcvt/crossjumping fix - PR rtl-optimization/58668 http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01726.html (note, Eric approved earlier version of the patch but Steven wanted to use active_insn_p instead, haven't committed anything yet, waiting to see what should be committed) - improve Scimark2 SOR by 42% through small predcom change - PR tree-optimization/59643 http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01986.html - fix up PCH - PR pch/59436 http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00016.html (note, as pointed out by Mike in followup, what I'd like to commit is a version with s/(void *) // in the patch, already bootstrapped/regtested) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2013-05-17 6:49 Jakub Jelinek 2013-05-17 15:44 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2013-05-17 6:49 UTC (permalink / raw) To: Dodji Seketeli; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00282.html Reject -fsanitize=address -fsanitize=thread linking that won't ever work at runtime. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-05-17 6:49 Jakub Jelinek @ 2013-05-17 15:44 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2013-05-17 15:44 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Dodji Seketeli, gcc-patches On 05/17/2013 12:49 AM, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00282.html > Reject -fsanitize=address -fsanitize=thread linking that won't ever work at > runtime. I thought Dodji already OK's this. If there's any concern about the scope going outside Dodji's area, then I'll approve it :-) jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2013-04-26 7:40 Jakub Jelinek 2013-04-26 11:01 ` Gabriel Dos Reis 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2013-04-26 7:40 UTC (permalink / raw) To: Gabriel Dos Reis; +Cc: gcc-patches Hi! I'd like to ping 2 color diagnostics patches: - http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00787.html colorize filename using locus color even when printed without :line:column - http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00923.html make -fdiagnostics-color=auto the default if GCC_COLORS env var is in environment Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-04-26 7:40 Jakub Jelinek @ 2013-04-26 11:01 ` Gabriel Dos Reis 0 siblings, 0 replies; 504+ messages in thread From: Gabriel Dos Reis @ 2013-04-26 11:01 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Thu, Apr 25, 2013 at 5:22 PM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping 2 color diagnostics patches: > > - http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00787.html > colorize filename using locus color even when printed > without :line:column you should declare the variables locus_cs and locus_ce with initializers, instead of declaration followed by assignments. OK with those changes. > > - http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00923.html > make -fdiagnostics-color=auto the default if GCC_COLORS > env var is in environment This patch is OK. Thanks! > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2013-03-05 13:12 Jakub Jelinek 2013-03-05 13:26 ` Richard Biener ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2013-03-05 13:12 UTC (permalink / raw) To: Vladimir Makarov, Tom Tromey, Richard Biener, Jeff Law; +Cc: gcc-patches Hi! Thanks for all the recent reviews of memory leak plugging patches, there are 4 still unreviewed from last week though. - sched-deps leak fix: http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01197.html - LRA leak fix: http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01239.html - libcpp leak fix: http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01341.html - PCH leak fix + --enable-checking=valgrind changes to allow --enable-checking=yes,valgrind bootstrap to succeed: http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00044.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-03-05 13:12 Jakub Jelinek @ 2013-03-05 13:26 ` Richard Biener 2013-03-05 13:47 ` Jakub Jelinek 2013-03-05 15:44 ` Vladimir Makarov 2013-03-05 15:46 ` Vladimir Makarov 2 siblings, 1 reply; 504+ messages in thread From: Richard Biener @ 2013-03-05 13:26 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Vladimir Makarov, Tom Tromey, Jeff Law, gcc-patches On Tue, 5 Mar 2013, Jakub Jelinek wrote: > Hi! > > Thanks for all the recent reviews of memory leak plugging patches, > there are 4 still unreviewed from last week though. > > - sched-deps leak fix: > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01197.html > > - LRA leak fix: > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01239.html > > - libcpp leak fix: > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01341.html > > - PCH leak fix + --enable-checking=valgrind changes to allow > --enable-checking=yes,valgrind bootstrap to succeed: > http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00044.html That looks awkward ... isn't there a simple valgrind_disable () / valgrind_enable () way of disabling checking around this code? Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-03-05 13:26 ` Richard Biener @ 2013-03-05 13:47 ` Jakub Jelinek 2013-03-05 13:52 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2013-03-05 13:47 UTC (permalink / raw) To: Richard Biener; +Cc: Vladimir Makarov, Tom Tromey, Jeff Law, gcc-patches On Tue, Mar 05, 2013 at 02:26:03PM +0100, Richard Biener wrote: > On Tue, 5 Mar 2013, Jakub Jelinek wrote: > > Thanks for all the recent reviews of memory leak plugging patches, > > there are 4 still unreviewed from last week though. > > > > - sched-deps leak fix: > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01197.html > > > > - LRA leak fix: > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01239.html > > > > - libcpp leak fix: > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01341.html > > > > - PCH leak fix + --enable-checking=valgrind changes to allow > > --enable-checking=yes,valgrind bootstrap to succeed: > > http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00044.html > > That looks awkward ... isn't there a simple valgrind_disable () / > valgrind_enable () way of disabling checking around this code? Unfortunately not. I went through all valgrind.h and memcheck.h client calls. If at least there was a VALGRIND_GET_VBITS variants that allowed getting all vbits, (i.e. whether something is unaddressable vs. undefined vs. defined), rather than just if any of the vbits are unaddressable, give up, otherwise return undefined vs. defined bits, it would simplify the code. I hope perhaps future valgrind version could add that, so it would be just VALGRIND_GET_VBITS2, VALGRIND_MAKE_MEM_DEFINED before and VALGRIND_SET_VBITS2 at the end (restore previous state). I've at least added __builtin_expect, so the binary search code isn't in hot path. It isn't that slow, during binary search I'm always testing just a single byte, and say if we don't have any single memory allocations > 4GB, it will be at most 37 valgrind client calls per objects, usually much smaller number than that. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-03-05 13:47 ` Jakub Jelinek @ 2013-03-05 13:52 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2013-03-05 13:52 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Vladimir Makarov, Tom Tromey, Jeff Law, gcc-patches On Tue, 5 Mar 2013, Jakub Jelinek wrote: > On Tue, Mar 05, 2013 at 02:26:03PM +0100, Richard Biener wrote: > > On Tue, 5 Mar 2013, Jakub Jelinek wrote: > > > Thanks for all the recent reviews of memory leak plugging patches, > > > there are 4 still unreviewed from last week though. > > > > > > - sched-deps leak fix: > > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01197.html > > > > > > - LRA leak fix: > > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01239.html > > > > > > - libcpp leak fix: > > > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01341.html > > > > > > - PCH leak fix + --enable-checking=valgrind changes to allow > > > --enable-checking=yes,valgrind bootstrap to succeed: > > > http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00044.html > > > > That looks awkward ... isn't there a simple valgrind_disable () / > > valgrind_enable () way of disabling checking around this code? > > Unfortunately not. I went through all valgrind.h and memcheck.h > client calls. If at least there was a VALGRIND_GET_VBITS variants > that allowed getting all vbits, (i.e. whether something is unaddressable > vs. undefined vs. defined), rather than just if any of the vbits are > unaddressable, give up, otherwise return undefined vs. defined bits, > it would simplify the code. I hope perhaps future valgrind version > could add that, so it would be just VALGRIND_GET_VBITS2, > VALGRIND_MAKE_MEM_DEFINED before and VALGRIND_SET_VBITS2 at the end > (restore previous state). I've at least added __builtin_expect, > so the binary search code isn't in hot path. It isn't that slow, > during binary search I'm always testing just a single byte, and > say if we don't have any single memory allocations > 4GB, it will be > at most 37 valgrind client calls per objects, usually much smaller > number than that. Alternatively using a suppressions file during bootstrap might be possible ... maybe also useful for general valgrind debugging use? Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-03-05 13:12 Jakub Jelinek 2013-03-05 13:26 ` Richard Biener @ 2013-03-05 15:44 ` Vladimir Makarov 2013-03-05 15:46 ` Vladimir Makarov 2 siblings, 0 replies; 504+ messages in thread From: Vladimir Makarov @ 2013-03-05 15:44 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Tom Tromey, Richard Biener, Jeff Law, gcc-patches On 03/05/2013 08:12 AM, Jakub Jelinek wrote: > Hi! > > Thanks for all the recent reviews of memory leak plugging patches, > there are 4 still unreviewed from last week though. > > - sched-deps leak fix: > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01197.html > > This patch is ok. Thanks for working on this, Jakub. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-03-05 13:12 Jakub Jelinek 2013-03-05 13:26 ` Richard Biener 2013-03-05 15:44 ` Vladimir Makarov @ 2013-03-05 15:46 ` Vladimir Makarov 2 siblings, 0 replies; 504+ messages in thread From: Vladimir Makarov @ 2013-03-05 15:46 UTC (permalink / raw) To: gcc-patches On 03/05/2013 08:12 AM, Jakub Jelinek wrote: > Hi! > > Thanks for all the recent reviews of memory leak plugging patches, > there are 4 still unreviewed from last week though. > > LRA leak fix: > http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01239.html > This patch is ok too. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2013-02-07 8:24 Jakub Jelinek 2013-02-07 14:34 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2013-02-07 8:24 UTC (permalink / raw) To: Jason Merrill, Cary Coutant; +Cc: gcc-patches Hi! - http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01477.html PR56154 fix invalid .debug_loc entries if an empty range is emitted at .Ltext0 symbol Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2013-02-07 8:24 Jakub Jelinek @ 2013-02-07 14:34 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2013-02-07 14:34 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Cary Coutant, gcc-patches On 02/07/2013 01:24 AM, Jakub Jelinek wrote: > Hi! > > - http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01477.html > PR56154 > fix invalid .debug_loc entries if an empty range is emitted > at .Ltext0 symbol This is good. Please install. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2013-01-30 10:18 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2013-01-30 10:18 UTC (permalink / raw) To: Richard Henderson, Uros Bizjak, Jason Merrill, Jan Hubicka, Dodji Seketeli Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01056.html PR55742 - P1 - fix multiversioning (i386 backend) http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01105.html PR55374 - put -lasan early on the command line with -fsanitize=address Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-12-18 14:12 Jakub Jelinek 2012-12-18 21:36 ` Paul Richard Thomas 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-12-18 14:12 UTC (permalink / raw) To: Joseph S. Myers, Alexandre Oliva; +Cc: gcc-patches, fortran Hi! - PR c/39464 P2 -Wpointer-sign fix http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00523.html - PR fortran/55636 P1 Fortran ABI (mangling) fix http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00726.html - PR c++/55619 C FE changes corresponding to C++ FE changes for inline asm "m" constrained inputs http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00852.html - PR debug/54402 P1 --max-vartrack-reverse-op-size=N to speed up var-tracking http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00891.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-12-18 14:12 Jakub Jelinek @ 2012-12-18 21:36 ` Paul Richard Thomas 0 siblings, 0 replies; 504+ messages in thread From: Paul Richard Thomas @ 2012-12-18 21:36 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Joseph S. Myers, Alexandre Oliva, gcc-patches, fortran Dear Jakub, The fortran part looks fine to me. The sooner that you commit the better - I will update the unlimited polymorphic patch accordingly. Thanks Paul On 18 December 2012 15:11, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > - PR c/39464 P2 -Wpointer-sign fix > http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00523.html > > - PR fortran/55636 P1 Fortran ABI (mangling) fix > http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00726.html > > - PR c++/55619 C FE changes corresponding to C++ FE changes for inline asm "m" constrained inputs > http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00852.html > > - PR debug/54402 P1 --max-vartrack-reverse-op-size=N to speed up var-tracking > http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00891.html > > Jakub -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-11-26 12:30 Jakub Jelinek 2012-12-06 9:28 ` Richard Biener 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-11-26 12:30 UTC (permalink / raw) To: gcc-patches; +Cc: Richard Biener, Dodji Seketeli, Tom Tromey - PR55137 fold reassociation fix http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00636.html (alternatively also retry with unsigned atype if the reassociation would fail otherwise) - PR43631 fix up var-tracking notes in between bbs http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01201.html - PR55331 substitute_and_fold fix for memmove folding to nothing http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01302.html - convert asan to use builtins instead of building fndecls on the fly http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01875.html - PR55380 tiny libcpp performance fix + hack for asan/valgrind http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01973.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-26 12:30 Jakub Jelinek @ 2012-12-06 9:28 ` Richard Biener 0 siblings, 0 replies; 504+ messages in thread From: Richard Biener @ 2012-12-06 9:28 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Dodji Seketeli, Tom Tromey On Mon, 26 Nov 2012, Jakub Jelinek wrote: > - PR55137 fold reassociation fix > http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00636.html > (alternatively also retry with unsigned atype if the reassociation > would fail otherwise) Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-11-16 9:10 Jakub Jelinek 2012-11-17 19:12 ` Richard Henderson ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2012-11-16 9:10 UTC (permalink / raw) To: gcc-patches; +Cc: Richard Henderson, Jeff Law Hi! - PR54921 invalidate sp in cselib on fp setter insn http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02035.html (perhaps in light of PR54402 the single_succ (ENTRY_BLOCK_PTR) from the patch should be nuked) - PR55188 testcase fix for targets with different branch cost http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00361.html - PR55137 fold reassociation fix http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00636.html (alternatively also retry with unsigned atype if the reassociation would fail otherwise) - PR55236 range test optimization fix with -fwrapv http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00707.html (perhaps PLUS_EXPR can be handled similarly instead of bailing out) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-16 9:10 Jakub Jelinek @ 2012-11-17 19:12 ` Richard Henderson 2012-11-17 19:16 ` Richard Henderson 2012-11-17 20:04 ` Richard Henderson 2 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2012-11-17 19:12 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jeff Law On 11/16/2012 01:10 AM, Jakub Jelinek wrote: > - PR55188 testcase fix for targets with different branch cost > http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00361.html Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-16 9:10 Jakub Jelinek 2012-11-17 19:12 ` Richard Henderson @ 2012-11-17 19:16 ` Richard Henderson 2012-11-17 20:04 ` Richard Henderson 2 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2012-11-17 19:16 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jeff Law On 11/16/2012 01:10 AM, Jakub Jelinek wrote: > - PR55236 range test optimization fix with -fwrapv > http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00707.html > (perhaps PLUS_EXPR can be handled similarly instead of bailing out) > Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-16 9:10 Jakub Jelinek 2012-11-17 19:12 ` Richard Henderson 2012-11-17 19:16 ` Richard Henderson @ 2012-11-17 20:04 ` Richard Henderson 2012-11-19 7:53 ` Jakub Jelinek 2 siblings, 1 reply; 504+ messages in thread From: Richard Henderson @ 2012-11-17 20:04 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jeff Law On 11/16/2012 01:10 AM, Jakub Jelinek wrote: > Hi! > > - PR54921 invalidate sp in cselib on fp setter insn > http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02035.html > (perhaps in light of PR54402 the single_succ (ENTRY_BLOCK_PTR) > from the patch should be nuked) > + rtx expr = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX); > + if (expr) > + pat = XEXP (expr, 0); > + if (GET_CODE (pat) == SET > + && SET_DEST (pat) == hard_frame_pointer_rtx) > + cselib_invalidate_rtx (stack_pointer_rtx); > + else if (GET_CODE (pat) == PARALLEL) This is only one possible way that FP can be set. The others are with CFA_DEF_CFA or CFA_ADJUST_CFA. Given + && frame_pointer_needed + && RTX_FRAME_RELATED_P (insn) is there any reason to do more than && modified_in_p (hard_frame_pointer_rtx, insn) ? r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-17 20:04 ` Richard Henderson @ 2012-11-19 7:53 ` Jakub Jelinek 2012-11-19 16:56 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-11-19 7:53 UTC (permalink / raw) To: Richard Henderson; +Cc: gcc-patches, Jeff Law On Sat, Nov 17, 2012 at 11:10:04AM -0800, Richard Henderson wrote: > On 11/16/2012 01:10 AM, Jakub Jelinek wrote: > > Hi! > > > > - PR54921 invalidate sp in cselib on fp setter insn > > http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02035.html > > (perhaps in light of PR54402 the single_succ (ENTRY_BLOCK_PTR) > > from the patch should be nuked) > > > + rtx expr = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX); > > + if (expr) > > + pat = XEXP (expr, 0); > > + if (GET_CODE (pat) == SET > > + && SET_DEST (pat) == hard_frame_pointer_rtx) > > + cselib_invalidate_rtx (stack_pointer_rtx); > > + else if (GET_CODE (pat) == PARALLEL) > > This is only one possible way that FP can be set. > The others are with CFA_DEF_CFA or CFA_ADJUST_CFA. > > Given > > + && frame_pointer_needed > + && RTX_FRAME_RELATED_P (insn) > > is there any reason to do more than > > && modified_in_p (hard_frame_pointer_rtx, insn) > > ? I'd prefer to only invalidate the stack pointer on the first assignment to the hard pointer. If the cselib link between sp and hfp is already broken, invalidating sp will only result in worse code. Dunno if there are any targets that adjust the hard frame pointer after it has been set once or similar. Perhaps we could walk here CSELIB_VAL_PTR (hfpval)->locs here, and look if any rtls in there have find_base_term (x->loc) == find_base_term (stack_pointer_rtx), and only if yes, invalidate (and guard it by the modified_in_p test). BTW, var-tracking.c uses a similar test. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-11-19 7:53 ` Jakub Jelinek @ 2012-11-19 16:56 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2012-11-19 16:56 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jeff Law On 2012-11-18 23:53, Jakub Jelinek wrote: > I'd prefer to only invalidate the stack pointer on the first assignment > to the hard pointer. If the cselib link between sp and hfp is already > broken, invalidating sp will only result in worse code. Dunno if there > are any targets that adjust the hard frame pointer after it has been set > once or similar. I'm not aware of such a target. Though I did not audit them now. > Perhaps we could walk here CSELIB_VAL_PTR (hfpval)->locs here, and look > if any rtls in there have find_base_term (x->loc) == find_base_term > (stack_pointer_rtx), and only if yes, invalidate (and guard it by the > modified_in_p test). Sounds plausible. > BTW, var-tracking.c uses a similar test. Ouch. Where is that? r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-10-22 18:31 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2012-10-22 18:31 UTC (permalink / raw) To: Jason Merrill, Richard Henderson; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01538.html - PR54844 with lots of dups, C++ FE ICE with sizeof in template http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01700.html - PR54970 small DW_OP_GNU_implicit_pointer improvements - the dwarf2out.c and tree-sra.c bits of the patch already acked, but cfgexpand.c and var-tracking.c bits are not Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-08-27 7:44 Jakub Jelinek 2012-09-03 11:34 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-08-27 7:44 UTC (permalink / raw) To: Jason Merrill, Alexandre Oliva; +Cc: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01100.html - C++ -Wsizeof-pointer-memaccess support (C is already in) http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01376.html - valtrack ICE fix Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-08-27 7:44 Jakub Jelinek @ 2012-09-03 11:34 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2012-09-03 11:34 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Alexandre Oliva, gcc-patches On Mon, Aug 27, 2012 at 9:42 AM, Jakub Jelinek <jakub@redhat.com> wrote: > http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01100.html > - C++ -Wsizeof-pointer-memaccess support (C is already in) > > http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01376.html > - valtrack ICE fix This one is ok. Thanks, Richard. > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-06-11 11:28 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2012-06-11 11:28 UTC (permalink / raw) To: Joseph S. Myers; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00105.html - add warning for complit with incomplte type Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-03-05 11:09 Jakub Jelinek 2012-03-05 12:18 ` Richard Guenther 2012-03-05 20:08 ` Richard Henderson 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2012-03-05 11:09 UTC (permalink / raw) To: Richard Guenther, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping two patches deferred to 4.8. I've bootstrapped/regtested them on x86_64-linux and i686-linux: - PR51721 VRP register_edge_assert_for_2 improvements http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00046.html - PR51902 dwarf2out .debug_ranges ~ 22% reduction http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01171.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-03-05 11:09 Jakub Jelinek @ 2012-03-05 12:18 ` Richard Guenther 2012-03-05 20:08 ` Richard Henderson 1 sibling, 0 replies; 504+ messages in thread From: Richard Guenther @ 2012-03-05 12:18 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches On Mon, 5 Mar 2012, Jakub Jelinek wrote: > Hi! > > I'd like to ping two patches deferred to 4.8. I've bootstrapped/regtested > them on x86_64-linux and i686-linux: > > - PR51721 VRP register_edge_assert_for_2 improvements > http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00046.html Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-03-05 11:09 Jakub Jelinek 2012-03-05 12:18 ` Richard Guenther @ 2012-03-05 20:08 ` Richard Henderson 1 sibling, 0 replies; 504+ messages in thread From: Richard Henderson @ 2012-03-05 20:08 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Guenther, Jason Merrill, gcc-patches On 03/05/2012 03:08 AM, Jakub Jelinek wrote: > - PR51902 dwarf2out .debug_ranges ~ 22% reduction > http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01171.html Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-02-14 10:07 Jakub Jelinek 2012-02-17 14:56 ` Jan Hubicka 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-02-14 10:07 UTC (permalink / raw) To: Jason Merrill, Richard Guenther, Jan Hubicka; +Cc: gcc-patches Hi! I'd like to ping two patches: - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01335.html PR debug/51950 P2 -gdwarf-4 -fdebug-types-section cloning bug - http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00496.html PR middle-end/51929 P1 cgraph verification failure with same body aliases and cloning Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-02-14 10:07 Jakub Jelinek @ 2012-02-17 14:56 ` Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2012-02-17 14:56 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Richard Guenther, Jan Hubicka, gcc-patches > Hi! > > I'd like to ping two patches: > > - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01335.html > PR debug/51950 P2 > -gdwarf-4 -fdebug-types-section cloning bug > > - http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00496.html > PR middle-end/51929 P1 > cgraph verification failure with same body aliases and cloning I am convinced I approved this in the PR. The patch is OK. Thanks for looking ito it. Honza > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-02-03 10:14 Jakub Jelinek 2012-02-03 10:56 ` Paolo Carlini 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-02-03 10:14 UTC (permalink / raw) To: Jason Merrill, Eric Botcazou, Richard Guenther, Benjamin Kosnik Cc: gcc-patches Hi! I'd like to ping 3 patches: - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01335.html PR debug/51950 -gdwarf-4 -fdebug-types-section cloning bug - http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00034.html PR middle-end/52074 fix EXPAND_NORMAL expansion with -fsection-anchors - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01492.html update libstdc++ baseline_symbols.txt for several targets Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-02-03 10:14 Jakub Jelinek @ 2012-02-03 10:56 ` Paolo Carlini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Carlini @ 2012-02-03 10:56 UTC (permalink / raw) To: Jakub Jelinek Cc: Jason Merrill, Eric Botcazou, Richard Guenther, Benjamin Kosnik, gcc-patches On 02/03/2012 11:13 AM, Jakub Jelinek wrote: > - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01492.html > update libstdc++ baseline_symbols.txt for several targets This is Ok (sorry for not telling you explicitly earlier) Thanks, Paolo. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-01-24 10:29 Jakub Jelinek 2012-01-24 10:53 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-01-24 10:29 UTC (permalink / raw) To: Joseph S. Myers; +Cc: gcc-patches Hi! I'd like to ping following patch: - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00819.html P2 option handling ICE with -Wp,-pie or -Wp,-shared Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-01-24 10:29 Jakub Jelinek @ 2012-01-24 10:53 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2012-01-24 10:53 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Joseph S. Myers, gcc-patches On Tue, Jan 24, 2012 at 11:28 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping following patch: > > - http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00819.html > P2 option handling ICE with -Wp,-pie or -Wp,-shared Ok. Thanks, Richard. > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2012-01-02 10:38 Jakub Jelinek 2012-01-02 12:20 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2012-01-02 10:38 UTC (permalink / raw) To: Ian Lance Taylor, DJ Delorie, Richard Henderson, Ulrich Weigand, Bernd Schmidt Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01539.html PR driver/48306, P2 - libiberty fix for gcc driver to find paths even when $PATH contains some gcc subdirectories http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01451.html - the passes.c and reload1.c memory leak fixes (opts-common.c already fixed) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2012-01-02 10:38 Jakub Jelinek @ 2012-01-02 12:20 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2012-01-02 12:20 UTC (permalink / raw) To: Jakub Jelinek Cc: Ian Lance Taylor, DJ Delorie, Richard Henderson, Ulrich Weigand, Bernd Schmidt, gcc-patches On Mon, Jan 2, 2012 at 11:37 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01539.html > PR driver/48306, P2 > - libiberty fix for gcc driver to find paths even when > $PATH contains some gcc subdirectories > > http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01451.html > - the passes.c and reload1.c memory leak fixes (opts-common.c > already fixed) This one is ok. Thanks, Richard. > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-11-07 21:54 Jakub Jelinek 2011-11-08 13:45 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-11-07 21:54 UTC (permalink / raw) To: gcc-patches Hi! I'd like to ping the restrict_based_on_field attribute patch: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00135.html We currently don't do cast restricts and even if we do them again, as this attribute doesn't make the type __restrict it wouldn't affect those, it only affects parameters, if they are __restrict themselves what they point to, and global vars. IMHO it would be a pitty not to improve generated code for std::vector for 4.7. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-11-07 21:54 Jakub Jelinek @ 2011-11-08 13:45 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2011-11-08 13:45 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Mon, Nov 7, 2011 at 10:45 PM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I'd like to ping the restrict_based_on_field attribute patch: > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00135.html > > We currently don't do cast restricts and even if we do them again, > as this attribute doesn't make the type __restrict it wouldn't > affect those, it only affects parameters, if they are __restrict > themselves what they point to, and global vars. > > IMHO it would be a pitty not to improve generated code for std::vector > for 4.7. The patch probably needs updating for the changes I committed and it still says "The patch is still incomplete,.." It does look like this would map to the more general solution explicitely specifying a restrict tag. That way we'd avoid the funny field walkings (do you properly update the FIELD_DECL parameter of the attribute when instantiating templates?) --- libstdc++-v3/include/bits/stl_vector.h.jj 2011-08-18 08:36:12.000000000 +0200 +++ libstdc++-v3/include/bits/stl_vector.h 2011-10-03 15:45:26.000000000 +0200 @@ -77,9 +77,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER struct _Vector_impl : public _Tp_alloc_type { - pointer _M_start; - pointer _M_finish; - pointer _M_end_of_storage; + /* These pointers act like restricted pointers, except that there + are 3 pointers pointing into the same array instead of just one. + That is, if any part of the array pointed by _M_start is + modified, it can be accessed through either pointers based + on the _M_start field, or based on the _M_finish field, or + _M_end_of_storage field. */ + pointer _M_start + __attribute__((__restrict_based_on_field__ (_M_start))); + pointer _M_finish + __attribute__((__restrict_based_on_field__ (_M_start))); + pointer _M_end_of_storage + __attribute__((__restrict_based_on_field__ (_M_start))); are we sure that no shallow copies of vectors are allowed? I'm thinking of move constructors or so ... Finally just the above is not very much testing coverage. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-11-02 20:19 Jakub Jelinek 2011-11-04 10:11 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-11-02 20:19 UTC (permalink / raw) To: Richard Guenther, Ira Rosen, Richard Henderson; +Cc: gcc-patches Hi! - Gather vectorization patch + incremental patches http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02411.html http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02846.html http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02851.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-11-02 20:19 Jakub Jelinek @ 2011-11-04 10:11 ` Richard Guenther 2011-11-04 10:39 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Guenther @ 2011-11-04 10:11 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Ira Rosen, Richard Henderson, gcc-patches On Wed, 2 Nov 2011, Jakub Jelinek wrote: > Hi! > > - Gather vectorization patch + incremental patches > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02411.html I'm not sure I like using new builtins for gather representation on the tree level too much, given that we are now moving towards using tree codes for suffle. Thus, how complicated would it be to have a gather tree code and optab and to handle the mixed size index issue in the expander? I realize this would be quite some reorg to the patchset ... so, why did you choose builtins over a more generic approach? > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02846.html + if (TREE_CODE (base) == MEM_REF) { - off = TREE_OPERAND (base, 1); + if (!integer_zerop (TREE_OPERAND (base, 1))) + { + if (off == NULL_TREE) + { + double_int moff = mem_ref_offset (base); + off = double_int_to_tree (sizetype, moff); + } + else + off = size_binop (PLUS_EXPR, off, TREE_OPERAND (base, 1)); that's not safe, TREE_OPEAND (base, 1) is of pointer type, so you unconditionally need to do the conversion to sizetype of TREE_OPEAND (base, 1). The routine lacks comments - it's got quite big and fails to state any reason for its complexity. I'm also not sure why DR would include any loop invariant parts of the SCEV - doesn't it instantiate just for the loop in question? Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-11-04 10:11 ` Richard Guenther @ 2011-11-04 10:39 ` Jakub Jelinek 2011-11-04 11:44 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-11-04 10:39 UTC (permalink / raw) To: Richard Guenther; +Cc: Ira Rosen, Richard Henderson, gcc-patches On Fri, Nov 04, 2011 at 10:52:44AM +0100, Richard Guenther wrote: > > - Gather vectorization patch + incremental patches > > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02411.html > > I'm not sure I like using new builtins for gather representation > on the tree level too much, given that we are now moving > towards using tree codes for suffle. Thus, how complicated > would it be to have a gather tree code and optab and to > handle the mixed size index issue in the expander? > > I realize this would be quite some reorg to the patchset ... > so, why did you choose builtins over a more generic approach? Because while permutations etc. are common to most targets, currently gather is very specialized, specific to one target, with lots of details how it must look like (e.g. the mask stuff where we currently don't even have tree code for conditional loads or conditional stores), and additionally unlike VEC_PERM_EXPR etc. which are normal expressions this one is a reference (and conditional one too), so I'm afraid I'd need to touch huge amounts of code (most places that currently handle MEM_REF/TARGET_MEM_REF would need to handle VEC_GATHER_MEM_REF too, as it is a memory read (well, set of conditional memory reads). The i?86 backend already has (except 4) all the needed builtins anyway and handles expanding them too, the 4 ones are just to cope with the weirdo definition of some of them (half sized vectors). And when it is represented as builtin, the side-effects are handled by all optimization passes automatically, similarly how e.g. atomic builtins are right now builtins and not expressions. So I thought it is better to use builtins right now, then when we in 4.8+ hopefully do something about conditional loads/stores and their vectorization and if we introduce for that some new GIMPLE representation, this could be done on top of that. > > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02846.html > > + if (TREE_CODE (base) == MEM_REF) > { > - off = TREE_OPERAND (base, 1); > + if (!integer_zerop (TREE_OPERAND (base, 1))) > + { > + if (off == NULL_TREE) > + { > + double_int moff = mem_ref_offset (base); > + off = double_int_to_tree (sizetype, moff); > + } > + else > + off = size_binop (PLUS_EXPR, off, TREE_OPERAND (base, 1)); > > that's not safe, TREE_OPEAND (base, 1) is of pointer type, so > you unconditionally need to do the conversion to sizetype of > TREE_OPEAND (base, 1). Ok, will fix. > The routine lacks comments - it's got quite big and fails to And add the comments. > state any reason for its complexity. I'm also not sure why > DR would include any loop invariant parts of the SCEV - doesn't > it instantiate just for the loop in question? I'm not sure I understand your question. With the incremental patch I'm not using any DR info appart from DR_REF to determine what is loop invariant part of the address and what is not. The reason for that is that split_constant_offset turns the GIMPLE code into a sometimes big tree, which actually may contain a mixture of loop invariants/constants and SSA_NAMEs defined in the loop, that all with casts, multiplications/additions/subtractions. For gather I need to split it into a single loop invariant argument (which can be computed before the loop as loop invariant and thus can be arbitrary tree expression that is just gimplified there) and another SSA_NAME defined into the loop which can be vectorized which is perhaps sign-extended and multiplied by 1/2/4/8. With the approach the incremental patch does I just walk what split_constant_offset during DR walks and peel off loop invariants until I have something that should be used as the vectorized index. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-11-04 10:39 ` Jakub Jelinek @ 2011-11-04 11:44 ` Richard Guenther 2011-11-04 14:09 ` Michael Matz 0 siblings, 1 reply; 504+ messages in thread From: Richard Guenther @ 2011-11-04 11:44 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Ira Rosen, Richard Henderson, gcc-patches On Fri, 4 Nov 2011, Jakub Jelinek wrote: > On Fri, Nov 04, 2011 at 10:52:44AM +0100, Richard Guenther wrote: > > > - Gather vectorization patch + incremental patches > > > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02411.html > > > > I'm not sure I like using new builtins for gather representation > > on the tree level too much, given that we are now moving > > towards using tree codes for suffle. Thus, how complicated > > would it be to have a gather tree code and optab and to > > handle the mixed size index issue in the expander? > > > > I realize this would be quite some reorg to the patchset ... > > so, why did you choose builtins over a more generic approach? > > Because while permutations etc. are common to most targets, > currently gather is very specialized, specific to one target, > with lots of details how it must look like (e.g. the mask stuff where > we currently don't even have tree code for conditional loads or conditional > stores), and additionally unlike VEC_PERM_EXPR etc. which are normal > expressions this one is a reference (and conditional one too), so > I'm afraid I'd need to touch huge amounts of code (most places that > currently handle MEM_REF/TARGET_MEM_REF would need to handle > VEC_GATHER_MEM_REF too, as it is a memory read (well, set of conditional > memory reads). The i?86 backend already has (except 4) all the needed > builtins anyway and handles expanding them too, the 4 ones are just > to cope with the weirdo definition of some of them (half sized vectors). > And when it is represented as builtin, the side-effects are handled by > all optimization passes automatically, similarly how e.g. atomic builtins > are right now builtins and not expressions. > > So I thought it is better to use builtins right now, then when we in 4.8+ > hopefully do something about conditional loads/stores and their > vectorization and if we introduce for that some new GIMPLE representation, > this could be done on top of that. Ok. I guess it's ok to use builtins for now - I didn't think of the memory reference issue ;) > > > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02846.html > > > > + if (TREE_CODE (base) == MEM_REF) > > { > > - off = TREE_OPERAND (base, 1); > > + if (!integer_zerop (TREE_OPERAND (base, 1))) > > + { > > + if (off == NULL_TREE) > > + { > > + double_int moff = mem_ref_offset (base); > > + off = double_int_to_tree (sizetype, moff); > > + } > > + else > > + off = size_binop (PLUS_EXPR, off, TREE_OPERAND (base, 1)); > > > > that's not safe, TREE_OPEAND (base, 1) is of pointer type, so > > you unconditionally need to do the conversion to sizetype of > > TREE_OPEAND (base, 1). > > Ok, will fix. > > > The routine lacks comments - it's got quite big and fails to > > And add the comments. > > > state any reason for its complexity. I'm also not sure why > > DR would include any loop invariant parts of the SCEV - doesn't > > it instantiate just for the loop in question? > > I'm not sure I understand your question. With the incremental > patch I'm not using any DR info appart from DR_REF to determine > what is loop invariant part of the address and what is not. > The reason for that is that split_constant_offset turns the GIMPLE > code into a sometimes big tree, which actually may contain a mixture > of loop invariants/constants and SSA_NAMEs defined in the loop, > that all with casts, multiplications/additions/subtractions. > For gather I need to split it into a single loop invariant > argument (which can be computed before the loop as loop invariant > and thus can be arbitrary tree expression that is just gimplified > there) and another SSA_NAME defined into the loop which can be > vectorized which is perhaps sign-extended and multiplied by 1/2/4/8. > > With the approach the incremental patch does I just > walk what split_constant_offset during DR walks and peel off > loop invariants until I have something that should be used as the > vectorized index. It looks like split_constant_offset walks def stmts in an unbound fashion. That's surely a bad idea - SCEV should already have expanded everything non-loop-invariant, thus it should at most look through DEFs that trivially add to the constant offset, not through others. Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-11-04 11:44 ` Richard Guenther @ 2011-11-04 14:09 ` Michael Matz 0 siblings, 0 replies; 504+ messages in thread From: Michael Matz @ 2011-11-04 14:09 UTC (permalink / raw) To: Richard Guenther; +Cc: Jakub Jelinek, Ira Rosen, Richard Henderson, gcc-patches Hi, On Fri, 4 Nov 2011, Richard Guenther wrote: > > With the approach the incremental patch does I just walk what > > split_constant_offset during DR walks and peel off loop invariants > > until I have something that should be used as the vectorized index. > > It looks like split_constant_offset walks def stmts in an unbound > fashion. That's surely a bad idea - SCEV should already have expanded > everything non-loop-invariant, thus it should at most look through DEFs > that trivially add to the constant offset, not through others. split_constant_offset is also used for canonicalization, to increase chances of finding the same base in two data refs to be able to use offset based disambiguation. For that it sometimes has to look also through loop invariant parts. Ciao, Michael. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-09-26 9:30 Jakub Jelinek 2011-09-26 10:08 ` Richard Sandiford 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-09-26 9:30 UTC (permalink / raw) To: Richard Guenther, Eric Botcazou, Richard Sandiford; +Cc: gcc-patches Hi! A couple of unreviewed patches: tree-ssa-strlen optimization: [1/2] http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00890.html [2/2] http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00891.html optimize all ones vectors in simplify-rtx.c (and i386 expansion): http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01364.html fortran type_for_size langhook fixes: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01418.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-09-26 9:30 Jakub Jelinek @ 2011-09-26 10:08 ` Richard Sandiford 0 siblings, 0 replies; 504+ messages in thread From: Richard Sandiford @ 2011-09-26 10:08 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Guenther, Eric Botcazou, gcc-patches Jakub Jelinek <jakub@redhat.com> writes: > optimize all ones vectors in simplify-rtx.c (and i386 expansion): > http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01364.html I wonder whether we should have a CONSTM1_RTX(MODE). It seems inconsistent to have vector 0s and 1s, but only have integer -1s. As far as simplify-rtx.c goes, I think all_ones_cst should cover the existing CONST_INT_P case too. CONST_INTs have to be represented as sign-extended, and "trueop1" should still have mode "mode", so something's wrong if the current code matches things that aren't constm1_rtx. The simplify-rtx.c change looks good otherwise. Richard ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-09-12 15:39 Jakub Jelinek 2011-09-12 16:17 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-09-12 15:39 UTC (permalink / raw) To: gcc-patches; +Cc: Richard Henderson Hi! I'd like to ping two patches of mine: http://gcc.gnu.org/ml/gcc-patches/2011-08/msg02385.html - PR rtl-optimization/50212 fix EH ICE with -freorder-blocks-and-partition http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00386.html - PR debug/50299 addition original argument mode to CALL_INSN_FUNCTION_USAGE to fix up call site debug info Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-09-12 15:39 Jakub Jelinek @ 2011-09-12 16:17 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-09-12 16:17 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Richard Henderson On 09/12/2011 09:18 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping two patches of mine: > > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg02385.html > - PR rtl-optimization/50212 > fix EH ICE with -freorder-blocks-and-partition Seems OK. Though I did wonder why we were deleting the label and whether or not that was an indication that there was another suitable label in the insn stream that should be used instead. Assuming you verified that is not the case, then this patch is OK. > > http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00386.html > - PR debug/50299 > addition original argument mode to > CALL_INSN_FUNCTION_USAGE to fix up call site debug info OK jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-08-29 9:41 Jakub Jelinek 2011-08-29 12:00 ` Joseph S. Myers ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-08-29 9:41 UTC (permalink / raw) To: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01767.html PR middle-end/48722 Fix RTL sharing problem with CALL_INSN_FUNCTION_USAGE http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00428.html Adjust gthr-posix.h so that g++ -C -E works with STL headers Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-08-29 9:41 Jakub Jelinek @ 2011-08-29 12:00 ` Joseph S. Myers 2011-08-29 12:49 ` Bernd Schmidt 2011-08-29 21:33 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Joseph S. Myers @ 2011-08-29 12:00 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Mon, 29 Aug 2011, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00428.html > Adjust gthr-posix.h so that g++ -C -E works with STL headers OK in the absence of libgcc maintainer objections within 24 hours. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-08-29 9:41 Jakub Jelinek 2011-08-29 12:00 ` Joseph S. Myers @ 2011-08-29 12:49 ` Bernd Schmidt 2011-08-29 21:33 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Bernd Schmidt @ 2011-08-29 12:49 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On 08/29/11 11:03, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01767.html > PR middle-end/48722 > Fix RTL sharing problem with CALL_INSN_FUNCTION_USAGE Looks OK. Bernd ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-08-29 9:41 Jakub Jelinek 2011-08-29 12:00 ` Joseph S. Myers 2011-08-29 12:49 ` Bernd Schmidt @ 2011-08-29 21:33 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-08-29 21:33 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/29/11 03:03, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01767.html PR > middle-end/48722 Fix RTL sharing problem with > CALL_INSN_FUNCTION_USAGE > > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00428.html Adjust > gthr-posix.h so that g++ -C -E works with STL headers OK and OK. Thanks, Jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOW/UVAAoJEBRtltQi2kC7qA8H/16vGf20cdoMv/aHwa+tmW0S eWkn6kbYHHy1M+ai61nP8tCe5TSalI2UC0sJKiI/Y83Hs7pYqLFptTyauqzpTezQ kpxEemFQ1VBvR5gfsv+Ypkc/LvSogKt3Oodq98tt+XxciCDjqpHIOgNy1KSo8gpJ tOJfVBOF8RLnmvwLKI3X8EpDAe7T7BYJqnj+yEb0TzPHawMhA29NPNK6lkD+o8Ub EcujfaqTSTE2sOWe9OlgAQO5NbOk89c7jUKwuww0yNYg24xAnK0jXGASJ48wassN xOLtb9dIndvC1KtNtyg0ttp3UYdtnIF9PNPfjtoysUrVCumhZ7ipCfi1hS90xXA= =t/A/ -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-08-18 9:45 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-08-18 9:45 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00428.html - adjust gthr-posix.h so that g++ -C -E works with STL headers Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-06-20 9:22 Jakub Jelinek 2011-06-21 18:37 ` Richard Henderson 2011-06-25 19:39 ` Eric Botcazou 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-06-20 9:22 UTC (permalink / raw) To: Jason Merrill, Richard Henderson, Richard Guenther, Mike Stump, Rainer Orth Cc: gcc-patches [testsuite] http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01069.html PR tree-optimization/48377, PR middle-end/49191 trunk/4.6 non_strict_align testsuite support [debug] http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00649.html trunk only DW_OP_GNU_parameter_ref support [debug] http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00751.html trunk only DW_OP_GNU_convert <0> support Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-06-20 9:22 Jakub Jelinek @ 2011-06-21 18:37 ` Richard Henderson 2011-06-25 19:39 ` Eric Botcazou 1 sibling, 0 replies; 504+ messages in thread From: Richard Henderson @ 2011-06-21 18:37 UTC (permalink / raw) To: Jakub Jelinek Cc: Jason Merrill, Richard Guenther, Mike Stump, Rainer Orth, gcc-patches On 06/19/2011 11:41 PM, Jakub Jelinek wrote: > [debug] > http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00649.html > trunk only > DW_OP_GNU_parameter_ref support > > [debug] > http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00751.html > trunk only > DW_OP_GNU_convert <0> support Both ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-06-20 9:22 Jakub Jelinek 2011-06-21 18:37 ` Richard Henderson @ 2011-06-25 19:39 ` Eric Botcazou 2011-06-25 23:56 ` Mike Stump 1 sibling, 1 reply; 504+ messages in thread From: Eric Botcazou @ 2011-06-25 19:39 UTC (permalink / raw) To: gcc-patches Cc: Jakub Jelinek, Jason Merrill, Richard Henderson, Richard Guenther, Mike Stump, Rainer Orth > [testsuite] > http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01069.html > PR tree-optimization/48377, PR middle-end/49191 > trunk/4.6 > non_strict_align testsuite support Mike, Rainer, can one of you two take a look at this? -- Eric Botcazou ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-06-25 19:39 ` Eric Botcazou @ 2011-06-25 23:56 ` Mike Stump 0 siblings, 0 replies; 504+ messages in thread From: Mike Stump @ 2011-06-25 23:56 UTC (permalink / raw) To: Eric Botcazou Cc: GCC Patches, Jakub Jelinek, Jason Merrill, Richard Henderson, Richard Guenther, Rainer Orth On Jun 25, 2011, at 11:53 AM, Eric Botcazou wrote: >> [testsuite] >> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01069.html >> PR tree-optimization/48377, PR middle-end/49191 >> trunk/4.6 >> non_strict_align testsuite support > > Mike, Rainer, can one of you two take a look at this? Done, reviewed and approved in original thread. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-05-23 9:34 Jakub Jelinek 2011-05-23 10:11 ` Richard Guenther 2011-05-23 18:13 ` Jeff Law 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-05-23 9:34 UTC (permalink / raw) To: Richard Henderson, Jason Merrill, Richard Guenther; +Cc: gcc-patches Hi! - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00895.html P1 PR48973 4.6/4.7 fix for expansion of comparisons with signed 1 bit precision type - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00403.html debug info improvement for unused parameters passed in memory - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01182.html various debug info improvements (typed DWARF stack etc.) - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01246.html optimize away unneeded DW_OP_GNU_convert ops with typed DWARF stack - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01454.html PR49032 fix dbxout so that -gstabs doesn't reference optimized away static vars - http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01669.html PR48688 optimization, I know Richard asked for trying it during combine, but that attempt failed due to opposite optimization Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-05-23 9:34 Jakub Jelinek @ 2011-05-23 10:11 ` Richard Guenther 2011-05-23 18:13 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Richard Guenther @ 2011-05-23 10:11 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, Jason Merrill, gcc-patches On Mon, 23 May 2011, Jakub Jelinek wrote: > Hi! > > - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00895.html > P1 PR48973 4.6/4.7 fix for expansion of comparisons with signed > 1 bit precision type Ok. I'll leave the rest to others. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-05-23 9:34 Jakub Jelinek 2011-05-23 10:11 ` Richard Guenther @ 2011-05-23 18:13 ` Jeff Law 1 sibling, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-05-23 18:13 UTC (permalink / raw) To: Jakub Jelinek Cc: Richard Henderson, Jason Merrill, Richard Guenther, gcc-patches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/23/11 01:48, Jakub Jelinek wrote: > > - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00403.html > debug info improvement for unused parameters passed in memory OK. > > - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01454.html > PR49032 fix dbxout so that -gstabs doesn't reference optimized > away static vars OK. Jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJN2op6AAoJEBRtltQi2kC7aCAH/3KgaTS9z8SLio0jH+5wzIzt Ctjt7xsHKUMoY+fw4EZG/N9grRCYHnSSIA+aqKD4lPAj61sVM5z7LuOV7UOicwjv BEw7UCblFUh9bduttxZ0PmhHOCk5NXjYCbvVh7SUC62H//eg8KIzLnvhuPe5pg+v Z2u2huj+oN2dmpj6C9oR6XZGqxDjehU6+QMrWQcJLESq1M/eYYdzPZpiuqcHyhBr 6CYGJPJIgMyiN4VaFFsK+5t5+n2SAWESbb6VT/yCl5HsKMpTvhtPqy29LEOUZYYq l+ulwSVDD+yQCsEY3or3nm07O2uYLkr6dZyoby4AfBBeVJX0Sp7lPoXons64doo= =NTdi -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-05-12 16:12 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-05-12 16:12 UTC (permalink / raw) To: Richard Henderson, Jason Merrill; +Cc: gcc-patches Hi! - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00403.html debug info improvement for unused parameters passed in memory - http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01669.html PR48688 optimization, I know Richard asked for trying it during combine, but that attempt failed due to opposite optimization Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-04-26 12:55 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-04-26 12:55 UTC (permalink / raw) To: Richard Henderson, Jason Merrill; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01117.html - fix unwind info in presence of inline asm, 4.6/4.7 http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01264.html - typed DWARF stack Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-03-14 20:20 Jakub Jelinek 2011-03-14 20:27 ` Diego Novillo 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-03-14 20:20 UTC (permalink / raw) To: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01749.html - PR middle-end/47917, snprintf folding Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-03-14 20:20 Jakub Jelinek @ 2011-03-14 20:27 ` Diego Novillo 0 siblings, 0 replies; 504+ messages in thread From: Diego Novillo @ 2011-03-14 20:27 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Mon, Mar 14, 2011 at 16:19, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01749.html > - PR middle-end/47917, snprintf folding OK. Diego. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-02-28 10:38 Jakub Jelinek 2011-02-28 16:07 ` Jeff Law ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-02-28 10:38 UTC (permalink / raw) To: gcc-patches Hi! PR46790 P1 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01410.html (or http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01426.html ) workaround for older ld --gc-sections issues PR47893 P1 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01647.html add_frame_space vs. temp_slot tracking of stack slots PR47283 P4 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01166.html debug fix for Pmode!=ptr_mode and special address mode targets now tested on both ia64-hpux and spu-elf Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-28 10:38 Jakub Jelinek @ 2011-02-28 16:07 ` Jeff Law 2011-02-28 16:18 ` Jeff Law 2011-02-28 18:12 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-02-28 16:07 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/28/11 01:52, Jakub Jelinek wrote: > Hi! > > PR46790 P1 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01410.html > (or http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01426.html ) > workaround for older ld --gc-sections issues I prefer the first patch (test for buggy linker). OK for trunk. Thanks, Jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNa8AHAAoJEBRtltQi2kC7Z6wH/3iYC0d2whnamRRn2DUVZriA qsXxlCo2w1e/VAV3HRh48sgUz3AT5ZcCWGJZY6tRQoEWPIWOyc5g2xyGA8XSlDdP GfvV4QiUgREtw+U65Pp9NXaUFwx3Yv5Y8npAkzRU7WMncdrrjk+mz49uhyo6IbXE TlOaY+7hYvaBKsu5GOjo5peTKaNZWDuWrb180mz3oJa+/p8cFTMVaQVwZXfUzgC1 DCBO5Zrg1ppZMT6QMGvASJutKJ3QDZ5ySjf01XllpdoKIhO6FXt+uTD7i53AWAih QnnrUD9GC/AHcsmY37D02DYEkraiCd63J6LcfkucYKHhR+psjFjyVo7Oybyk0yw= =/1tY -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-28 10:38 Jakub Jelinek 2011-02-28 16:07 ` Jeff Law @ 2011-02-28 16:18 ` Jeff Law 2011-02-28 18:12 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-02-28 16:18 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/28/11 01:52, Jakub Jelinek wrote: > PR47283 P4 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01166.html > debug fix for Pmode!=ptr_mode and special address mode targets > now tested on both ia64-hpux and spu-elf OK. Jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNa8C2AAoJEBRtltQi2kC7B2MH/2APoXMp90YPb6WTXHJK2qlf v0RbAUApda/dGqKDxSG95a1frfV9adUN60J/AUjBUYaeOceWfb3cNQdSx6EzJXEl Ghz4/V+NY1jGs6w+pc32rppcR2ZLiRV/5RiG+PrHcCK1V1b+6TSRh+n9idiTWVGj UrUrNyzS4+daie89ytr5M7MGwSFEg3Ah9RgyPBYL1oXL34gpgBlRDvABFRoNRVFx B4FTD+rTBwx7zg7nLnGL+BOzr2fJ/WXXfxRXgDQKvoI5ljQVawnA33NKxXYOdKgD HPhN3ONrFV7hhhxLuIYwboLW5Mr2M6nsKFHlTEehaMecsrR0H6HO7v6+E7XMJKQ= =TVX3 -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-28 10:38 Jakub Jelinek 2011-02-28 16:07 ` Jeff Law 2011-02-28 16:18 ` Jeff Law @ 2011-02-28 18:12 ` Jeff Law 2 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2011-02-28 18:12 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/28/11 01:52, Jakub Jelinek wrote: > > PR47893 P1 http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01647.html > add_frame_space vs. temp_slot tracking of stack slots Approved. jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNa9IMAAoJEBRtltQi2kC7NEUH/ioHe9fL9h0MTcfz/yCbOYG0 91YtPFh0zXide3Rt+DBvgooNd3fk5PdXT2dhkiXpP0IktlOMJJYwXjbH2CtR/Ny0 g2Kb4eQxAHRfjoty3v3CmYIV1Z+pMihSTXc5Zp143o2ysOHHgqGoS+LwpQYPPni3 ZNtliHZwLe+3jNT//pr0sv8qbGkg6e+L69ZAncM+RYnOpHZAwiOKzfr8h3z0xgoh 9P2SGF9aXLDrEYkkvj3W3Awy3BcsHdFIoxJM2AyZ9qwvo9ygQmd9LCs6CRnVL6Md vgCp3zuFNZ2r8BenduNd4ooZk4jn2hblaQDK+cc4Sp+hoDbalqx6u2mLKrGD2go= =AOuT -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2011-02-03 11:59 Jakub Jelinek 2011-02-03 16:14 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-02-03 11:59 UTC (permalink / raw) To: Richard Henderson, Jeff Law, Richard Guenther; +Cc: gcc-patches Hi! The following patch is awaiting review for a week: - http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02059.html P1 PR31490, section flags conflict handling Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 11:59 Jakub Jelinek @ 2011-02-03 16:14 ` Richard Henderson 2011-02-03 16:20 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Henderson @ 2011-02-03 16:14 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jeff Law, Richard Guenther, gcc-patches On 02/03/2011 03:58 AM, Jakub Jelinek wrote: > Hi! > > The following patch is awaiting review for a week: > > - http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02059.html > P1 PR31490, section flags conflict handling > > Jakub I think the second patch, attempting to keep the warnings in declaration order, is better. I don't think there's so much extra work to warrant the inconsistency. One change though, > /* Private flag applied to disable section-anchors in a particular section. > This needs to be kept in sync with the flags used by varasm.c (defined in > output.h). */ > -#define SECTION_NO_ANCHOR 0x2000000 > +#define SECTION_NO_ANCHOR 0x4000000 That ought to have been defined as (SECTION_MACH_DEP << 1). That does leave the comment slightly out of date -- "other machine-dependent uses" perhaps? r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:14 ` Richard Henderson @ 2011-02-03 16:20 ` Jakub Jelinek 2011-02-03 16:25 ` IainS 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2011-02-03 16:20 UTC (permalink / raw) To: Richard Henderson; +Cc: Jeff Law, Richard Guenther, gcc-patches On Thu, Feb 03, 2011 at 08:14:23AM -0800, Richard Henderson wrote: > On 02/03/2011 03:58 AM, Jakub Jelinek wrote: > > The following patch is awaiting review for a week: > > > > - http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02059.html > > P1 PR31490, section flags conflict handling > > I think the second patch, attempting to keep the warnings in declaration order, > is better. I don't think there's so much extra work to warrant the inconsistency. Thanks. > One change though, > > > /* Private flag applied to disable section-anchors in a particular section. > > This needs to be kept in sync with the flags used by varasm.c (defined in > > output.h). */ > > -#define SECTION_NO_ANCHOR 0x2000000 > > +#define SECTION_NO_ANCHOR 0x4000000 > > That ought to have been defined as (SECTION_MACH_DEP << 1). That does leave > the comment slightly out of date -- "other machine-dependent uses" perhaps? Well, it perhaps could be just SECTION_MACH_DEP, at least I can't see any reasons why it couldn't, just the assert required that it was bigger: config/darwin.c: gcc_assert (SECTION_NO_ANCHOR > SECTION_MACH_DEP); config/alpha/alpha.c:#define SECTION_PUBLIC SECTION_MACH_DEP config/i386/winnt.c:#define SECTION_PE_SHARED SECTION_MACH_DEP config/ia64/ia64.c:#define SECTION_VMS_OVERLAY SECTION_MACH_DEP config/mep/mep.c:#define SECTION_MEP_VLIW SECTION_MACH_DEP darwin doesn't support alpha/ia64/mep (I hope) and is not winnt. I just can't test it on Darwin. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:20 ` Jakub Jelinek @ 2011-02-03 16:25 ` IainS 2011-02-03 16:27 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: IainS @ 2011-02-03 16:25 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, Jeff Law, Richard Guenther, gcc-patches On 3 Feb 2011, at 16:20, Jakub Jelinek wrote: > On Thu, Feb 03, 2011 at 08:14:23AM -0800, Richard Henderson wrote: >> On 02/03/2011 03:58 AM, Jakub Jelinek wrote: >>> The following patch is awaiting review for a week: >>> >>> - http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02059.html >>> P1 PR31490, section flags conflict handling >> >> I think the second patch, attempting to keep the warnings in >> declaration order, >> is better. I don't think there's so much extra work to warrant the >> inconsistency. > > Thanks. > >> One change though, >> >>> /* Private flag applied to disable section-anchors in a particular >>> section. >>> This needs to be kept in sync with the flags used by varasm.c >>> (defined in >>> output.h). */ >>> -#define SECTION_NO_ANCHOR 0x2000000 >>> +#define SECTION_NO_ANCHOR 0x4000000 >> >> That ought to have been defined as (SECTION_MACH_DEP << 1). That >> does leave >> the comment slightly out of date -- "other machine-dependent uses" >> perhaps? > > Well, it perhaps could be just SECTION_MACH_DEP, at least I can't > see any > reasons why it couldn't, just the assert required that it was bigger: hmm, won't that output.h to be before every instance of darwin.h? > config/darwin.c: gcc_assert (SECTION_NO_ANCHOR > SECTION_MACH_DEP); > config/alpha/alpha.c:#define SECTION_PUBLIC SECTION_MACH_DEP > config/i386/winnt.c:#define SECTION_PE_SHARED SECTION_MACH_DEP > config/ia64/ia64.c:#define SECTION_VMS_OVERLAY SECTION_MACH_DEP > config/mep/mep.c:#define SECTION_MEP_VLIW SECTION_MACH_DEP > > darwin doesn't support alpha/ia64/mep (I hope) and is not winnt. > I just can't test it on Darwin. .... I can if you like, Iain > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:25 ` IainS @ 2011-02-03 16:27 ` Richard Henderson 2011-02-03 16:38 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Richard Henderson @ 2011-02-03 16:27 UTC (permalink / raw) To: IainS; +Cc: Jakub Jelinek, Jeff Law, Richard Guenther, gcc-patches On 02/03/2011 08:24 AM, IainS wrote: >> Well, it perhaps could be just SECTION_MACH_DEP, at least I can't see any >> reasons why it couldn't, just the assert required that it was bigger: > > hmm, > won't that output.h to be before every instance of darwin.h? No, just so long as it's included before SECTION_NO_ANCHOR is used. What's in darwin.h is merely a macro definition, not a "real" use. > .... I can if you like, Please. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:27 ` Richard Henderson @ 2011-02-03 16:38 ` Jakub Jelinek 2011-02-03 16:49 ` IainS 2011-02-03 18:44 ` Mike Stump 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-02-03 16:38 UTC (permalink / raw) To: Richard Henderson; +Cc: IainS, Jeff Law, Richard Guenther, gcc-patches On Thu, Feb 03, 2011 at 08:27:03AM -0800, Richard Henderson wrote: > On 02/03/2011 08:24 AM, IainS wrote: > >> Well, it perhaps could be just SECTION_MACH_DEP, at least I can't see any > >> reasons why it couldn't, just the assert required that it was bigger: > > > > hmm, > > won't that output.h to be before every instance of darwin.h? > > No, just so long as it's included before SECTION_NO_ANCHOR is used. > What's in darwin.h is merely a macro definition, not a "real" use. Well, I see no reason why SECTION_NO_ANCHOR could not be defined in config/darwin.c instead. It is used just in config/darwin.c and config/darwin-sections.def. While the latter is included by both config/darwin.c and config/darwin.h, in darwin.h only the NAME from it matters. So something like (separate patch, if you want to test it together with the PR31490 patch just remove the config/darwin.h hunk from the PR31490 patch): 2011-02-03 Jakub Jelinek <jakub@redhat.com> * config/darwin.h (SECTION_NO_ANCHOR): Remove. * config/darwin.c (SECTION_NO_ANCHOR): Define. (darwin_init_sections): Remove assertion. --- gcc/config/darwin.c.jj 2011-01-15 11:26:39.411777352 +0100 +++ gcc/config/darwin.c 2011-02-03 17:35:15.074388782 +0100 @@ -160,6 +160,11 @@ output_objc_section_asm_op (const void * output_section_asm_op (directive); } + +/* Private flag applied to disable section-anchors in a particular section. */ +#define SECTION_NO_ANCHOR SECTION_MACH_DEP + + /* Implement TARGET_ASM_INIT_SECTIONS. */ void @@ -177,10 +182,6 @@ darwin_init_sections (void) readonly_data_section = darwin_sections[const_section]; exception_section = darwin_sections[darwin_exception_section]; eh_frame_section = darwin_sections[darwin_eh_frame_section]; - - /* Make sure that there is no conflict between the 'no anchor' section - flag declared in darwin.h and the section flags declared in output.h. */ - gcc_assert (SECTION_NO_ANCHOR > SECTION_MACH_DEP); } int --- gcc/config/darwin.h.jj 2011-01-28 20:34:16.455652744 +0100 +++ gcc/config/darwin.h 2011-02-03 17:33:25.676670013 +0100 @@ -651,11 +651,6 @@ int darwin_label_is_anonymous_local_objc /* The generic version, archs should over-ride where required. */ #define MACHOPIC_NL_SYMBOL_PTR_SECTION ".non_lazy_symbol_pointer" -/* Private flag applied to disable section-anchors in a particular section. - This needs to be kept in sync with the flags used by varasm.c (defined in - output.h). */ -#define SECTION_NO_ANCHOR 0x2000000 - /* Declare the section variables. */ #ifndef USED_FOR_TARGET enum darwin_section_enum { Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:38 ` Jakub Jelinek @ 2011-02-03 16:49 ` IainS 2011-02-03 16:54 ` Jakub Jelinek 2011-02-03 18:44 ` Mike Stump 1 sibling, 1 reply; 504+ messages in thread From: IainS @ 2011-02-03 16:49 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, Jeff Law, Richard Guenther, gcc-patches On 3 Feb 2011, at 16:38, Jakub Jelinek wrote: > On Thu, Feb 03, 2011 at 08:27:03AM -0800, Richard Henderson wrote: >> On 02/03/2011 08:24 AM, IainS wrote: >>>> Well, it perhaps could be just SECTION_MACH_DEP, at least I can't >>>> see any >>>> reasons why it couldn't, just the assert required that it was >>>> bigger: >>> >>> hmm, >>> won't that output.h to be before every instance of darwin.h? note to self: 'please engage brain before hitting send' ;) >> No, just so long as it's included before SECTION_NO_ANCHOR is used. >> What's in darwin.h is merely a macro definition, not a "real" use. > > Well, I see no reason why SECTION_NO_ANCHOR could not be defined in > config/darwin.c instead. It is used just in config/darwin.c and > config/darwin-sections.def. While the latter is included by both > config/darwin.c and config/darwin.h, in darwin.h only the NAME from it > matters. Yes, that seems better... I will test this change on its own on Darwin OK? (that is, if the whole patch needs checking then ping me - because this needs doing on PPC which takes a while)> Iain > > So something like (separate patch, if you want to test it together > with the PR31490 patch just remove the config/darwin.h hunk from the > PR31490 patch): > > 2011-02-03 Jakub Jelinek <jakub@redhat.com> > > * config/darwin.h (SECTION_NO_ANCHOR): Remove. > * config/darwin.c (SECTION_NO_ANCHOR): Define. > (darwin_init_sections): Remove assertion. > > --- gcc/config/darwin.c.jj 2011-01-15 11:26:39.411777352 +0100 > +++ gcc/config/darwin.c 2011-02-03 17:35:15.074388782 +0100 > @@ -160,6 +160,11 @@ output_objc_section_asm_op (const void * > output_section_asm_op (directive); > } > > + > +/* Private flag applied to disable section-anchors in a particular > section. */ > +#define SECTION_NO_ANCHOR SECTION_MACH_DEP > + > + > /* Implement TARGET_ASM_INIT_SECTIONS. */ > > void > @@ -177,10 +182,6 @@ darwin_init_sections (void) > readonly_data_section = darwin_sections[const_section]; > exception_section = darwin_sections[darwin_exception_section]; > eh_frame_section = darwin_sections[darwin_eh_frame_section]; > - > - /* Make sure that there is no conflict between the 'no anchor' > section > - flag declared in darwin.h and the section flags declared in > output.h. */ > - gcc_assert (SECTION_NO_ANCHOR > SECTION_MACH_DEP); > } > > int > --- gcc/config/darwin.h.jj 2011-01-28 20:34:16.455652744 +0100 > +++ gcc/config/darwin.h 2011-02-03 17:33:25.676670013 +0100 > @@ -651,11 +651,6 @@ int darwin_label_is_anonymous_local_objc > /* The generic version, archs should over-ride where required. */ > #define MACHOPIC_NL_SYMBOL_PTR_SECTION ".non_lazy_symbol_pointer" > > -/* Private flag applied to disable section-anchors in a particular > section. > - This needs to be kept in sync with the flags used by varasm.c > (defined in > - output.h). */ > -#define SECTION_NO_ANCHOR 0x2000000 > - > /* Declare the section variables. */ > #ifndef USED_FOR_TARGET > enum darwin_section_enum { > > > Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:49 ` IainS @ 2011-02-03 16:54 ` Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2011-02-03 16:54 UTC (permalink / raw) To: IainS; +Cc: Richard Henderson, Jeff Law, Richard Guenther, gcc-patches On Thu, Feb 03, 2011 at 04:49:06PM +0000, IainS wrote: > Yes, that seems better... > > I will test this change on its own on Darwin OK? Yeah, that should be sufficient. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 16:38 ` Jakub Jelinek 2011-02-03 16:49 ` IainS @ 2011-02-03 18:44 ` Mike Stump 2011-02-03 19:04 ` IainS 1 sibling, 1 reply; 504+ messages in thread From: Mike Stump @ 2011-02-03 18:44 UTC (permalink / raw) To: Jakub Jelinek Cc: Richard Henderson, IainS, Jeff Law, Richard Guenther, gcc-patches On Feb 3, 2011, at 8:38 AM, Jakub Jelinek wrote: > 2011-02-03 Jakub Jelinek <jakub@redhat.com> > > * config/darwin.h (SECTION_NO_ANCHOR): Remove. > * config/darwin.c (SECTION_NO_ANCHOR): Define. > (darwin_init_sections): Remove assertion. Ok. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2011-02-03 18:44 ` Mike Stump @ 2011-02-03 19:04 ` IainS 0 siblings, 0 replies; 504+ messages in thread From: IainS @ 2011-02-03 19:04 UTC (permalink / raw) To: Mike Stump Cc: Jakub Jelinek, Richard Henderson, Jeff Law, Richard Guenther, gcc-patches On 3 Feb 2011, at 18:43, Mike Stump wrote: > On Feb 3, 2011, at 8:38 AM, Jakub Jelinek wrote: >> 2011-02-03 Jakub Jelinek <jakub@redhat.com> >> >> * config/darwin.h (SECTION_NO_ANCHOR): Remove. >> * config/darwin.c (SECTION_NO_ANCHOR): Define. >> (darwin_init_sections): Remove assertion. > > Ok. I guess, given that it was my code, I could have said that the change looked correct by inspection ... ... but, FWIW, a stage1 compiler passed make check-gcc-c RUNTESTFLAGS="--target_board=unix\{-fsection-anchors, \}\{-m32,-m64\} compat.exp=* struct-layout-1.exp=* vect.exp=*" on powerpc-darwin9. Iain ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-11-05 20:04 Jakub Jelinek 2010-11-09 15:48 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-11-05 20:04 UTC (permalink / raw) To: gcc-patches Hi! Patches awaiting review for more than ~ a week: http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02318.html - Fix dead_debug_* ICE (PR debug/46171, P1) http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01243.html - Fix up guality/sra-1.c testcase (PR middle-end/45663, P3) http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01524.html - DW_OP_GNU_entry_value + DW_TAG_GNU_call_site support http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02633.html - Improve debug info for params only referenced in DEBUG stmts at expand time (PR debug/45882) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-11-05 20:04 Jakub Jelinek @ 2010-11-09 15:48 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2010-11-09 15:48 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On 11/05/10 14:02, Jakub Jelinek wrote: > Hi! > > Patches awaiting review for more than ~ a week: > > http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02318.html > - Fix dead_debug_* ICE (PR debug/46171, P1) OK. > http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01243.html > - Fix up guality/sra-1.c testcase (PR middle-end/45663, P3) OK. > http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01524.html > - DW_OP_GNU_entry_value + DW_TAG_GNU_call_site support > > http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02633.html > - Improve debug info for params only referenced in DEBUG > stmts at expand time (PR debug/45882) I'm leaving these two for someone who understands this stuff better. If nobody responds in a week or so, let me know and I'll take a closer look at them. Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-09-08 18:13 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2010-09-08 18:13 UTC (permalink / raw) To: Jason Merrill, Richard Henderson; +Cc: gcc-patches, Roland McGrath Hi! - http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00874.html DW_OP_GNU_implicit_pointer support - http://gcc.gnu.org/ml/gcc-patches/2010-08/msg01475.html DW_OP_GNU_entry_value/DW_TAG_GNU_call_site support Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-07-20 16:59 Jakub Jelinek 2010-07-27 17:39 ` Jeff Law 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-07-20 16:59 UTC (permalink / raw) To: gcc-patches Hi! - Fix DECL_ALIGN during expand PR target/44542 http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01803.html - Fix up asm-es-2.c testcase, update ppc/ia64 md.texi section on inline-asm side-effects testsuite/44701 http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01051.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-07-20 16:59 Jakub Jelinek @ 2010-07-27 17:39 ` Jeff Law 0 siblings, 0 replies; 504+ messages in thread From: Jeff Law @ 2010-07-27 17:39 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On 07/20/10 11:01, Jakub Jelinek wrote: > Hi! > > - Fix DECL_ALIGN during expand > PR target/44542 > http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01803.html OK. > - Fix up asm-es-2.c testcase, update ppc/ia64 md.texi section > on inline-asm side-effects > testsuite/44701 > http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01051.html OK, after removing the extraneous "Note that on PowerPC targets," as suggested by Andreas. jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-06-21 10:12 Jakub Jelinek 2010-06-21 11:19 ` Paolo Bonzini 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-06-21 10:12 UTC (permalink / raw) To: Alexandre Oliva, Paolo Bonzini, DJ Delorie, Joseph S. Myers Cc: gcc-patches, Jan Kratochvil Hi! I'd like to ping Jan Kratochvil's patch to fix up dates in generated man pages: http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01112.html Ok for trunk? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-06-21 10:12 Jakub Jelinek @ 2010-06-21 11:19 ` Paolo Bonzini 2010-06-21 12:08 ` Jan Kratochvil 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2010-06-21 11:19 UTC (permalink / raw) To: Jakub Jelinek Cc: Alexandre Oliva, DJ Delorie, Joseph S. Myers, gcc-patches, Jan Kratochvil On 06/21/2010 11:51 AM, Jakub Jelinek wrote: > Hi! > > I'd like to ping Jan Kratochvil's patch to fix up dates in generated > man pages: > http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01112.html > > Ok for trunk? Yes, thanks! Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-06-21 11:19 ` Paolo Bonzini @ 2010-06-21 12:08 ` Jan Kratochvil 2010-06-21 12:20 ` Jan Kratochvil 0 siblings, 1 reply; 504+ messages in thread From: Jan Kratochvil @ 2010-06-21 12:08 UTC (permalink / raw) To: Paolo Bonzini Cc: Jakub Jelinek, Alexandre Oliva, DJ Delorie, Joseph S. Myers, gcc-patches On Mon, 21 Jun 2010 12:00:07 +0200, Paolo Bonzini wrote: > On 06/21/2010 11:51 AM, Jakub Jelinek wrote: > > I'd like to ping Jan Kratochvil's patch to fix up dates in generated > > man pages: > > http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01112.html > > Yes, thanks! Checked-in as r161066. Forgot to place the PR # there so closed PR other/43480 by hand. Thanks, Jan ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-06-21 12:08 ` Jan Kratochvil @ 2010-06-21 12:20 ` Jan Kratochvil 0 siblings, 0 replies; 504+ messages in thread From: Jan Kratochvil @ 2010-06-21 12:20 UTC (permalink / raw) To: Paolo Bonzini Cc: Jakub Jelinek, Alexandre Oliva, DJ Delorie, Joseph S. Myers, gcc-patches On Mon, 21 Jun 2010 13:24:23 +0200, Jan Kratochvil wrote: > Checked-in as r161066. Forgot to place the PR # there so closed PR other/43480 > by hand. Wrongly patched libjava/classpath/ChangeLog , therefore fixed it up: ------------------------------------------------------------------------ r161069 | jkratoch | 2010-06-21 13:40:02 +0200 (Mon, 21 Jun 2010) | 3 lines Move the entry from libjava/classpath/ ChangeLog to ChangeLog.gcj as it is a local change. Reported by Jakub Jelinek, approved by Mark Wielaard. ------------------------------------------------------------------------ Index: libjava/classpath/ChangeLog =================================================================== --- libjava/classpath/ChangeLog (revision 161068) +++ libjava/classpath/ChangeLog (revision 161069) @@ -1,8 +1,3 @@ -2010-06-21 Jan Kratochvil <jan.kratochvil@redhat.com> - - * doc/Makefile.am (POD2MAN): Provide --date from ChangeLog. - * doc/Makefile.in: Regenerate. - 2010-06-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * scripts/check_jni_methods.sh.in: Don't use diff -U. Index: libjava/classpath/ChangeLog.gcj =================================================================== --- libjava/classpath/ChangeLog.gcj (revision 161068) +++ libjava/classpath/ChangeLog.gcj (revision 161069) @@ -1,3 +1,8 @@ +2010-06-21 Jan Kratochvil <jan.kratochvil@redhat.com> + + * doc/Makefile.am (POD2MAN): Provide --date from ChangeLog. + * doc/Makefile.in: Regenerate. + 2010-04-07 Jakub Jelinek <jakub@redhat.com> * native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-05-10 17:00 Jakub Jelinek 2010-05-10 23:43 ` Joseph S. Myers 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-05-10 17:00 UTC (permalink / raw) To: Jason Merrill, Joseph S. Myers, Ian Lance Taylor; +Cc: gcc-patches Hi! [4.6] http://gcc.gnu.org/ml/gcc-patches/2010-05/msg00400.html - improve debug info with SRA optimized objects (only tree-sra changes reviewed so far, the 2 extra break; stmts removed in my copy) [4.6] http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01762.html - fix up .debug_macinfo [4.6] http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01045.html - improve -### Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-05-10 17:00 Jakub Jelinek @ 2010-05-10 23:43 ` Joseph S. Myers 0 siblings, 0 replies; 504+ messages in thread From: Joseph S. Myers @ 2010-05-10 23:43 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Ian Lance Taylor, gcc-patches On Mon, 10 May 2010, Jakub Jelinek wrote: > [4.6] http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01045.html > - improve -### OK with "alpha numeric" changed to "alphanumeric". -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-04-19 9:47 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2010-04-19 9:47 UTC (permalink / raw) To: Richard Henderson, Richard Guenther, Jason Merrill; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00082.html - adjustment for DWARF4 CIE header changes (new fields added into the middle of the header) http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00818.html - 1% size decrease of .debug_loc (only merges adjacent ranges with the same location expression) http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01045.html - improve -### Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch Ping @ 2010-03-02 19:00 Jeff Law 2010-03-03 10:09 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jeff Law @ 2010-03-02 19:00 UTC (permalink / raw) To: gcc-patches Ping! http://gcc.gnu.org/ml/gcc-patches/2010-02/msg01010.html Jeff ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch Ping 2010-03-02 19:00 Patch Ping Jeff Law @ 2010-03-03 10:09 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2010-03-03 10:09 UTC (permalink / raw) To: Jeff Law; +Cc: gcc-patches On Tue, Mar 2, 2010 at 7:59 PM, Jeff Law <law@redhat.com> wrote: > > Ping! > > http://gcc.gnu.org/ml/gcc-patches/2010-02/msg01010.html Ok. Thanks, Richard. > Jeff > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-02-23 15:42 Jakub Jelinek 2010-02-23 20:12 ` Uros Bizjak 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-02-23 15:42 UTC (permalink / raw) To: Uros Bizjak, Richard Henderson, H.J. Lu; +Cc: gcc-patches Hi! - Fix AVX vector permutation handling (PR target/43107) http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00736.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-02-23 15:42 Patch ping Jakub Jelinek @ 2010-02-23 20:12 ` Uros Bizjak 0 siblings, 0 replies; 504+ messages in thread From: Uros Bizjak @ 2010-02-23 20:12 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, H.J. Lu, gcc-patches On 02/23/2010 04:35 PM, Jakub Jelinek wrote: > Hi! > > - Fix AVX vector permutation handling (PR target/43107) > http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00736.html > > 2010-02-18 Jakub Jelinek<jakub@redhat.com> > > PR target/43107 > * config/i386/i386.c (avx_vpermilp_parallel): Reject indexes > greater or equal to nelt instead of 2 * nelt. > (expand_vec_perm_1): When op0 and op1 are equal, mask indexes > with nelt - 1. > Please CSE (nelt -1) into a temporary. OK with that change. Thanks, Uros. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-02-09 22:39 Jakub Jelinek 2010-02-09 22:52 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-02-09 22:39 UTC (permalink / raw) To: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2010-01/msg01402.html - fix asm redirection of ffs on s390x (to fix glibc s390x build) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-02-09 22:39 Jakub Jelinek @ 2010-02-09 22:52 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2010-02-09 22:52 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Tue, Feb 9, 2010 at 11:43 PM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2010-01/msg01402.html > - fix asm redirection of ffs on s390x (to fix glibc s390x build) Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-01-14 9:33 Jakub Jelinek 2010-01-14 19:12 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-01-14 9:33 UTC (permalink / raw) To: Richard Henderson, Richard Guenther; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00430.html - 4.5: fix VTA from needlessly resetting debug stmts during inlining http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00431.html - 4.5: fix var-tracking on MO_USE_NO_VAR http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00403.html - 4.5/4.4: don't emit .weak for undefs that are DECL_WEAK just because the undef symbols are known to use C++ vague linkage. Only emit .weak for undefs if they have weak attribute, #pragma weak or some target specific similar extension. All patches have been bootstrapped/regtested several times on several linux targets. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-01-14 9:33 Jakub Jelinek @ 2010-01-14 19:12 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2010-01-14 19:12 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Guenther, gcc-patches On 01/14/2010 01:33 AM, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00430.html > - 4.5: fix VTA from needlessly resetting debug stmts during inlining > > http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00431.html > - 4.5: fix var-tracking on MO_USE_NO_VAR > > http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00403.html > - 4.5/4.4: don't emit .weak for undefs that are DECL_WEAK just > because the undef symbols are known to use C++ vague linkage. > Only emit .weak for undefs if they have weak attribute, #pragma weak > or some target specific similar extension. > > All patches have been bootstrapped/regtested several times on several linux > targets. All ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2010-01-04 10:54 Jakub Jelinek 2010-01-04 14:35 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2010-01-04 10:54 UTC (permalink / raw) To: Joseph S. Myers, Richard Guenther, Alexandre Oliva; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01011.html - P1 -m{arch,cpu,tune}=native regression in the driver caused by -fcompare-debug changes in the driver Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2010-01-04 10:54 Jakub Jelinek @ 2010-01-04 14:35 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2010-01-04 14:35 UTC (permalink / raw) To: Jakub Jelinek Cc: Joseph S. Myers, Richard Guenther, Alexandre Oliva, gcc-patches On Mon, Jan 4, 2010 at 11:54 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01011.html > - P1 -m{arch,cpu,tune}=native regression in the driver > caused by -fcompare-debug changes in the driver Ok. Thanks, Richard. > Jakub > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-11-02 13:17 Jakub Jelinek 2009-11-02 13:29 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2009-11-02 13:17 UTC (permalink / raw) To: Jason Merrill, Richard Guenther, Jan Hubicka; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01352.html - Fix ICEs with non-matched #pragma GCC visibility and namespace with visibility attribute http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01627.html - Fix -fipa-struct-reorg ICE with unmaterialized clones Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-11-02 13:17 Jakub Jelinek @ 2009-11-02 13:29 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2009-11-02 13:29 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Jan Hubicka, gcc-patches On Mon, 2 Nov 2009, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01627.html > - Fix -fipa-struct-reorg ICE with unmaterialized clones Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-10-19 19:22 Jakub Jelinek 2009-10-19 19:22 ` Richard Henderson ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Jakub Jelinek @ 2009-10-19 19:22 UTC (permalink / raw) To: Richard Henderson, Jason Merrill, Joseph S. Myers; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00864.html - fix DW_OP_{le,gt,ge,gt} handling in unwind-dw2.c http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00837.html - raw string support (libcpp bits reviewed by Tom Tromey already, C/C++ bits need approval) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-19 19:22 Jakub Jelinek @ 2009-10-19 19:22 ` Richard Henderson 2009-10-19 21:09 ` Joseph S. Myers 2009-10-19 22:06 ` Jason Merrill 2 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2009-10-19 19:22 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Jason Merrill, Joseph S. Myers, gcc-patches On 10/19/2009 12:16 PM, Jakub Jelinek wrote: > Hi! > > http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00864.html > - fix DW_OP_{le,gt,ge,gt} handling in unwind-dw2.c Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-19 19:22 Jakub Jelinek 2009-10-19 19:22 ` Richard Henderson @ 2009-10-19 21:09 ` Joseph S. Myers 2009-10-19 22:06 ` Jason Merrill 2 siblings, 0 replies; 504+ messages in thread From: Joseph S. Myers @ 2009-10-19 21:09 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, Jason Merrill, gcc-patches On Mon, 19 Oct 2009, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00837.html > - raw string support (libcpp bits reviewed by Tom Tromey already, > C/C++ bits need approval) The C changes are OK. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-19 19:22 Jakub Jelinek 2009-10-19 19:22 ` Richard Henderson 2009-10-19 21:09 ` Joseph S. Myers @ 2009-10-19 22:06 ` Jason Merrill 2009-10-20 1:25 ` Paolo Carlini 2 siblings, 1 reply; 504+ messages in thread From: Jason Merrill @ 2009-10-19 22:06 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Richard Henderson, Joseph S. Myers, gcc-patches On 10/19/2009 03:16 PM, Jakub Jelinek wrote: > http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00837.html > - raw string support (libcpp bits reviewed by Tom Tromey already, > C/C++ bits need approval) OK. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-19 22:06 ` Jason Merrill @ 2009-10-20 1:25 ` Paolo Carlini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Carlini @ 2009-10-20 1:25 UTC (permalink / raw) To: Jason Merrill Cc: Jakub Jelinek, Richard Henderson, Joseph S. Myers, gcc-patches > On 10/19/2009 03:16 PM, Jakub Jelinek wrote: >> http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00837.html >> - raw string support (libcpp bits reviewed by Tom Tromey already, >> C/C++ bits need approval) > > OK. Great. Can you please also update wwwdocs about that? Thanks, Paolo. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-10-12 12:37 Jakub Jelinek 2009-10-12 19:23 ` Tom Tromey 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2009-10-12 12:37 UTC (permalink / raw) To: Tom Tromey; +Cc: gcc-patches Hi! Could you please in light of http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00179.html review the libcpp bits of http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01099.html ? Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-12 12:37 Jakub Jelinek @ 2009-10-12 19:23 ` Tom Tromey 2009-10-12 20:21 ` Jakub Jelinek 0 siblings, 1 reply; 504+ messages in thread From: Tom Tromey @ 2009-10-12 19:23 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches >>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes: Jakub> Could you please in light of Jakub> http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00179.html Jakub> review the libcpp bits of Jakub> http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01099.html Jakub> ? I read the patch. Sorry about the delay -- these days my attention wanders a lot so pings for libcpp patches are very helpful. Most of the patch is clearly fine. I didn't see anything limiting this to C++0x, but I suppose that will be done outside libcpp. The patch refers to `CPP_OPTION (pfile, uliterals)' but I didn't see an addition to struct cpp_options. Would it be too much trouble to use calls to cpp_error_with_line for all new errors? I think this is generally preferable, and in this code I think it would also let us emit errors against locations inside strings. (And, for errors about unterminated strings, it would let us point to the start of the string, which seems better to me.) lex_raw_string uses _cpp_get_fresh_line, failing if that returns false. _cpp_get_fresh_line will always return false inside of a directive -- do we care about raw strings containing newlines in directives? Some nits.. From lex_raw_string: +/* Lexes raw a string. The stored string contains the spelling, including I think the first sentence should be "Lexes a raw string". From _cpp_lex_direct: + case 'R': /* 'L', 'u' or 'U' may introduce wide characters or strings. */ This comment needs an update. This isn't part of libcpp, but it seems to me that C_LEX_RAW_STRINGS is now confusingly named. Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-12 19:23 ` Tom Tromey @ 2009-10-12 20:21 ` Jakub Jelinek 2009-10-12 21:29 ` Tom Tromey 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2009-10-12 20:21 UTC (permalink / raw) To: Tom Tromey; +Cc: Jakub Jelinek, gcc-patches On Mon, Oct 12, 2009 at 01:20:36PM -0600, Tom Tromey wrote: > I read the patch. Sorry about the delay -- these days my attention > wanders a lot so pings for libcpp patches are very helpful. Thanks. > I didn't see anything limiting this to C++0x, but I suppose that will be > done outside libcpp. > > The patch refers to `CPP_OPTION (pfile, uliterals)' but I didn't see an > addition to struct cpp_options. Both of the above questions are related. It is uliterals that limits this to C++0x and GNUC99, and that wasn't added because it is already pre-existing. Before this patch it was used to limit u"", U"", u'x', U'x', now it guards also u8"", R"[]", LR"[]", uR"[]", UR"[]" and u8R"[]" style strings. See init.c (lang_defaults). > Would it be too much trouble to use calls to cpp_error_with_line for all > new errors? I think this is generally preferable, and in this code I > think it would also let us emit errors against locations inside strings. > (And, for errors about unterminated strings, it would let us point to > the start of the string, which seems better to me.) > > lex_raw_string uses _cpp_get_fresh_line, failing if that returns false. > _cpp_get_fresh_line will always return false inside of a directive -- do > we care about raw strings containing newlines in directives? I'll look at these 2 tomorrow. > +/* Lexes raw a string. The stored string contains the spelling, including > > I think the first sentence should be "Lexes a raw string". Fixed in my copy. > >From _cpp_lex_direct: > > + case 'R': > /* 'L', 'u' or 'U' may introduce wide characters or strings. */ > > This comment needs an update. Likewise. > This isn't part of libcpp, but it seems to me that C_LEX_RAW_STRINGS is > now confusingly named. True, perhaps C_LEX_STRING_NO_TRANSLATE_NO_JOIN or just C_LEX_STRING_NO_JOIN will need to be used instead. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-10-12 20:21 ` Jakub Jelinek @ 2009-10-12 21:29 ` Tom Tromey 0 siblings, 0 replies; 504+ messages in thread From: Tom Tromey @ 2009-10-12 21:29 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches >>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes: Tom> I didn't see anything limiting this to C++0x, but I suppose that will be Tom> done outside libcpp. Tom> The patch refers to `CPP_OPTION (pfile, uliterals)' but I didn't see an Tom> addition to struct cpp_options. Jakub> Both of the above questions are related. It is uliterals that Jakub> limits this to C++0x and GNUC99, and that wasn't added because it Jakub> is already pre-existing. Oops, I didn't think to look there :) If you need to add a new option here, that is fine by me. IIUC, this part is really just about satisfying the differing needs of the C and C++ FEs. Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-08-06 20:57 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2009-08-06 20:57 UTC (permalink / raw) To: Richard Henderson, Jason Merrill; +Cc: gcc-patches Hi! I'd like to ping: [4.5] Allow exceptions together with -freorder-blocks-and-partition http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01743.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-05-20 21:07 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2009-05-20 21:07 UTC (permalink / raw) To: David Edelsohn, Ben Elliston, Ian Lance Taylor; +Cc: gcc-patches Hi! [rs6000] http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00151.html PR target/40017 - handle context sensitive vector bool even after #include <stdbool.h> in C99 [emutls] http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00248.html PR other/40024 - fix emutls bug Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-04-08 18:16 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2009-04-08 18:16 UTC (permalink / raw) To: gcc-patches Hi! [4.4/4.5] P2 teach fwprop to propagate into asms to avoid reload asm regressions http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01361.html [4.5] Use DW_TAG_member instead of DW_TAG_variable for static data members http://gcc.gnu.org/ml/gcc-patches/2009-04/msg00485.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2009-01-09 16:41 Jakub Jelinek 2009-01-10 2:39 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2009-01-09 16:41 UTC (permalink / raw) To: Uros Bizjak, Jan Hubicka, Jason Merrill, Mark Mitchell, Joseph S. Myers Cc: gcc-patches Hi! I'd like to ping a couple of patches for 4.4 regressions: [i386] PR target/38708, P1 http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00239.html [c++] PR c++/36695, P2 http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00018.html (with s/default/value/ in the error message) [c/c++] PR c/32455, P2 http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00644.html [c++] PR c++/38648, P2 http://gcc.gnu.org/ml/gcc-patches/2008-12/msg01316.html [c] PR c/32041, P2 http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00369.html (with s/32084/32041/g; C++ part already approved by Jason) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2009-01-09 16:41 Jakub Jelinek @ 2009-01-10 2:39 ` Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2009-01-10 2:39 UTC (permalink / raw) To: gcc-patches [ I managed to drop gcc-patches when I sent this. ] Jakub Jelinek <jakub@redhat.com> writes: > [c++] PR c++/36695, P2 > http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00018.html > (with s/default/value/ in the error message) This is OK. > [c/c++] PR c/32455, P2 > http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00644.html I'm not really comfortable with breaking the building of old version of glibc just to fix an ice-on-invalid. I'll approve this for gcc 4.5, to give people more time to update their glibc. > [c++] PR c++/38648, P2 > http://gcc.gnu.org/ml/gcc-patches/2008-12/msg01316.html This is OK. > [c] PR c/32041, P2 > http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00369.html > (with s/32084/32041/g; C++ part already approved by Jason) This is OK if no objections from the C frontend maintainers by Tuesday (or if they approve it before then). Thanks. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-11-10 16:53 Jakub Jelinek 2008-11-12 15:51 ` Nick Clifton 2008-11-22 2:49 ` Ian Lance Taylor 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-11-10 16:53 UTC (permalink / raw) To: Eric Botcazou, Jason Merrill, Ian Lance Taylor, Nick Clifton; +Cc: gcc-patches Hi! - PR middle-end/37316 RTL fix for assign_parm_remove_parallels 4.4 regression http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00982.html - PR rtl-optimization/36998 Dwarf2 DW_CFA_GNU_args_size fixes http://gcc.gnu.org/ml/gcc-patches/2008-10/msg01322.html - PR target/37170 RTL/target fix for arm (and xtensa in followup) missing assemble_external calls http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00063.html Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-11-10 16:53 Jakub Jelinek @ 2008-11-12 15:51 ` Nick Clifton 2008-11-22 2:49 ` Ian Lance Taylor 1 sibling, 0 replies; 504+ messages in thread From: Nick Clifton @ 2008-11-12 15:51 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Eric Botcazou, Jason Merrill, Ian Lance Taylor, gcc-patches Hi Jakub, > - PR target/37170 > RTL/target fix for arm (and xtensa in followup) missing > assemble_external calls > http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00063.html This patch is approved for the ARM. Cheers Nick ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-11-10 16:53 Jakub Jelinek 2008-11-12 15:51 ` Nick Clifton @ 2008-11-22 2:49 ` Ian Lance Taylor 1 sibling, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2008-11-22 2:49 UTC (permalink / raw) To: Jakub Jelinek Cc: Eric Botcazou, Jason Merrill, Ian Lance Taylor, Nick Clifton, gcc-patches Jakub Jelinek <jakub@redhat.com> writes: > - PR middle-end/37316 > RTL fix for assign_parm_remove_parallels 4.4 regression > http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00982.html This is OK. Thanks. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-09-26 0:33 Jakub Jelinek 2008-09-26 12:53 ` Diego Novillo 2008-09-26 17:36 ` Richard Henderson 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-09-26 0:33 UTC (permalink / raw) To: gcc-patches; +Cc: Jason Merrill Hi! - http://gcc.gnu.org/ml/gcc-patches/2008-09/msg00592.html fix dwarf2out ICE on UNSPEC in DECL_RTL, PR middle-end/37275 - http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01387.html fix gcc -v --help, PR middle-end/37576 Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-09-26 0:33 Jakub Jelinek @ 2008-09-26 12:53 ` Diego Novillo 2008-09-26 17:36 ` Richard Henderson 1 sibling, 0 replies; 504+ messages in thread From: Diego Novillo @ 2008-09-26 12:53 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jason Merrill 2008/9/25 Jakub Jelinek <jakub@redhat.com>: > - http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01387.html > fix gcc -v --help, PR middle-end/37576 OK. Diego. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-09-26 0:33 Jakub Jelinek 2008-09-26 12:53 ` Diego Novillo @ 2008-09-26 17:36 ` Richard Henderson 1 sibling, 0 replies; 504+ messages in thread From: Richard Henderson @ 2008-09-26 17:36 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Jason Merrill Jakub Jelinek wrote: > - http://gcc.gnu.org/ml/gcc-patches/2008-09/msg00592.html > fix dwarf2out ICE on UNSPEC in DECL_RTL, PR middle-end/37275 Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-07-28 15:02 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-07-28 15:02 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00984.html - 4.3/4.4 P1 PR rtl-optimization/36419 - last patch in the series to fix -Os -fasynchronous-unwind-tables Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-06-27 16:11 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-06-27 16:11 UTC (permalink / raw) To: Jason Merrill, Mark Mitchell; +Cc: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01305.html - 4.1/4.3/4.4 P1 regression, fix unwind info if combine_stack_adjustment combined post-prologue adjustment with prologue adjustment One of: http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00764.html http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00783.html - 4.3/4.4 P2 regression, typeid on member function: I understood disagreement between Jason/Mark in the thread whether arrays with incomplete element types are supposed to be valid typeid arguments or not. Which of these patches we want (or something different?)? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-05-07 8:38 Jakub Jelinek 2008-05-07 14:59 ` Jason Merrill 2008-05-10 19:23 ` Diego Novillo 0 siblings, 2 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-05-07 8:38 UTC (permalink / raw) To: gcc-patches; +Cc: Mark Mitchell, Jason Merrill, Richard Guenther Hi! - C++ compound literal diagnostics PR c++/36023 P2 4.3/4.4 http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02045.html - fix dwarf2out.c for Fortran COMMONs PR debug/35896 P1 4.4 http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02114.html - change simplify_plus_minus canonicalization PR target/36090 P1 4.3/4.4 http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00202.html testcase in http://gcc.gnu.org/bugzilla/attachment.cgi?id=15576&action=view - nowait for tree-parloops.c - - 4.4 http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00288.html All patches have been bootstrapped/regtested on x86_64-linux, PR36090 also on ppc-linux, ppc64-linux and i386-linux. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-05-07 8:38 Jakub Jelinek @ 2008-05-07 14:59 ` Jason Merrill 2008-05-21 15:05 ` Jakub Jelinek 2008-05-10 19:23 ` Diego Novillo 1 sibling, 1 reply; 504+ messages in thread From: Jason Merrill @ 2008-05-07 14:59 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Mark Mitchell, Richard Guenther Jakub Jelinek wrote: > - C++ compound literal diagnostics PR c++/36023 P2 4.3/4.4 > http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02045.html Rather than duplicating code, please split out the parts of check_initializer that are also appropriate for finish_compound_literal. > - fix dwarf2out.c for Fortran COMMONs PR debug/35896 P1 4.4 > http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02114.html OK. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-05-07 14:59 ` Jason Merrill @ 2008-05-21 15:05 ` Jakub Jelinek 2008-05-21 15:51 ` Jason Merrill 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2008-05-21 15:05 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches On Wed, May 07, 2008 at 10:52:42AM -0400, Jason Merrill wrote: > Jakub Jelinek wrote: > >- C++ compound literal diagnostics PR c++/36023 P2 4.3/4.4 > > http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02045.html > > Rather than duplicating code, please split out the parts of > check_initializer that are also appropriate for finish_compound_literal. Sorry for getting to this so late. check_initializer has: if (TREE_CODE (type) == ARRAY_TYPE) { tree element_type = TREE_TYPE (type); /* The array type itself need not be complete, because the initializer may tell us how many elements are in the array. But, the elements of the array must be complete. */ if (!COMPLETE_TYPE_P (complete_type (element_type))) { error ("elements of array %q#D have incomplete type", decl); return NULL_TREE; } /* It is not valid to initialize a VLA. */ if (init && ((COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type))) || !TREE_CONSTANT (TYPE_SIZE (element_type)))) { error ("variable-sized object %qD may not be initialized", decl); return NULL_TREE; } } While the 3 if conditions can be the same (assuming finish_compound_literal passes compound_literal as init), the problem is with the diagnostics, as finish_compound_literal doesn't have any decl, just the type, and in check_initializer reporting the decl is really preferrable over just returning the type. So, if I were to move the above into separate function, it would need to special case that, say: bool check_array_initializer (tree decl, tree type, tree init) { if (TREE_CODE (type) == ARRAY_TYPE) { tree element_type = TREE_TYPE (type); /* The array type itself need not be complete, because the initializer may tell us how many elements are in the array. But, the elements of the array must be complete. */ if (!COMPLETE_TYPE_P (complete_type (element_type))) { if (decl) error ("elements of array %q#D have incomplete type", decl); else error ("elements of array %q#T have incomplete type", type); return true; } /* It is not valid to initialize a VLA. */ if (init && ((COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type))) || !TREE_CONSTANT (TYPE_SIZE (element_type)))) { if (decl) error ("variable-sized object %qD may not be initialized", decl); else error ("variable-sized compound literal"); return true; } } return false; } and check_initializer replacing its code with if (check_array_initializer (decl, type, init)) return NULL_TREE; and finish_compound_literal adding: if (check_array_initializer (NULL_TREE, type, compound_literal)) return error_mark_node; I think this is uglification rather than cleanup, especially given the size of the duplicated code and that the error messages need to be different, but certainly if you prefer it that way, I can write a patch. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-05-21 15:05 ` Jakub Jelinek @ 2008-05-21 15:51 ` Jason Merrill 0 siblings, 0 replies; 504+ messages in thread From: Jason Merrill @ 2008-05-21 15:51 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches Jakub Jelinek wrote: > I think this is uglification rather than cleanup, especially given the > size of the duplicated code and that the error messages need to be > different, but certainly if you prefer it that way, I can write a patch. I think I do prefer it that way, so that if we add additional checks in the future it will be obvious that we need to handle both cases. If checks are in two different places changes in one tend not to be reflected in the other. Jason ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-05-07 8:38 Jakub Jelinek 2008-05-07 14:59 ` Jason Merrill @ 2008-05-10 19:23 ` Diego Novillo 1 sibling, 0 replies; 504+ messages in thread From: Diego Novillo @ 2008-05-10 19:23 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Mark Mitchell, Jason Merrill, Richard Guenther On 5/7/08 4:32 AM, Jakub Jelinek wrote: > - nowait for tree-parloops.c - - 4.4 > http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00288.html ISTR approving this one. If I didn't, the patch is OK. Diego. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping... @ 2008-04-05 16:54 Jan Hubicka 2008-04-05 17:36 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2008-04-05 16:54 UTC (permalink / raw) To: gcc-patches Hi, I would like to ping the BRANCH_COST patch http://gcc.gnu.org/ml/gcc/2008-03/msg00137.html I hope to proceed with updating GCC to optimize cold blocks in same way as -Os and explicitely marked hot functions in -Os code for speed. For this I need to populate RTL cost interfaces with the profile info and teach expansion about it. This is taking quite some years now, I realize it might not be clear what I am precisely shooting for, so I will also add wiki page. Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-05 16:54 Jan Hubicka @ 2008-04-05 17:36 ` Richard Guenther 2008-04-05 20:39 ` Jan Hubicka 2008-08-29 22:15 ` Jan Hubicka 0 siblings, 2 replies; 504+ messages in thread From: Richard Guenther @ 2008-04-05 17:36 UTC (permalink / raw) To: Jan Hubicka; +Cc: gcc-patches On Sat, Apr 5, 2008 at 6:26 PM, Jan Hubicka <hubicka@ucw.cz> wrote: > Hi, > I would like to ping the BRANCH_COST patch > http://gcc.gnu.org/ml/gcc/2008-03/msg00137.html > > I hope to proceed with updating GCC to optimize cold blocks in same way > as -Os and explicitely marked hot functions in -Os code for speed. > For this I need to populate RTL cost interfaces with the profile info > and teach expansion about it. > This is taking quite some years now, I realize it might not be clear > what I am precisely shooting for, so I will also add wiki page. I think the patch makes sense (BRANCH_COST is special anyway compared to other isns cost), but I'd like to see the bigger picture as well here. In particular, BRANCH_COST (hot, predictable), why isn't that simply BRANCH_COST (optimize_size_p, predictable) matching what I possibly expect for the other cost interface (insn_cost (optimize_size_p, rtx)). Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-05 17:36 ` Richard Guenther @ 2008-04-05 20:39 ` Jan Hubicka 2008-04-08 20:42 ` Mark Mitchell 2008-08-29 22:15 ` Jan Hubicka 1 sibling, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2008-04-05 20:39 UTC (permalink / raw) To: Richard Guenther; +Cc: Jan Hubicka, gcc-patches > > I think the patch makes sense (BRANCH_COST is special anyway compared to > other isns cost), but I'd like to see the bigger picture as well here. In > particular, BRANCH_COST (hot, predictable), why isn't that simply > BRANCH_COST (optimize_size_p, predictable) matching what I possibly > expect for the other cost interface (insn_cost (optimize_size_p, rtx)). The reason is that I don't think current paradigm of optimize_size variable and profile info is good combination. We have maybe_hot_bb_p and probably_cold_bb_p that use CFG profile to guess on hotness. Their names suggest in what direction they are conservative and it defaults to preferred -O2 behaviour (ie code tends to be hot unless there is really good reason for otherwise). I would like to have hot_bb_p predicate that take into accounts the hints: 1) hot/cold function attributes 2) -Os versus optimize_size 3) function local profile (ie things guarded with __builtin_expect or leading to abort) 4) profile feedback and decide on hotness. With -Os defaulting to conservative behaviour (ie function is hot only if attribute or profile feedback suggest so) and -O2 defaulting to aggressive behaviour (function is hot if not declared cold, function local profile is within bounds). I see that hotness in 90% corelate with !optimize_size, but not in 100% cases, especially in decision affecting the whole function or unit or loop or so that might contain both hot and cold stuff. So I think hottness is more precise name for what is going on here. Honza > > Thanks, > Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-05 20:39 ` Jan Hubicka @ 2008-04-08 20:42 ` Mark Mitchell 2008-04-08 22:52 ` Jan Hubicka 2008-04-10 18:36 ` Michael Matz 0 siblings, 2 replies; 504+ messages in thread From: Mark Mitchell @ 2008-04-08 20:42 UTC (permalink / raw) To: Jan Hubicka; +Cc: Richard Guenther, gcc-patches Jan Hubicka wrote: > I would like to have hot_bb_p predicate that take into accounts the > hints: > 1) hot/cold function attributes > 2) -Os versus optimize_size > 3) function local profile (ie things guarded with __builtin_expect or > leading to abort) > 4) profile feedback > and decide on hotness. With -Os defaulting to conservative behaviour > (ie function is hot only if attribute or profile feedback suggest so) > and -O2 defaulting to aggressive behaviour (function is hot if not > declared cold, function local profile is within bounds). This seems like a good idea, except that I'm not sure it's what people really want from -Os. With -Os, I think some users want small code, all the time, period. -- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-08 20:42 ` Mark Mitchell @ 2008-04-08 22:52 ` Jan Hubicka 2008-04-08 23:06 ` Mark Mitchell 2008-04-10 18:36 ` Michael Matz 1 sibling, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2008-04-08 22:52 UTC (permalink / raw) To: Mark Mitchell; +Cc: Jan Hubicka, Richard Guenther, gcc-patches > Jan Hubicka wrote: > > >I would like to have hot_bb_p predicate that take into accounts the > >hints: > > 1) hot/cold function attributes > > 2) -Os versus optimize_size > > 3) function local profile (ie things guarded with __builtin_expect or > > leading to abort) > > 4) profile feedback > >and decide on hotness. With -Os defaulting to conservative behaviour > >(ie function is hot only if attribute or profile feedback suggest so) > >and -O2 defaulting to aggressive behaviour (function is hot if not > >declared cold, function local profile is within bounds). > > This seems like a good idea, except that I'm not sure it's what people > really want from -Os. With -Os, I think some users want small code, all > the time, period. What I think -Os can be really useful for is well maintained code base, with code size constraints. (Linux kernel) You compile it with -Os and get small code except for the case you explicitly use __attribute__ ((hot)). Given the observation that just tiny portion of program is hot, it in general makes more sense than using -O2/-O3 and cold attribute. We however can't make this default behaviour for -O2, since we can't insist on user always marking hot functions hot in random package. I am less sure about profile feedback. Feedback with -Os can either mean "figure hotness yourself" or "get the code faster without increasing code size". To some degree I however expect that "get me the smallest code" people probably won't bother with profile feedback anyway. Honza > > -- > Mark Mitchell > CodeSourcery > mark@codesourcery.com > (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-08 22:52 ` Jan Hubicka @ 2008-04-08 23:06 ` Mark Mitchell 2008-04-09 7:19 ` Andi Kleen 2008-04-10 13:36 ` Jan Hubicka 0 siblings, 2 replies; 504+ messages in thread From: Mark Mitchell @ 2008-04-08 23:06 UTC (permalink / raw) To: Jan Hubicka; +Cc: Jan Hubicka, Richard Guenther, gcc-patches Jan Hubicka wrote: > What I think -Os can be really useful for is well maintained code base, > with code size constraints. (Linux kernel) You compile it with -Os and > get small code except for the case you explicitly use __attribute__ > ((hot)). Given the observation that just tiny portion of program is > hot, it in general makes more sense than using -O2/-O3 and cold attribute. That makes sense, but it's only one usage model. Another case is where you want your applications to be small -- perhaps because the whole application is "cold". I'm running on an embedded device, I want to have this application available, but flash is scarce, and I expect to need this application only very rarely; please use no more space than possible. If the user uses something like __attribute__((hot)) to specifically say something about a function that's arguable. But, I think that -Os means *small*. Of course, I don't have any objection with adding a -Os -f<something> option to do something that's more like "small code, except for places where you think it really matters". -- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-08 23:06 ` Mark Mitchell @ 2008-04-09 7:19 ` Andi Kleen 2008-04-10 13:36 ` Jan Hubicka 1 sibling, 0 replies; 504+ messages in thread From: Andi Kleen @ 2008-04-09 7:19 UTC (permalink / raw) To: Mark Mitchell; +Cc: Jan Hubicka, Jan Hubicka, Richard Guenther, gcc-patches Mark Mitchell <mark@codesourcery.com> writes: > Jan Hubicka wrote: > >> What I think -Os can be really useful for is well maintained code base, >> with code size constraints. (Linux kernel) You compile it with -Os and >> get small code except for the case you explicitly use __attribute__ >> ((hot)). Given the observation that just tiny portion of program is >> hot, it in general makes more sense than using -O2/-O3 and cold attribute. > > That makes sense, but it's only one usage model. Another case is > where you want your applications to be small -- perhaps because the > whole application is "cold". I'm running on an embedded device, I > want to have this application available, but flash is scarce, and I > expect to need this application only very rarely; please use no more > space than possible. But even such an embedded application might have a single function or two which is time critical. So giving a runtime switch for hot would even make sense for them. And if they don't want it, just should just not use __attribute__((hot)) Also there is plenty of precendence on other compilers for pragmas to change optimization levels on the fly inside files (I sometimes would really love that for -funroll-loops for example), so there seems to be definitely user demand for things like this. Also to be honest I would like to have a -Omostly-small That is current -Os is usually better for icache constrained applications that don't loop much (like a kernel), but sometimes it generates extremly bad code just to save a few bytes which has hurt in the past (as in appearing on profiles for macro benchmarks). One example for this is division code generation where on x86 -Os prefers always the hardware DIV instructions even when they can be magnitudes slower than an only slightly bigger expanded sequence. __attribute__((hot)) of course is the first step to fix that. -Andi ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-08 23:06 ` Mark Mitchell 2008-04-09 7:19 ` Andi Kleen @ 2008-04-10 13:36 ` Jan Hubicka 1 sibling, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2008-04-10 13:36 UTC (permalink / raw) To: Mark Mitchell; +Cc: Jan Hubicka, Jan Hubicka, Richard Guenther, gcc-patches > > Of course, I don't have any objection with adding a -Os -f<something> > option to do something that's more like "small code, except for places > where you think it really matters". To some degree, I would like to avoid GCC command line explossion. It always seemed to me that it is resonable to make -Os optimize for size unless explicitely stated in program to not do so. On the other hand, at the moment it is more about infrastructure, and I guess we all agree on the other half that -O2 + attribute cold (or other good hint, like abort call or builtin_expect) should lead to optimization for size So I am happy to drop the -Os part of the plot, and make "hot" predicate to always result false for -Os declaring whole compiled application cold. Later we can think of what -f option we want or what -Os behaviour is preferrable. As Andi mentioned, we have problem that -O2 is bit too performance centric for average application in many cases probably making system built with -O2 requiring more memory than it would need and thus be slower. Though I believe we are better in this respect than many other compilers. It might make sense to make -O2 more code size concerned instead of having -Omostly-small or have some -fXXX finetunning for -Os to make -Os useable for applications where speed matters too. But it is better to handle this independently. Just thinking of way how to benchmark this drive my head crazy ;) Honza > > -- > Mark Mitchell > CodeSourcery > mark@codesourcery.com > (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-08 20:42 ` Mark Mitchell 2008-04-08 22:52 ` Jan Hubicka @ 2008-04-10 18:36 ` Michael Matz 2008-04-11 8:16 ` Mark Mitchell 1 sibling, 1 reply; 504+ messages in thread From: Michael Matz @ 2008-04-10 18:36 UTC (permalink / raw) To: Mark Mitchell; +Cc: Jan Hubicka, Richard Guenther, gcc-patches Hi, On Tue, 8 Apr 2008, Mark Mitchell wrote: > > and decide on hotness. With -Os defaulting to conservative behaviour > > (ie function is hot only if attribute or profile feedback suggest so) > > and -O2 defaulting to aggressive behaviour (function is hot if not > > declared cold, function local profile is within bounds). > > This seems like a good idea, except that I'm not sure it's what people really > want from -Os. With -Os, I think some users want small code, all the time, > period. Then they should not use attribute(hot) or profile feedback, period. Ciao, Michael. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-10 18:36 ` Michael Matz @ 2008-04-11 8:16 ` Mark Mitchell 2008-04-12 19:10 ` Hans-Peter Nilsson 0 siblings, 1 reply; 504+ messages in thread From: Mark Mitchell @ 2008-04-11 8:16 UTC (permalink / raw) To: Michael Matz; +Cc: Jan Hubicka, Richard Guenther, gcc-patches Michael Matz wrote: >>> and decide on hotness. With -Os defaulting to conservative behaviour >>> (ie function is hot only if attribute or profile feedback suggest so) >>> and -O2 defaulting to aggressive behaviour (function is hot if not >>> declared cold, function local profile is within bounds). >> This seems like a good idea, except that I'm not sure it's what people really >> want from -Os. With -Os, I think some users want small code, all the time, >> period. > > Then they should not use attribute(hot) or profile feedback, period. The issue I am raising is that __attribute((hot))__ is a property of the application, not of the system. So, the developer building the application might well mark something as "hot" because that's the inner loop of that application -- but the application as a whole might be very rarely used on the target system. There's no way for the developer of the application to know that, and there's no way for the system integration to know that __attribute__((hot))__ is in use, effectively wasting precious flash. Clearly, if this makes a 100MB application 100 bytes bigger, nobody cares. I am not sure if there is any issue here in practice. If the reality is that the total fraction of hot functions is very small, then it may be so small that we don't care. I certainly understand the idea of the attribute, and I think it's a good idea. I also think a mode where -Os honors that attribute (even at the expense of size) is a good idea. What I don't know is whether that's the right default behavior for -Os. I'd be interested in what others think. -- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-11 8:16 ` Mark Mitchell @ 2008-04-12 19:10 ` Hans-Peter Nilsson 0 siblings, 0 replies; 504+ messages in thread From: Hans-Peter Nilsson @ 2008-04-12 19:10 UTC (permalink / raw) To: Mark Mitchell; +Cc: gcc-patches On Fri, 11 Apr 2008, Mark Mitchell wrote: > I certainly understand the idea of the attribute, and I think it's a good > idea. I also think a mode where -Os honors that attribute (even at the > expense of size) is a good idea. Yes. > What I don't know is whether that's the > right default behavior for -Os. No, for one because the person/s writing the programs may be different (and with different views on where to add attr hot) from the ones that need to compile it, using the -Os option. > I'd be interested in what others think. As you suggested, I agree with using a separate -f, like -foptimize-hot-for-speed to enable that behaviour (but maybe having a shorter name). brgds, H-P ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-04-05 17:36 ` Richard Guenther 2008-04-05 20:39 ` Jan Hubicka @ 2008-08-29 22:15 ` Jan Hubicka 2008-08-30 19:06 ` Richard Guenther 1 sibling, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2008-08-29 22:15 UTC (permalink / raw) To: Richard Guenther; +Cc: Jan Hubicka, gcc-patches > On Sat, Apr 5, 2008 at 6:26 PM, Jan Hubicka <hubicka@ucw.cz> wrote: > > Hi, > > I would like to ping the BRANCH_COST patch > > http://gcc.gnu.org/ml/gcc/2008-03/msg00137.html > > > > I hope to proceed with updating GCC to optimize cold blocks in same way > > as -Os and explicitely marked hot functions in -Os code for speed. > > For this I need to populate RTL cost interfaces with the profile info > > and teach expansion about it. > > This is taking quite some years now, I realize it might not be clear > > what I am precisely shooting for, so I will also add wiki page. > > I think the patch makes sense (BRANCH_COST is special anyway compared to > other isns cost), but I'd like to see the bigger picture as well here. In > particular, BRANCH_COST (hot, predictable), why isn't that simply > BRANCH_COST (optimize_size_p, predictable) matching what I possibly > expect for the other cost interface (insn_cost (optimize_size_p, rtx)). Hi, with the optimize_*_for_speed_p predicates, this patch becomes cleaner now. I would also like to update other costs similar way so we can avoid the current way we switch optimize_size global variable. Bootstrapped/regtested i686-linux, OK? * optabs.c (expand_abs_nojump): Update BRANCH_COST call. * fold-cost.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop): Likewise. * dojump.c (do_jump): Likewise. * ifcvt.c (MAX_CONDITIONAL_EXECUTE): Likewise. (note-if_info): Add BRANCH_COST. (noce_try_store_flag_constants, noce_try_addcc, noce_try_store_flag_mask, noce_try_cmove_arith, noce_try_cmove_arith, noce_try_cmove_arith, noce_find_if_block, find_if_case_1, find_if_case_2): Use compuated branch cost. * expr.h (BRANCH_COST): Update default. * predict.c (predictable_edge_p): New function. * expmed.c (expand_smod_pow2, expand_sdiv_pow2, emit_store_flag): Update BRANCH_COST call. * basic-block.h (predictable_edge_p): Declare. * config/alpha/alpha.h (BRANCH_COST): Update. * config/frv/frv.h (BRANCH_COST): Update. * config/s390/s390.h (BRANCH_COST): Update. * config/spu/spu.h (BRANCH_COST): Update. * config/sparc/sparc.h (BRANCH_COST): Update. * config/m32r/m32r.h (BRANCH_COST): Update. * config/i386/i386.h (BRANCH_COST): Update. * config/i386/i386.c (ix86_expand_int_movcc): Update use of BRANCH_COST. * config/sh/sh.h (BRANCH_COST): Update. * config/pdp11/pdp11.h (BRANCH_COST): Update. * config/avr/avr.h (BRANCH_COST): Update. * config/crx/crx.h (BRANCH_COST): Update. * config/xtensa/xtensa.h (BRANCH_COST): Update. * config/stormy16/stormy16.h (BRANCH_COST): Update. * config/m68hc11/m68hc11.h (BRANCH_COST): Update. * config/iq2000/iq2000.h (BRANCH_COST): Update. * config/ia64/ia64.h (BRANCH_COST): Update. * config/rs6000/rs6000.h (BRANCH_COST): Update. * config/arc/arc.h (BRANCH_COST): Update. * config/score/score.h (BRANCH_COST): Update. * config/arm/arm.h (BRANCH_COST): Update. * config/pa/pa.h (BRANCH_COST): Update. * config/mips/mips.h (BRANCH_COST): Update. * config/vax/vax.h (BRANCH_COST): Update. * config/h8300/h8300.h (BRANCH_COST): Update. * params.def (PARAM_PREDICTABLE_BRANCH_OUTCOME): New. * doc/invoke.texi (predictable-branch-cost-outcome): Document. * doc/tm.texi (BRANCH_COST): Update. Index: doc/tm.texi =================================================================== *** doc/tm.texi (revision 139737) --- doc/tm.texi (working copy) *************** value to the result of that function. T *** 5874,5882 **** are the same as to this macro. @end defmac ! @defmac BRANCH_COST ! A C expression for the cost of a branch instruction. A value of 1 is ! the default; other values are interpreted relative to that. @end defmac Here are additional macros which do not specify precise relative costs, --- 5874,5887 ---- are the same as to this macro. @end defmac ! @defmac BRANCH_COST (@var{speed_p}, @var{predictable_p}) ! A C expression for the cost of a branch instruction. A value of 1 is the ! default; other values are interpreted relative to that. Parameter @var{speed_p} ! is true when the branch in question should be optimized for speed. When ! it is false, @code{BRANCH_COST} should be returning value optimal for code size ! rather then performance considerations. @var{predictable_p} is true for well ! predictable branches. On many architectures the @code{BRANCH_COST} can be ! reduced then. @end defmac Here are additional macros which do not specify precise relative costs, Index: doc/invoke.texi =================================================================== *** doc/invoke.texi (revision 139737) --- doc/invoke.texi (working copy) *************** to the hottest structure frequency in th *** 6905,6910 **** --- 6905,6914 ---- parameter, then structure reorganization is not applied to this structure. The default is 10. + @item predictable-branch-cost-outcome + When branch is predicted to be taken with probability lower than this threshold + (in percent), then it is considered well predictable. The default is 10. + @item max-crossjump-edges The maximum number of incoming edges to consider for crossjumping. The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in Index: optabs.c =================================================================== *** optabs.c (revision 139737) --- optabs.c (working copy) *************** expand_abs_nojump (enum machine_mode mod *** 3443,3449 **** value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)), where W is the width of MODE. */ ! if (GET_MODE_CLASS (mode) == MODE_INT && BRANCH_COST >= 2) { rtx extended = expand_shift (RSHIFT_EXPR, mode, op0, size_int (GET_MODE_BITSIZE (mode) - 1), --- 3443,3451 ---- value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)), where W is the width of MODE. */ ! if (GET_MODE_CLASS (mode) == MODE_INT ! && BRANCH_COST (optimize_insn_for_speed_p (), ! false) >= 2) { rtx extended = expand_shift (RSHIFT_EXPR, mode, op0, size_int (GET_MODE_BITSIZE (mode) - 1), Index: fold-const.c =================================================================== *** fold-const.c (revision 139737) --- fold-const.c (working copy) *************** fold_cond_expr_with_comparison (tree typ *** 5109,5115 **** \f #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT ! #define LOGICAL_OP_NON_SHORT_CIRCUIT (BRANCH_COST >= 2) #endif /* EXP is some logical combination of boolean tests. See if we can --- 5109,5117 ---- \f #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT ! #define LOGICAL_OP_NON_SHORT_CIRCUIT \ ! (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), \ ! false) >= 2) #endif /* EXP is some logical combination of boolean tests. See if we can *************** fold_truthop (enum tree_code code, tree *** 5357,5363 **** that can be merged. Avoid doing this if the RHS is a floating-point comparison since those can trap. */ ! if (BRANCH_COST >= 2 && ! FLOAT_TYPE_P (TREE_TYPE (rl_arg)) && simple_operand_p (rl_arg) && simple_operand_p (rr_arg)) --- 5359,5366 ---- that can be merged. Avoid doing this if the RHS is a floating-point comparison since those can trap. */ ! if (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), ! false) >= 2 && ! FLOAT_TYPE_P (TREE_TYPE (rl_arg)) && simple_operand_p (rl_arg) && simple_operand_p (rr_arg)) Index: dojump.c =================================================================== *** dojump.c (revision 139737) --- dojump.c (working copy) *************** do_jump (tree exp, rtx if_false_label, r *** 510,516 **** /* High branch cost, expand as the bitwise AND of the conditions. Do the same if the RHS has side effects, because we're effectively turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */ ! if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) goto normal; case TRUTH_ANDIF_EXPR: --- 510,518 ---- /* High branch cost, expand as the bitwise AND of the conditions. Do the same if the RHS has side effects, because we're effectively turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */ ! if (BRANCH_COST (optimize_insn_for_speed_p (), ! false) >= 4 ! || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) goto normal; case TRUTH_ANDIF_EXPR: *************** do_jump (tree exp, rtx if_false_label, r *** 531,537 **** /* High branch cost, expand as the bitwise OR of the conditions. Do the same if the RHS has side effects, because we're effectively turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ ! if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) goto normal; case TRUTH_ORIF_EXPR: --- 533,540 ---- /* High branch cost, expand as the bitwise OR of the conditions. Do the same if the RHS has side effects, because we're effectively turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ ! if (BRANCH_COST (optimize_insn_for_speed_p (), false)>= 4 ! || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) goto normal; case TRUTH_ORIF_EXPR: Index: ifcvt.c =================================================================== *** ifcvt.c (revision 139737) --- ifcvt.c (working copy) *************** *** 67,73 **** #endif #ifndef MAX_CONDITIONAL_EXECUTE ! #define MAX_CONDITIONAL_EXECUTE (BRANCH_COST + 1) #endif #define IFCVT_MULTIPLE_DUMPS 1 --- 67,75 ---- #endif #ifndef MAX_CONDITIONAL_EXECUTE ! #define MAX_CONDITIONAL_EXECUTE \ ! (BRANCH_COST (optimize_function_for_speed_p (cfun), false) \ ! + 1) #endif #define IFCVT_MULTIPLE_DUMPS 1 *************** struct noce_if_info *** 626,631 **** --- 628,636 ---- from TEST_BB. For the noce transformations, we allow the symmetric form as well. */ bool then_else_reversed; + + /* Estimated cost of the particular branch instruction. */ + int branch_cost; }; static rtx noce_emit_store_flag (struct noce_if_info *, rtx, int, int); *************** noce_try_store_flag_constants (struct no *** 963,982 **** normalize = 0; else if (ifalse == 0 && exact_log2 (itrue) >= 0 && (STORE_FLAG_VALUE == 1 ! || BRANCH_COST >= 2)) normalize = 1; else if (itrue == 0 && exact_log2 (ifalse) >= 0 && can_reverse ! && (STORE_FLAG_VALUE == 1 || BRANCH_COST >= 2)) normalize = 1, reversep = 1; else if (itrue == -1 && (STORE_FLAG_VALUE == -1 ! || BRANCH_COST >= 2)) normalize = -1; else if (ifalse == -1 && can_reverse ! && (STORE_FLAG_VALUE == -1 || BRANCH_COST >= 2)) normalize = -1, reversep = 1; ! else if ((BRANCH_COST >= 2 && STORE_FLAG_VALUE == -1) ! || BRANCH_COST >= 3) normalize = -1; else return FALSE; --- 968,987 ---- normalize = 0; else if (ifalse == 0 && exact_log2 (itrue) >= 0 && (STORE_FLAG_VALUE == 1 ! || if_info->branch_cost >= 2)) normalize = 1; else if (itrue == 0 && exact_log2 (ifalse) >= 0 && can_reverse ! && (STORE_FLAG_VALUE == 1 || if_info->branch_cost >= 2)) normalize = 1, reversep = 1; else if (itrue == -1 && (STORE_FLAG_VALUE == -1 ! || if_info->branch_cost >= 2)) normalize = -1; else if (ifalse == -1 && can_reverse ! && (STORE_FLAG_VALUE == -1 || if_info->branch_cost >= 2)) normalize = -1, reversep = 1; ! else if ((if_info->branch_cost >= 2 && STORE_FLAG_VALUE == -1) ! || if_info->branch_cost >= 3) normalize = -1; else return FALSE; *************** noce_try_addcc (struct noce_if_info *if_ *** 1107,1113 **** /* If that fails, construct conditional increment or decrement using setcc. */ ! if (BRANCH_COST >= 2 && (XEXP (if_info->a, 1) == const1_rtx || XEXP (if_info->a, 1) == constm1_rtx)) { --- 1112,1118 ---- /* If that fails, construct conditional increment or decrement using setcc. */ ! if (if_info->branch_cost >= 2 && (XEXP (if_info->a, 1) == const1_rtx || XEXP (if_info->a, 1) == constm1_rtx)) { *************** noce_try_store_flag_mask (struct noce_if *** 1158,1164 **** int reversep; reversep = 0; ! if ((BRANCH_COST >= 2 || STORE_FLAG_VALUE == -1) && ((if_info->a == const0_rtx && rtx_equal_p (if_info->b, if_info->x)) --- 1163,1169 ---- int reversep; reversep = 0; ! if ((if_info->branch_cost >= 2 || STORE_FLAG_VALUE == -1) && ((if_info->a == const0_rtx && rtx_equal_p (if_info->b, if_info->x)) *************** noce_try_cmove_arith (struct noce_if_inf *** 1317,1323 **** /* ??? FIXME: Magic number 5. */ if (cse_not_expected && MEM_P (a) && MEM_P (b) ! && BRANCH_COST >= 5) { a = XEXP (a, 0); b = XEXP (b, 0); --- 1322,1328 ---- /* ??? FIXME: Magic number 5. */ if (cse_not_expected && MEM_P (a) && MEM_P (b) ! && if_info->branch_cost >= 5) { a = XEXP (a, 0); b = XEXP (b, 0); *************** noce_try_cmove_arith (struct noce_if_inf *** 1347,1353 **** if (insn_a) { insn_cost = insn_rtx_cost (PATTERN (insn_a)); ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (BRANCH_COST)) return FALSE; } else --- 1352,1358 ---- if (insn_a) { insn_cost = insn_rtx_cost (PATTERN (insn_a)); ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (if_info->branch_cost)) return FALSE; } else *************** noce_try_cmove_arith (struct noce_if_inf *** 1356,1362 **** if (insn_b) { insn_cost += insn_rtx_cost (PATTERN (insn_b)); ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (BRANCH_COST)) return FALSE; } --- 1361,1367 ---- if (insn_b) { insn_cost += insn_rtx_cost (PATTERN (insn_b)); ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (if_info->branch_cost)) return FALSE; } *************** noce_find_if_block (basic_block test_bb, *** 2831,2836 **** --- 2836,2843 ---- if_info.cond_earliest = cond_earliest; if_info.jump = jump; if_info.then_else_reversed = then_else_reversed; + if_info.branch_cost = BRANCH_COST (optimize_bb_for_speed_p (test_bb), + predictable_edge_p (then_edge)); /* Do the real work. */ *************** find_if_case_1 (basic_block test_bb, edg *** 3597,3603 **** test_bb->index, then_bb->index); /* THEN is small. */ ! if (! cheap_bb_rtx_cost_p (then_bb, COSTS_N_INSNS (BRANCH_COST))) return FALSE; /* Registers set are dead, or are predicable. */ --- 3604,3612 ---- test_bb->index, then_bb->index); /* THEN is small. */ ! if (! cheap_bb_rtx_cost_p (then_bb, ! COSTS_N_INSNS (BRANCH_COST (optimize_bb_for_speed_p (then_edge->src), ! predictable_edge_p (then_edge))))) return FALSE; /* Registers set are dead, or are predicable. */ *************** find_if_case_2 (basic_block test_bb, edg *** 3711,3717 **** test_bb->index, else_bb->index); /* ELSE is small. */ ! if (! cheap_bb_rtx_cost_p (else_bb, COSTS_N_INSNS (BRANCH_COST))) return FALSE; /* Registers set are dead, or are predicable. */ --- 3720,3728 ---- test_bb->index, else_bb->index); /* ELSE is small. */ ! if (! cheap_bb_rtx_cost_p (else_bb, ! COSTS_N_INSNS (BRANCH_COST (optimize_bb_for_speed_p (else_edge->src), ! predictable_edge_p (else_edge))))) return FALSE; /* Registers set are dead, or are predicable. */ Index: expr.h =================================================================== *** expr.h (revision 139737) --- expr.h (working copy) *************** along with GCC; see the file COPYING3. *** 36,42 **** /* The default branch cost is 1. */ #ifndef BRANCH_COST ! #define BRANCH_COST 1 #endif /* This is the 4th arg to `expand_expr'. --- 36,42 ---- /* The default branch cost is 1. */ #ifndef BRANCH_COST ! #define BRANCH_COST(speed_p, predictable_p) 1 #endif /* This is the 4th arg to `expand_expr'. Index: predict.c =================================================================== *** predict.c (revision 139737) --- predict.c (working copy) *************** optimize_insn_for_speed_p (void) *** 245,250 **** --- 245,267 ---- return !optimize_insn_for_size_p (); } + /* Return true when edge E is likely to be well predictable by branch + predictor. */ + + bool + predictable_edge_p (edge e) + { + if (profile_status == PROFILE_ABSENT) + return false; + if ((e->probability + <= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100) + || (REG_BR_PROB_BASE - e->probability + <= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100)) + return true; + return false; + } + + /* Set RTL expansion for BB profile. */ void Index: expmed.c =================================================================== *** expmed.c (revision 139737) --- expmed.c (working copy) *************** expand_smod_pow2 (enum machine_mode mode *** 3492,3498 **** result = gen_reg_rtx (mode); /* Avoid conditional branches when they're expensive. */ ! if (BRANCH_COST >= 2 && optimize_insn_for_speed_p ()) { rtx signmask = emit_store_flag (result, LT, op0, const0_rtx, --- 3492,3498 ---- result = gen_reg_rtx (mode); /* Avoid conditional branches when they're expensive. */ ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) >= 2 && optimize_insn_for_speed_p ()) { rtx signmask = emit_store_flag (result, LT, op0, const0_rtx, *************** expand_sdiv_pow2 (enum machine_mode mode *** 3592,3598 **** logd = floor_log2 (d); shift = build_int_cst (NULL_TREE, logd); ! if (d == 2 && BRANCH_COST >= 1) { temp = gen_reg_rtx (mode); temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1); --- 3592,3600 ---- logd = floor_log2 (d); shift = build_int_cst (NULL_TREE, logd); ! if (d == 2 ! && BRANCH_COST (optimize_insn_for_speed_p (), ! false) >= 1) { temp = gen_reg_rtx (mode); temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1); *************** expand_sdiv_pow2 (enum machine_mode mode *** 3602,3608 **** } #ifdef HAVE_conditional_move ! if (BRANCH_COST >= 2) { rtx temp2; --- 3604,3611 ---- } #ifdef HAVE_conditional_move ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) ! >= 2) { rtx temp2; *************** expand_sdiv_pow2 (enum machine_mode mode *** 3631,3637 **** } #endif ! if (BRANCH_COST >= 2) { int ushift = GET_MODE_BITSIZE (mode) - logd; --- 3634,3641 ---- } #endif ! if (BRANCH_COST (optimize_insn_for_speed_p (), ! false) >= 2) { int ushift = GET_MODE_BITSIZE (mode) - logd; *************** emit_store_flag (rtx target, enum rtx_co *** 5345,5351 **** comparison with zero. Don't do any of these cases if branches are very cheap. */ ! if (BRANCH_COST > 0 && GET_MODE_CLASS (mode) == MODE_INT && (code == EQ || code == NE) && op1 != const0_rtx) { --- 5349,5356 ---- comparison with zero. Don't do any of these cases if branches are very cheap. */ ! if (BRANCH_COST (optimize_insn_for_speed_p (), ! false) > 0 && GET_MODE_CLASS (mode) == MODE_INT && (code == EQ || code == NE) && op1 != const0_rtx) { *************** emit_store_flag (rtx target, enum rtx_co *** 5368,5377 **** do LE and GT if branches are expensive since they are expensive on 2-operand machines. */ ! if (BRANCH_COST == 0 || GET_MODE_CLASS (mode) != MODE_INT || op1 != const0_rtx || (code != EQ && code != NE ! && (BRANCH_COST <= 1 || (code != LE && code != GT)))) return 0; /* See what we need to return. We can only return a 1, -1, or the --- 5373,5384 ---- do LE and GT if branches are expensive since they are expensive on 2-operand machines. */ ! if (BRANCH_COST (optimize_insn_for_speed_p (), ! false) == 0 || GET_MODE_CLASS (mode) != MODE_INT || op1 != const0_rtx || (code != EQ && code != NE ! && (BRANCH_COST (optimize_insn_for_speed_p (), ! false) <= 1 || (code != LE && code != GT)))) return 0; /* See what we need to return. We can only return a 1, -1, or the *************** emit_store_flag (rtx target, enum rtx_co *** 5467,5473 **** that "or", which is an extra insn, so we only handle EQ if branches are expensive. */ ! if (tem == 0 && (code == NE || BRANCH_COST > 1)) { if (rtx_equal_p (subtarget, op0)) subtarget = 0; --- 5474,5483 ---- that "or", which is an extra insn, so we only handle EQ if branches are expensive. */ ! if (tem == 0 ! && (code == NE ! || BRANCH_COST (optimize_insn_for_speed_p (), ! false) > 1)) { if (rtx_equal_p (subtarget, op0)) subtarget = 0; Index: basic-block.h =================================================================== *** basic-block.h (revision 139737) --- basic-block.h (working copy) *************** extern void guess_outgoing_edge_probabil *** 848,853 **** --- 848,854 ---- extern void remove_predictions_associated_with_edge (edge); extern bool edge_probability_reliable_p (const_edge); extern bool br_prob_note_reliable_p (const_rtx); + extern bool predictable_edge_p (edge); /* In cfg.c */ extern void dump_regset (regset, FILE *); Index: config/alpha/alpha.h =================================================================== *** config/alpha/alpha.h (revision 139737) --- config/alpha/alpha.h (working copy) *************** extern int alpha_memory_latency; *** 640,646 **** #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) /* Provide the cost of a branch. Exact meaning under development. */ ! #define BRANCH_COST 5 \f /* Stack layout; function entry, exit and calling. */ --- 640,646 ---- #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) /* Provide the cost of a branch. Exact meaning under development. */ ! #define BRANCH_COST(speed_p, predictable_p) 5 \f /* Stack layout; function entry, exit and calling. */ Index: config/frv/frv.h =================================================================== *** config/frv/frv.h (revision 139737) --- config/frv/frv.h (working copy) *************** do { \ *** 2193,2199 **** /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST frv_branch_cost_int /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a --- 2193,2199 ---- /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST(speed_p, predictable_p) frv_branch_cost_int /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a Index: config/s390/s390.h =================================================================== *** config/s390/s390.h (revision 139737) --- config/s390/s390.h (working copy) *************** extern struct rtx_def *s390_compare_op0, *** 828,834 **** /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST 1 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 --- 828,834 ---- /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST(speed_p, predictable_p) 1 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 Index: config/spu/spu.h =================================================================== *** config/spu/spu.h (revision 139737) --- config/spu/spu.h (working copy) *************** targetm.resolve_overloaded_builtin = spu *** 434,440 **** \f /* Costs */ ! #define BRANCH_COST spu_branch_cost #define SLOW_BYTE_ACCESS 0 --- 434,440 ---- \f /* Costs */ ! #define BRANCH_COST(speed_p, predictable_p) spu_branch_cost #define SLOW_BYTE_ACCESS 0 Index: config/sparc/sparc.h =================================================================== *** config/sparc/sparc.h (revision 139737) --- config/sparc/sparc.h (working copy) *************** do { *** 2196,2202 **** On Niagara-2, a not-taken branch costs 1 cycle whereas a taken branch costs 6 cycles. */ ! #define BRANCH_COST \ ((sparc_cpu == PROCESSOR_V9 \ || sparc_cpu == PROCESSOR_ULTRASPARC) \ ? 7 \ --- 2196,2202 ---- On Niagara-2, a not-taken branch costs 1 cycle whereas a taken branch costs 6 cycles. */ ! #define BRANCH_COST (speed_p, predictable_p) \ ((sparc_cpu == PROCESSOR_V9 \ || sparc_cpu == PROCESSOR_ULTRASPARC) \ ? 7 \ Index: config/m32r/m32r.h =================================================================== *** config/m32r/m32r.h (revision 139737) --- config/m32r/m32r.h (working copy) *************** L2: .word STATIC *** 1224,1230 **** /* A value of 2 here causes GCC to avoid using branches in comparisons like while (a < N && a). Branches aren't that expensive on the M32R so we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */ ! #define BRANCH_COST ((TARGET_BRANCH_COST) ? 2 : 1) /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no --- 1224,1230 ---- /* A value of 2 here causes GCC to avoid using branches in comparisons like while (a < N && a). Branches aren't that expensive on the M32R so we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */ ! #define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1) /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no Index: config/i386/i386.h =================================================================== *** config/i386/i386.h (revision 139737) --- config/i386/i386.h (working copy) *************** do { \ *** 1975,1981 **** /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST ix86_branch_cost /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no --- 1975,1982 ---- /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST(speed_p, predictable_p) \ ! (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost) /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no Index: config/i386/i386.c =================================================================== *** config/i386/i386.c (revision 139737) --- config/i386/i386.c (working copy) *************** ix86_expand_int_movcc (rtx operands[]) *** 14636,14642 **** */ if ((!TARGET_CMOVE || (mode == QImode && TARGET_PARTIAL_REG_STALL)) ! && BRANCH_COST >= 2) { if (cf == 0) { --- 14636,14643 ---- */ if ((!TARGET_CMOVE || (mode == QImode && TARGET_PARTIAL_REG_STALL)) ! && BRANCH_COST (optimize_insn_for_speed_p (), ! false) >= 2) { if (cf == 0) { *************** ix86_expand_int_movcc (rtx operands[]) *** 14721,14727 **** optab op; rtx var, orig_out, out, tmp; ! if (BRANCH_COST <= 2) return 0; /* FAIL */ /* If one of the two operands is an interesting constant, load a --- 14722,14728 ---- optab op; rtx var, orig_out, out, tmp; ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) <= 2) return 0; /* FAIL */ /* If one of the two operands is an interesting constant, load a Index: config/sh/sh.h =================================================================== *** config/sh/sh.h (revision 139737) --- config/sh/sh.h (working copy) *************** struct sh_args { *** 2847,2853 **** The SH1 does not have delay slots, hence we get a pipeline stall at every branch. The SH4 is superscalar, so the single delay slot is not sufficient to keep both pipelines filled. */ ! #define BRANCH_COST (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) \f /* Assembler output control. */ --- 2847,2854 ---- The SH1 does not have delay slots, hence we get a pipeline stall at every branch. The SH4 is superscalar, so the single delay slot is not sufficient to keep both pipelines filled. */ ! #define BRANCH_COST(speed_p, predictable_p) \ ! (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) \f /* Assembler output control. */ Index: config/pdp11/pdp11.h =================================================================== *** config/pdp11/pdp11.h (revision 139737) --- config/pdp11/pdp11.h (working copy) *************** JMP FUNCTION 0x0058 0x0000 <- FUNCTION *** 1057,1063 **** /* there is no point in avoiding branches on a pdp, since branches are really cheap - I just want to find out how much difference the BRANCH_COST macro makes in code */ ! #define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1) #define COMPARE_FLAG_MODE HImode --- 1057,1063 ---- /* there is no point in avoiding branches on a pdp, since branches are really cheap - I just want to find out how much difference the BRANCH_COST macro makes in code */ ! #define BRANCH_COST(speed_p, predictable_p) (TARGET_BRANCH_CHEAP ? 0 : 1) #define COMPARE_FLAG_MODE HImode Index: config/avr/avr.h =================================================================== *** config/avr/avr.h (revision 139737) --- config/avr/avr.h (working copy) *************** do { \ *** 511,517 **** (MODE)==SImode ? 8 : \ (MODE)==SFmode ? 8 : 16) ! #define BRANCH_COST 0 #define SLOW_BYTE_ACCESS 0 --- 511,517 ---- (MODE)==SImode ? 8 : \ (MODE)==SFmode ? 8 : 16) ! #define BRANCH_COST(speed_p, predictable_p) 0 #define SLOW_BYTE_ACCESS 0 Index: config/crx/crx.h =================================================================== *** config/crx/crx.h (revision 139737) --- config/crx/crx.h (working copy) *************** struct cumulative_args *** 420,426 **** /* Moving to processor register flushes pipeline - thus asymmetric */ #define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2) /* Assume best case (branch predicted) */ ! #define BRANCH_COST 2 #define SLOW_BYTE_ACCESS 1 --- 420,426 ---- /* Moving to processor register flushes pipeline - thus asymmetric */ #define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2) /* Assume best case (branch predicted) */ ! #define BRANCH_COST(speed_p, predictable_p) 2 #define SLOW_BYTE_ACCESS 1 Index: config/xtensa/xtensa.h =================================================================== *** config/xtensa/xtensa.h (revision 139737) --- config/xtensa/xtensa.h (working copy) *************** typedef struct xtensa_args *** 882,888 **** #define MEMORY_MOVE_COST(MODE, CLASS, IN) 4 ! #define BRANCH_COST 3 /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ --- 882,888 ---- #define MEMORY_MOVE_COST(MODE, CLASS, IN) 4 ! #define BRANCH_COST(speed_p, predictable_p) 3 /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ Index: config/stormy16/stormy16.h =================================================================== *** config/stormy16/stormy16.h (revision 139737) --- config/stormy16/stormy16.h (working copy) *************** do { \ *** 587,593 **** #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) ! #define BRANCH_COST 5 #define SLOW_BYTE_ACCESS 0 --- 587,593 ---- #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) ! #define BRANCH_COST(speed_p, predictable_p) 5 #define SLOW_BYTE_ACCESS 0 Index: config/m68hc11/m68hc11.h =================================================================== *** config/m68hc11/m68hc11.h (revision 139737) --- config/m68hc11/m68hc11.h (working copy) *************** extern unsigned char m68hc11_reg_valid_f *** 1266,1272 **** Pretend branches are cheap because GCC generates sub-optimal code for the default value. */ ! #define BRANCH_COST 0 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 0 --- 1266,1272 ---- Pretend branches are cheap because GCC generates sub-optimal code for the default value. */ ! #define BRANCH_COST(speed_p, predictable_p) 0 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 0 Index: config/iq2000/iq2000.h =================================================================== *** config/iq2000/iq2000.h (revision 139737) --- config/iq2000/iq2000.h (working copy) *************** typedef struct iq2000_args *** 624,630 **** #define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \ (TO_P ? 2 : 16) ! #define BRANCH_COST 2 #define SLOW_BYTE_ACCESS 1 --- 624,630 ---- #define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \ (TO_P ? 2 : 16) ! #define BRANCH_COST(speed_p, predictable_p) 2 #define SLOW_BYTE_ACCESS 1 Index: config/ia64/ia64.h =================================================================== *** config/ia64/ia64.h (revision 139737) --- config/ia64/ia64.h (working copy) *************** do { \ *** 1384,1390 **** many additional insn groups we run into, vs how good the dynamic branch predictor is. */ ! #define BRANCH_COST 6 /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a --- 1384,1390 ---- many additional insn groups we run into, vs how good the dynamic branch predictor is. */ ! #define BRANCH_COST(speed_p, predictable_p) 6 /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a Index: config/rs6000/rs6000.h =================================================================== *** config/rs6000/rs6000.h (revision 139737) --- config/rs6000/rs6000.h (working copy) *************** extern enum rs6000_nop_insertion rs6000_ *** 967,973 **** Set this to 3 on the RS/6000 since that is roughly the average cost of an unscheduled conditional branch. */ ! #define BRANCH_COST 3 /* Override BRANCH_COST heuristic which empirically produces worse performance for removing short circuiting from the logical ops. */ --- 967,973 ---- Set this to 3 on the RS/6000 since that is roughly the average cost of an unscheduled conditional branch. */ ! #define BRANCH_COST(speed_p, predictable_p) 3 /* Override BRANCH_COST heuristic which empirically produces worse performance for removing short circuiting from the logical ops. */ Index: config/arc/arc.h =================================================================== *** config/arc/arc.h (revision 139737) --- config/arc/arc.h (working copy) *************** arc_select_cc_mode (OP, X, Y) *** 824,830 **** /* The cost of a branch insn. */ /* ??? What's the right value here? Branches are certainly more expensive than reg->reg moves. */ ! #define BRANCH_COST 2 /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no --- 824,830 ---- /* The cost of a branch insn. */ /* ??? What's the right value here? Branches are certainly more expensive than reg->reg moves. */ ! #define BRANCH_COST(speed_p, predictable_p) 2 /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no Index: config/score/score.h =================================================================== *** config/score/score.h (revision 139737) --- config/score/score.h (working copy) *************** typedef struct score_args *** 793,799 **** (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) /* Try to generate sequences that don't involve branches. */ ! #define BRANCH_COST 2 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 --- 793,799 ---- (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) /* Try to generate sequences that don't involve branches. */ ! #define BRANCH_COST(speed_p, predictable_p) 2 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 Index: config/arm/arm.h =================================================================== *** config/arm/arm.h (revision 139737) --- config/arm/arm.h (working copy) *************** do { \ *** 2297,2303 **** /* Try to generate sequences that don't involve branches, we can then use conditional instructions */ ! #define BRANCH_COST \ (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) \f /* Position Independent Code. */ --- 2297,2303 ---- /* Try to generate sequences that don't involve branches, we can then use conditional instructions */ ! #define BRANCH_COST(speed_p, predictable_p) \ (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) \f /* Position Independent Code. */ Index: config/pa/pa.h =================================================================== *** config/pa/pa.h (revision 139737) --- config/pa/pa.h (working copy) *************** do { \ *** 1570,1576 **** : 2) /* Adjust the cost of branches. */ ! #define BRANCH_COST (pa_cpu == PROCESSOR_8000 ? 2 : 1) /* Handling the special cases is going to get too complicated for a macro, just call `pa_adjust_insn_length' to do the real work. */ --- 1570,1576 ---- : 2) /* Adjust the cost of branches. */ ! #define BRANCH_COST(speed_p, predictable_p) (pa_cpu == PROCESSOR_8000 ? 2 : 1) /* Handling the special cases is going to get too complicated for a macro, just call `pa_adjust_insn_length' to do the real work. */ Index: config/mips/mips.h =================================================================== *** config/mips/mips.h (revision 139737) --- config/mips/mips.h (working copy) *************** typedef struct mips_args { *** 2551,2557 **** /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST mips_branch_cost #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 /* If defined, modifies the length assigned to instruction INSN as a --- 2551,2557 ---- /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ ! #define BRANCH_COST(speed_p, predictable_p) mips_branch_cost #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 /* If defined, modifies the length assigned to instruction INSN as a Index: config/vax/vax.h =================================================================== *** config/vax/vax.h (revision 139737) --- config/vax/vax.h (working copy) *************** enum reg_class { NO_REGS, ALL_REGS, LIM_ *** 648,654 **** Branches are extremely cheap on the VAX while the shift insns often used to replace branches can be expensive. */ ! #define BRANCH_COST 0 \f /* Tell final.c how to eliminate redundant test instructions. */ --- 648,654 ---- Branches are extremely cheap on the VAX while the shift insns often used to replace branches can be expensive. */ ! #define BRANCH_COST(speed_p, predictable_p) 0 \f /* Tell final.c how to eliminate redundant test instructions. */ Index: config/h8300/h8300.h =================================================================== *** config/h8300/h8300.h (revision 139737) --- config/h8300/h8300.h (working copy) *************** struct cum_arg *** 1004,1010 **** #define DELAY_SLOT_LENGTH(JUMP) \ (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2) ! #define BRANCH_COST 0 /* Tell final.c how to eliminate redundant test instructions. */ --- 1004,1010 ---- #define DELAY_SLOT_LENGTH(JUMP) \ (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2) ! #define BRANCH_COST(speed_p, predictable_p) 0 /* Tell final.c how to eliminate redundant test instructions. */ Index: params.def =================================================================== *** params.def (revision 139737) --- params.def (working copy) *************** DEFPARAM (PARAM_STRUCT_REORG_COLD_STRUCT *** 78,83 **** --- 78,90 ---- "The threshold ratio between current and hottest structure counts", 10, 0, 100) + /* When branch is predicted to be taken with probability lower than this + threshold (in percent), then it is considered well predictable. */ + DEFPARAM (PARAM_PREDICTABLE_BRANCH_OUTCOME, + "predictable-branch-outcome", + "Maximal esitmated outcome of branch considered predictable", + 2, 0, 50) + /* The single function inlining limit. This is the maximum size of a function counted in internal gcc instructions (not in real machine instructions) that is eligible for inlining ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-08-29 22:15 ` Jan Hubicka @ 2008-08-30 19:06 ` Richard Guenther 2008-09-02 14:38 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Richard Guenther @ 2008-08-30 19:06 UTC (permalink / raw) To: Jan Hubicka; +Cc: gcc-patches On Thu, Aug 28, 2008 at 10:32 PM, Jan Hubicka <hubicka@ucw.cz> wrote: >> On Sat, Apr 5, 2008 at 6:26 PM, Jan Hubicka <hubicka@ucw.cz> wrote: >> > Hi, >> > I would like to ping the BRANCH_COST patch >> > http://gcc.gnu.org/ml/gcc/2008-03/msg00137.html >> > >> > I hope to proceed with updating GCC to optimize cold blocks in same way >> > as -Os and explicitely marked hot functions in -Os code for speed. >> > For this I need to populate RTL cost interfaces with the profile info >> > and teach expansion about it. >> > This is taking quite some years now, I realize it might not be clear >> > what I am precisely shooting for, so I will also add wiki page. >> >> I think the patch makes sense (BRANCH_COST is special anyway compared to >> other isns cost), but I'd like to see the bigger picture as well here. In >> particular, BRANCH_COST (hot, predictable), why isn't that simply >> BRANCH_COST (optimize_size_p, predictable) matching what I possibly >> expect for the other cost interface (insn_cost (optimize_size_p, rtx)). > > Hi, > with the optimize_*_for_speed_p predicates, this patch becomes cleaner > now. I would also like to update other costs similar way so we can > avoid the current way we switch optimize_size global variable. > > Bootstrapped/regtested i686-linux, OK? It looks ok, but I think that PARAM_PREDICTABLE_BRANCH_OUTCOME should be a target macro and not a param. Ok with that change, but please wait 24h to let others comment. Thanks, Richard. > * optabs.c (expand_abs_nojump): Update BRANCH_COST call. > * fold-cost.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop): Likewise. > * dojump.c (do_jump): Likewise. > * ifcvt.c (MAX_CONDITIONAL_EXECUTE): Likewise. > (note-if_info): Add BRANCH_COST. > (noce_try_store_flag_constants, noce_try_addcc, noce_try_store_flag_mask, > noce_try_cmove_arith, noce_try_cmove_arith, noce_try_cmove_arith, > noce_find_if_block, find_if_case_1, find_if_case_2): Use compuated > branch cost. > * expr.h (BRANCH_COST): Update default. > * predict.c (predictable_edge_p): New function. > * expmed.c (expand_smod_pow2, expand_sdiv_pow2, emit_store_flag): > Update BRANCH_COST call. > * basic-block.h (predictable_edge_p): Declare. > * config/alpha/alpha.h (BRANCH_COST): Update. > * config/frv/frv.h (BRANCH_COST): Update. > * config/s390/s390.h (BRANCH_COST): Update. > * config/spu/spu.h (BRANCH_COST): Update. > * config/sparc/sparc.h (BRANCH_COST): Update. > * config/m32r/m32r.h (BRANCH_COST): Update. > * config/i386/i386.h (BRANCH_COST): Update. > * config/i386/i386.c (ix86_expand_int_movcc): Update use of BRANCH_COST. > * config/sh/sh.h (BRANCH_COST): Update. > * config/pdp11/pdp11.h (BRANCH_COST): Update. > * config/avr/avr.h (BRANCH_COST): Update. > * config/crx/crx.h (BRANCH_COST): Update. > * config/xtensa/xtensa.h (BRANCH_COST): Update. > * config/stormy16/stormy16.h (BRANCH_COST): Update. > * config/m68hc11/m68hc11.h (BRANCH_COST): Update. > * config/iq2000/iq2000.h (BRANCH_COST): Update. > * config/ia64/ia64.h (BRANCH_COST): Update. > * config/rs6000/rs6000.h (BRANCH_COST): Update. > * config/arc/arc.h (BRANCH_COST): Update. > * config/score/score.h (BRANCH_COST): Update. > * config/arm/arm.h (BRANCH_COST): Update. > * config/pa/pa.h (BRANCH_COST): Update. > * config/mips/mips.h (BRANCH_COST): Update. > * config/vax/vax.h (BRANCH_COST): Update. > * config/h8300/h8300.h (BRANCH_COST): Update. > * params.def (PARAM_PREDICTABLE_BRANCH_OUTCOME): New. > * doc/invoke.texi (predictable-branch-cost-outcome): Document. > * doc/tm.texi (BRANCH_COST): Update. > Index: doc/tm.texi > =================================================================== > *** doc/tm.texi (revision 139737) > --- doc/tm.texi (working copy) > *************** value to the result of that function. T > *** 5874,5882 **** > are the same as to this macro. > @end defmac > > ! @defmac BRANCH_COST > ! A C expression for the cost of a branch instruction. A value of 1 is > ! the default; other values are interpreted relative to that. > @end defmac > > Here are additional macros which do not specify precise relative costs, > --- 5874,5887 ---- > are the same as to this macro. > @end defmac > > ! @defmac BRANCH_COST (@var{speed_p}, @var{predictable_p}) > ! A C expression for the cost of a branch instruction. A value of 1 is the > ! default; other values are interpreted relative to that. Parameter @var{speed_p} > ! is true when the branch in question should be optimized for speed. When > ! it is false, @code{BRANCH_COST} should be returning value optimal for code size > ! rather then performance considerations. @var{predictable_p} is true for well > ! predictable branches. On many architectures the @code{BRANCH_COST} can be > ! reduced then. > @end defmac > > Here are additional macros which do not specify precise relative costs, > Index: doc/invoke.texi > =================================================================== > *** doc/invoke.texi (revision 139737) > --- doc/invoke.texi (working copy) > *************** to the hottest structure frequency in th > *** 6905,6910 **** > --- 6905,6914 ---- > parameter, then structure reorganization is not applied to this structure. > The default is 10. > > + @item predictable-branch-cost-outcome > + When branch is predicted to be taken with probability lower than this threshold > + (in percent), then it is considered well predictable. The default is 10. > + > @item max-crossjump-edges > The maximum number of incoming edges to consider for crossjumping. > The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in > Index: optabs.c > =================================================================== > *** optabs.c (revision 139737) > --- optabs.c (working copy) > *************** expand_abs_nojump (enum machine_mode mod > *** 3443,3449 **** > value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)), > where W is the width of MODE. */ > > ! if (GET_MODE_CLASS (mode) == MODE_INT && BRANCH_COST >= 2) > { > rtx extended = expand_shift (RSHIFT_EXPR, mode, op0, > size_int (GET_MODE_BITSIZE (mode) - 1), > --- 3443,3451 ---- > value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)), > where W is the width of MODE. */ > > ! if (GET_MODE_CLASS (mode) == MODE_INT > ! && BRANCH_COST (optimize_insn_for_speed_p (), > ! false) >= 2) > { > rtx extended = expand_shift (RSHIFT_EXPR, mode, op0, > size_int (GET_MODE_BITSIZE (mode) - 1), > Index: fold-const.c > =================================================================== > *** fold-const.c (revision 139737) > --- fold-const.c (working copy) > *************** fold_cond_expr_with_comparison (tree typ > *** 5109,5115 **** > > > #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT > ! #define LOGICAL_OP_NON_SHORT_CIRCUIT (BRANCH_COST >= 2) > #endif > > /* EXP is some logical combination of boolean tests. See if we can > --- 5109,5117 ---- > > > #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT > ! #define LOGICAL_OP_NON_SHORT_CIRCUIT \ > ! (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), \ > ! false) >= 2) > #endif > > /* EXP is some logical combination of boolean tests. See if we can > *************** fold_truthop (enum tree_code code, tree > *** 5357,5363 **** > that can be merged. Avoid doing this if the RHS is a floating-point > comparison since those can trap. */ > > ! if (BRANCH_COST >= 2 > && ! FLOAT_TYPE_P (TREE_TYPE (rl_arg)) > && simple_operand_p (rl_arg) > && simple_operand_p (rr_arg)) > --- 5359,5366 ---- > that can be merged. Avoid doing this if the RHS is a floating-point > comparison since those can trap. */ > > ! if (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), > ! false) >= 2 > && ! FLOAT_TYPE_P (TREE_TYPE (rl_arg)) > && simple_operand_p (rl_arg) > && simple_operand_p (rr_arg)) > Index: dojump.c > =================================================================== > *** dojump.c (revision 139737) > --- dojump.c (working copy) > *************** do_jump (tree exp, rtx if_false_label, r > *** 510,516 **** > /* High branch cost, expand as the bitwise AND of the conditions. > Do the same if the RHS has side effects, because we're effectively > turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */ > ! if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) > goto normal; > > case TRUTH_ANDIF_EXPR: > --- 510,518 ---- > /* High branch cost, expand as the bitwise AND of the conditions. > Do the same if the RHS has side effects, because we're effectively > turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */ > ! if (BRANCH_COST (optimize_insn_for_speed_p (), > ! false) >= 4 > ! || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) > goto normal; > > case TRUTH_ANDIF_EXPR: > *************** do_jump (tree exp, rtx if_false_label, r > *** 531,537 **** > /* High branch cost, expand as the bitwise OR of the conditions. > Do the same if the RHS has side effects, because we're effectively > turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ > ! if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) > goto normal; > > case TRUTH_ORIF_EXPR: > --- 533,540 ---- > /* High branch cost, expand as the bitwise OR of the conditions. > Do the same if the RHS has side effects, because we're effectively > turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ > ! if (BRANCH_COST (optimize_insn_for_speed_p (), false)>= 4 > ! || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) > goto normal; > > case TRUTH_ORIF_EXPR: > Index: ifcvt.c > =================================================================== > *** ifcvt.c (revision 139737) > --- ifcvt.c (working copy) > *************** > *** 67,73 **** > #endif > > #ifndef MAX_CONDITIONAL_EXECUTE > ! #define MAX_CONDITIONAL_EXECUTE (BRANCH_COST + 1) > #endif > > #define IFCVT_MULTIPLE_DUMPS 1 > --- 67,75 ---- > #endif > > #ifndef MAX_CONDITIONAL_EXECUTE > ! #define MAX_CONDITIONAL_EXECUTE \ > ! (BRANCH_COST (optimize_function_for_speed_p (cfun), false) \ > ! + 1) > #endif > > #define IFCVT_MULTIPLE_DUMPS 1 > *************** struct noce_if_info > *** 626,631 **** > --- 628,636 ---- > from TEST_BB. For the noce transformations, we allow the symmetric > form as well. */ > bool then_else_reversed; > + > + /* Estimated cost of the particular branch instruction. */ > + int branch_cost; > }; > > static rtx noce_emit_store_flag (struct noce_if_info *, rtx, int, int); > *************** noce_try_store_flag_constants (struct no > *** 963,982 **** > normalize = 0; > else if (ifalse == 0 && exact_log2 (itrue) >= 0 > && (STORE_FLAG_VALUE == 1 > ! || BRANCH_COST >= 2)) > normalize = 1; > else if (itrue == 0 && exact_log2 (ifalse) >= 0 && can_reverse > ! && (STORE_FLAG_VALUE == 1 || BRANCH_COST >= 2)) > normalize = 1, reversep = 1; > else if (itrue == -1 > && (STORE_FLAG_VALUE == -1 > ! || BRANCH_COST >= 2)) > normalize = -1; > else if (ifalse == -1 && can_reverse > ! && (STORE_FLAG_VALUE == -1 || BRANCH_COST >= 2)) > normalize = -1, reversep = 1; > ! else if ((BRANCH_COST >= 2 && STORE_FLAG_VALUE == -1) > ! || BRANCH_COST >= 3) > normalize = -1; > else > return FALSE; > --- 968,987 ---- > normalize = 0; > else if (ifalse == 0 && exact_log2 (itrue) >= 0 > && (STORE_FLAG_VALUE == 1 > ! || if_info->branch_cost >= 2)) > normalize = 1; > else if (itrue == 0 && exact_log2 (ifalse) >= 0 && can_reverse > ! && (STORE_FLAG_VALUE == 1 || if_info->branch_cost >= 2)) > normalize = 1, reversep = 1; > else if (itrue == -1 > && (STORE_FLAG_VALUE == -1 > ! || if_info->branch_cost >= 2)) > normalize = -1; > else if (ifalse == -1 && can_reverse > ! && (STORE_FLAG_VALUE == -1 || if_info->branch_cost >= 2)) > normalize = -1, reversep = 1; > ! else if ((if_info->branch_cost >= 2 && STORE_FLAG_VALUE == -1) > ! || if_info->branch_cost >= 3) > normalize = -1; > else > return FALSE; > *************** noce_try_addcc (struct noce_if_info *if_ > *** 1107,1113 **** > > /* If that fails, construct conditional increment or decrement using > setcc. */ > ! if (BRANCH_COST >= 2 > && (XEXP (if_info->a, 1) == const1_rtx > || XEXP (if_info->a, 1) == constm1_rtx)) > { > --- 1112,1118 ---- > > /* If that fails, construct conditional increment or decrement using > setcc. */ > ! if (if_info->branch_cost >= 2 > && (XEXP (if_info->a, 1) == const1_rtx > || XEXP (if_info->a, 1) == constm1_rtx)) > { > *************** noce_try_store_flag_mask (struct noce_if > *** 1158,1164 **** > int reversep; > > reversep = 0; > ! if ((BRANCH_COST >= 2 > || STORE_FLAG_VALUE == -1) > && ((if_info->a == const0_rtx > && rtx_equal_p (if_info->b, if_info->x)) > --- 1163,1169 ---- > int reversep; > > reversep = 0; > ! if ((if_info->branch_cost >= 2 > || STORE_FLAG_VALUE == -1) > && ((if_info->a == const0_rtx > && rtx_equal_p (if_info->b, if_info->x)) > *************** noce_try_cmove_arith (struct noce_if_inf > *** 1317,1323 **** > /* ??? FIXME: Magic number 5. */ > if (cse_not_expected > && MEM_P (a) && MEM_P (b) > ! && BRANCH_COST >= 5) > { > a = XEXP (a, 0); > b = XEXP (b, 0); > --- 1322,1328 ---- > /* ??? FIXME: Magic number 5. */ > if (cse_not_expected > && MEM_P (a) && MEM_P (b) > ! && if_info->branch_cost >= 5) > { > a = XEXP (a, 0); > b = XEXP (b, 0); > *************** noce_try_cmove_arith (struct noce_if_inf > *** 1347,1353 **** > if (insn_a) > { > insn_cost = insn_rtx_cost (PATTERN (insn_a)); > ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (BRANCH_COST)) > return FALSE; > } > else > --- 1352,1358 ---- > if (insn_a) > { > insn_cost = insn_rtx_cost (PATTERN (insn_a)); > ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (if_info->branch_cost)) > return FALSE; > } > else > *************** noce_try_cmove_arith (struct noce_if_inf > *** 1356,1362 **** > if (insn_b) > { > insn_cost += insn_rtx_cost (PATTERN (insn_b)); > ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (BRANCH_COST)) > return FALSE; > } > > --- 1361,1367 ---- > if (insn_b) > { > insn_cost += insn_rtx_cost (PATTERN (insn_b)); > ! if (insn_cost == 0 || insn_cost > COSTS_N_INSNS (if_info->branch_cost)) > return FALSE; > } > > *************** noce_find_if_block (basic_block test_bb, > *** 2831,2836 **** > --- 2836,2843 ---- > if_info.cond_earliest = cond_earliest; > if_info.jump = jump; > if_info.then_else_reversed = then_else_reversed; > + if_info.branch_cost = BRANCH_COST (optimize_bb_for_speed_p (test_bb), > + predictable_edge_p (then_edge)); > > /* Do the real work. */ > > *************** find_if_case_1 (basic_block test_bb, edg > *** 3597,3603 **** > test_bb->index, then_bb->index); > > /* THEN is small. */ > ! if (! cheap_bb_rtx_cost_p (then_bb, COSTS_N_INSNS (BRANCH_COST))) > return FALSE; > > /* Registers set are dead, or are predicable. */ > --- 3604,3612 ---- > test_bb->index, then_bb->index); > > /* THEN is small. */ > ! if (! cheap_bb_rtx_cost_p (then_bb, > ! COSTS_N_INSNS (BRANCH_COST (optimize_bb_for_speed_p (then_edge->src), > ! predictable_edge_p (then_edge))))) > return FALSE; > > /* Registers set are dead, or are predicable. */ > *************** find_if_case_2 (basic_block test_bb, edg > *** 3711,3717 **** > test_bb->index, else_bb->index); > > /* ELSE is small. */ > ! if (! cheap_bb_rtx_cost_p (else_bb, COSTS_N_INSNS (BRANCH_COST))) > return FALSE; > > /* Registers set are dead, or are predicable. */ > --- 3720,3728 ---- > test_bb->index, else_bb->index); > > /* ELSE is small. */ > ! if (! cheap_bb_rtx_cost_p (else_bb, > ! COSTS_N_INSNS (BRANCH_COST (optimize_bb_for_speed_p (else_edge->src), > ! predictable_edge_p (else_edge))))) > return FALSE; > > /* Registers set are dead, or are predicable. */ > Index: expr.h > =================================================================== > *** expr.h (revision 139737) > --- expr.h (working copy) > *************** along with GCC; see the file COPYING3. > *** 36,42 **** > > /* The default branch cost is 1. */ > #ifndef BRANCH_COST > ! #define BRANCH_COST 1 > #endif > > /* This is the 4th arg to `expand_expr'. > --- 36,42 ---- > > /* The default branch cost is 1. */ > #ifndef BRANCH_COST > ! #define BRANCH_COST(speed_p, predictable_p) 1 > #endif > > /* This is the 4th arg to `expand_expr'. > Index: predict.c > =================================================================== > *** predict.c (revision 139737) > --- predict.c (working copy) > *************** optimize_insn_for_speed_p (void) > *** 245,250 **** > --- 245,267 ---- > return !optimize_insn_for_size_p (); > } > > + /* Return true when edge E is likely to be well predictable by branch > + predictor. */ > + > + bool > + predictable_edge_p (edge e) > + { > + if (profile_status == PROFILE_ABSENT) > + return false; > + if ((e->probability > + <= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100) > + || (REG_BR_PROB_BASE - e->probability > + <= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100)) > + return true; > + return false; > + } > + > + > /* Set RTL expansion for BB profile. */ > > void > Index: expmed.c > =================================================================== > *** expmed.c (revision 139737) > --- expmed.c (working copy) > *************** expand_smod_pow2 (enum machine_mode mode > *** 3492,3498 **** > result = gen_reg_rtx (mode); > > /* Avoid conditional branches when they're expensive. */ > ! if (BRANCH_COST >= 2 > && optimize_insn_for_speed_p ()) > { > rtx signmask = emit_store_flag (result, LT, op0, const0_rtx, > --- 3492,3498 ---- > result = gen_reg_rtx (mode); > > /* Avoid conditional branches when they're expensive. */ > ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) >= 2 > && optimize_insn_for_speed_p ()) > { > rtx signmask = emit_store_flag (result, LT, op0, const0_rtx, > *************** expand_sdiv_pow2 (enum machine_mode mode > *** 3592,3598 **** > logd = floor_log2 (d); > shift = build_int_cst (NULL_TREE, logd); > > ! if (d == 2 && BRANCH_COST >= 1) > { > temp = gen_reg_rtx (mode); > temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1); > --- 3592,3600 ---- > logd = floor_log2 (d); > shift = build_int_cst (NULL_TREE, logd); > > ! if (d == 2 > ! && BRANCH_COST (optimize_insn_for_speed_p (), > ! false) >= 1) > { > temp = gen_reg_rtx (mode); > temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1); > *************** expand_sdiv_pow2 (enum machine_mode mode > *** 3602,3608 **** > } > > #ifdef HAVE_conditional_move > ! if (BRANCH_COST >= 2) > { > rtx temp2; > > --- 3604,3611 ---- > } > > #ifdef HAVE_conditional_move > ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) > ! >= 2) > { > rtx temp2; > > *************** expand_sdiv_pow2 (enum machine_mode mode > *** 3631,3637 **** > } > #endif > > ! if (BRANCH_COST >= 2) > { > int ushift = GET_MODE_BITSIZE (mode) - logd; > > --- 3634,3641 ---- > } > #endif > > ! if (BRANCH_COST (optimize_insn_for_speed_p (), > ! false) >= 2) > { > int ushift = GET_MODE_BITSIZE (mode) - logd; > > *************** emit_store_flag (rtx target, enum rtx_co > *** 5345,5351 **** > comparison with zero. Don't do any of these cases if branches are > very cheap. */ > > ! if (BRANCH_COST > 0 > && GET_MODE_CLASS (mode) == MODE_INT && (code == EQ || code == NE) > && op1 != const0_rtx) > { > --- 5349,5356 ---- > comparison with zero. Don't do any of these cases if branches are > very cheap. */ > > ! if (BRANCH_COST (optimize_insn_for_speed_p (), > ! false) > 0 > && GET_MODE_CLASS (mode) == MODE_INT && (code == EQ || code == NE) > && op1 != const0_rtx) > { > *************** emit_store_flag (rtx target, enum rtx_co > *** 5368,5377 **** > do LE and GT if branches are expensive since they are expensive on > 2-operand machines. */ > > ! if (BRANCH_COST == 0 > || GET_MODE_CLASS (mode) != MODE_INT || op1 != const0_rtx > || (code != EQ && code != NE > ! && (BRANCH_COST <= 1 || (code != LE && code != GT)))) > return 0; > > /* See what we need to return. We can only return a 1, -1, or the > --- 5373,5384 ---- > do LE and GT if branches are expensive since they are expensive on > 2-operand machines. */ > > ! if (BRANCH_COST (optimize_insn_for_speed_p (), > ! false) == 0 > || GET_MODE_CLASS (mode) != MODE_INT || op1 != const0_rtx > || (code != EQ && code != NE > ! && (BRANCH_COST (optimize_insn_for_speed_p (), > ! false) <= 1 || (code != LE && code != GT)))) > return 0; > > /* See what we need to return. We can only return a 1, -1, or the > *************** emit_store_flag (rtx target, enum rtx_co > *** 5467,5473 **** > that "or", which is an extra insn, so we only handle EQ if branches > are expensive. */ > > ! if (tem == 0 && (code == NE || BRANCH_COST > 1)) > { > if (rtx_equal_p (subtarget, op0)) > subtarget = 0; > --- 5474,5483 ---- > that "or", which is an extra insn, so we only handle EQ if branches > are expensive. */ > > ! if (tem == 0 > ! && (code == NE > ! || BRANCH_COST (optimize_insn_for_speed_p (), > ! false) > 1)) > { > if (rtx_equal_p (subtarget, op0)) > subtarget = 0; > Index: basic-block.h > =================================================================== > *** basic-block.h (revision 139737) > --- basic-block.h (working copy) > *************** extern void guess_outgoing_edge_probabil > *** 848,853 **** > --- 848,854 ---- > extern void remove_predictions_associated_with_edge (edge); > extern bool edge_probability_reliable_p (const_edge); > extern bool br_prob_note_reliable_p (const_rtx); > + extern bool predictable_edge_p (edge); > > /* In cfg.c */ > extern void dump_regset (regset, FILE *); > Index: config/alpha/alpha.h > =================================================================== > *** config/alpha/alpha.h (revision 139737) > --- config/alpha/alpha.h (working copy) > *************** extern int alpha_memory_latency; > *** 640,646 **** > #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) > > /* Provide the cost of a branch. Exact meaning under development. */ > ! #define BRANCH_COST 5 > > /* Stack layout; function entry, exit and calling. */ > > --- 640,646 ---- > #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) > > /* Provide the cost of a branch. Exact meaning under development. */ > ! #define BRANCH_COST(speed_p, predictable_p) 5 > > /* Stack layout; function entry, exit and calling. */ > > Index: config/frv/frv.h > =================================================================== > *** config/frv/frv.h (revision 139737) > --- config/frv/frv.h (working copy) > *************** do { \ > *** 2193,2199 **** > > /* A C expression for the cost of a branch instruction. A value of 1 is the > default; other values are interpreted relative to that. */ > ! #define BRANCH_COST frv_branch_cost_int > > /* Define this macro as a C expression which is nonzero if accessing less than > a word of memory (i.e. a `char' or a `short') is no faster than accessing a > --- 2193,2199 ---- > > /* A C expression for the cost of a branch instruction. A value of 1 is the > default; other values are interpreted relative to that. */ > ! #define BRANCH_COST(speed_p, predictable_p) frv_branch_cost_int > > /* Define this macro as a C expression which is nonzero if accessing less than > a word of memory (i.e. a `char' or a `short') is no faster than accessing a > Index: config/s390/s390.h > =================================================================== > *** config/s390/s390.h (revision 139737) > --- config/s390/s390.h (working copy) > *************** extern struct rtx_def *s390_compare_op0, > *** 828,834 **** > > /* A C expression for the cost of a branch instruction. A value of 1 > is the default; other values are interpreted relative to that. */ > ! #define BRANCH_COST 1 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 1 > --- 828,834 ---- > > /* A C expression for the cost of a branch instruction. A value of 1 > is the default; other values are interpreted relative to that. */ > ! #define BRANCH_COST(speed_p, predictable_p) 1 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 1 > Index: config/spu/spu.h > =================================================================== > *** config/spu/spu.h (revision 139737) > --- config/spu/spu.h (working copy) > *************** targetm.resolve_overloaded_builtin = spu > *** 434,440 **** > > /* Costs */ > > ! #define BRANCH_COST spu_branch_cost > > #define SLOW_BYTE_ACCESS 0 > > --- 434,440 ---- > > /* Costs */ > > ! #define BRANCH_COST(speed_p, predictable_p) spu_branch_cost > > #define SLOW_BYTE_ACCESS 0 > > Index: config/sparc/sparc.h > =================================================================== > *** config/sparc/sparc.h (revision 139737) > --- config/sparc/sparc.h (working copy) > *************** do { > *** 2196,2202 **** > On Niagara-2, a not-taken branch costs 1 cycle whereas a taken > branch costs 6 cycles. */ > > ! #define BRANCH_COST \ > ((sparc_cpu == PROCESSOR_V9 \ > || sparc_cpu == PROCESSOR_ULTRASPARC) \ > ? 7 \ > --- 2196,2202 ---- > On Niagara-2, a not-taken branch costs 1 cycle whereas a taken > branch costs 6 cycles. */ > > ! #define BRANCH_COST (speed_p, predictable_p) \ > ((sparc_cpu == PROCESSOR_V9 \ > || sparc_cpu == PROCESSOR_ULTRASPARC) \ > ? 7 \ > Index: config/m32r/m32r.h > =================================================================== > *** config/m32r/m32r.h (revision 139737) > --- config/m32r/m32r.h (working copy) > *************** L2: .word STATIC > *** 1224,1230 **** > /* A value of 2 here causes GCC to avoid using branches in comparisons like > while (a < N && a). Branches aren't that expensive on the M32R so > we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */ > ! #define BRANCH_COST ((TARGET_BRANCH_COST) ? 2 : 1) > > /* Nonzero if access to memory by bytes is slow and undesirable. > For RISC chips, it means that access to memory by bytes is no > --- 1224,1230 ---- > /* A value of 2 here causes GCC to avoid using branches in comparisons like > while (a < N && a). Branches aren't that expensive on the M32R so > we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */ > ! #define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1) > > /* Nonzero if access to memory by bytes is slow and undesirable. > For RISC chips, it means that access to memory by bytes is no > Index: config/i386/i386.h > =================================================================== > *** config/i386/i386.h (revision 139737) > --- config/i386/i386.h (working copy) > *************** do { \ > *** 1975,1981 **** > /* A C expression for the cost of a branch instruction. A value of 1 > is the default; other values are interpreted relative to that. */ > > ! #define BRANCH_COST ix86_branch_cost > > /* Define this macro as a C expression which is nonzero if accessing > less than a word of memory (i.e. a `char' or a `short') is no > --- 1975,1982 ---- > /* A C expression for the cost of a branch instruction. A value of 1 > is the default; other values are interpreted relative to that. */ > > ! #define BRANCH_COST(speed_p, predictable_p) \ > ! (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost) > > /* Define this macro as a C expression which is nonzero if accessing > less than a word of memory (i.e. a `char' or a `short') is no > Index: config/i386/i386.c > =================================================================== > *** config/i386/i386.c (revision 139737) > --- config/i386/i386.c (working copy) > *************** ix86_expand_int_movcc (rtx operands[]) > *** 14636,14642 **** > */ > > if ((!TARGET_CMOVE || (mode == QImode && TARGET_PARTIAL_REG_STALL)) > ! && BRANCH_COST >= 2) > { > if (cf == 0) > { > --- 14636,14643 ---- > */ > > if ((!TARGET_CMOVE || (mode == QImode && TARGET_PARTIAL_REG_STALL)) > ! && BRANCH_COST (optimize_insn_for_speed_p (), > ! false) >= 2) > { > if (cf == 0) > { > *************** ix86_expand_int_movcc (rtx operands[]) > *** 14721,14727 **** > optab op; > rtx var, orig_out, out, tmp; > > ! if (BRANCH_COST <= 2) > return 0; /* FAIL */ > > /* If one of the two operands is an interesting constant, load a > --- 14722,14728 ---- > optab op; > rtx var, orig_out, out, tmp; > > ! if (BRANCH_COST (optimize_insn_for_speed_p (), false) <= 2) > return 0; /* FAIL */ > > /* If one of the two operands is an interesting constant, load a > Index: config/sh/sh.h > =================================================================== > *** config/sh/sh.h (revision 139737) > --- config/sh/sh.h (working copy) > *************** struct sh_args { > *** 2847,2853 **** > The SH1 does not have delay slots, hence we get a pipeline stall > at every branch. The SH4 is superscalar, so the single delay slot > is not sufficient to keep both pipelines filled. */ > ! #define BRANCH_COST (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) > > /* Assembler output control. */ > > --- 2847,2854 ---- > The SH1 does not have delay slots, hence we get a pipeline stall > at every branch. The SH4 is superscalar, so the single delay slot > is not sufficient to keep both pipelines filled. */ > ! #define BRANCH_COST(speed_p, predictable_p) \ > ! (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) > > /* Assembler output control. */ > > Index: config/pdp11/pdp11.h > =================================================================== > *** config/pdp11/pdp11.h (revision 139737) > --- config/pdp11/pdp11.h (working copy) > *************** JMP FUNCTION 0x0058 0x0000 <- FUNCTION > *** 1057,1063 **** > /* there is no point in avoiding branches on a pdp, > since branches are really cheap - I just want to find out > how much difference the BRANCH_COST macro makes in code */ > ! #define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1) > > > #define COMPARE_FLAG_MODE HImode > --- 1057,1063 ---- > /* there is no point in avoiding branches on a pdp, > since branches are really cheap - I just want to find out > how much difference the BRANCH_COST macro makes in code */ > ! #define BRANCH_COST(speed_p, predictable_p) (TARGET_BRANCH_CHEAP ? 0 : 1) > > > #define COMPARE_FLAG_MODE HImode > Index: config/avr/avr.h > =================================================================== > *** config/avr/avr.h (revision 139737) > --- config/avr/avr.h (working copy) > *************** do { \ > *** 511,517 **** > (MODE)==SImode ? 8 : \ > (MODE)==SFmode ? 8 : 16) > > ! #define BRANCH_COST 0 > > #define SLOW_BYTE_ACCESS 0 > > --- 511,517 ---- > (MODE)==SImode ? 8 : \ > (MODE)==SFmode ? 8 : 16) > > ! #define BRANCH_COST(speed_p, predictable_p) 0 > > #define SLOW_BYTE_ACCESS 0 > > Index: config/crx/crx.h > =================================================================== > *** config/crx/crx.h (revision 139737) > --- config/crx/crx.h (working copy) > *************** struct cumulative_args > *** 420,426 **** > /* Moving to processor register flushes pipeline - thus asymmetric */ > #define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2) > /* Assume best case (branch predicted) */ > ! #define BRANCH_COST 2 > > #define SLOW_BYTE_ACCESS 1 > > --- 420,426 ---- > /* Moving to processor register flushes pipeline - thus asymmetric */ > #define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2) > /* Assume best case (branch predicted) */ > ! #define BRANCH_COST(speed_p, predictable_p) 2 > > #define SLOW_BYTE_ACCESS 1 > > Index: config/xtensa/xtensa.h > =================================================================== > *** config/xtensa/xtensa.h (revision 139737) > --- config/xtensa/xtensa.h (working copy) > *************** typedef struct xtensa_args > *** 882,888 **** > > #define MEMORY_MOVE_COST(MODE, CLASS, IN) 4 > > ! #define BRANCH_COST 3 > > /* How to refer to registers in assembler output. > This sequence is indexed by compiler's hard-register-number (see above). */ > --- 882,888 ---- > > #define MEMORY_MOVE_COST(MODE, CLASS, IN) 4 > > ! #define BRANCH_COST(speed_p, predictable_p) 3 > > /* How to refer to registers in assembler output. > This sequence is indexed by compiler's hard-register-number (see above). */ > Index: config/stormy16/stormy16.h > =================================================================== > *** config/stormy16/stormy16.h (revision 139737) > --- config/stormy16/stormy16.h (working copy) > *************** do { \ > *** 587,593 **** > > #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) > > ! #define BRANCH_COST 5 > > #define SLOW_BYTE_ACCESS 0 > > --- 587,593 ---- > > #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) > > ! #define BRANCH_COST(speed_p, predictable_p) 5 > > #define SLOW_BYTE_ACCESS 0 > > Index: config/m68hc11/m68hc11.h > =================================================================== > *** config/m68hc11/m68hc11.h (revision 139737) > --- config/m68hc11/m68hc11.h (working copy) > *************** extern unsigned char m68hc11_reg_valid_f > *** 1266,1272 **** > > Pretend branches are cheap because GCC generates sub-optimal code > for the default value. */ > ! #define BRANCH_COST 0 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 0 > --- 1266,1272 ---- > > Pretend branches are cheap because GCC generates sub-optimal code > for the default value. */ > ! #define BRANCH_COST(speed_p, predictable_p) 0 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 0 > Index: config/iq2000/iq2000.h > =================================================================== > *** config/iq2000/iq2000.h (revision 139737) > --- config/iq2000/iq2000.h (working copy) > *************** typedef struct iq2000_args > *** 624,630 **** > #define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \ > (TO_P ? 2 : 16) > > ! #define BRANCH_COST 2 > > #define SLOW_BYTE_ACCESS 1 > > --- 624,630 ---- > #define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \ > (TO_P ? 2 : 16) > > ! #define BRANCH_COST(speed_p, predictable_p) 2 > > #define SLOW_BYTE_ACCESS 1 > > Index: config/ia64/ia64.h > =================================================================== > *** config/ia64/ia64.h (revision 139737) > --- config/ia64/ia64.h (working copy) > *************** do { \ > *** 1384,1390 **** > many additional insn groups we run into, vs how good the dynamic > branch predictor is. */ > > ! #define BRANCH_COST 6 > > /* Define this macro as a C expression which is nonzero if accessing less than > a word of memory (i.e. a `char' or a `short') is no faster than accessing a > --- 1384,1390 ---- > many additional insn groups we run into, vs how good the dynamic > branch predictor is. */ > > ! #define BRANCH_COST(speed_p, predictable_p) 6 > > /* Define this macro as a C expression which is nonzero if accessing less than > a word of memory (i.e. a `char' or a `short') is no faster than accessing a > Index: config/rs6000/rs6000.h > =================================================================== > *** config/rs6000/rs6000.h (revision 139737) > --- config/rs6000/rs6000.h (working copy) > *************** extern enum rs6000_nop_insertion rs6000_ > *** 967,973 **** > Set this to 3 on the RS/6000 since that is roughly the average cost of an > unscheduled conditional branch. */ > > ! #define BRANCH_COST 3 > > /* Override BRANCH_COST heuristic which empirically produces worse > performance for removing short circuiting from the logical ops. */ > --- 967,973 ---- > Set this to 3 on the RS/6000 since that is roughly the average cost of an > unscheduled conditional branch. */ > > ! #define BRANCH_COST(speed_p, predictable_p) 3 > > /* Override BRANCH_COST heuristic which empirically produces worse > performance for removing short circuiting from the logical ops. */ > Index: config/arc/arc.h > =================================================================== > *** config/arc/arc.h (revision 139737) > --- config/arc/arc.h (working copy) > *************** arc_select_cc_mode (OP, X, Y) > *** 824,830 **** > /* The cost of a branch insn. */ > /* ??? What's the right value here? Branches are certainly more > expensive than reg->reg moves. */ > ! #define BRANCH_COST 2 > > /* Nonzero if access to memory by bytes is slow and undesirable. > For RISC chips, it means that access to memory by bytes is no > --- 824,830 ---- > /* The cost of a branch insn. */ > /* ??? What's the right value here? Branches are certainly more > expensive than reg->reg moves. */ > ! #define BRANCH_COST(speed_p, predictable_p) 2 > > /* Nonzero if access to memory by bytes is slow and undesirable. > For RISC chips, it means that access to memory by bytes is no > Index: config/score/score.h > =================================================================== > *** config/score/score.h (revision 139737) > --- config/score/score.h (working copy) > *************** typedef struct score_args > *** 793,799 **** > (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) > > /* Try to generate sequences that don't involve branches. */ > ! #define BRANCH_COST 2 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 1 > --- 793,799 ---- > (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) > > /* Try to generate sequences that don't involve branches. */ > ! #define BRANCH_COST(speed_p, predictable_p) 2 > > /* Nonzero if access to memory by bytes is slow and undesirable. */ > #define SLOW_BYTE_ACCESS 1 > Index: config/arm/arm.h > =================================================================== > *** config/arm/arm.h (revision 139737) > --- config/arm/arm.h (working copy) > *************** do { \ > *** 2297,2303 **** > > /* Try to generate sequences that don't involve branches, we can then use > conditional instructions */ > ! #define BRANCH_COST \ > (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) > > /* Position Independent Code. */ > --- 2297,2303 ---- > > /* Try to generate sequences that don't involve branches, we can then use > conditional instructions */ > ! #define BRANCH_COST(speed_p, predictable_p) \ > (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) > > /* Position Independent Code. */ > Index: config/pa/pa.h > =================================================================== > *** config/pa/pa.h (revision 139737) > --- config/pa/pa.h (working copy) > *************** do { \ > *** 1570,1576 **** > : 2) > > /* Adjust the cost of branches. */ > ! #define BRANCH_COST (pa_cpu == PROCESSOR_8000 ? 2 : 1) > > /* Handling the special cases is going to get too complicated for a macro, > just call `pa_adjust_insn_length' to do the real work. */ > --- 1570,1576 ---- > : 2) > > /* Adjust the cost of branches. */ > ! #define BRANCH_COST(speed_p, predictable_p) (pa_cpu == PROCESSOR_8000 ? 2 : 1) > > /* Handling the special cases is going to get too complicated for a macro, > just call `pa_adjust_insn_length' to do the real work. */ > Index: config/mips/mips.h > =================================================================== > *** config/mips/mips.h (revision 139737) > --- config/mips/mips.h (working copy) > *************** typedef struct mips_args { > *** 2551,2557 **** > /* A C expression for the cost of a branch instruction. A value of > 1 is the default; other values are interpreted relative to that. */ > > ! #define BRANCH_COST mips_branch_cost > #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 > > /* If defined, modifies the length assigned to instruction INSN as a > --- 2551,2557 ---- > /* A C expression for the cost of a branch instruction. A value of > 1 is the default; other values are interpreted relative to that. */ > > ! #define BRANCH_COST(speed_p, predictable_p) mips_branch_cost > #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 > > /* If defined, modifies the length assigned to instruction INSN as a > Index: config/vax/vax.h > =================================================================== > *** config/vax/vax.h (revision 139737) > --- config/vax/vax.h (working copy) > *************** enum reg_class { NO_REGS, ALL_REGS, LIM_ > *** 648,654 **** > Branches are extremely cheap on the VAX while the shift insns often > used to replace branches can be expensive. */ > > ! #define BRANCH_COST 0 > > /* Tell final.c how to eliminate redundant test instructions. */ > > --- 648,654 ---- > Branches are extremely cheap on the VAX while the shift insns often > used to replace branches can be expensive. */ > > ! #define BRANCH_COST(speed_p, predictable_p) 0 > > /* Tell final.c how to eliminate redundant test instructions. */ > > Index: config/h8300/h8300.h > =================================================================== > *** config/h8300/h8300.h (revision 139737) > --- config/h8300/h8300.h (working copy) > *************** struct cum_arg > *** 1004,1010 **** > #define DELAY_SLOT_LENGTH(JUMP) \ > (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2) > > ! #define BRANCH_COST 0 > > /* Tell final.c how to eliminate redundant test instructions. */ > > --- 1004,1010 ---- > #define DELAY_SLOT_LENGTH(JUMP) \ > (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2) > > ! #define BRANCH_COST(speed_p, predictable_p) 0 > > /* Tell final.c how to eliminate redundant test instructions. */ > > Index: params.def > =================================================================== > *** params.def (revision 139737) > --- params.def (working copy) > *************** DEFPARAM (PARAM_STRUCT_REORG_COLD_STRUCT > *** 78,83 **** > --- 78,90 ---- > "The threshold ratio between current and hottest structure counts", > 10, 0, 100) > > + /* When branch is predicted to be taken with probability lower than this > + threshold (in percent), then it is considered well predictable. */ > + DEFPARAM (PARAM_PREDICTABLE_BRANCH_OUTCOME, > + "predictable-branch-outcome", > + "Maximal esitmated outcome of branch considered predictable", > + 2, 0, 50) > + > /* The single function inlining limit. This is the maximum size > of a function counted in internal gcc instructions (not in > real machine instructions) that is eligible for inlining > ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2008-08-30 19:06 ` Richard Guenther @ 2008-09-02 14:38 ` Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2008-09-02 14:38 UTC (permalink / raw) To: Richard Guenther; +Cc: Jan Hubicka, gcc-patches "Richard Guenther" <richard.guenther@gmail.com> writes: > On Thu, Aug 28, 2008 at 10:32 PM, Jan Hubicka <hubicka@ucw.cz> wrote: >>> On Sat, Apr 5, 2008 at 6:26 PM, Jan Hubicka <hubicka@ucw.cz> wrote: >>> > Hi, >>> > I would like to ping the BRANCH_COST patch >>> > http://gcc.gnu.org/ml/gcc/2008-03/msg00137.html >>> > >>> > I hope to proceed with updating GCC to optimize cold blocks in same way >>> > as -Os and explicitely marked hot functions in -Os code for speed. >>> > For this I need to populate RTL cost interfaces with the profile info >>> > and teach expansion about it. >>> > This is taking quite some years now, I realize it might not be clear >>> > what I am precisely shooting for, so I will also add wiki page. >>> >>> I think the patch makes sense (BRANCH_COST is special anyway compared to >>> other isns cost), but I'd like to see the bigger picture as well here. In >>> particular, BRANCH_COST (hot, predictable), why isn't that simply >>> BRANCH_COST (optimize_size_p, predictable) matching what I possibly >>> expect for the other cost interface (insn_cost (optimize_size_p, rtx)). >> >> Hi, >> with the optimize_*_for_speed_p predicates, this patch becomes cleaner >> now. I would also like to update other costs similar way so we can >> avoid the current way we switch optimize_size global variable. >> >> Bootstrapped/regtested i686-linux, OK? > > It looks ok, but I think that PARAM_PREDICTABLE_BRANCH_OUTCOME > should be a target macro and not a param. > > Ok with that change, but please wait 24h to let others comment. It would be nice to see BRANCH_COST turn into a target hook rather than a macro, Since you have to touch every definition of it anyhow. I won't insist on it, though. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-02-20 14:35 Jakub Jelinek 2008-02-20 16:26 ` Tom Tromey 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2008-02-20 14:35 UTC (permalink / raw) To: gcc-patches Hi! Preprocessing fix for macro expanded #pragmas: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01145.html Bootstrapped/regtested many times on many linux targets, ok for 4.4? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2008-02-20 14:35 Jakub Jelinek @ 2008-02-20 16:26 ` Tom Tromey 0 siblings, 0 replies; 504+ messages in thread From: Tom Tromey @ 2008-02-20 16:26 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches >>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes: Jakub> Preprocessing fix for macro expanded #pragmas: Jakub> http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01145.html Jakub> Bootstrapped/regtested many times on many linux targets, ok for 4.4? I don't think I can approve or reject this patch, since it is part of the C FE and not libcpp. That said, it looks pretty reasonable to me. It seems a bit odd to duplicate the pragma/name mapping in c_pp_lookup_pragma and in init_pragma. I think it would be mildly better to keep this information in a single place. Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2008-02-15 16:47 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2008-02-15 16:47 UTC (permalink / raw) To: Diego Novillo, Richard Henderson; +Cc: gcc-patches Hi! Could you please review: Use shared OpenMP clause for FRAME.* tree-nested created vars rather than firstprivate (PR middle-end/35130) http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00360.html ? Thanks. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-09-04 10:02 Jan Hubicka 2007-09-04 10:07 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2007-09-04 10:02 UTC (permalink / raw) To: gcc-patches Hi, please would be possible to review those few patches? They are blocking some other stuff. Copyprop sharing fix http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01230.html Regrename fix (hopefully last needed for RTL sharing checker) http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01103.html Kai's patch for MS/SYSV attribute handling (it would be nice feature to have in next release) http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01515.html Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2007-09-04 10:02 Jan Hubicka @ 2007-09-04 10:07 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2007-09-04 10:07 UTC (permalink / raw) To: Jan Hubicka; +Cc: gcc-patches On 9/4/07, Jan Hubicka <hubicka@ucw.cz> wrote: > Hi, > please would be possible to review those few patches? They are blocking > some other stuff. > > Copyprop sharing fix > http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01230.html > Regrename fix (hopefully last needed for RTL sharing checker) > http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01103.html These two are ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-07-30 18:17 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2007-07-30 18:17 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01127.html -- second patch of the parloop branch merge http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01783.html http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01876.html -- loop preserving project merge patches http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00930.html -- improves alias information with builtin functions Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-07-09 9:03 Zdenek Dvorak 2007-07-09 9:44 ` Richard Guenther 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2007-07-09 9:03 UTC (permalink / raw) To: gcc-patches; +Cc: dnovillo Hello, http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01339.html -- first patch for the parloop branch merge http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01322.html -- moves loop exit updating to remove_edge (one of changes to enable loop structures to be preserved over more optimization passes) Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2007-07-09 9:03 Zdenek Dvorak @ 2007-07-09 9:44 ` Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2007-07-09 9:44 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches, dnovillo On 7/9/07, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01339.html > -- first patch for the parloop branch merge Ok. > http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01322.html > -- moves loop exit updating to remove_edge (one of changes to enable > loop structures to be preserved over more optimization passes) Ok. Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-05-24 21:39 Krister Walfridsson 0 siblings, 0 replies; 504+ messages in thread From: Krister Walfridsson @ 2007-05-24 21:39 UTC (permalink / raw) To: gcc-patches; +Cc: thorpej http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00332.html -- Use --as-needed -lgcc_s for eh support for NetBSD /Krister ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-05-23 9:13 Zdenek Dvorak 2007-05-23 20:24 ` Diego Novillo 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2007-05-23 9:13 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01633.html -- dominator analysis cleanups http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00737.html -- analysis and generation of nontemporal prefetches http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01862.html -- rtl part of the patch for generation of nontemporal stores Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2007-05-23 9:13 Zdenek Dvorak @ 2007-05-23 20:24 ` Diego Novillo 0 siblings, 0 replies; 504+ messages in thread From: Diego Novillo @ 2007-05-23 20:24 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches On 5/23/07, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote: > http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01633.html > -- dominator analysis cleanups Nice cleanup. OK. > http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00737.html > -- analysis and generation of nontemporal prefetches OK, but I hope you have the --param patch for the cache size ready soon. > http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01862.html > -- rtl part of the patch for generation of nontemporal stores Looks like the obvious thing to do in RTL, but I can't approve this part. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-04-18 1:07 Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2007-04-18 1:07 UTC (permalink / raw) To: gcc-patches Hi, I would like to ping the patch http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01169.html that removes line nmuber notes from RTL. I think it is quite important cleanup and would like it to receive testing within mainline for some period of time. Thanks, Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2007-04-17 1:49 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2007-04-17 1:49 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01304.html -- predictive commoning http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00044.html -- fixes two bugs that prevent us from optimizing unrolled loops http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01633.html -- dominator analysis cleanups http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01965.html -- patch to avoid rescanning cfg in cfg cleanup Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-12-16 0:05 H. J. Lu 2006-12-16 0:35 ` Janis Johnson 0 siblings, 1 reply; 504+ messages in thread From: H. J. Lu @ 2006-12-16 0:05 UTC (permalink / raw) To: Janis Johnson; +Cc: gcc-patches Hi Janis, Can you take a look at SSSE3 builtin test patch: http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00352.html Thanks. H.J. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-12-16 0:05 H. J. Lu @ 2006-12-16 0:35 ` Janis Johnson 0 siblings, 0 replies; 504+ messages in thread From: Janis Johnson @ 2006-12-16 0:35 UTC (permalink / raw) To: H. J. Lu; +Cc: Janis Johnson, gcc-patches On Fri, Dec 15, 2006 at 04:05:39PM -0800, H. J. Lu wrote: > Hi Janis, > > Can you take a look at SSSE3 builtin test patch: > > http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00352.html I'm sorry, I thought that message was just saying that you would add to the 4.2 branch the tests you had already checked in on mainline, I missed the extra "S" in SSSE3. The patch is OK. This whole directory is skipped if the effective target isn't i?86*-*-* or x86_64-*-*, so there's no need to specify that in the individual tests. It's probably there for older tests from when they were in other parts of the testsuite. That's just for your information for future tests, you don't need to change these. Janis ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping
@ 2006-12-14 23:53 Zdenek Dvorak
2006-12-15 13:12 ` Richard Guenther
0 siblings, 1 reply; 504+ messages in thread
From: Zdenek Dvorak @ 2006-12-14 23:53 UTC (permalink / raw)
To: gcc-patches
Hello,
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01495.html
> estimate_num_insns is currently used for several things:
>
> -- on several places (loop unrolling, unswitching, exception
> handling expansion), to estimate the size of the code
> -- in prefetching, to estimate time necessary to execute the
> code
> -- in inlining for magic heuristic (that pretends to do the
> former, but in fact turns out to be closer to the latter)
>
> Not surprisingly, it cannot work well enough for all these usages
> (in particular, the optimizations that rely on it being the size of
> the code suffer by the unrealistical values returned for calls and
> divisions). This patch makes it possible to select which of these
> three estimates should be returned (by passing the structure containing
> costs of various constructs to it).
Zdenek
^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-12-14 23:53 Zdenek Dvorak @ 2006-12-15 13:12 ` Richard Guenther 2006-12-16 16:32 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Richard Guenther @ 2006-12-15 13:12 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches On 12/15/06, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01495.html > > > estimate_num_insns is currently used for several things: > > > > -- on several places (loop unrolling, unswitching, exception > > handling expansion), to estimate the size of the code > > -- in prefetching, to estimate time necessary to execute the > > code > > -- in inlining for magic heuristic (that pretends to do the > > former, but in fact turns out to be closer to the latter) > > > > Not surprisingly, it cannot work well enough for all these usages > > (in particular, the optimizations that rely on it being the size of > > the code suffer by the unrealistical values returned for calls and > > divisions). This patch makes it possible to select which of these > > three estimates should be returned (by passing the structure containing > > costs of various constructs to it). One thing that I didn't like with this patch was exposing the extra parameter at all call sites like estimate_num_insns (cfun, &eni_inlining_weights). Can we at least have wrappers around that like estimate_num_insns_for_inlining (cfun) or whatever better we come up with? Otherwise splitting the cost metrics is the only sane way to go - it's being on my todo for splitting optimize-size and optimize-speed counts for inlining as well. I think I cannot approve this change though ;) Thanks, Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-12-15 13:12 ` Richard Guenther @ 2006-12-16 16:32 ` Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2006-12-16 16:32 UTC (permalink / raw) To: Richard Guenther; +Cc: gcc-patches Hello, > >http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01495.html > > > >> estimate_num_insns is currently used for several things: > >> > >> -- on several places (loop unrolling, unswitching, exception > >> handling expansion), to estimate the size of the code > >> -- in prefetching, to estimate time necessary to execute the > >> code > >> -- in inlining for magic heuristic (that pretends to do the > >> former, but in fact turns out to be closer to the latter) > >> > >> Not surprisingly, it cannot work well enough for all these usages > >> (in particular, the optimizations that rely on it being the size of > >> the code suffer by the unrealistical values returned for calls and > >> divisions). This patch makes it possible to select which of these > >> three estimates should be returned (by passing the structure containing > >> costs of various constructs to it). > > One thing that I didn't like with this patch was exposing the extra > parameter at all call sites like estimate_num_insns (cfun, > &eni_inlining_weights). > Can we at least have wrappers around that like > estimate_num_insns_for_inlining (cfun) or whatever better we come up with? the reason I decided to expose this parameter everywhere is that this way, tree_num_loop_insns can also be parametrized on what metrics we do want to use (without need to create three versions of this function). I can create the wrappers if you prefer anyway, although I think it would be a bit confusing. Zdenek > Otherwise splitting the cost metrics is the only sane way to go - it's > being on > my todo for splitting optimize-size and optimize-speed counts for inlining > as > well. > > I think I cannot approve this change though ;) > > Thanks, > Richard. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch Ping @ 2006-05-02 14:32 Tom Tromey 2006-05-03 2:22 ` Mark Mitchell 0 siblings, 1 reply; 504+ messages in thread From: Tom Tromey @ 2006-05-02 14:32 UTC (permalink / raw) To: Gcc Patch List Could someone review this please? http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01584.html It changes gcov to consistently use get_gcov_unsigned_t(), instead of relying on unsigned_type_node, which gcj does not define. Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch Ping 2006-05-02 14:32 Patch Ping Tom Tromey @ 2006-05-03 2:22 ` Mark Mitchell 0 siblings, 0 replies; 504+ messages in thread From: Mark Mitchell @ 2006-05-03 2:22 UTC (permalink / raw) To: tromey; +Cc: Gcc Patch List Tom Tromey wrote: > Could someone review this please? > > http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01584.html > > It changes gcov to consistently use get_gcov_unsigned_t(), instead of > relying on unsigned_type_node, which gcj does not define. This is OK. -- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-03-21 21:26 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2006-03-21 21:26 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01424.html -- patch for PR 23855, to produce more efficient and easier to optimize code for nested for-loops http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00345.html -- makes affine combinations use the new double_int infrastructure Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-03-10 19:33 Uttam Pawar 2006-03-11 20:40 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Uttam Pawar @ 2006-03-10 19:33 UTC (permalink / raw) To: gcc-patches; +Cc: uttamp Ping. Can anybody review the following patches again, please? http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01484.html http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01377.html - Uttam ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-10 19:33 Uttam Pawar @ 2006-03-11 20:40 ` Roger Sayle 2006-03-13 19:23 ` Uttam Pawar 0 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2006-03-11 20:40 UTC (permalink / raw) To: Uttam Pawar; +Cc: gcc-patches On Fri, 10 Mar 2006, Uttam Pawar wrote: > Ping. Can anybody review the following patches again, please? > http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01484.html The bt-load.c fix is OK, to close PR rtl-optimiztion/25739. I think the other changes are suitably obvious enough, even if not part of the middle-end, that I can approve them. Remember to commit the version with the "if" checks before the calls to free, and mention the above PR number in the ChangeLog entry. > http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01377.html This one is also OK for mainline. Thanks, Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-11 20:40 ` Roger Sayle @ 2006-03-13 19:23 ` Uttam Pawar 2006-03-14 1:02 ` Roger Sayle ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Uttam Pawar @ 2006-03-13 19:23 UTC (permalink / raw) To: Roger Sayle; +Cc: uttamp, gcc-patches Roger, Thanks for reviewing the patches and for your feedback. > The bt-load.c fix is OK, to close PR rtl-optimiztion/25739. > I think the other changes are suitably obvious enough, even if > not part of the middle-end, that I can approve them. Remember > to commit the version with the "if" checks before the calls to > free, and mention the above PR number in the ChangeLog entry. Here is a complete patch again. This has been regtest on powerpc64-linux with no new regressions. If it looks ok, could you commit it please, as I do not have commit access. Thanks, Uttam 2006-03-13 Uttam Pawar <uttamp@us.ibm.com> * gensupport.c (identify_predicable_attribute): Free p_false pointer. * gcov.c (create_file_names): Free name pointer. PR rtl-optimization/25739 * bt-load.c (augment_live_range): Free tos pointer. Index: gcc/gensupport.c =================================================================== *** gcc/gensupport.c (revision 111144) --- gcc/gensupport.c (working copy) *************** identify_predicable_attribute (void) *** 464,469 **** --- 464,471 ---- message_with_line (elem->lineno, "attribute `predicable' is not a boolean"); errors = 1; + if (p_false) + free (p_false); return; } p_true[-1] = '\0'; *************** identify_predicable_attribute (void) *** 481,492 **** --- 483,498 ---- message_with_line (elem->lineno, "attribute `predicable' cannot be const"); errors = 1; + if (p_false) + free (p_false); return; default: message_with_line (elem->lineno, "attribute `predicable' must have a constant default"); errors = 1; + if (p_false) + free (p_false); return; } *************** identify_predicable_attribute (void) *** 501,506 **** --- 507,515 ---- value); errors = 1; } + + if (p_false) + free (p_false); } /* Return the number of alternatives in constraint S. */ Index: gcc/gcov.c =================================================================== *** gcc/gcov.c (revision 111144) --- gcc/gcov.c (working copy) *************** create_file_names (const char *file_name *** 658,663 **** --- 658,664 ---- strcpy (da_file_name, name); strcpy (da_file_name + length, GCOV_DATA_SUFFIX); + free (name); return; } Index: gcc/bt-load.c =================================================================== *** gcc/bt-load.c (revision 111144) --- gcc/bt-load.c (working copy) *************** augment_live_range (bitmap live_range, H *** 911,916 **** --- 911,917 ---- { if (full_range) IOR_HARD_REG_SET (*btrs_live_in_range, btrs_live[new_bb->index]); + free (tos); return; } *tos++ = new_bb; ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-13 19:23 ` Uttam Pawar @ 2006-03-14 1:02 ` Roger Sayle 2006-03-14 16:49 ` Steve Ellcey 2006-03-15 10:15 ` Andreas Schwab 2 siblings, 0 replies; 504+ messages in thread From: Roger Sayle @ 2006-03-14 1:02 UTC (permalink / raw) To: Uttam Pawar; +Cc: gcc-patches On Mon, 13 Mar 2006, Uttam Pawar wrote: > Here is a complete patch again. This has been regtest on powerpc64-linux > with no new regressions. If it looks ok, could you commit it please, as > I do not have commit access. No problem. Committed to mainline as revision 112039. Thanks, Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-13 19:23 ` Uttam Pawar 2006-03-14 1:02 ` Roger Sayle @ 2006-03-14 16:49 ` Steve Ellcey 2006-03-14 16:55 ` Andrew Pinski ` (2 more replies) 2006-03-15 10:15 ` Andreas Schwab 2 siblings, 3 replies; 504+ messages in thread From: Steve Ellcey @ 2006-03-14 16:49 UTC (permalink / raw) To: gcc-patches; +Cc: uttamp, roger > 2006-03-13 Uttam Pawar <uttamp@us.ibm.com> > > * gensupport.c (identify_predicable_attribute): Free > p_false pointer. > * gcov.c (create_file_names): Free name pointer. > > PR rtl-optimization/25739 > * bt-load.c (augment_live_range): Free tos pointer. I think that this patch may be breaking the IA64 bootstrap (HP-UX and Linux). It is dying with: build/genmddeps /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md > tmp-mddeps /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md:792: unknown value `no' for `predicable' attribute /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md:1992: unknown value `no' for `predicable' attribute (and a bunch more) I am guessing this may be related to the change made to identify_predicable_attribute. Is anyone seeing this? Steve Ellcey sje@cup.hp.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-14 16:49 ` Steve Ellcey @ 2006-03-14 16:55 ` Andrew Pinski 2006-03-15 4:38 ` Roger Sayle 2006-03-15 10:23 ` Grigory Zagorodnev 2 siblings, 0 replies; 504+ messages in thread From: Andrew Pinski @ 2006-03-14 16:55 UTC (permalink / raw) To: Steve Ellcey; +Cc: gcc-patches, roger, uttamp On Mar 14, 2006, at 11:49 AM, Steve Ellcey wrote: > I am guessing this may be related to the change made to > identify_predicable_attribute. Is anyone seeing this? No but it does look wrong. predicable_false = p_false; So it is not leaked at the end of the function but rather when it is replaced. Maybe doing a free right before the assignment to predicable_false and removing the free at the end of identify_predicable_attribute will keep the leak fixed and fix the bootstrap bug. -- Pinski ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-14 16:49 ` Steve Ellcey 2006-03-14 16:55 ` Andrew Pinski @ 2006-03-15 4:38 ` Roger Sayle 2006-03-15 19:29 ` Steve Ellcey 2006-03-15 10:23 ` Grigory Zagorodnev 2 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2006-03-15 4:38 UTC (permalink / raw) To: Steve Ellcey; +Cc: gcc-patches, uttamp On Tue, 14 Mar 2006, Steve Ellcey wrote: > > 2006-03-13 Uttam Pawar <uttamp@us.ibm.com> > > > > * gensupport.c (identify_predicable_attribute): Free > > p_false pointer. > > * gcov.c (create_file_names): Free name pointer. > > > > PR rtl-optimization/25739 > > * bt-load.c (augment_live_range): Free tos pointer. > > I think that this patch may be breaking the IA64 bootstrap (HP-UX and > Linux). It is dying with: > > build/genmddeps /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md > tmp-mddeps > /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md:792: unknown value `no' for `predicable' attribute > /proj/opensrc/nightly/src/trunk/gcc/config/ia64/ia64.md:1992: unknown value `no' for `predicable' attribute > > (and a bunch more) > > I am guessing this may be related to the change made to > identify_predicable_attribute. Is anyone seeing this? Grrr! I was most of the way through an IA-64 bootstrap of a fix (along the lines of Andrew Pinski's suggestion), when someone at OpenEye decided to switch off the SGI Altix box I was using (as the air conditioning in the machine room just gave up). I suspect (hope?) that someone will post/commit a fix soon, but if not I'll get back to it once my Itanium boxes are back online. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-15 4:38 ` Roger Sayle @ 2006-03-15 19:29 ` Steve Ellcey 0 siblings, 0 replies; 504+ messages in thread From: Steve Ellcey @ 2006-03-15 19:29 UTC (permalink / raw) To: roger; +Cc: gcc-patches, uttamp, grigory_zagorodnev > Grrr! I was most of the way through an IA-64 bootstrap of a fix > (along the lines of Andrew Pinski's suggestion), when someone at > OpenEye decided to switch off the SGI Altix box I was using (as > the air conditioning in the machine room just gave up). > > I suspect (hope?) that someone will post/commit a fix soon, but > if not I'll get back to it once my Itanium boxes are back online. > > Roger > -- Roger, I did a bootstrap by just removing the last 'if (p_false) free (p_false);' like Grigory suggested and that builds but of course it reintroduces the memory leak. When I did a 'if (predicable_false) free (predicable_false);' before setting predicable_false, I got the following warning that becomes an error when we use -Werror later in the bootstrap: gcc/gensupport.c: In function 'identify_predicable_attribute': gcc/gensupport.c:478: warning: passing argument 1 of 'free' discards qualifiers from pointer target type The declaration of predicable_false is: static const char *predicable_false; I am not sure how to address that. Steve Ellcey sje@cup.hp.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-14 16:49 ` Steve Ellcey 2006-03-14 16:55 ` Andrew Pinski 2006-03-15 4:38 ` Roger Sayle @ 2006-03-15 10:23 ` Grigory Zagorodnev 2 siblings, 0 replies; 504+ messages in thread From: Grigory Zagorodnev @ 2006-03-15 10:23 UTC (permalink / raw) To: Steve Ellcey; +Cc: gcc-patches, uttamp, roger [-- Attachment #1: Type: text/plain, Size: 711 bytes --] Steve Ellcey wrote: > I think that this patch may be breaking the IA64 bootstrap (HP-UX and > I am guessing this may be related to the change made to > identify_predicable_attribute. Is anyone seeing this? Hi! I do see the same on ia64 trunk builds since this commit. Arm build failures are expected as well because attribute "predicable" is used there too. It seems to be wrong to free p_false memory at the end of 'identify_predicable_attribute' routine when it returns with success - the pointer is assigned to predicable_true and predicable_false variables for the future use. Therefore there is no memory leak. The fix is just back out a part of original commit. Do you think it is ok? - Grigory [-- Attachment #2: gensupport.c.patch --] [-- Type: text/plain, Size: 366 bytes --] Index: gcc/gensupport.c =================================================================== --- gcc/gensupport.c (revision 112077) +++ gcc/gensupport.c (working copy) @@ -511,9 +511,6 @@ identify_predicable_attribute (void) value); errors = 1; } - - if (p_false) - free (p_false); } /* Return the number of alternatives in constraint S. */ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-03-13 19:23 ` Uttam Pawar 2006-03-14 1:02 ` Roger Sayle 2006-03-14 16:49 ` Steve Ellcey @ 2006-03-15 10:15 ` Andreas Schwab 2 siblings, 0 replies; 504+ messages in thread From: Andreas Schwab @ 2006-03-15 10:15 UTC (permalink / raw) To: Uttam Pawar; +Cc: Roger Sayle, gcc-patches Uttam Pawar <uttamp@us.ibm.com> writes: > *************** identify_predicable_attribute (void) > *** 501,506 **** > --- 507,515 ---- > value); > errors = 1; > } > + > + if (p_false) > + free (p_false); > } This is broken. Checked in this patch as obvious fix to the bootstrap failure. Andreas. 2006-03-15 Andreas Schwab <schwab@suse.de> * gensupport.c (identify_predicable_attribute): Don't free p_false when it is still in use. Index: gcc/gensupport.c =================================================================== --- gcc/gensupport.c (revision 112080) +++ gcc/gensupport.c (working copy) @@ -510,10 +510,9 @@ identify_predicable_attribute (void) "unknown value `%s' for `predicable' attribute", value); errors = 1; + if (p_false) + free (p_false); } - - if (p_false) - free (p_false); } /* Return the number of alternatives in constraint S. */ -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 504+ messages in thread
* [patch] for PR26327 @ 2006-02-16 23:51 Uttam Pawar 2006-02-21 19:36 ` patch Ping Uttam Pawar 0 siblings, 1 reply; 504+ messages in thread From: Uttam Pawar @ 2006-02-16 23:51 UTC (permalink / raw) To: gcc-patches Hello, The following patch fixes the reported memory leaks. I also noticed the fix by Sebastian Pop, for a memory leak in gcc/tree-if-conv.c (ignored from this patch). Bootstrapped on powerpc64-linux. Testing (make check) showed no new regressions. Thanks, Uttam 2006-02-16 Uttam Pawar <uttamp@us.ibm.com> PR other/26327 * ipa-inline.c (cgraph_early_inlining): Allocate is done after the sorrycount and errorcount check. * loop-unroll.c (referenced_in_one_insn_in_loop_p): Free pointer 'body'. * cfgloop.c (cancel_loop): Free bbs pointer. * collect2.c (prefix_from_string): Free nstore pointer. * reload1.c (fix_abnormal_edges): Free blocks pointer. Index: gcc/ipa-inline.c =================================================================== *** gcc/ipa-inline.c (revision 111144) --- gcc/ipa-inline.c (working copy) *************** cgraph_early_inlining (void) *** 1137,1148 **** { struct cgraph_node *node; int nnodes; ! struct cgraph_node **order = ! XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); int i; if (sorrycount || errorcount) return; #ifdef ENABLE_CHECKING for (node = cgraph_nodes; node; node = node->next) gcc_assert (!node->aux); --- 1137,1150 ---- { struct cgraph_node *node; int nnodes; ! struct cgraph_node **order; int i; if (sorrycount || errorcount) return; + + order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); + #ifdef ENABLE_CHECKING for (node = cgraph_nodes; node; node = node->next) gcc_assert (!node->aux); Index: gcc/loop-unroll.c =================================================================== *** gcc/loop-unroll.c (revision 111144) --- gcc/loop-unroll.c (working copy) *************** referenced_in_one_insn_in_loop_p (struct *** 1532,1537 **** --- 1532,1538 ---- count_ref++; } } + free (body); return (count_ref == 1); } Index: gcc/cfgloop.c =================================================================== *** gcc/cfgloop.c (revision 111144) --- gcc/cfgloop.c (working copy) *************** cancel_loop (struct loops *loops, struct *** 1033,1038 **** --- 1033,1040 ---- /* Free loop data. */ flow_loop_free (loop); + + free (bbs); } /* Cancels LOOP and all its subloops. */ Index: gcc/collect2.c =================================================================== *** gcc/collect2.c (revision 111144) --- gcc/collect2.c (working copy) *************** prefix_from_string (const char *p, struc *** 728,733 **** --- 728,735 ---- else endp++; } + + free (nstore); } ^L /* Main program. */ Index: gcc/reload1.c =================================================================== *** gcc/reload1.c (revision 111144) --- gcc/reload1.c (working copy) *************** fixup_abnormal_edges (void) *** 8342,8347 **** --- 8342,8348 ---- blocks = sbitmap_alloc (last_basic_block); sbitmap_ones (blocks); find_many_sub_basic_blocks (blocks); + sbitmap_free (blocks); } if (inserted) ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch Ping 2006-02-16 23:51 [patch] for PR26327 Uttam Pawar @ 2006-02-21 19:36 ` Uttam Pawar 0 siblings, 0 replies; 504+ messages in thread From: Uttam Pawar @ 2006-02-21 19:36 UTC (permalink / raw) To: gcc-patches; +Cc: uttamp ping, 1) http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01377.html, this is for pr# 26327 2) http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01485.html Thanks, ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-02-16 15:58 Zdenek Dvorak 2006-02-17 2:40 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-16 15:58 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00676.html -- patch to improve the functions to work affine combinations; this patch blocks further ivopts cleanups (in particular, it keeps decl_rtl_to_reset alive -- I would really like to get rid of this ugly hack). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-16 15:58 Patch ping Zdenek Dvorak @ 2006-02-17 2:40 ` Roger Sayle 2006-02-17 9:24 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2006-02-17 2:40 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches On Thu, 16 Feb 2006, Zdenek Dvorak wrote: > http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00676.html > -- patch to improve the functions to work affine combinations; this > patch blocks further ivopts cleanups (in particular, it keeps > decl_rtl_to_reset alive -- I would really like to get rid of this > ugly hack). I'm a bit uncomfortable with the code duplication introduced by your new double_int structure. Similar double word arithmetic routines are already duplicated in the tree-ssa optimizers. The middle-end handling of TREE_OVERFLOW/TREE_CONSTANT_OVERFLOW and representation of INTEGER_CST, REAL_CST, CONST_INT and CONST_DOUBLE in trees and RTL are already "weeping sores" in GCC's infrastructure. Rather than add another set of hacks, or get embroiled in the inevitable clean-up, might I recommend using HOST_WIDE_INT pairs for the time being? Entangling your iv-opts clean-ups with the nightmare of GCC's multi-precision integer handling might result in delaying your changes until 4.3 or later :-( For example it isn't clear whether your new structure is a constructive step in the right direction. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-17 2:40 ` Roger Sayle @ 2006-02-17 9:24 ` Zdenek Dvorak 2006-02-17 10:34 ` Paolo Bonzini 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-17 9:24 UTC (permalink / raw) To: Roger Sayle; +Cc: gcc-patches Hello, > On Thu, 16 Feb 2006, Zdenek Dvorak wrote: > > http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00676.html > > -- patch to improve the functions to work affine combinations; this > > patch blocks further ivopts cleanups (in particular, it keeps > > decl_rtl_to_reset alive -- I would really like to get rid of this > > ugly hack). > > > I'm a bit uncomfortable with the code duplication introduced by your > new double_int structure. what code duplication? It just introduces a few simple wrapper functions, so that the manipulation is simpler and the code is cleaner. > Similar double word arithmetic routines > are already duplicated in the tree-ssa optimizers. The middle-end > handling of TREE_OVERFLOW/TREE_CONSTANT_OVERFLOW and representation > of INTEGER_CST, REAL_CST, CONST_INT and CONST_DOUBLE in trees and > RTL are already "weeping sores" in GCC's infrastructure. Rather > than add another set of hacks, or get embroiled in the inevitable > clean-up, might I recommend using HOST_WIDE_INT pairs for the time > being? I am really uncomfortable with this suggestion :-( Yep, it is certainly possible; however, keeping two parts of the same object separate strikes me as wrong design. > Entangling your iv-opts clean-ups with the nightmare of GCC's > multi-precision integer handling might result in delaying your > changes until 4.3 or later :-( For example it isn't clear whether > your new structure is a constructive step in the right direction. Well, as long as ivopts must handle the case of short and long integers separately, it is very hard to make any progress in it. Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-17 9:24 ` Zdenek Dvorak @ 2006-02-17 10:34 ` Paolo Bonzini 2006-02-17 15:31 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2006-02-17 10:34 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches, Roger Sayle >> Similar double word arithmetic routines >> are already duplicated in the tree-ssa optimizers. The middle-end >> handling of TREE_OVERFLOW/TREE_CONSTANT_OVERFLOW and representation >> of INTEGER_CST, REAL_CST, CONST_INT and CONST_DOUBLE in trees and >> RTL are already "weeping sores" in GCC's infrastructure. Rather >> than add another set of hacks, or get embroiled in the inevitable >> clean-up, might I recommend using HOST_WIDE_INT pairs for the time >> being? While I agree on the code duplication issues, on the other hand, I like the struct double_int much more than HOST_WIDE_INT pairs. Don't hold your breath, but if Zdenek's patch goes in I might work on using his struct double_int in fold-const.c as well. That's probably 4.3. Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-17 10:34 ` Paolo Bonzini @ 2006-02-17 15:31 ` Roger Sayle 2006-02-21 9:15 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2006-02-17 15:31 UTC (permalink / raw) To: Paolo Bonzini; +Cc: Zdenek Dvorak, gcc-patches, rth On Fri, 17 Feb 2006, Paolo Bonzini wrote: > While I agree on the code duplication issues, on the other hand, I like > the struct double_int much more than HOST_WIDE_INT pairs. > > Don't hold your breath, but if Zdenek's patch goes in I might work on > using his struct double_int in fold-const.c as well. That's probably 4.3. Ok, I see a plan... The new double_int bears more than a passing similarity to tree.h's struct tree_int_cst_lowhi. It looks like we already have a suitable double_int, we're just not using it as the basis of our low-level arithmetic routines. Ok, Zdenek, it looks like the way to proceed is to break out all of your new wrappers into their own doubleint.h and doubleint.c, and to change tree.h:tree_int_cst.int_cst to be of type double_int as a single preparatory patch. For compatability with the existing usage, you'll probably want to keep the high word signed. Clearly these prototypes don't belong in tree-affine.h, and I'd prefer to leave hwint.h untouched so it can potentially be used in other projects (generator programs?) without a hwint.c (i.e. like longlong.h). Then as time permits, probably mostly in 4.3, we'll move over fold-const.c, tree.c, tree-ssa and the RTL optimizers to use these new APIs. This can also lead into a longer term plan to disambiguate CONST_DOUBLE in our RTL, by distinguishing CONST_DOUBLE (which should only need two words), from a hypothetical CONST_REAL (which currently needs about six). Presumably folks are happy with taking and returning double_int structures rather than pointers to them, or pairs of HWIs as is done with the current APIs? During the transition the pairs of HWIs routines will remain. I suspect that we'll end up with two sets of low-level interfaces, for with and without over overflow detection, with overflow being returned as a bool rather than stored in the double_int representation. INTEGER_CSTs then become augmented double_int's with types, overflow, signedness, etc... The first patch is simple enough, it's the transition that it prompts... Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-17 15:31 ` Roger Sayle @ 2006-02-21 9:15 ` Zdenek Dvorak 2006-02-21 14:47 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-21 9:15 UTC (permalink / raw) To: Roger Sayle; +Cc: Paolo Bonzini, gcc-patches, rth Hello, > > While I agree on the code duplication issues, on the other hand, I like > > the struct double_int much more than HOST_WIDE_INT pairs. > > > > Don't hold your breath, but if Zdenek's patch goes in I might work on > > using his struct double_int in fold-const.c as well. That's probably 4.3. > > Ok, I see a plan... > > The new double_int bears more than a passing similarity to tree.h's struct > tree_int_cst_lowhi. It looks like we already have a suitable double_int, > we're just not using it as the basis of our low-level arithmetic routines. > > Ok, Zdenek, it looks like the way to proceed is to break out all of > your new wrappers into their own doubleint.h and doubleint.c, and > to change tree.h:tree_int_cst.int_cst to be of type double_int as a > single preparatory patch. For compatability with the existing usage, > you'll probably want to keep the high word signed. Clearly these > prototypes don't belong in tree-affine.h, and I'd prefer to leave > hwint.h untouched so it can potentially be used in other projects > (generator programs?) without a hwint.c (i.e. like longlong.h). here is the proposed patch; bootstrapped & regtested on x86_64. Zdenek * gengtype.c (main): Handle double_int type. * tree.h (struct tree_int_cst): Make type of int_cst double_int. * doubleint.c: New file. * doubleint.h: New file. * system.h: Include doubleint.h. * Makefile.in (SYSTEM_H): Include doubleint.h. (doubleint.o): Add. Index: gengtype.c =================================================================== *** gengtype.c (revision 111309) --- gengtype.c (working copy) *************** main(int ARG_UNUSED (argc), char ** ARG_ *** 3037,3042 **** --- 3037,3043 ---- do_scalar_typedef ("CUMULATIVE_ARGS", &pos); do_scalar_typedef ("REAL_VALUE_TYPE", &pos); + do_scalar_typedef ("double_int", &pos); do_scalar_typedef ("uint8", &pos); do_scalar_typedef ("jword", &pos); do_scalar_typedef ("JCF_u2", &pos); Index: tree.h =================================================================== *** tree.h (revision 111309) --- tree.h (working copy) *************** extern void omp_clause_range_check_faile *** 1239,1251 **** struct tree_int_cst GTY(()) { struct tree_common common; ! /* A sub-struct is necessary here because the function `const_hash' ! wants to scan both words as a unit and taking the address of the ! sub-struct yields the properly inclusive bounded pointer. */ ! struct tree_int_cst_lowhi { ! unsigned HOST_WIDE_INT low; ! HOST_WIDE_INT high; ! } int_cst; }; /* In a REAL_CST node. struct real_value is an opaque entity, with --- 1239,1245 ---- struct tree_int_cst GTY(()) { struct tree_common common; ! double_int int_cst; }; /* In a REAL_CST node. struct real_value is an opaque entity, with Index: doubleint.c =================================================================== *** doubleint.c (revision 0) --- doubleint.c (revision 0) *************** *** 0 **** --- 1,288 ---- + /* Operations with long integers. + Copyright (C) 2006 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + #include "config.h" + #include "system.h" + #include "coretypes.h" + #include "tm.h" + #include "tree.h" + + /* Constructs double_int from tree CST. */ + + double_int + tree_to_double_int (tree cst) + { + return TREE_INT_CST (cst); + } + + /* Restricts constant CST to the precision given by MASK. */ + + static inline double_int + restrict_cst_to_precision (double_int mask, double_int cst) + { + double_int r; + + DI_LOW_SET (r, DI_LOW (cst) & DI_LOW (mask)); + DI_HIGH_SET (r, DI_HIGH (cst) & DI_HIGH (mask)); + + return r; + } + + /* Returns true if X (whose precision is given by MASK) fits in + HOST_WIDE_INT. */ + + bool + double_int_fits_in_hwi_p (double_int mask, double_int x) + { + if (double_int_negative_p (mask, x)) + return DI_HIGH (x) == DI_HIGH (mask); + else + return DI_HIGH (x) == 0 && (HOST_WIDE_INT) DI_LOW (x) >= 0; + } + + /* Returns true if X fits in unsigned HOST_WIDE_INT. */ + + bool + double_int_fits_in_unsigned_hwi_p (double_int x) + { + return DI_HIGH (x) == 0; + } + + /* Returns true if SCALE is negative in precision of MASK. */ + + bool + double_int_negative_p (double_int mask, double_int scale) + { + if (DI_HIGH (mask)) + return (DI_HIGH (scale) & ~(DI_HIGH (mask) >> 1)) != 0; + else + return (DI_LOW (scale) & ~(DI_LOW (mask) >> 1)) != 0; + } + + /* Returns value of X, whose precision is given by MASK. X must satisfy + double_int_fits_in_hwi_p. */ + + HOST_WIDE_INT + double_int_to_hwi (double_int mask, double_int x) + { + if (DI_HIGH (mask) || !double_int_negative_p (mask, x)) + return DI_LOW (x); + else + return DI_LOW (x) | ~DI_LOW (mask); + } + + /* Returns value of X. X must satisfy double_int_fits_in_unsigned_hwi_p. */ + + unsigned HOST_WIDE_INT + double_int_to_unsigned_hwi (double_int x) + { + return DI_LOW (x); + } + + /* Returns A * B, truncated so that it fits into precision given by MASK. */ + + double_int + double_int_mul (double_int mask, double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + mul_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns A + B, truncated so that it fits into precision given by MASK. */ + + double_int + double_int_add (double_int mask, double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + add_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns -A, truncated so that it fits into precision given by MASK. */ + + double_int + double_int_negate (double_int mask, double_int a) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + neg_double (DI_LOW (a), DI_HIGH (a), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns A / B (computed as unsigned, rounded down). */ + + double_int + double_int_divide (double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo, rem_lo; + HOST_WIDE_INT hi, rem_hi; + double_int ret; + + div_and_round_double (FLOOR_DIV_EXPR, true, + DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), + &lo, &hi, &rem_lo, &rem_hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return ret; + } + + /* Constructs tree in type TYPE from with value given by CST (precision of CST + is the same as the precision of TYPE -- in particular, it must satisfy + double_int_fits_to_type_p). */ + + tree + double_int_to_tree (tree type, double_int cst) + { + unsigned HOST_WIDE_INT lo = DI_LOW (cst); + HOST_WIDE_INT hi = DI_HIGH (cst); + unsigned prec = TYPE_PRECISION (type); + bool negative; + + if (prec > HOST_BITS_PER_WIDE_INT) + { + prec -= HOST_BITS_PER_WIDE_INT; + negative = (hi >> (prec - 1)) & 1; + if (negative) + hi |= (~(unsigned HOST_WIDE_INT) 0) << (prec - 1) << 1; + } + else + { + negative = (DI_LOW (cst) >> (prec - 1)) & 1; + if (negative) + { + lo |= (~(unsigned HOST_WIDE_INT) 0) << (prec - 1) << 1; + hi = ~(unsigned HOST_WIDE_INT) 0; + } + } + + return build_int_cst_wide (type, lo, hi); + } + + /* Returns true if VAL is smaller or equal to the maximal value + representable in TYPE. */ + + bool + double_int_fits_to_type_p (tree type, double_int val) + { + unsigned prec = TYPE_PRECISION (type); + double_int mask = double_int_mask (TYPE_UNSIGNED (type) ? prec : prec - 1); + + return (((DI_LOW (val) & DI_LOW (mask)) == DI_LOW (val)) + && ((DI_HIGH (val) & DI_HIGH (mask)) == DI_HIGH (val))); + } + + /* Returns true if A < B, unsigned comparison. */ + + bool + double_int_smaller_p (double_int a, double_int b) + { + if (DI_HIGH (a) < DI_HIGH (b)) + return true; + if (DI_HIGH (a) > DI_HIGH (b)) + return false; + return DI_LOW (a) < DI_LOW (b); + } + + /* Splits last digit of *X in BASE and returns it. */ + + static unsigned + double_int_split_digit (double_int *x, unsigned base) + { + unsigned HOST_WIDE_INT resl, reml; + HOST_WIDE_INT resh, remh; + + div_and_round_double (FLOOR_DIV_EXPR, true, x->low, x->high, base, 0, + &resl, &resh, &reml, &remh); + x->high = resh; + x->low = resl; + + return reml; + } + + /* Dumps X (in precision given by MASK) to FILE. If SIGN is true, X is + considered to be signed. */ + + void + dump_double_int (FILE *file, double_int mask, double_int x, bool sign) + { + unsigned digits[100], n; + int i; + + if (double_int_zero_p (x)) + { + fprintf (file, "0"); + return; + } + + if (sign && double_int_negative_p (mask, x)) + { + fprintf (file, "-"); + x = double_int_negate (mask, x); + } + + for (n = 0; !double_int_zero_p (x); n++) + digits[n] = double_int_split_digit (&x, 10); + for (i = n - 1; i >= 0; i--) + fprintf (file, "%u", digits[i]); + } + + /* Returns a MASK for precision of PREC bits. */ + + double_int + double_int_mask (unsigned prec) + { + double_int mask; + + if (prec > HOST_BITS_PER_WIDE_INT) + { + prec -= HOST_BITS_PER_WIDE_INT; + DI_HIGH_SET (mask, (((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1)); + DI_LOW_SET (mask, ~(unsigned HOST_WIDE_INT) 0); + } + else + { + DI_HIGH_SET (mask, 0); + DI_LOW_SET (mask, (((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1)); + } + + return mask; + } Index: doubleint.h =================================================================== *** doubleint.h (revision 0) --- doubleint.h (revision 0) *************** *** 0 **** --- 1,118 ---- + /* Operations with long integers. + Copyright (C) 2006 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + #ifndef DOUBLE_INT_H + #define DOUBLE_INT_H + + /* A large integer. The precision of the represented number is between + 1 and 2 * HOST_BITS_PER_WIDE_INT and it must be provided in each + operation in form of mask that prescribes the significant bits + (such mask is also double_int and can be obtained using + double_int_mask). Signedness is only relevant for some operations + (comparisons, division), in these cases the description of + the function states whether the numbers are assumed to be signed + or unsigned. */ + + typedef struct + { + unsigned HOST_WIDE_INT low; + HOST_WIDE_INT high; /* High is signed for historical reasons (it replaces + a similar structure that was used previously). It + makes manipulation with the numbers more cumbersome, + so it would be nice to change it. */ + } double_int; + #define DI_LOW(X) (X).low + #define DI_HIGH(X) ((unsigned HOST_WIDE_INT) (X).high) + #define DI_LOW_SET(X, L) ((X).low = (unsigned HOST_WIDE_INT) (L)) + #define DI_HIGH_SET(X, L) ((X).high = (HOST_WIDE_INT) (L)) + + union tree_node; + + union tree_node *double_int_to_tree (union tree_node *, double_int); + bool double_int_fits_to_type_p (union tree_node *, double_int); + double_int tree_to_double_int (union tree_node *tree); + bool double_int_fits_in_hwi_p (double_int, double_int); + HOST_WIDE_INT double_int_to_hwi (double_int, double_int); + bool double_int_fits_in_unsigned_hwi_p (double_int); + unsigned HOST_WIDE_INT double_int_to_unsigned_hwi (double_int); + double_int double_int_mul (double_int, double_int, double_int); + double_int double_int_add (double_int, double_int, double_int); + double_int double_int_negate (double_int, double_int); + double_int double_int_divide (double_int, double_int); + bool double_int_negative_p (double_int, double_int); + bool double_int_smaller_p (double_int, double_int); + void dump_double_int (FILE *, double_int, double_int, bool); + double_int double_int_mask (unsigned); + + /* Constructs double_int from integer CST. */ + + static inline double_int + hwi_to_double_int (HOST_WIDE_INT cst) + { + double_int r; + + DI_LOW_SET (r, cst); + DI_HIGH_SET (r, cst < 0 ? ~(unsigned HOST_WIDE_INT) 0 : 0); + + return r; + } + + /* Constructs mask with all bits 1. */ + + static inline double_int + double_int_all (void) + { + return hwi_to_double_int (-1); + } + + /* Returns true if CST is zero. */ + + static inline bool + double_int_zero_p (double_int cst) + { + return DI_LOW (cst) == 0 && DI_HIGH (cst) == 0; + } + + /* Returns true if CST is one. */ + + static inline bool + double_int_one_p (double_int cst) + { + return DI_LOW (cst) == 1 && DI_HIGH (cst) == 0; + } + + /* Returns true if CST is minus one in precision of MASK. */ + + static inline bool + double_int_minus_one_p (double_int mask, double_int cst) + { + return (DI_LOW (cst) == DI_LOW (mask) + && DI_HIGH (cst) == DI_HIGH (mask)); + } + + /* Returns true if CST1 == CST2. */ + + static inline bool + double_int_equal_p (double_int cst1, double_int cst2) + { + return DI_LOW (cst1) == DI_LOW (cst2) && DI_HIGH (cst1) == DI_HIGH (cst2); + } + + #endif /* DOUBLE_INT_H */ Index: system.h =================================================================== *** system.h (revision 111309) --- system.h (working copy) *************** extern void fancy_abort (const char *, i *** 609,614 **** --- 609,616 ---- # define FALSE false #endif /* !__cplusplus */ + /* Get definition of double_int. */ + #include "doubleint.h" /* Some compilers do not allow the use of unsigned char in bitfields. */ #define BOOL_BITFIELD unsigned int Index: Makefile.in =================================================================== *** Makefile.in (revision 111309) --- Makefile.in (working copy) *************** INSN_ATTR_H = insn-attr.h $(srcdir)/insn *** 773,779 **** C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) C_PRAGMA_H = c-pragma.h $(CPPLIB_H) C_TREE_H = c-tree.h $(C_COMMON_H) toplev.h $(DIAGNOSTIC_H) ! SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h --- 773,779 ---- C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) C_PRAGMA_H = c-pragma.h $(CPPLIB_H) C_TREE_H = c-tree.h $(C_COMMON_H) toplev.h $(DIAGNOSTIC_H) ! SYSTEM_H = system.h hwint.h doubleint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h *************** prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_ *** 1779,1784 **** --- 1779,1786 ---- convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(FLAGS_H) convert.h toplev.h langhooks.h real.h + doubleint.o: doubleint.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) + langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) toplev.h $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \ langhooks.h $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) intl.h \ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 9:15 ` Zdenek Dvorak @ 2006-02-21 14:47 ` Roger Sayle 2006-02-21 15:43 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2006-02-21 14:47 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: Paolo Bonzini, gcc-patches, rth Hi Zdenek, On Tue, 21 Feb 2006, Zdenek Dvorak wrote: > > * gengtype.c (main): Handle double_int type. > * tree.h (struct tree_int_cst): Make type of int_cst double_int. > * doubleint.c: New file. > * doubleint.h: New file. > * system.h: Include doubleint.h. > * Makefile.in (SYSTEM_H): Include doubleint.h. > (doubleint.o): Add. Hmmm, not quite. > + /* A large integer. The precision of the represented number is between > + 1 and 2 * HOST_BITS_PER_WIDE_INT and it must be provided in each > + operation in form of mask that prescribes the significant bits > + (such mask is also double_int and can be obtained using > + double_int_mask). Signedness is only relevant for some operations > + (comparisons, division), in these cases the description of > + the function states whether the numbers are assumed to be signed > + or unsigned. */ > + > + typedef struct > + { > + unsigned HOST_WIDE_INT low; > + HOST_WIDE_INT high; /* High is signed for historical reasons (it replaces > + a similar structure that was used previously). It > + makes manipulation with the numbers more cumbersome, > + so it would be nice to change it. */ > + } double_int; > + #define DI_LOW(X) (X).low > + #define DI_HIGH(X) ((unsigned HOST_WIDE_INT) (X).high) > + #define DI_LOW_SET(X, L) ((X).low = (unsigned HOST_WIDE_INT) (L)) > + #define DI_HIGH_SET(X, L) ((X).high = (HOST_WIDE_INT) (L)) I believe that the last sixty years of digital computation have decisively shown the superiority of two's complement arithmetic for representing signed integers as binary, and convenient for interconversion with unsigned values. You should treat double_int like you would a TImode. For example, -1 should be represented by both the high an low words containing all one bits. + /* Returns true if CST is minus one in precision of MASK. */ + + static inline bool + double_int_minus_one_p (double_int mask, double_int cst) + { + return (DI_LOW (cst) == DI_LOW (mask) + && DI_HIGH (cst) == DI_HIGH (mask)); + } Then you wouldn't need a mask to test for minus one! + /* Returns true if SCALE is negative in precision of MASK. */ + + bool + double_int_negative_p (double_int mask, double_int scale) + { + if (DI_HIGH (mask)) + return (DI_HIGH (scale) & ~(DI_HIGH (mask) >> 1)) != 0; + else + return (DI_LOW (scale) & ~(DI_LOW (mask) >> 1)) != 0; + } And you wouldn't have to do pass in a mask to determine whether a value is negative. You would be able to implement a signed comparison, which is not so mysteriously missing from from your patch. But most importantly.... + mul_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); ... + add_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); ... + neg_double (DI_LOW (a), DI_HIGH (a), &lo, &hi); ... + div_and_round_double (FLOOR_DIV_EXPR, true, + DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), + &lo, &hi, &rem_lo, &rem_hi); You'll now get the correct results out of all of these routines, which assume the same sign-extended two's complement representation of integers as used in the rest of the compiler, and the vast majority of the rest of the planet. The most bizarre thing is that all of the code that you want/need to perform 2*HOST_WIDE_INT arithmetic is already in the compiler. Perhaps I'm thinking about this all wrong. Anyone whose done a first-year Computer Science course would be aware of my side of the argument above, and I'd hope its safe to say you'd be able to predict these objections. Maybe you could describe the benefits of your novel approach? Why not normalize mask to double_int_all, which allows values to be represented independently of their precision? Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 14:47 ` Roger Sayle @ 2006-02-21 15:43 ` Zdenek Dvorak 2006-02-21 18:01 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-21 15:43 UTC (permalink / raw) To: Roger Sayle; +Cc: Paolo Bonzini, gcc-patches, rth Hello, > I believe that the last sixty years of digital computation have > decisively shown the superiority of two's complement arithmetic > for representing signed integers as binary, and convenient for > interconversion with unsigned values. yes, this is why I have chosen to use it (well, why I haven't considered any other in the first place). > You should treat double_int like you would a TImode. For example, -1 > should be represented by both the high an low words containing all one > bits. This is quite orthogonal issue to whether to use two's complement arithmetic or something else. As far as I understand, this is the main point of your objection, so I will focus on it. There are several basic properties I want double_int to satisfy: 1) it is possible to represent numbers with smaller precision than 2 * HOST_BITS_PER_WIDE_INT 2) it is not neccessary to distinguish between signed and unsigned values in functions that perform arithmetics modulo 2^precision (+, -, *, negation,...) 3) each number has only one possible representation. I will for now assume that we agree on that these are desirable; if not, I will present my arguments on this issue in the followup mail(s). 1) and 3) leave us with basically three choices of how to represent the numbers; avoiding long explanation, let us demonstrate these on examples, say we want to represent 8-bit values: -- (a): unsigned 127 = signed 127 = {0, 127} unsigned 255 = signed -1 = {0, 255} -- (b) unsigned 127 = signed 127 = {0, 127} unsigned 255 = signed -1 = {-1, -1} -- (c) unsigned 127 = signed 127 = {0, 127} unsigned 255 = {0,255} signed -1 = {-1, -1} My choice is (a). Your choice seems to be either (b) or (c), you are not quite clear about it. By property 2, it would be nice for signed and unsigned numbers with the same precision to have the same representation (use the same range of numbers); this leaves only (a) and (b) as possibilities. Regardless of the choice, because of 3) you need to have some normalization of the results of the operation -- e.g., in representation (b), 127 + 127 = 254 = {-1, -2}, but add_double would return {0,254}. In representation (a), -1 + -1 = -2 = {0,254}, but add_double would return {0, 510}. For (a), this normalization is X & MASK. For (b), it is if (X & (1<< (prec - 1)) == 0) ? X & MASK : X | ~MASK. Between (a) and (b), I have chosen (a) as the normalization is simpler. > + /* Returns true if CST is minus one in precision of MASK. */ > + > + static inline bool > + double_int_minus_one_p (double_int mask, double_int cst) > + { > + return (DI_LOW (cst) == DI_LOW (mask) > + && DI_HIGH (cst) == DI_HIGH (mask)); > + } > > Then you wouldn't need a mask to test for minus one! > > + /* Returns true if SCALE is negative in precision of MASK. */ > + > + bool > + double_int_negative_p (double_int mask, double_int scale) > + { > + if (DI_HIGH (mask)) > + return (DI_HIGH (scale) & ~(DI_HIGH (mask) >> 1)) != 0; > + else > + return (DI_LOW (scale) & ~(DI_LOW (mask) >> 1)) != 0; > + } > > And you wouldn't have to do pass in a mask to determine whether > a value is negative. yes, this is about the only real advantage of the representation (b). > You would be able to implement a signed comparison, which is > not so mysteriously missing from from your patch. You would still need to distinguish between signed and unsigned versions of the comparison, at the very least for numbers whose precision is exactly 2 * HOST_BITS_PER_WIDE_INT. The reason I do not implement signed comparison is that I do not need it anywhere, not because it would be somehow fundamentally harder than the unsigned case. > But most importantly.... > > + mul_double (DI_LOW (a), DI_HIGH (a), > + DI_LOW (b), DI_HIGH (b), &lo, &hi); > ... > + add_double (DI_LOW (a), DI_HIGH (a), > + DI_LOW (b), DI_HIGH (b), &lo, &hi); > ... > + neg_double (DI_LOW (a), DI_HIGH (a), &lo, &hi); > ... > + div_and_round_double (FLOOR_DIV_EXPR, true, > + DI_LOW (a), DI_HIGH (a), > + DI_LOW (b), DI_HIGH (b), > + &lo, &hi, &rem_lo, &rem_hi); > > You'll now get the correct results out of all of these routines, which > assume the same sign-extended two's complement representation of > integers as used in the rest of the compiler, and the vast majority > of the rest of the planet. Regardless of whether the representation you choose is (a), (b), or (c), you need to do some normalization of the result. This is simplest for (a) -- just mask out bits outside of the precision, more complicated for (b) -- you need to do sign extension, and even more quite complex for (c) (you need to distinguish between the signed and unsigned cases). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 15:43 ` Zdenek Dvorak @ 2006-02-21 18:01 ` Richard Henderson 2006-02-21 23:04 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Richard Henderson @ 2006-02-21 18:01 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: Roger Sayle, Paolo Bonzini, gcc-patches On Tue, Feb 21, 2006 at 04:43:17PM +0100, Zdenek Dvorak wrote: > yes, this is about the only real advantage of the representation (b). The fact that rtl uses (b) for its const_int lends support for using that representation elsewhere. It's surely less confusing to have one rule instead of two. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 18:01 ` Richard Henderson @ 2006-02-21 23:04 ` Zdenek Dvorak 2006-02-21 23:16 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-21 23:04 UTC (permalink / raw) To: Richard Henderson, Roger Sayle, Paolo Bonzini, gcc-patches Hello, > On Tue, Feb 21, 2006 at 04:43:17PM +0100, Zdenek Dvorak wrote: > > yes, this is about the only real advantage of the representation (b). > > The fact that rtl uses (b) for its const_int lends support for using > that representation elsewhere. It's surely less confusing to have > one rule instead of two. rtl (function immed_double_const) usses the following rules: the function takes two HOST_WIDE_INTs i0 and i1 (where i1 corresponds to higher bits). Let w be precision of the mode of the constructed constant, and s the sign bit of the represented number (i.e. the one at position 1 << (w - 1)). If w <= HOST_BITS_PER_WIDE_INT, the functions returns just CONST_INT, not CONST_DOUBLE. In this case, rule (b) -- filling bits above w with s -- is used. Suppose now w > HOST_BITS_PER_WIDE_INT. If i1 == 0 and i0 >=0, or i1 == -1 and i1 < 0, we return CONST_INT for i0, anyway. Otherwise, the components i0 and i1 are put into the constant unchanged. In particular, this means that the rtl semantics allows multiple representations for the same number, in case HOST_BITS_PER_WIDE_INT < w < 2 * HOST_BITS_PER_WIDE_INT. I do not really have very strong preferences whether to use semantics (a) or (b), as long as we do not use the semantics we use for rtl :-) I slightly prefer (a), as 1) normalization is slightly simpler 2) it is the more senseful one if the components of double_int are manipulated as unsigned numbers (which I prefer as it makes it less likely to run into problems with undefined semantics of overflow for signed types). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 23:04 ` Zdenek Dvorak @ 2006-02-21 23:16 ` Richard Henderson 2006-02-22 0:20 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Richard Henderson @ 2006-02-21 23:16 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: Roger Sayle, Paolo Bonzini, gcc-patches On Wed, Feb 22, 2006 at 12:04:37AM +0100, Zdenek Dvorak wrote: > If w <= HOST_BITS_PER_WIDE_INT, the functions returns just CONST_INT, not > CONST_DOUBLE. In this case, rule (b) -- filling bits above w with s -- > is used. Yep. > Suppose now w > HOST_BITS_PER_WIDE_INT. If i1 == 0 and i0 >=0, or > i1 == -1 and i1 < 0, we return CONST_INT for i0, anyway. Sure. It saves memory. > Otherwise, the components i0 and i1 are put into the constant unchanged. Note that there exists no rtl mode for which w > HBPWI and w < 2*HBPWI. That is, if w > HBPWI, then w == 2*HBPWI. So the point you're trying to make here doesn't actually apply, so rule (b) continues to hold. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-02-21 23:16 ` Richard Henderson @ 2006-02-22 0:20 ` Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2006-02-22 0:20 UTC (permalink / raw) To: Richard Henderson, Roger Sayle, Paolo Bonzini, gcc-patches Hello, > On Wed, Feb 22, 2006 at 12:04:37AM +0100, Zdenek Dvorak wrote: > > If w <= HOST_BITS_PER_WIDE_INT, the functions returns just CONST_INT, not > > CONST_DOUBLE. In this case, rule (b) -- filling bits above w with s -- > > is used. > > Yep. > > > Suppose now w > HOST_BITS_PER_WIDE_INT. If i1 == 0 and i0 >=0, or > > i1 == -1 and i1 < 0, we return CONST_INT for i0, anyway. > > Sure. It saves memory. > > > Otherwise, the components i0 and i1 are put into the constant unchanged. > > Note that there exists no rtl mode for which w > HBPWI and w < 2*HBPWI. > That is, if w > HBPWI, then w == 2*HBPWI. So the point you're trying to > make here doesn't actually apply, so rule (b) continues to hold. ehm... immed_double_const would really need clean up, and pruning of completely missleading comments... I will send patch once it passes testing. Anyway, here is the patch for double_ints with rule (b). Zdenek * gengtype.c (main): Handle double_int type. * tree.h (struct tree_int_cst): Make type of int_cst double_int. * doubleint.c: New file. * doubleint.h: New file. * system.h: Include doubleint.h. * Makefile.in (SYSTEM_H): Include doubleint. (doubleint.o): Add. Index: gengtype.c =================================================================== *** gengtype.c (revision 111309) --- gengtype.c (working copy) *************** main(int ARG_UNUSED (argc), char ** ARG_ *** 3037,3042 **** --- 3037,3043 ---- do_scalar_typedef ("CUMULATIVE_ARGS", &pos); do_scalar_typedef ("REAL_VALUE_TYPE", &pos); + do_scalar_typedef ("double_int", &pos); do_scalar_typedef ("uint8", &pos); do_scalar_typedef ("jword", &pos); do_scalar_typedef ("JCF_u2", &pos); Index: tree.h =================================================================== *** tree.h (revision 111309) --- tree.h (working copy) *************** extern void omp_clause_range_check_faile *** 1239,1251 **** struct tree_int_cst GTY(()) { struct tree_common common; ! /* A sub-struct is necessary here because the function `const_hash' ! wants to scan both words as a unit and taking the address of the ! sub-struct yields the properly inclusive bounded pointer. */ ! struct tree_int_cst_lowhi { ! unsigned HOST_WIDE_INT low; ! HOST_WIDE_INT high; ! } int_cst; }; /* In a REAL_CST node. struct real_value is an opaque entity, with --- 1239,1245 ---- struct tree_int_cst GTY(()) { struct tree_common common; ! double_int int_cst; }; /* In a REAL_CST node. struct real_value is an opaque entity, with Index: doubleint.c =================================================================== *** doubleint.c (revision 0) --- doubleint.c (revision 0) *************** *** 0 **** --- 1,298 ---- + /* Operations with long integers. + Copyright (C) 2006 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + #include "config.h" + #include "system.h" + #include "coretypes.h" + #include "tm.h" + #include "tree.h" + + /* Restricts constant CST to the precision given by MASK. */ + + static inline double_int + restrict_cst_to_precision (double_int mask, double_int cst) + { + double_int r; + bool negative; + unsigned HOST_WIDE_INT sbit, snum; + + /* Copy the sign bit to the bits outside of mask. */ + if (DI_HIGH (mask)) + { + sbit = (DI_HIGH (mask) >> 1) + 1; + snum = DI_HIGH (cst); + } + else + { + sbit = (DI_LOW (mask) >> 1) + 1; + snum = DI_LOW (cst); + } + negative = (snum & sbit) != 0; + + if (negative) + { + DI_LOW_SET (r, DI_LOW (cst) | ~DI_LOW (mask)); + DI_HIGH_SET (r, DI_HIGH (cst) | ~DI_HIGH (mask)); + } + else + { + DI_LOW_SET (r, DI_LOW (cst) & DI_LOW (mask)); + DI_HIGH_SET (r, DI_HIGH (cst) & DI_HIGH (mask)); + } + + return r; + } + + /* Zeros bits of CST outside of MASK. */ + + static inline double_int + zero_excess_bits (double_int mask, double_int cst) + { + double_int r; + + DI_LOW_SET (r, DI_LOW (cst) & DI_LOW (mask)); + DI_HIGH_SET (r, DI_HIGH (cst) & DI_HIGH (mask)); + + return r; + } + + /* Constructs double_int from tree CST. */ + + double_int + tree_to_double_int (tree cst) + { + tree type = TREE_TYPE (cst); + double_int mask = double_int_mask (TYPE_PRECISION (type)); + return restrict_cst_to_precision (mask, TREE_INT_CST (cst)); + } + + /* Returns true if X fits in HOST_WIDE_INT. */ + + bool + double_int_fits_in_hwi_p (double_int x) + { + return ((DI_HIGH (x) == 0 && (HOST_WIDE_INT) DI_LOW (x) >= 0) + || (DI_HIGH (x) == ALL_ONES && (HOST_WIDE_INT) DI_LOW (x) < 0)); + } + + /* Returns true if X fits in unsigned HOST_WIDE_INT. */ + + bool + double_int_fits_in_unsigned_hwi_p (double_int x) + { + return DI_HIGH (x) == 0; + } + + /* Returns true if SCALE is negative. */ + + bool + double_int_negative_p (double_int scale) + { + return (HOST_WIDE_INT) DI_HIGH (scale) < 0; + } + + /* Returns value of X as a signed number. X must satisfy + double_int_fits_in_hwi_p. */ + + HOST_WIDE_INT + double_int_to_hwi (double_int x) + { + return DI_LOW (x); + } + + /* Returns value of X as an unsigned number. X must satisfy + double_int_fits_in_unsigned_hwi_p. */ + + unsigned HOST_WIDE_INT + double_int_to_unsigned_hwi (double_int x) + { + return DI_LOW (x); + } + + /* Returns A * B, in precision given by MASK. */ + + double_int + double_int_mul (double_int mask, double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + mul_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns A + B, in precision given by MASK. */ + + double_int + double_int_add (double_int mask, double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + add_double (DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns -A, in precision given by MASK. */ + + double_int + double_int_negate (double_int mask, double_int a) + { + unsigned HOST_WIDE_INT lo; + HOST_WIDE_INT hi; + double_int ret; + + neg_double (DI_LOW (a), DI_HIGH (a), &lo, &hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Returns A / B (computed as unsigned in precision given by MASK, rounded + down). */ + + double_int + double_int_divide (double_int mask, double_int a, double_int b) + { + unsigned HOST_WIDE_INT lo, rem_lo; + HOST_WIDE_INT hi, rem_hi; + double_int ret; + + a = zero_excess_bits (mask, a); + b = zero_excess_bits (mask, b); + div_and_round_double (FLOOR_DIV_EXPR, true, + DI_LOW (a), DI_HIGH (a), + DI_LOW (b), DI_HIGH (b), + &lo, &hi, &rem_lo, &rem_hi); + DI_LOW_SET (ret, lo); + DI_HIGH_SET (ret, hi); + + return restrict_cst_to_precision (mask, ret); + } + + /* Constructs tree in type TYPE from with value given by CST (precision of CST + is the same as the precision of TYPE). */ + + tree + double_int_to_tree (tree type, double_int cst) + { + unsigned HOST_WIDE_INT lo = DI_LOW (cst); + HOST_WIDE_INT hi = DI_HIGH (cst); + + if (TYPE_UNSIGNED (type)) + cst = zero_excess_bits (double_int_mask (TYPE_PRECISION (type)), cst); + return build_int_cst_wide (type, lo, hi); + } + + /* Returns true if A < B, unsigned comparison, in precision given by MASK. */ + + bool + double_int_smaller_p (double_int mask, double_int a, double_int b) + { + a = zero_excess_bits (mask, a); + b = zero_excess_bits (mask, b); + if (DI_HIGH (a) < DI_HIGH (b)) + return true; + if (DI_HIGH (a) > DI_HIGH (b)) + return false; + return DI_LOW (a) < DI_LOW (b); + } + + /* Splits last digit of *X (taken as unsigned in precision + of 2 * HOST_BITS_PER_WIDE_INT bits) in BASE and returns it. */ + + static unsigned + double_int_split_digit (double_int *x, unsigned base) + { + unsigned HOST_WIDE_INT resl, reml; + HOST_WIDE_INT resh, remh; + + div_and_round_double (FLOOR_DIV_EXPR, true, x->low, x->high, base, 0, + &resl, &resh, &reml, &remh); + x->high = resh; + x->low = resl; + + return reml; + } + + /* Dumps X (in precision given by MASK) to FILE. If SIGN is true, X is + considered to be signed. */ + + void + dump_double_int (FILE *file, double_int mask, double_int x, bool sign) + { + unsigned digits[100], n; + int i; + + if (double_int_zero_p (x)) + { + fprintf (file, "0"); + return; + } + + if (double_int_negative_p (x)) + { + if (sign) + { + fprintf (file, "-"); + x = double_int_negate (mask, x); + } + else + x = zero_excess_bits (mask, x); + } + + for (n = 0; !double_int_zero_p (x); n++) + digits[n] = double_int_split_digit (&x, 10); + for (i = n - 1; i >= 0; i--) + fprintf (file, "%u", digits[i]); + } + + /* Returns a MASK for precision of PREC bits. */ + + double_int + double_int_mask (unsigned prec) + { + double_int mask; + + if (prec > HOST_BITS_PER_WIDE_INT) + { + prec -= HOST_BITS_PER_WIDE_INT; + DI_HIGH_SET (mask, (((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1)); + DI_LOW_SET (mask, ~(unsigned HOST_WIDE_INT) 0); + } + else + { + DI_HIGH_SET (mask, 0); + DI_LOW_SET (mask, (((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1)); + } + + return mask; + } Index: doubleint.h =================================================================== *** doubleint.h (revision 0) --- doubleint.h (revision 0) *************** *** 0 **** --- 1,126 ---- + /* Operations with long integers. + Copyright (C) 2006 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + #ifndef DOUBLE_INT_H + #define DOUBLE_INT_H + + /* A large integer. The precision of the represented number is between + 1 and 2 * HOST_BITS_PER_WIDE_INT and it must be provided in each + operation in form of mask that prescribes the significant bits + (such mask is also double_int and can be obtained using + double_int_mask). Signedness is only relevant for some operations + (comparisons, division), in these cases the description of + the function states whether the numbers are assumed to be signed + or unsigned. The bits outside of the precision of the number are + set to be equal to the sign bit, for compatibility with rtl + representation (and tree representation of numbers in signed types; + in unsigned ones, such bits are zeroed). */ + + typedef struct + { + unsigned HOST_WIDE_INT low; + HOST_WIDE_INT high; /* High is signed for historical reasons (it replaces + a similar structure that was used previously). It + makes manipulation with the numbers more cumbersome, + so it would be nice to change it. */ + } double_int; + #define DI_LOW(X) (X).low + #define DI_HIGH(X) ((unsigned HOST_WIDE_INT) (X).high) + #define DI_LOW_SET(X, L) ((X).low = (unsigned HOST_WIDE_INT) (L)) + #define DI_HIGH_SET(X, L) ((X).high = (HOST_WIDE_INT) (L)) + #define ALL_ONES (~((unsigned HOST_WIDE_INT) 0)) + + union tree_node; + + union tree_node *double_int_to_tree (union tree_node *, double_int); + double_int tree_to_double_int (union tree_node *tree); + bool double_int_fits_in_hwi_p (double_int); + HOST_WIDE_INT double_int_to_hwi (double_int); + bool double_int_fits_in_unsigned_hwi_p (double_int); + unsigned HOST_WIDE_INT double_int_to_unsigned_hwi (double_int); + double_int double_int_mul (double_int, double_int, double_int); + double_int double_int_add (double_int, double_int, double_int); + double_int double_int_negate (double_int, double_int); + double_int double_int_divide (double_int, double_int, double_int); + bool double_int_negative_p (double_int); + bool double_int_smaller_p (double_int, double_int, double_int); + void dump_double_int (FILE *, double_int, double_int, bool); + double_int double_int_mask (unsigned); + + /* Constructs double_int from integer CST. Note that this number may need to + be masked for a given precison in order to be valid. */ + + static inline double_int + hwi_to_double_int (HOST_WIDE_INT cst) + { + double_int r; + + DI_LOW_SET (r, cst); + DI_HIGH_SET (r, cst < 0 ? ALL_ONES : 0); + + return r; + } + + /* Constructs mask with all bits 1. */ + + static inline double_int + double_int_all (void) + { + double_int r; + + DI_LOW_SET (r, ALL_ONES); + DI_HIGH_SET (r, ALL_ONES); + + return r; + } + + /* Returns true if CST is zero. */ + + static inline bool + double_int_zero_p (double_int cst) + { + return DI_LOW (cst) == 0 && DI_HIGH (cst) == 0; + } + + /* Returns true if CST is one. */ + + static inline bool + double_int_one_p (double_int cst) + { + return DI_LOW (cst) == 1 && DI_HIGH (cst) == 0; + } + + /* Returns true if CST is minus one. */ + + static inline bool + double_int_minus_one_p (double_int cst) + { + return (DI_LOW (cst) == ALL_ONES && DI_HIGH (cst) == ALL_ONES); + } + + /* Returns true if CST1 == CST2. */ + + static inline bool + double_int_equal_p (double_int cst1, double_int cst2) + { + return DI_LOW (cst1) == DI_LOW (cst2) && DI_HIGH (cst1) == DI_HIGH (cst2); + } + + #endif /* DOUBLE_INT_H */ Index: system.h =================================================================== *** system.h (revision 111309) --- system.h (working copy) *************** extern void fancy_abort (const char *, i *** 609,614 **** --- 609,616 ---- # define FALSE false #endif /* !__cplusplus */ + /* Get definition of double_int. */ + #include "doubleint.h" /* Some compilers do not allow the use of unsigned char in bitfields. */ #define BOOL_BITFIELD unsigned int Index: Makefile.in =================================================================== *** Makefile.in (revision 111309) --- Makefile.in (working copy) *************** INSN_ATTR_H = insn-attr.h $(srcdir)/insn *** 773,779 **** C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) C_PRAGMA_H = c-pragma.h $(CPPLIB_H) C_TREE_H = c-tree.h $(C_COMMON_H) toplev.h $(DIAGNOSTIC_H) ! SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h --- 773,779 ---- C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) C_PRAGMA_H = c-pragma.h $(CPPLIB_H) C_TREE_H = c-tree.h $(C_COMMON_H) toplev.h $(DIAGNOSTIC_H) ! SYSTEM_H = system.h hwint.h doubleint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h *************** prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_ *** 1779,1784 **** --- 1779,1786 ---- convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(FLAGS_H) convert.h toplev.h langhooks.h real.h + doubleint.o: doubleint.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) + langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) toplev.h $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \ langhooks.h $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) intl.h \ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-02-14 17:19 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2006-02-14 17:19 UTC (permalink / raw) To: gcc-patches Hi! --with{,out}-long-double-128 configure option: http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00664.html (together with the already approved remaining parts of: http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00274.html http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00271.html http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00263.html). Ok for trunk? Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-01-28 0:07 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2006-01-28 0:07 UTC (permalink / raw) To: gcc-patches Hello, I would like to ping the following two patches, that block followup cleanup patches to ivopts and other parts of the loop optimizer. http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00676.html -- improves, cleans up, and moves to the separate file functions for work with affine combinations http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01259.html -- removes final value replacement from ivopts Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-01-16 21:54 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2006-01-16 21:54 UTC (permalink / raw) To: gcc-patches, fortran Hi! Ping: http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01957.html - fix debuginfo for preprocessed fortran sources Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping... @ 2006-01-10 21:41 Jan Hubicka 2006-01-10 22:45 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2006-01-10 21:41 UTC (permalink / raw) To: gcc-patches, rth Hi, the patch: http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01877.html used to rearrange saving code in inliner is needed to proceed further on IPA branch merging. Would be possible to take a look on it, please? Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping... 2006-01-10 21:41 Jan Hubicka @ 2006-01-10 22:45 ` Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2006-01-10 22:45 UTC (permalink / raw) To: Jan Hubicka; +Cc: gcc-patches, rth Jan Hubicka <hubicka@ucw.cz> writes: > the patch: > http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01877.html > used to rearrange saving code in inliner is needed to proceed further on > IPA branch merging. Would be possible to take a look on it, please? OK, I tried to wrap my head around it. The update_clones_p field in inline_data needs a comment. The update_clones parameter to tree_function_versioning needs a comment. The comment "This means not lowering some constructs such as exception handling" in tree_rest_of_compilation no longer seems accurate. It now calls save_inline_function_body, which does appear to lower exception handling. OK with those changes. Thanks. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2006-01-10 14:03 Zdenek Dvorak 2006-01-10 14:20 ` Diego Novillo 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2006-01-10 14:03 UTC (permalink / raw) To: gcc-patches; +Cc: dnovillo Hello, http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00670.html -- a patch to make dumps in several loop optimization passes (ivopts, vectorizer, ...) easier to read, by having scev & data dependence analysis dumps disabled by default http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01820.html -- an updated version of one of tree-ssa-operands.c cleanup patches; it was approved by Diego except for one suspicious place, which is changed in this version Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-01-10 14:03 Zdenek Dvorak @ 2006-01-10 14:20 ` Diego Novillo 2006-01-10 16:27 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Diego Novillo @ 2006-01-10 14:20 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches On Tuesday 10 January 2006 09:03, Zdenek Dvorak wrote: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00670.html > -- a patch to make dumps in several loop optimization passes (ivopts, > vectorizer, ...) easier to read, by having scev & data dependence > analysis dumps disabled by default > Not completely OK. When I specify -details, I want every piece of information produced by the pass. It's fine with me if you want to add a specific -analysis switch that is orthogonal from -details. But with your patch, -details would not print everything in the scev and data dependence dumps. A simple tweak to this patch would give us both things. Make TDF_DETAILS include TDF_ANALYSIS in its bitmask. In fact, we could even have: #define TDF_DETAILS (1<<3) | TDF_ANALYSIS | TDF_STATS > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01820.html > -- an updated version of one of tree-ssa-operands.c > cleanup patches; it was approved by Diego except for one > suspicious place, which is changed in this version > OK. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2006-01-10 14:20 ` Diego Novillo @ 2006-01-10 16:27 ` Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2006-01-10 16:27 UTC (permalink / raw) To: Diego Novillo; +Cc: gcc-patches Hello, > > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00670.html > > -- a patch to make dumps in several loop optimization passes (ivopts, > > vectorizer, ...) easier to read, by having scev & data dependence > > analysis dumps disabled by default > > > Not completely OK. When I specify -details, I want every piece of > information produced by the pass. > It's fine with me if you want to add a specific -analysis switch that is > orthogonal from -details. But with your patch, -details would not print > everything in the scev and data dependence dumps. > > A simple tweak to this patch would give us both things. Make TDF_DETAILS > include TDF_ANALYSIS in its bitmask. In fact, we could even have: > > #define TDF_DETAILS (1<<3) | TDF_ANALYSIS | TDF_STATS the point of this patch is that I want to be able to show everything -details shows now, except for what -analysis does (because the dumps covered by -analysis are almost never useful, except for the case there is a bug in one of those analyses). I do not really care whether -analysis dumps are shown by default, I just want to have a simple way how to disable them while still preserving the other -details dumps. Is that possible in the solution you propose? Zdenek > > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01820.html > > -- an updated version of one of tree-ssa-operands.c > > cleanup patches; it was approved by Diego except for one > > suspicious place, which is changed in this version > > > OK. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping... @ 2005-12-19 19:30 Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2005-12-19 19:30 UTC (permalink / raw) To: gcc-patches, rth Hi, the patch: http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01877.html used to rearrange saving code in inliner is needed to proceed further on IPA branch merging. Would be possible to take a look on it, please? Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2005-12-19 8:10 Jan Beulich 2005-12-19 9:26 ` Gerald Pfeifer 0 siblings, 1 reply; 504+ messages in thread From: Jan Beulich @ 2005-12-19 8:10 UTC (permalink / raw) To: gcc-patches Is there any chance to get a review for http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00166.html http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00181.html http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00659.html (the last one being of particular importance, and at the same time almost to be considered trivial, as it fixes a number of testsuite failures)? Thanks, Jan ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-12-19 8:10 patch ping Jan Beulich @ 2005-12-19 9:26 ` Gerald Pfeifer 0 siblings, 0 replies; 504+ messages in thread From: Gerald Pfeifer @ 2005-12-19 9:26 UTC (permalink / raw) To: Jan Beulich; +Cc: gcc-patches On Mon, 19 Dec 2005, Jan Beulich wrote: > Is there any chance to get a review for > > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00166.html > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00181.html > http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00659.html Jan, and others pinging patches: I strongly recommend to provide the original Subject line or a short description in addition to the URL for such pings -- that'll make it much more likely that the responsible maintainers look into them. Gerald ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2005-11-19 19:14 Rafael Ávila de Espíndola 2005-11-20 9:06 ` Andreas Jaeger 0 siblings, 1 reply; 504+ messages in thread From: Rafael Ávila de Espíndola @ 2005-11-19 19:14 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 247 bytes --] approved http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00134.html approved http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01734.html approved for treelang. Fortran approval is missing http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00017.html Rafael [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-11-19 19:14 Rafael Ávila de Espíndola @ 2005-11-20 9:06 ` Andreas Jaeger 0 siblings, 0 replies; 504+ messages in thread From: Andreas Jaeger @ 2005-11-20 9:06 UTC (permalink / raw) To: Rafael Ávila de Espíndola; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 1444 bytes --] Rafael Ávila de Espíndola <rafael.espindola@gmail.com> writes: > approved > http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00134.html Please see: http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00539.html and then a new patch, Alexandre promised to check it in. Please adjust your ChangeLog entries, they are not according to our policies and include them in the updated patch. You have: * gcc/configure: Removed the all.build target * gcc/configure.ac: Removed the all.build target * gcc/cp/Make-lang.in: Removed the all.build target * gcc/doc/sourcebuild.texi: Removed the all.build target * gcc/fortran/Make-lang.in: Removed the all.build target But most of these directories have their own ChangeLog file and the entry should go there. Also, you should give the function in the line as full name, e.g. for cp/Make-lang.in your entry for gcc/cp/ChangeLog would be: * Make-lang.in (c++.all.build): Remove. > approved > http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01734.html > approved for treelang. Fortran approval is missing > http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00017.html > > Rafael Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping @ 2005-10-30 13:57 Richard Kenner 0 siblings, 0 replies; 504+ messages in thread From: Richard Kenner @ 2005-10-30 13:57 UTC (permalink / raw) To: ian; +Cc: gcc-patches I am also somewhat troubled that I can't find any documentation on what TREE_TYPE of a INTEGER_TYPE, ENUMERAL_TYPE, or CHAR_TYPE is supposed to mean. Is that usage specific to the Ada frontend? What is the general meaning? It's used more often by the Ada front end, but I think others generate it as well, since it wasn't added for Ada. It means that the given type is a *subtype* of its TREE_TYPE, which means that we are saying that the values of an object of that type are restricted to a subset of the values of the type in TREE_TYPE. The range is given by TYPE_MIN_VALUE and TYPE_MAX_VALUE. ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2005-10-29 1:18 Andrew Pinski 2005-10-29 4:16 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Andrew Pinski @ 2005-10-29 1:18 UTC (permalink / raw) To: gcc-patches I thought that I would not have to ping patches any more with the patch queue but I am wrong, oh well. http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow This fixes one of the wrong-code regressions in 4.1, basicially fold was building a tree which depends on signed overflowing being defined as wrapping which is only true with -fwrapv. -- Pinski ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-10-29 1:18 Andrew Pinski @ 2005-10-29 4:16 ` Ian Lance Taylor 2005-10-29 20:17 ` Andrew Pinski 0 siblings, 1 reply; 504+ messages in thread From: Ian Lance Taylor @ 2005-10-29 4:16 UTC (permalink / raw) To: Andrew Pinski; +Cc: gcc-patches Andrew Pinski <pinskia@physics.uc.edu> writes: > I thought that I would not have to ping patches any more > with the patch queue but I am wrong, oh well. > > http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html > [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow > > This fixes one of the wrong-code regressions in 4.1, basicially > fold was building a tree which depends on signed overflowing > being defined as wrapping which is only true with -fwrapv. Setting etype to TREE_TYPE (etype) looks wrong to me. And I suspect that the reason you have to do it is that your patch doesn't set value back to zero. The old code would work because it checks TREE_OVERFLOW again. But your patch effectively does not--it is possible for value to fall through without TREE_OVERFLOW being set. Also, I think the patch makes the code more confusing. In the case of flag_wrapv && !TYPE_UNSIGNED (type), the first computation of value is of no importance. How about something like this? I haven't tested it. Ian --- fold-const.c.~1.629.~ 2005-10-21 10:15:14.000000000 -0700 +++ fold-const.c 2005-10-28 20:57:15.000000000 -0700 @@ -4013,8 +4013,22 @@ build_range_check (tree type, tree exp, } } - value = const_binop (MINUS_EXPR, high, low, 0); - if (value != 0 && TREE_OVERFLOW (value) && ! TYPE_UNSIGNED (etype)) + /* Try to build a check for whether EXP - LOW is between zero and + HIGH - LOW. We can only do this safely using an unsigned type, + or when signed values wrap around. Otherwise EXP - LOW might + overflow. And of course it doesn't work if HIGH - LOW + overflows. */ + + value = NULL_TREE; + + if (TYPE_UNSIGNED (type) || flag_wrapv) + { + value = const_binop (MINUS_EXPR, high, low, 0); + if (value && TREE_OVERFLOW (value)) + value = NULL_TREE; + } + + if (value == NULL_TREE && !TYPE_UNSIGNED (type)) { tree utype, minv, maxv; @@ -4038,6 +4052,8 @@ build_range_check (tree type, tree exp, low = fold_convert (etype, low); exp = fold_convert (etype, exp); value = const_binop (MINUS_EXPR, high, low, 0); + if (TREE_OVERFLOW (value)) + value = NULL_TREE; } break; default: @@ -4045,7 +4061,7 @@ build_range_check (tree type, tree exp, } } - if (value != 0 && ! TREE_OVERFLOW (value)) + if (value) return build_range_check (type, fold_build2 (MINUS_EXPR, etype, exp, low), 1, fold_convert (etype, integer_zero_node), ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-10-29 4:16 ` Ian Lance Taylor @ 2005-10-29 20:17 ` Andrew Pinski 2005-10-29 20:26 ` Andrew Pinski 0 siblings, 1 reply; 504+ messages in thread From: Andrew Pinski @ 2005-10-29 20:17 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: Andrew Pinski, gcc-patches > > Andrew Pinski <pinskia@physics.uc.edu> writes: > > > I thought that I would not have to ping patches any more > > with the patch queue but I am wrong, oh well. > > > > http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html > > [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow > > > > This fixes one of the wrong-code regressions in 4.1, basicially > > fold was building a tree which depends on signed overflowing > > being defined as wrapping which is only true with -fwrapv. > > Setting etype to TREE_TYPE (etype) looks wrong to me. And I suspect > that the reason you have to do it is that your patch doesn't set value > back to zero. The old code would work because it checks TREE_OVERFLOW > again. But your patch effectively does not--it is possible for value > to fall through without TREE_OVERFLOW being set. > > Also, I think the patch makes the code more confusing. In the case of > flag_wrapv && !TYPE_UNSIGNED (type), the first computation of value is > of no importance. > > How about something like this? I haven't tested it. This works except it introduces two Ada test failures, I am going to look into them. They are both ICEs. -- Pinski ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-10-29 20:17 ` Andrew Pinski @ 2005-10-29 20:26 ` Andrew Pinski 2005-10-29 21:08 ` Andrew Pinski 0 siblings, 1 reply; 504+ messages in thread From: Andrew Pinski @ 2005-10-29 20:26 UTC (permalink / raw) To: Andrew Pinski; +Cc: Ian Lance Taylor, Andrew Pinski, gcc-patches > > > > > Andrew Pinski <pinskia@physics.uc.edu> writes: > > > > > I thought that I would not have to ping patches any more > > > with the patch queue but I am wrong, oh well. > > > > > > http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html > > > [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow > > > > > > This fixes one of the wrong-code regressions in 4.1, basicially > > > fold was building a tree which depends on signed overflowing > > > being defined as wrapping which is only true with -fwrapv. > > > > Setting etype to TREE_TYPE (etype) looks wrong to me. And I suspect > > that the reason you have to do it is that your patch doesn't set value > > back to zero. The old code would work because it checks TREE_OVERFLOW > > again. But your patch effectively does not--it is possible for value > > to fall through without TREE_OVERFLOW being set. > > > > Also, I think the patch makes the code more confusing. In the case of > > flag_wrapv && !TYPE_UNSIGNED (type), the first computation of value is > > of no importance. > > > > How about something like this? I haven't tested it. > This works except it introduces two Ada test failures, I am going to look > into them. They are both ICEs. Both of the failure is due to range_binop returning NULL in: 4047 if (integer_zerop (range_binop (NE_EXPR, integer_type_node, 4048 minv, 1, maxv, 1))) This is due to minv being a non-constant value. Let me try the obvious patch to test for that case and see if it works. -- Pinski ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-10-29 20:26 ` Andrew Pinski @ 2005-10-29 21:08 ` Andrew Pinski 2005-10-30 4:59 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Andrew Pinski @ 2005-10-29 21:08 UTC (permalink / raw) To: Andrew Pinski; +Cc: Andrew Pinski, Ian Lance Taylor, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1888 bytes --] > > > > > > > > > Andrew Pinski <pinskia@physics.uc.edu> writes: > > > > > > > I thought that I would not have to ping patches any more > > > > with the patch queue but I am wrong, oh well. > > > > > > > > http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html > > > > [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow > > > > > > > > This fixes one of the wrong-code regressions in 4.1, basicially > > > > fold was building a tree which depends on signed overflowing > > > > being defined as wrapping which is only true with -fwrapv. > > > > > > Setting etype to TREE_TYPE (etype) looks wrong to me. And I suspect > > > that the reason you have to do it is that your patch doesn't set value > > > back to zero. The old code would work because it checks TREE_OVERFLOW > > > again. But your patch effectively does not--it is possible for value > > > to fall through without TREE_OVERFLOW being set. > > > > > > Also, I think the patch makes the code more confusing. In the case of > > > flag_wrapv && !TYPE_UNSIGNED (type), the first computation of value is > > > of no importance. > > > > > > How about something like this? I haven't tested it. > > This works except it introduces two Ada test failures, I am going to look > > into them. They are both ICEs. > > Both of the failure is due to range_binop returning NULL in: > 4047 if (integer_zerop (range_binop (NE_EXPR, integer_type_node, > 4048 minv, 1, maxv, 1))) > > This is due to minv being a non-constant value. > > Let me try the obvious patch to test for that case and see if it works. Here is the patch which works for those two tests and also for my testcase still, it adds the testcase also to the patch. I am right now doing a full bootstrap/test on x86_64-pc-linux-gnu with this patch. Thanks, Andrew Pinski [-- Attachment #2: ASCII C program text --] [-- Type: text/plain, Size: 2360 bytes --] Index: fold-const.c =================================================================== --- fold-const.c (revision 105995) +++ fold-const.c (working copy) @@ -4013,8 +4013,22 @@ build_range_check (tree type, tree exp, } } - value = const_binop (MINUS_EXPR, high, low, 0); - if (value != 0 && TREE_OVERFLOW (value) && ! TYPE_UNSIGNED (etype)) + /* Try to build a check for whether EXP - LOW is between zero and + HIGH - LOW. We can only do this safely using an unsigned type, + or when signed values wrap around. Otherwise EXP - LOW might + overflow. And of course it doesn't work if HIGH - LOW + overflows. */ + + value = NULL_TREE; + + if (TYPE_UNSIGNED (type) || flag_wrapv) + { + value = const_binop (MINUS_EXPR, high, low, 0); + if (value && TREE_OVERFLOW (value)) + value = NULL_TREE; + } + + if (value == NULL_TREE && !TYPE_UNSIGNED (type)) { tree utype, minv, maxv; @@ -4025,6 +4039,11 @@ build_range_check (tree type, tree exp, case INTEGER_TYPE: case ENUMERAL_TYPE: case CHAR_TYPE: + /* If we have a type which is a subtype use the + subtype instead. */ + if (TREE_TYPE (etype)) + etype = TREE_TYPE (etype); + utype = lang_hooks.types.unsigned_type (etype); maxv = fold_convert (utype, TYPE_MAX_VALUE (etype)); maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1, @@ -4038,6 +4057,8 @@ build_range_check (tree type, tree exp, low = fold_convert (etype, low); exp = fold_convert (etype, exp); value = const_binop (MINUS_EXPR, high, low, 0); + if (TREE_OVERFLOW (value)) + value = NULL_TREE; } break; default: @@ -4045,7 +4066,7 @@ build_range_check (tree type, tree exp, } } - if (value != 0 && ! TREE_OVERFLOW (value)) + if (value) return build_range_check (type, fold_build2 (MINUS_EXPR, etype, exp, low), 1, fold_convert (etype, integer_zero_node), Index: testsuite/gcc.c-torture/execute/pr22429-1.c =================================================================== --- testsuite/gcc.c-torture/execute/pr22429-1.c (revision 0) +++ testsuite/gcc.c-torture/execute/pr22429-1.c (revision 0) @@ -0,0 +1,14 @@ +int f(int n) +{ + if (-1073741824 <= n && n <= 1073741823) + return 1; + return 0; +} + +int main() +{ + if (f(1073741824)) + abort (); + return 0; +} + ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2005-10-29 21:08 ` Andrew Pinski @ 2005-10-30 4:59 ` Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2005-10-30 4:59 UTC (permalink / raw) To: Andrew Pinski; +Cc: gcc-patches Andrew Pinski <pinskia@physics.uc.edu> writes: > + /* If we have a type which is a subtype use the > + subtype instead. */ > + if (TREE_TYPE (etype)) > + etype = TREE_TYPE (etype); This makes me a bit nervous simply because I can't see anything else in fold-const.c which does anything like this. I am also somewhat troubled that I can't find any documentation on what TREE_TYPE of a INTEGER_TYPE, ENUMERAL_TYPE, or CHAR_TYPE is supposed to mean. Is that usage specific to the Ada frontend? What is the general meaning? What if you simply don't do the optimization if range_binop returns NULL? Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-10-04 16:35 Ian Lance Taylor 2005-10-04 17:49 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Ian Lance Taylor @ 2005-10-04 16:35 UTC (permalink / raw) To: gcc-patches Patch for 4.1 regression PR preprocessor/13726 (-dI -C -E does not work correctly): http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01472.html Patch for 4.1 regression PR libstdc++/13583 (limited memory leak in threaded program): http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01550.html Ping! Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2005-10-04 16:35 Patch ping Ian Lance Taylor @ 2005-10-04 17:49 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2005-10-04 17:49 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-patches On Tue, Oct 04, 2005 at 09:35:33AM -0700, Ian Lance Taylor wrote: > Patch for 4.1 regression PR preprocessor/13726 (-dI -C -E does not > work correctly): > http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01472.html Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-08-29 8:03 Jakub Jelinek 2005-08-29 8:49 ` Ian Lance Taylor 0 siblings, 1 reply; 504+ messages in thread From: Jakub Jelinek @ 2005-08-29 8:03 UTC (permalink / raw) To: gcc-patches Hi! http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01187.html - fix __builtin_*_chk if GCC is able to figure out maxlen, but len is not compile time constant and object size of destination is known (bootstrapped/regtested several times on i?86-linux HEAD plus on 7 linux arches in 4.0 backport) Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2005-08-29 8:03 Jakub Jelinek @ 2005-08-29 8:49 ` Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2005-08-29 8:49 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches Jakub Jelinek <jakub@redhat.com> writes: > http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01187.html > - fix __builtin_*_chk if GCC is able to figure out maxlen, but len > is not compile time constant and object size of destination is > known (bootstrapped/regtested several times on i?86-linux HEAD > plus on 7 linux arches in 4.0 backport) This is OK. Thanks. [ My first approval as middle-end maintainer! ] Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping... @ 2005-08-01 12:56 Jan Hubicka 0 siblings, 0 replies; 504+ messages in thread From: Jan Hubicka @ 2005-08-01 12:56 UTC (permalink / raw) To: gcc-patches, rth Hi, this patch to avoid quadratic behaviour when duplicating EH regions: http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01052.html seems to be pretty important for inline heavy C++ sources. Would be possible to take a look? Thanks, Honza ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2005-06-15 22:34 Eric Christopher 0 siblings, 0 replies; 504+ messages in thread From: Eric Christopher @ 2005-06-15 22:34 UTC (permalink / raw) To: gcc-patches Fixes %b for languages other than C. http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00166.html -eric ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-05-18 11:23 Tobias Schlüter 0 siblings, 0 replies; 504+ messages in thread From: Tobias Schlüter @ 2005-05-18 11:23 UTC (permalink / raw) To: GCC Fortran mailing list, patch This is a patch that somehow got lost: [gfortran] Minor cleanup to trans-intrinsic.c http://gcc.gnu.org/ml/fortran/2005-02/msg00048.html - Tobi ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-05-12 20:41 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2005-05-12 20:41 UTC (permalink / raw) To: gcc-patches; +Cc: fortran Hi! Fix FORALL: http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02960.html Bootstrapped/regtested on HEAD on {x86_64,ppc64}-redhat-linux and on 4.0 branch on {i386,x86_64,ia64,ppc,ppc64,s390,s390x}-redhat-linux. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-04-04 15:14 Ian Lance Taylor 2005-04-05 2:09 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Ian Lance Taylor @ 2005-04-04 15:14 UTC (permalink / raw) To: gcc-patches; +Cc: cgf, dannysmith Patch ping: http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02460.html This is a patch to the Windows code to fix PR 9963. The current code uses TREE_ASM_WRITTEN without ever setting it. My proposed patch tests TREE_ASM_WRITTEN on a decl rather than a string. Thanks to Danny Smith for testing the patch. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2005-04-04 15:14 Ian Lance Taylor @ 2005-04-05 2:09 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2005-04-05 2:09 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-patches, cgf, dannysmith On Mon, Apr 04, 2005 at 11:13:43AM -0400, Ian Lance Taylor wrote: > http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02460.html Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-03-30 19:18 Dale Johannesen 2005-03-30 22:59 ` Tom Tromey 2005-03-30 23:05 ` Geoffrey Keating 0 siblings, 2 replies; 504+ messages in thread From: Dale Johannesen @ 2005-03-30 19:18 UTC (permalink / raw) To: gcc-patches@gcc.gnu.org Patches; +Cc: Dale Johannesen Handle STATEMENT_LIST in debug_tree http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02470.html Objective C hooks for OBJ_TYPE_REF_EXPR http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02473.html Fix PR 19225 http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02530.html Thanks! ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2005-03-30 19:18 Dale Johannesen @ 2005-03-30 22:59 ` Tom Tromey 2005-03-30 23:05 ` Geoffrey Keating 1 sibling, 0 replies; 504+ messages in thread From: Tom Tromey @ 2005-03-30 22:59 UTC (permalink / raw) To: Dale Johannesen; +Cc: Gcc Patch List >>>>> "Dale" == Dale Johannesen <dalej@apple.com> writes: Dale> Handle STATEMENT_LIST in debug_tree Dale> http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02470.html Yeah, this would be really helpful when debugging gcjx. Thanks for pointing it out, I'm going to apply it to my branch :-) Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2005-03-30 19:18 Dale Johannesen 2005-03-30 22:59 ` Tom Tromey @ 2005-03-30 23:05 ` Geoffrey Keating 1 sibling, 0 replies; 504+ messages in thread From: Geoffrey Keating @ 2005-03-30 23:05 UTC (permalink / raw) To: Dale Johannesen; +Cc: gcc-patches Dale Johannesen <dalej@apple.com> writes: > Handle STATEMENT_LIST in debug_tree > http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02470.html OK. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-03-25 21:26 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2005-03-25 21:26 UTC (permalink / raw) To: gcc-patches Hello, a few patches for that I did not get answer for and consider them nice or important enough to bother... http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01644.html -- the patch to include ggc memory consumption report to the standard timevar report http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00205.html -- tree level store motion speed up (PR 17790) http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00450.html -- TARGET_MEM_REF patch (representation for target-specific addressing modes on tree level). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-03-09 23:35 Jakub Jelinek 0 siblings, 0 replies; 504+ messages in thread From: Jakub Jelinek @ 2005-03-09 23:35 UTC (permalink / raw) To: Richard Henderson, Roger Sayle; +Cc: gcc-patches Hi! Fix try_combine splitting (PR target/20322) http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00647.html Bootstrapped/regtested on {i386,x86_64,ia64,ppc,ppc64,s390,s390x}-linux, no regressions. Jakub ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2005-02-27 16:37 Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2005-02-27 16:37 UTC (permalink / raw) To: gcc-patches Hello, the radical cleanup and rewrite of store motion, that addresses the compile time problems (PR17790) http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00205.html Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-12-10 17:14 H. J. Lu 0 siblings, 0 replies; 504+ messages in thread From: H. J. Lu @ 2004-12-10 17:14 UTC (permalink / raw) To: gcc-patches Could someone please take a look at the patch http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01352.html for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18508 Thanks. H.J. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping
@ 2004-12-10 17:02 H. J. Lu
0 siblings, 0 replies; 504+ messages in thread
From: H. J. Lu @ 2004-12-10 17:02 UTC (permalink / raw)
To: Matthias Klose; +Cc: gcc-patches
Could someone please take a look at patch for
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18153
>
> PR18153 has a wrong AC_MSG_RESULT line, should be:
>
> AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
Thanks. Here is an updated one.
H.J.
----
2004-12-10 H.J. Lu <hongjiu.lu@intel.com>
PR target/18153
* configure.ac: Define HAVE_LD_STATIC_DYNAMIC if linker supports
-Bstatic/-Bdynamic option.
* config.in: Regenerated.
* configure: Likewise.
* gcc.c (init_spec): Pass -Bstatic/-Bdynamic to ld for static
-lunwind if possible.
--- gcc/config.in.static 2004-10-25 17:37:13.000000000 -0700
+++ gcc/config.in 2004-10-26 10:06:38.270754696 -0700
@@ -322,6 +322,9 @@
a read-write section. */
#undef HAVE_LD_RO_RW_SECTION_MIXING
+/* Define if your linker supports -Bstatic/-Bdynamic option. */
+#undef HAVE_LD_STATIC_DYNAMIC
+
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
--- gcc/configure.ac.static 2004-10-25 17:37:13.000000000 -0700
+++ gcc/configure.ac 2004-10-26 10:11:49.451512210 -0700
@@ -2645,6 +2645,25 @@ if test x"$gcc_cv_ld_pie" = xyes; then
fi
AC_MSG_RESULT($gcc_cv_ld_pie)
+AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
+gcc_cv_ld_static_dynamic=no
+if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10; then
+ gcc_cv_ld_static_dynamic=yes
+ fi
+elif test x$gcc_cv_ld != x; then
+ # Check if linker supports -Bstatic/-Bdynamic option
+ if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
+ && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
+ gcc_cv_ld_static_dynamic=yes
+ fi
+fi
+if test x"$gcc_cv_ld_static_dynamic" = xyes; then
+ AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
+[Define if your linker supports -Bstatic/-Bdynamic option.])
+fi
+AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
+
if test x"$demangler_in_ld" = xyes; then
AC_MSG_CHECKING(linker --demangle support)
gcc_cv_ld_demangle=no
--- gcc/gcc.c.static 2004-09-08 08:17:29.000000000 -0700
+++ gcc/gcc.c 2004-10-26 10:21:48.880992852 -0700
@@ -1647,7 +1647,11 @@ init_spec (void)
"-lgcc",
"-lgcc_eh"
#ifdef USE_LIBUNWIND_EXCEPTIONS
+# ifdef HAVE_LD_STATIC_DYNAMIC
+ " %{!static:-Bstatic} -lunwind %{!static:-Bdynamic}"
+# else
" -lunwind"
+# endif
#endif
);
^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch Ping @ 2004-10-11 20:39 Tom Tromey 2004-10-12 23:35 ` Geoffrey Keating 0 siblings, 1 reply; 504+ messages in thread From: Tom Tromey @ 2004-10-11 20:39 UTC (permalink / raw) To: Gcc Patch List Andrew approved the gcj part of this patch, but I think it still needs an approval for the gcc.c bit: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02420.html Tom ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch Ping 2004-10-11 20:39 Patch Ping Tom Tromey @ 2004-10-12 23:35 ` Geoffrey Keating 0 siblings, 0 replies; 504+ messages in thread From: Geoffrey Keating @ 2004-10-12 23:35 UTC (permalink / raw) To: tromey, gcc-patches Tom Tromey <tromey@redhat.com> writes: > Andrew approved the gcj part of this patch, but I think it still > needs an approval for the gcc.c bit: > > http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02420.html OK. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-09-03 23:39 H. J. Lu 2004-09-03 23:44 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: H. J. Lu @ 2004-09-03 23:39 UTC (permalink / raw) To: gcc-patches Here is a patch to disable branch hint for P4 and EM64T: http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02650.html Could someone please review it? Thanks. H.J. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-09-03 23:39 Patch ping H. J. Lu @ 2004-09-03 23:44 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2004-09-03 23:44 UTC (permalink / raw) To: H. J. Lu; +Cc: gcc-patches On Fri, Sep 03, 2004 at 04:28:09PM -0700, H. J. Lu wrote: > http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02650.html Ok. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
[parent not found: <20040731163035.GA7104@troutmask.apl.washington.edu>]
* Re: Patch ping [not found] <20040731163035.GA7104@troutmask.apl.washington.edu> @ 2004-08-06 20:45 ` Paul Brook 0 siblings, 0 replies; 504+ messages in thread From: Paul Brook @ 2004-08-06 20:45 UTC (permalink / raw) To: fortran; +Cc: Steve Kargl, gcc-patches [-- Attachment #1: Type: text/plain, Size: 3144 bytes --] On Saturday 31 July 2004 17:30, Steve Kargl wrote: > http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02001.html I made gfc_mpfr_to_mpz use the mprf->integer conversion routines rather than going via a string. Applied as attached. Paul 2004-08-06 Steven G. Kargl <kargls@comcast.net> * arith.c: Add #define for model numbers. Remove global GMP variables. (natural_logarithm,common_logarithm,exponential,sine, cosine,arctangent,hypercos,hypersine ): Remove. (gfc_mpfr_to_mpz,gfc_set_model_kind,gfc_set_model): New functions. (arctangent2,gfc_arith_init_1,gfc_arith_done_1 gfc_check_real_range, gfc_constant_result, gfc_range_check, gfc_arith_uminus,gfc_arith_plus, gfc_arith_minus, gfc_arith_times, gfc_arith_divide,complex_reciprocal,complex_pow_ui, gfc_arith_power,gfc_compare_expr,compare_complex,gfc_convert_real, gfc_convert_complex,gfc_int2real,gfc_int2complex, gfc_real2int,gfc_real2real,gfc_real2complex, gfc_complex2int,gfc_complex2real,gfc_complex2complex): Convert GMP to MPFR, use new functions. * arith.h: Remove extern global variables. (natural_logarithm,common_logarithm,exponential, sine, cosine, arctangent,hypercos,hypersine): Remove prototypes. (arctangent2): Update prototype from GMP to MPFR. (gfc_mpfr_to_mpz, gfc_set_model_kind,gfc_set_model): Add prototypes. * dump-parse-tree.c (gfc_show_expr): Convert GMP to MPFR. * expr.c (free_expr0,gfc_copy_expr): Convert GMP to MPFR. * gfortran.h (GFC_REAL_BITS): Remove. (arith): Add ARITH_NAN. Include mpfr.h. Define GFC_RND_MODE. Rename GCC_GFORTRAN_H GFC_GFC_H. (gfc_expr): Convert GMP to MPFR. * module.c: Add arith.h, correct type in comment. (mio_gmp_real): Convert GMP to MPFR. (mio_expr): Use gfc_set_model_kind(). * primary.c: Update copyright date with 2004. (match_real_constant,match_const_complex_part): Convert GMP to MPFR. * simplify.c: Remove global GMP variables (gfc_simplify_abs,gfc_simplify_acos,gfc_simplify_aimag, gfc_simplify_aint,gfc_simplify_dint,gfc_simplify_anint, gfc_simplify_dnint,gfc_simplify_asin,gfc_simplify_atan, gfc_simplify_atan2,gfc_simplify_ceiling,simplify_cmplx, gfc_simplify_conjg,gfc_simplify_cos,gfc_simplify_cosh, gfc_simplify_dim,gfc_simplify_dprod,gfc_simplify_epsilon, gfc_simplify_exp,gfc_simplify_exponent,gfc_simplify_floor, gfc_simplify_fraction,gfc_simplify_huge,gfc_simplify_int, gfc_simplify_ifix,gfc_simplify_idint,gfc_simplify_log, gfc_simplify_log10,simplify_min_max,gfc_simplify_mod, gfc_simplify_modulo,gfc_simplify_nearest,simplify_nint, gfc_simplify_rrspacing,gfc_simplify_scale, gfc_simplify_set_exponent,gfc_simplify_sign,gfc_simplify_sin, gfc_simplify_sinh,gfc_simplify_spacing,gfc_simplify_sqrt, gfc_simplify_tan,gfc_simplify_tanh,gfc_simplify_tiny, gfc_simplify_init_1,gfc_simplify_done_1): Convert GMP to MPFR. Use new functions. * trans-const.c (gfc_conv_mpfr_to_tree): Rename from gfc_conv_mpf_to_tree. Convert it to use MPFR (gfc_conv_constant_to_tree): Use it. * trans-const.h: Update prototype for gfc_conv_mpfr_to_tree(). * trans-intrinsic.c: Add arith.h, remove gmp.h (gfc_conv_intrinsic_aint,gfc_conv_intrinsic_mod): Convert GMP to MPFR. [-- Attachment #2: patch.mpfr.gz --] [-- Type: application/x-gzip, Size: 19909 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-07-08 14:50 jlquinn 2004-07-08 14:55 ` Roger Sayle 2004-07-08 15:26 ` Paolo Bonzini 0 siblings, 2 replies; 504+ messages in thread From: jlquinn @ 2004-07-08 14:50 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00217.html Ok for mainline? ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-07-08 14:50 jlquinn @ 2004-07-08 14:55 ` Roger Sayle 2004-07-08 15:26 ` Paolo Bonzini 1 sibling, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-07-08 14:55 UTC (permalink / raw) To: jlquinn; +Cc: gcc-patches On Thu, 8 Jul 2004 jlquinn@optonline.net wrote: > http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00217.html This is Ok for mainline. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-07-08 14:50 jlquinn 2004-07-08 14:55 ` Roger Sayle @ 2004-07-08 15:26 ` Paolo Bonzini 1 sibling, 0 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-07-08 15:26 UTC (permalink / raw) To: gcc-patches > http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00217.html > > Ok for mainline? I cannot approve anything but I'd suggest that, the next time you have such a series of mechanical patches, you may want to ask for preapproval. Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-06-24 3:10 Ziemowit Laski 0 siblings, 0 replies; 504+ messages in thread From: Ziemowit Laski @ 2004-06-24 3:10 UTC (permalink / raw) To: gcc-patches@gcc.gnu.org Patches http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01528.html Or is fixing PRs unimportant? :-) --Zem -------------------------------------------------------------- Ziemowit Laski 1 Infinite Loop, MS 301-2K Mac OS X Compiler Group Cupertino, CA USA 95014-2083 Apple Computer, Inc. +1.408.974.6229 Fax .5477 ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-06-23 19:35 Josef Zlomek 0 siblings, 0 replies; 504+ messages in thread From: Josef Zlomek @ 2004-06-23 19:35 UTC (permalink / raw) To: gcc-patches Hello, 1. Fix bug in var-tracking WRT location list for DW_AT_frame_base http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01730.html 2. PR/15242 - Duplicate computed gotos http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01670.html Thanks, Josef ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-06-21 22:57 Pat Haugen 0 siblings, 0 replies; 504+ messages in thread From: Pat Haugen @ 2004-06-21 22:57 UTC (permalink / raw) To: gcc-patches The following patches fix problems with not maintaining profile counts correctly when modifying the CFG. http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01558.html Fix for value profile transformations. http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01595.html Fix edge redirection in make_forwarder_block. http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01850.html Fix for split_block which was regressed with tree-ssa merge. -Pat ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-06-21 17:42 Jerry Quinn 0 siblings, 0 replies; 504+ messages in thread From: Jerry Quinn @ 2004-06-21 17:42 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01280.html ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-06-21 11:44 Paolo Bonzini 2004-06-21 15:20 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2004-06-21 11:44 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01844.html [PATCH] Say that LTGT may trap http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01531.html [PATCH] remove dead code from gcc.c http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00049.html Re: [Patch/RFC] Enable PCH for mingw32 All patches bootstrapped/regtested i686-pc-linux-gnu. Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-21 11:44 Patch ping Paolo Bonzini @ 2004-06-21 15:20 ` Roger Sayle 0 siblings, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-06-21 15:20 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches On Mon, 21 Jun 2004, Paolo Bonzini wrote: > http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01844.html > [PATCH] Say that LTGT may trap This is OK for mainline. Thanks, Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-06-14 13:11 Paul Brook 2004-06-14 17:14 ` Mark Mitchell 2004-06-15 0:08 ` Richard Henderson 0 siblings, 2 replies; 504+ messages in thread From: Paul Brook @ 2004-06-14 13:11 UTC (permalink / raw) To: gcc-patches The following patch seems to have slipped past without comment. Create DWARF3 cie frame entries: http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html The infrastructure to support this change (ie. unwinder and debugger) should now be in place. Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-14 13:11 Paul Brook @ 2004-06-14 17:14 ` Mark Mitchell 2004-06-14 17:36 ` Daniel Jacobowitz 2004-06-15 0:08 ` Richard Henderson 1 sibling, 1 reply; 504+ messages in thread From: Mark Mitchell @ 2004-06-14 17:14 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches Paul Brook wrote: > The following patch seems to have slipped past without comment. > > Create DWARF3 cie frame entries: > http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html > > The infrastructure to support this change (ie. unwinder and debugger) should > now be in place. OK. -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-14 17:14 ` Mark Mitchell @ 2004-06-14 17:36 ` Daniel Jacobowitz 2004-06-14 18:13 ` Paul Brook 0 siblings, 1 reply; 504+ messages in thread From: Daniel Jacobowitz @ 2004-06-14 17:36 UTC (permalink / raw) To: Mark Mitchell; +Cc: Paul Brook, gcc-patches On Mon, Jun 14, 2004 at 07:47:35AM -0700, Mark Mitchell wrote: > Paul Brook wrote: > > >The following patch seems to have slipped past without comment. > > > >Create DWARF3 cie frame entries: > >http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html > > > >The infrastructure to support this change (ie. unwinder and debugger) > >should now be in place. > > OK. Must we? This will silently regress debugging support for anyone using the most recent released version of GDB or the upcoming GDB 6.1.1. I don't see any point in generating DWARF3 CIEs unless we actually have a need for the uleb128. -- Daniel Jacobowitz ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-14 17:36 ` Daniel Jacobowitz @ 2004-06-14 18:13 ` Paul Brook 2004-06-14 18:22 ` Daniel Jacobowitz 0 siblings, 1 reply; 504+ messages in thread From: Paul Brook @ 2004-06-14 18:13 UTC (permalink / raw) To: gcc-patches; +Cc: Daniel Jacobowitz, Mark Mitchell, gcc-patches On Monday 14 June 2004 16:16, Daniel Jacobowitz wrote: > On Mon, Jun 14, 2004 at 07:47:35AM -0700, Mark Mitchell wrote: > > Paul Brook wrote: > > >The following patch seems to have slipped past without comment. > > > > > >Create DWARF3 cie frame entries: > > >http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html > > > > > >The infrastructure to support this change (ie. unwinder and debugger) > > >should now be in place. > > > > OK. > > Must we? This will silently regress debugging support for anyone using > the most recent released version of GDB or the upcoming GDB 6.1.1. It should have exactly zero impact because DW_CIE_VERSION is still 1. Unless I'm missing something of course... Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-14 18:13 ` Paul Brook @ 2004-06-14 18:22 ` Daniel Jacobowitz 0 siblings, 0 replies; 504+ messages in thread From: Daniel Jacobowitz @ 2004-06-14 18:22 UTC (permalink / raw) To: gcc-patches On Mon, Jun 14, 2004 at 04:27:24PM +0100, Paul Brook wrote: > On Monday 14 June 2004 16:16, Daniel Jacobowitz wrote: > > On Mon, Jun 14, 2004 at 07:47:35AM -0700, Mark Mitchell wrote: > > > Paul Brook wrote: > > > >The following patch seems to have slipped past without comment. > > > > > > > >Create DWARF3 cie frame entries: > > > >http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html > > > > > > > >The infrastructure to support this change (ie. unwinder and debugger) > > > >should now be in place. > > > > > > OK. > > > > Must we? This will silently regress debugging support for anyone using > > the most recent released version of GDB or the upcoming GDB 6.1.1. > > It should have exactly zero impact because DW_CIE_VERSION is still 1. Unless > I'm missing something of course... Oops, you're right. Silly me, I assumed the patch did something :) -- Daniel Jacobowitz ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-14 13:11 Paul Brook 2004-06-14 17:14 ` Mark Mitchell @ 2004-06-15 0:08 ` Richard Henderson 2004-06-15 16:33 ` Paul Brook 1 sibling, 1 reply; 504+ messages in thread From: Richard Henderson @ 2004-06-15 0:08 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches On Mon, Jun 14, 2004 at 12:10:23PM +0100, Paul Brook wrote: > Create DWARF3 cie frame entries: > http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html Hum. Given that this is the only difference between the two formats, I don't see the point of this particular test. Instead, test DWARF_FRAME_RETURN_COLUMN >= 256 and set the CIE version to 3 in that case, and output the uleb128. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-15 0:08 ` Richard Henderson @ 2004-06-15 16:33 ` Paul Brook 2004-06-15 17:46 ` Richard Henderson 0 siblings, 1 reply; 504+ messages in thread From: Paul Brook @ 2004-06-15 16:33 UTC (permalink / raw) To: gcc-patches; +Cc: Richard Henderson, gcc-patches On Monday 14 June 2004 23:56, Richard Henderson wrote: > On Mon, Jun 14, 2004 at 12:10:23PM +0100, Paul Brook wrote: > > Create DWARF3 cie frame entries: > > http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00845.html > > Hum. Given that this is the only difference between the two > formats, I don't see the point of this particular test. > > Instead, test DWARF_FRAME_RETURN_COLUMN >= 256 and set the > CIE version to 3 in that case, and output the uleb128. My motivation for generating CIE version 3 entries is compatibility with third party tools which can't read CIE version 1 entries. This affects targets where 128 <= DWARF_FRAME_RETURN_COLUMN < 256. I don't know if there are any supported gcc targets where this is the case. Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-15 16:33 ` Paul Brook @ 2004-06-15 17:46 ` Richard Henderson 0 siblings, 0 replies; 504+ messages in thread From: Richard Henderson @ 2004-06-15 17:46 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches On Tue, Jun 15, 2004 at 04:12:56PM +0100, Paul Brook wrote: > My motivation for generating CIE version 3 entries is compatibility > with third party tools which can't read CIE version 1 entries. Grr. Ok I guess. Please pressure these third parties to DTRT and add two lines of code to accept version 1 as well. r~ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-06-10 16:48 Tobias Schlüter 2004-06-11 6:49 ` Steve Kargl 0 siblings, 1 reply; 504+ messages in thread From: Tobias Schlüter @ 2004-06-10 16:48 UTC (permalink / raw) To: GCC Fortran mailing list, patch These patches went unreviewed so far: 1. Fix ICE with LEN intrinsic, PR 15211 http://gcc.gnu.org/ml/fortran/2004-05/msg00402.html 2. Passing NULL to a subroutine, PR 12841 http://gcc.gnu.org/ml/fortran/2004-05/msg00408.html 3. Alphabetize objects in Make-lang.in http://gcc.gnu.org/ml/fortran/2004-06/msg00023.html (I could commit this under the obviously correct rule, but I'd prefer if someone had a second look on it, there might be a reason for the current build order) 4. Implement DATE_AND_TIME, PR14923 http://gcc.gnu.org/ml/fortran/2004-06/msg00025.html (If this gets approved, I'd prefer if someone with a more recent automake than I have could regenerate Makefile.in, I get a bunch of warnings, but everything works) 5. Fix two-argument variant of MINLOC/MAXLOC, PR14928 http://gcc.gnu.org/ml/fortran/2004-06/msg00026.html - Tobi ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-06-10 16:48 Tobias Schlüter @ 2004-06-11 6:49 ` Steve Kargl 0 siblings, 0 replies; 504+ messages in thread From: Steve Kargl @ 2004-06-11 6:49 UTC (permalink / raw) To: Tobias Schl?ter; +Cc: GCC Fortran mailing list, patch On Thu, Jun 10, 2004 at 04:54:44PM +0200, Tobias Schl?ter wrote: > > These patches went unreviewed so far: > > 1. Fix ICE with LEN intrinsic, PR 15211 > http://gcc.gnu.org/ml/fortran/2004-05/msg00402.html > > 2. Passing NULL to a subroutine, PR 12841 > http://gcc.gnu.org/ml/fortran/2004-05/msg00408.html > > 3. Alphabetize objects in Make-lang.in > http://gcc.gnu.org/ml/fortran/2004-06/msg00023.html > (I could commit this under the obviously correct rule, but I'd prefer if > someone had a second look on it, there might be a reason for the current > build order) > > 4. Implement DATE_AND_TIME, PR14923 > http://gcc.gnu.org/ml/fortran/2004-06/msg00025.html > (If this gets approved, I'd prefer if someone with a more recent > automake than I have could regenerate Makefile.in, I get a bunch of > warnings, but everything works) > > 5. Fix two-argument variant of MINLOC/MAXLOC, PR14928 > http://gcc.gnu.org/ml/fortran/2004-06/msg00026.html > Join the crowd. http://gcc.gnu.org/ml/fortran/2004-06/msg00001.html and I have another patch to fix random.c. that I submit this week. -- Steve ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-05-29 19:51 jlquinn 0 siblings, 0 replies; 504+ messages in thread From: jlquinn @ 2004-05-29 19:51 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01712.html ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-05-20 13:25 Ben Elliston 0 siblings, 0 replies; 504+ messages in thread From: Ben Elliston @ 2004-05-20 13:25 UTC (permalink / raw) To: gcc-patches Any comments? http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00812.html Ben ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-05-16 11:59 Richard Guenther 0 siblings, 0 replies; 504+ messages in thread From: Richard Guenther @ 2004-05-16 11:59 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00187.html [PATCH] Add leafify function attribute ^ permalink raw reply [flat|nested] 504+ messages in thread
[parent not found: <c7dcf6$uiq$1@sea.gmane.org>]
[parent not found: <16538.13954.773875.174452@cuddles.cambridge.redhat.com>]
* Re: Patch Ping [not found] ` <16538.13954.773875.174452@cuddles.cambridge.redhat.com> @ 2004-05-06 19:00 ` Ranjit Mathew 0 siblings, 0 replies; 504+ messages in thread From: Ranjit Mathew @ 2004-05-06 19:00 UTC (permalink / raw) To: Andrew Haley; +Cc: java-patches, gcc-patches (Note: Andrew's mails haven't been showing up on the lists for some reason.) On Thu, 6 May 2004 13:58:42 +0100, Andrew Haley <aph@redhat.com> wrote: > > Ranjit Mathew writes: > > Hi, > > > > Can someone please review this patch: > > > > http://gcc.gnu.org/ml/java-patches/2004-q2/msg00230.html > > > > This fixes two PRs related to illegal package-private > > access. > > Sorry, I thought this was already discussed and approved. It is now. Thanks, I have committed it. Ranjit. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-05-04 23:01 Andrew Pinski 0 siblings, 0 replies; 504+ messages in thread From: Andrew Pinski @ 2004-05-04 23:01 UTC (permalink / raw) To: gcc-patches@gcc.gnu.org Patches; +Cc: Andrew Pinski http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02335.html [patch] TSP based bb reordering ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-04-28 13:35 Paul Brook 2004-04-28 13:51 ` Richard Earnshaw 2004-04-28 13:56 ` Roger Sayle 0 siblings, 2 replies; 504+ messages in thread From: Paul Brook @ 2004-04-28 13:35 UTC (permalink / raw) To: gcc-patches Patch ping: Output dwarf expressions for memory locations involving shifts. http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00856.html Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-28 13:35 Paul Brook @ 2004-04-28 13:51 ` Richard Earnshaw 2004-04-28 14:02 ` Paul Brook 2004-04-28 13:56 ` Roger Sayle 1 sibling, 1 reply; 504+ messages in thread From: Richard Earnshaw @ 2004-04-28 13:51 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches On Wed, 2004-04-28 at 14:33, Paul Brook wrote: > Patch ping: Output dwarf expressions for memory locations involving shifts. > > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00856.html > > Paul I don't think this is quite right. The MULT code had some simplifications when one of the operands was 0. However, a shift by zero is not the same as a multiply by zero -- the later results in zero, the former is a NOP. R. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-28 13:51 ` Richard Earnshaw @ 2004-04-28 14:02 ` Paul Brook 2004-04-28 15:36 ` Richard Earnshaw 0 siblings, 1 reply; 504+ messages in thread From: Paul Brook @ 2004-04-28 14:02 UTC (permalink / raw) To: Richard Earnshaw; +Cc: gcc-patches On Wednesday 28 April 2004 14:47, Richard Earnshaw wrote: > On Wed, 2004-04-28 at 14:33, Paul Brook wrote: > > Patch ping: Output dwarf expressions for memory locations involving > > shifts. > > > > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00856.html > > > > Paul > > I don't think this is quite right. The MULT code had some > simplifications when one of the operands was 0. However, a shift by > zero is not the same as a multiply by zero -- the later results in zero, > the former is a NOP. Are you sure? I see a check for (op0==0 || op1=0), but this is testing for successful evaluation, not actual values. Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-28 14:02 ` Paul Brook @ 2004-04-28 15:36 ` Richard Earnshaw 0 siblings, 0 replies; 504+ messages in thread From: Richard Earnshaw @ 2004-04-28 15:36 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches On Wed, 2004-04-28 at 14:56, Paul Brook wrote: > On Wednesday 28 April 2004 14:47, Richard Earnshaw wrote: > > On Wed, 2004-04-28 at 14:33, Paul Brook wrote: > > > Patch ping: Output dwarf expressions for memory locations involving > > > shifts. > > > > > > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00856.html > > > > > > Paul > > > > I don't think this is quite right. The MULT code had some > > simplifications when one of the operands was 0. However, a shift by > > zero is not the same as a multiply by zero -- the later results in zero, > > the former is a NOP. > > Are you sure? > I see a check for (op0==0 || op1=0), but this is testing for successful > evaluation, not actual values. Sorry, my mistake. I'd misread the code. Patch approved. R. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-28 13:35 Paul Brook 2004-04-28 13:51 ` Richard Earnshaw @ 2004-04-28 13:56 ` Roger Sayle 1 sibling, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-04-28 13:56 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches On Wed, 28 Apr 2004, Paul Brook wrote: > Patch ping: Output dwarf expressions for memory locations involving shifts. > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00856.html Fortunately, this is simple enough to understand even with my limited knowledge of dwarf. Ok for mainline. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-04-23 11:08 Zdenek Dvorak 2004-04-23 13:34 ` Nathan Sidwell 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2004-04-23 11:08 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00177.html -- enables unrolling of loops with <= n exit condition http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00802.html -- [tree-ssa] fixes kill_redundant_phi_nodes http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html -- the patch to prevent code with -fprofile-arcs and -fbranch-probabilities from diverging before the profile feedback pass (which may cause profile missmatches) http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01150.html -- speculative prefetching http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02335.html -- tsp based bb reordering Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-23 11:08 Zdenek Dvorak @ 2004-04-23 13:34 ` Nathan Sidwell 2004-04-23 13:48 ` Zdenek Dvorak 2004-04-24 13:01 ` Aldy Hernandez 0 siblings, 2 replies; 504+ messages in thread From: Nathan Sidwell @ 2004-04-23 13:34 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches Zdenek Dvorak wrote: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00177.html > -- enables unrolling of loops with <= n exit condition > > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00802.html > -- [tree-ssa] fixes kill_redundant_phi_nodes > > http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html > -- the patch to prevent code with -fprofile-arcs and > -fbranch-probabilities from diverging before the > profile feedback pass (which may cause profile missmatches) this one is ok, wrt the libgcov bits > > http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01150.html > -- speculative prefetching > > http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02335.html > -- tsp based bb reordering > > Zdenek -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-23 13:34 ` Nathan Sidwell @ 2004-04-23 13:48 ` Zdenek Dvorak 2004-04-23 14:18 ` Roger Sayle 2004-04-24 13:01 ` Aldy Hernandez 1 sibling, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2004-04-23 13:48 UTC (permalink / raw) To: Nathan Sidwell; +Cc: gcc-patches Hello, > >http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html > > -- the patch to prevent code with -fprofile-arcs and > > -fbranch-probabilities from diverging before the > > profile feedback pass (which may cause profile missmatches) > this one is ok, wrt the libgcov bits but you cannot approve the builtins.c/calls.c changes, right? Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-23 13:48 ` Zdenek Dvorak @ 2004-04-23 14:18 ` Roger Sayle 0 siblings, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-04-23 14:18 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches, Nathan Sidwell On Fri, 23 Apr 2004, Zdenek Dvorak wrote: > > >http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html > > > -- the patch to prevent code with -fprofile-arcs and > > > -fbranch-probabilities from diverging before the > > > profile feedback pass (which may cause profile missmatches) > > this one is ok, wrt the libgcov bits > > but you cannot approve the builtins.c/calls.c changes, right? These bits are OK for mainline, too. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-23 13:34 ` Nathan Sidwell 2004-04-23 13:48 ` Zdenek Dvorak @ 2004-04-24 13:01 ` Aldy Hernandez 2004-04-24 19:40 ` Zdenek Dvorak 2004-04-25 16:37 ` Zdenek Dvorak 1 sibling, 2 replies; 504+ messages in thread From: Aldy Hernandez @ 2004-04-24 13:01 UTC (permalink / raw) To: Nathan Sidwell; +Cc: Zdenek Dvorak, gcc-patches >>>>> "Nathan" == Nathan Sidwell <nathan@codesourcery.com> writes: >> http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html >> -- the patch to prevent code with -fprofile-arcs and >> -fbranch-probabilities from diverging before the >> profile feedback pass (which may cause profile missmatches) > this one is ok, wrt the libgcov bits Hi Nathan. Hi Zdenek. The gcov changes broke powerpc-eabi*, and possibly all embedded targets. See below. "pid_t" is not declared where you think it is. Aldy In file included from /home/cygnus/aldyh/source/untainted-sources/uber/gcc/libgcov.c:51: /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: error: parse error before "__gcov_fork" /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: warning: type defaults to nt' in declaration of _gcov_fork' /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: warning: data definition has no type or storage class make[1]: *** [libgcc/./_gcov.o] Error 1 ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-24 13:01 ` Aldy Hernandez @ 2004-04-24 19:40 ` Zdenek Dvorak 2004-04-25 3:39 ` Aldy Hernandez 2004-04-25 16:37 ` Zdenek Dvorak 1 sibling, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2004-04-24 19:40 UTC (permalink / raw) To: Aldy Hernandez; +Cc: Nathan Sidwell, gcc-patches Hello, > >>>>> "Nathan" == Nathan Sidwell <nathan@codesourcery.com> writes: > > >> http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html > >> -- the patch to prevent code with -fprofile-arcs and > >> -fbranch-probabilities from diverging before the > >> profile feedback pass (which may cause profile missmatches) > > this one is ok, wrt the libgcov bits > > Hi Nathan. Hi Zdenek. > > The gcov changes broke powerpc-eabi*, and possibly all embedded > targets. See below. "pid_t" is not declared where you think it is. does this help? Zdenek Index: libgcov.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/libgcov.c,v retrieving revision 1.25 diff -c -3 -p -r1.25 libgcov.c *** libgcov.c 23 Apr 2004 22:50:16 -0000 1.25 --- libgcov.c 24 Apr 2004 19:39:12 -0000 *************** void __gcov_merge_delta (gcov_type *coun *** 81,86 **** --- 81,87 ---- #include <errno.h> #include <sys/stat.h> #endif + #include <sys/types.h> #ifdef L_gcov #include "gcov-io.c" ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-24 19:40 ` Zdenek Dvorak @ 2004-04-25 3:39 ` Aldy Hernandez 0 siblings, 0 replies; 504+ messages in thread From: Aldy Hernandez @ 2004-04-25 3:39 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: Nathan Sidwell, gcc-patches > does this help? No. The error is while including gcov-io.h, and your suggested fix includes sys/types.h after gcov-io.h is included. Even if I move the inclusion up, the build fails because sys/types.h is not available: /home/cygnus/aldyh/source/untainted-sources/uber/gcc/libgcov.c:51:23: sys/types.h: No such file or directory Can you try a cross build of powerpc-eabispe? cheers. Aldy ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-24 13:01 ` Aldy Hernandez 2004-04-24 19:40 ` Zdenek Dvorak @ 2004-04-25 16:37 ` Zdenek Dvorak 1 sibling, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2004-04-25 16:37 UTC (permalink / raw) To: Aldy Hernandez; +Cc: Nathan Sidwell, gcc-patches Hello, > >> http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01148.html > >> -- the patch to prevent code with -fprofile-arcs and > >> -fbranch-probabilities from diverging before the > >> profile feedback pass (which may cause profile missmatches) > > this one is ok, wrt the libgcov bits > > Hi Nathan. Hi Zdenek. > > The gcov changes broke powerpc-eabi*, and possibly all embedded > targets. See below. "pid_t" is not declared where you think it is. > > Aldy > > In file included from > /home/cygnus/aldyh/source/untainted-sources/uber/gcc/libgcov.c:51: > /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: > error: parse error before "__gcov_fork" > /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: > warning: type defaults to nt' in declaration of _gcov_fork' > /home/cygnus/aldyh/source/untainted-sources/uber/gcc/gcov-io.h:452: > warning: data definition has no type or storage class > make[1]: *** [libgcc/./_gcov.o] Error 1 this patch fixes the problem, by not declaring the functions when inhibit_libc is defined. Commited as obvious. Zdenek * gcov-io.h (__gcov_fork, __gcov_execl, __gcov_execlp, * __gcov_execle, __gcov_execv, __gcov_execvp, __gcov_execve): Do not declare when inhibit_libc is defined. Index: gcov-io.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/gcov-io.h,v retrieving revision 1.49 diff -c -3 -p -r1.49 gcov-io.h *** gcov-io.h 23 Apr 2004 22:50:16 -0000 1.49 --- gcov-io.h 25 Apr 2004 16:33:30 -0000 *************** extern void __gcov_merge_single (gcov_ty *** 448,453 **** --- 448,454 ---- consecutive values. */ extern void __gcov_merge_delta (gcov_type *, unsigned); + #ifndef inhibit_libc /* The wrappers around some library functions.. */ extern pid_t __gcov_fork (void); extern int __gcov_execl (const char *, const char *, ...); *************** extern int __gcov_execle (const char *, *** 456,461 **** --- 457,463 ---- extern int __gcov_execv (const char *, char *const []); extern int __gcov_execvp (const char *, char *const []); extern int __gcov_execve (const char *, char *const [], char *const []); + #endif #endif /* IN_LIBGCOV */ ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-04-23 9:30 Paolo Bonzini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-04-23 9:30 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00911.html Fix PR/14899 by having comptypes recurse on vector types Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-04-19 19:21 Josef Zlomek 2004-04-20 0:50 ` Roger Sayle 0 siblings, 1 reply; 504+ messages in thread From: Josef Zlomek @ 2004-04-19 19:21 UTC (permalink / raw) To: gcc-patches Please could someone review following patches? Fix ICE when building glibc on ppc64 http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00045.html Fix bug in varible tracking - wrong location lists in some situations http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00272.html Thanks, josef ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 19:21 Josef Zlomek @ 2004-04-20 0:50 ` Roger Sayle 0 siblings, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-04-20 0:50 UTC (permalink / raw) To: Josef Zlomek; +Cc: gcc-patches On Mon, 19 Apr 2004, Josef Zlomek wrote: > Fix ICE when building glibc on ppc64 > http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00045.html This is OK for mainline. > Fix bug in varible tracking - wrong location lists in some situations > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00272.html As is this. Thanks. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-04-16 10:50 Paolo Bonzini 2004-04-16 21:16 ` Geoff Keating 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2004-04-16 10:50 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00384.html Enables -fweb at -O2 and -frename-registers at -O1 if variable tracking is available for the target's default debugging information format. Ok for mainline? Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-16 10:50 Paolo Bonzini @ 2004-04-16 21:16 ` Geoff Keating 2004-04-19 5:37 ` Andreas Jaeger 2004-04-19 5:41 ` Andreas Jaeger 0 siblings, 2 replies; 504+ messages in thread From: Geoff Keating @ 2004-04-16 21:16 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches "Paolo Bonzini" <bonzini@gnu.org> writes: > http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00384.html > Enables -fweb at -O2 and -frename-registers at -O1 if variable > tracking is available for the target's default debugging information > format. > > Ok for mainline? This is OK, assuming you bootstrapped it on at least one platform. -- - Geoffrey Keating <geoffk@geoffk.org> ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-16 21:16 ` Geoff Keating @ 2004-04-19 5:37 ` Andreas Jaeger 2004-04-19 9:45 ` Paolo Bonzini 2004-04-19 5:41 ` Andreas Jaeger 1 sibling, 1 reply; 504+ messages in thread From: Andreas Jaeger @ 2004-04-19 5:37 UTC (permalink / raw) To: Geoff Keating, Paolo, Bonzini, <bonzini@gnu.org>; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 851 bytes --] Geoff Keating <geoffk@geoffk.org> writes: > "Paolo Bonzini" <bonzini@gnu.org> writes: > >> http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00384.html >> Enables -fweb at -O2 and -frename-registers at -O1 if variable >> tracking is available for the target's default debugging information >> format. >> >> Ok for mainline? > > This is OK, assuming you bootstrapped it on at least one platform. Paolo, on which platform did you bootstrap this? It causes build errors on both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and myself on the main GCC list yesterday. Please fix the regressions that your patch has caused. Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 5:37 ` Andreas Jaeger @ 2004-04-19 9:45 ` Paolo Bonzini 2004-04-19 9:56 ` Arnaud Charlet ` (4 more replies) 0 siblings, 5 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-04-19 9:45 UTC (permalink / raw) To: gcc-patches > Paolo, > > on which platform did you bootstrap this? i686-pc-linux-gnu, all languages except Ada/treelang. > It causes build errors on > both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and > myself on the main GCC list yesterday. > > Please fix the regressions that your patch has caused. As I wrote on gcc, I don't think I can be blamed on this. The bugs are not in the code I touched, but only in the code I enabled. All I can do is disabling -frename-registers on the affected archs, as per the attached patch disable-ada-rename-regs.patch. Also, I guess would have been found earlier if the Ada testsuite had tested all optimization levels instead of -O2 only (and it used to be -O0, which seems really strange to me!). Can you please try the attached ada-testsuite.patch on a two-three days old gcc, on Linux/x86-64 and/or Linux/ia64? Ok to commit both patches? Paolo begin 666 ada-testsuite.patch M26YD97@Z(')U;E]A8V%T<PH]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]"E)#4R!F M:6QE.B O8W9S+V=C8R]G8V,O9V-C+W1E<W1S=6ET92]A9&$O86-A=',O<G5N M7V%C871S+'8*<F5T<FEE=FEN9R!R979I<VEO;B Q+C4*9&EF9B M=2 M<C$N M-2!R=6Y?86-A=',*+2TM(')U;E]A8V%T<PDX($IA;B R,# T(#$U.C$Y.C,V M("TP,# P"3$N-0HK*RL@<G5N7V%C871S"3$Y($%P<B R,# T(# Y.C,T.C$V M("TP,# P"D! ("TU,2PT("LU,2PX($! "B *(&-H;6]D("MX(&AO<W1?9VYA M=&UA:V4*( HM97AE8R D=&5S=&1I<B]R=6Y?86QL+G-H("(D0"(**V=C8V9L M86=S/2U/," D=&5S=&1I<B]R=6Y?86QL+G-H("(D0"(**V=C8V9L86=S/2U/ M,2 D=&5S=&1I<B]R=6Y?86QL+G-H("(D0"(**V=C8V9L86=S/2U/,B D=&5S M=&1I<B]R=6Y?86QL+G-H("(D0"(**V=C8V9L86=S/2U/,R D=&5S=&1I<B]R M=6Y?86QL+G-H("(D0"(**V=C8V9L86=S/2U/<R D=&5S=&1I<B]R=6Y?86QL M+G-H("(D0"(*26YD97@Z(')U;E]A;&PN<V@*/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/0I20U,@9FEL93H@+V-V<R]G8V,O9V-C+V=C8R]T97-T<W5I=&4O861A M+V%C871S+W)U;E]A;&PN<V@L=@IR971R:65V:6YG(')E=FES:6]N(#$N,34* M9&EF9B M=2 M<C$N,34@<G5N7V%L;"YS: HM+2T@<G5N7V%L;"YS: DQ-R!! M<'(@,C P-" Q-SHQ-#HQ." M,# P, DQ+C$U"BLK*R!R=6Y?86QL+G-H"3$Y M($%P<B R,# T(# Y.C,T.C$V("TP,# P"D! ("TY+#@@*SDL."! 0 H@(R!G M8V-F;&%G<STB+4\S("UF;VUI="UF<F%M92UP;VEN=&5R("UF=6YR;VQL+6%L M;"UL;V]P<R M9FEN;&EN92UF=6YC=&EO;G,B"B C(&=N871F;&%G<STB+6=N M871.(@H@"BUG8V-F;&%G<STB+4\R(@HM9VYA=&9L86=S/2(M9VYA='=S(@HK M.B D>V=C8V9L86=S/2(M3S(B?0HK.B D>V=N871F;&%G<STB+6=N871W<R)] M"B *('1A<F=E=%]R=6X@*"D@>PH@)"H*0$ @+3<X+#8@*S<X+#D@0$ *(&1I M<W!L87D@8'1Y<&4@9VYA=&UA:V5@"B!G;F%T;',@+78@/CX@)&1I<B]A8V%T M<RYL;V<*(&1I<W!L87D@(B(**V1I<W!L87D@9V-C(&]P=&EO;G,@87)E("(D M>V=C8V9L86=S?2(**V1I<W!L87D@9VYA=&UA:V4@;W!T:6]N<R!A<F4@(B1[ M9V-C9FQA9W-]("1[9VYA=&9L86=S?2(**V1I<W!L87D@(B(*( H@9&ES<&QA M>2 B"0D]/3T@86-A=',@<W5P<&]R=" ]/3TB"B!D:7-P;&%Y7VYO96]L(")' M96YE<F%T:6YG('-U<'!O<G0@9FEL97,N+BXB"D! ("TQ-3(L-B K,34U+#D@ M0$ *(&1I<W!L87D@(B!D;VYE+B(*(&1I<W!L87D@(B(*(&1I<W!L87D@(@D) M/3T](&%C871S('1E<W1S(#T]/2(**V1I<W!L87D@(B(**V1I<W!L87D@9V-C M(&]P=&EO;G,@87)E("(D>V=C8V9L86=S?2(**V1I<W!L87D@9VYA=&UA:V4@ M;W!T:6]N<R!A<F4@(B1[9V-C9FQA9W-]("1[9VYA=&9L86=S?2(*( H@:68@ M6R D(R M97$@,"!=.R!T:&5N"B @("!C:&%P=&5R<SU@8V0@)&1I<B]T97-T 0<SL@96-H;R!;82UZ72I@"@`` ` end begin 666 disable-ada-rename-regs.patch M26YD97@Z(&DS.#8O="UL:6YU>#8T"CT]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T* M4D-3(&9I;&4Z("]C=G,O9V-C+V=C8R]G8V,O8V]N9FEG+VDS.#8O="UL:6YU M>#8T+'8*<F5T<FEE=FEN9R!R979I<VEO;B Q+C4*9&EF9B M=2 M<C$N-2!T M+6QI;G5X-C0*+2TM(&DS.#8O="UL:6YU>#8T"3(X($YO=B R,# R(#$T.C0W M.C R("TP,# P"3$N-0HK*RL@:3,X-B]T+6QI;G5X-C0),3D@07!R(#(P,#0@ M,#DZ-#,Z-#$@+3 P,# *0$ @+3$X+#,@*S$X+#4@0$ *(",@8F5C875S92!T M:&5N(%]?1E)!345?14Y$7U\@;6EG:'0@;F]T(&)E('1H92!L87-T('1H:6YG M(&EN("YE:%]F<F%M90H@(R!S96-T:6]N+@H@0U)44U151D9?5%]#1DQ!1U,@ M/2 M9FYO+6]M:70M9G)A;64M<&]I;G1E<B M9FYO+6%S>6YC:')O;F]U<RUU M;G=I;F0M=&%B;&5S"BL**U1?041!7T-&3$%'4R ]("UF;F\M<F5N86UE+7)E M9VES=&5R<PI);F1E>#H@:6$V-"]T+6EA-C0*/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/0I20U,@9FEL93H@+V-V<R]G8V,O9V-C+V=C8R]C;VYF:6<O:6$V-"]T M+6EA-C0L=@IR971R:65V:6YG(')E=FES:6]N(#$N,C$*9&EF9B M=2 M<C$N M,C$@="UI838T"BTM+2!I838T+W0M:6$V- DR.2!/8W0@,C P,R Q-CHR,3HS M-B M,# P, DQ+C(Q"BLK*R!I838T+W0M:6$V- DQ.2!!<'(@,C P-" P.3HT M,SHT,2 M,# P, I 0" M-#DL,R K-#DL-2! 0 H@"B C(&=E;F%T=')T86(@ M9V5N97)A=&5S('9E<GD@;&]N9R!S=')I;F<@;&ET97)A;',N"B!I;G-N+6%T M=')T86(N;RUW87)N(#T@+5=N;RUE<G)O<@HK"BM47T%$05]#1DQ!1U,@/2 M 59FYO+7)E;F%M92UR96=I<W1E<G,* ` end ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:45 ` Paolo Bonzini @ 2004-04-19 9:56 ` Arnaud Charlet 2004-04-19 10:01 ` Paolo Bonzini 2004-04-19 10:07 ` Andreas Jaeger ` (3 subsequent siblings) 4 siblings, 1 reply; 504+ messages in thread From: Arnaud Charlet @ 2004-04-19 9:56 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches > Ok to commit both patches? Could you resubmit your patch in plain text, and/or as standard mime attachments ? thanks. uuencoded format is kind of antiquated these days, and not easily dealt without painful manual processing. Arno ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:56 ` Arnaud Charlet @ 2004-04-19 10:01 ` Paolo Bonzini 2004-04-19 12:10 ` Arnaud Charlet 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2004-04-19 10:01 UTC (permalink / raw) To: Arnaud Charlet, Andreas Jaeger; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 148 bytes --] > uuencoded format is kind of antiquated these days, and not easily > dealt without painful manual processing. Dense MS Outlook Express. :-( Paolo [-- Attachment #2: ada-testsuite.patch --] [-- Type: application/octet-stream, Size: 1646 bytes --] Index: run_acats =================================================================== RCS file: /cvs/gcc/gcc/gcc/testsuite/ada/acats/run_acats,v retrieving revision 1.5 diff -u -r1.5 run_acats --- run_acats 8 Jan 2004 15:19:36 -0000 1.5 +++ run_acats 19 Apr 2004 09:34:16 -0000 @@ -51,4 +51,8 @@ chmod +x host_gnatmake -exec $testdir/run_all.sh "$@" +gccflags=-O0 $testdir/run_all.sh "$@" +gccflags=-O1 $testdir/run_all.sh "$@" +gccflags=-O2 $testdir/run_all.sh "$@" +gccflags=-O3 $testdir/run_all.sh "$@" +gccflags=-Os $testdir/run_all.sh "$@" Index: run_all.sh =================================================================== RCS file: /cvs/gcc/gcc/gcc/testsuite/ada/acats/run_all.sh,v retrieving revision 1.15 diff -u -r1.15 run_all.sh --- run_all.sh 17 Apr 2004 17:14:18 -0000 1.15 +++ run_all.sh 19 Apr 2004 09:34:16 -0000 @@ -9,8 +9,8 @@ # gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions" # gnatflags="-gnatN" -gccflags="-O2" -gnatflags="-gnatws" +: ${gccflags="-O2"} +: ${gnatflags="-gnatws"} target_run () { $* @@ -78,6 +78,9 @@ display `type gnatmake` gnatls -v >> $dir/acats.log display "" +display gcc options are "${gccflags}" +display gnatmake options are "${gccflags} ${gnatflags}" +display "" display " === acats support ===" display_noeol "Generating support files..." @@ -152,6 +155,9 @@ display " done." display "" display " === acats tests ===" +display "" +display gcc options are "${gccflags}" +display gnatmake options are "${gccflags} ${gnatflags}" if [ $# -eq 0 ]; then chapters=`cd $dir/tests; echo [a-z]*` [-- Attachment #3: disable-ada-rename-regs.patch --] [-- Type: application/octet-stream, Size: 947 bytes --] Index: i386/t-linux64 =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/t-linux64,v retrieving revision 1.5 diff -u -r1.5 t-linux64 --- i386/t-linux64 28 Nov 2002 14:47:02 -0000 1.5 +++ i386/t-linux64 19 Apr 2004 09:43:41 -0000 @@ -18,3 +18,5 @@ # because then __FRAME_END__ might not be the last thing in .eh_frame # section. CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer -fno-asynchronous-unwind-tables + +T_ADA_CFLAGS = -fno-rename-registers Index: ia64/t-ia64 =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/ia64/t-ia64,v retrieving revision 1.21 diff -u -r1.21 t-ia64 --- ia64/t-ia64 29 Oct 2003 16:21:36 -0000 1.21 +++ ia64/t-ia64 19 Apr 2004 09:43:41 -0000 @@ -49,3 +49,5 @@ # genattrtab generates very long string literals. insn-attrtab.o-warn = -Wno-error + +T_ADA_CFLAGS = -fno-rename-registers ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 10:01 ` Paolo Bonzini @ 2004-04-19 12:10 ` Arnaud Charlet 0 siblings, 0 replies; 504+ messages in thread From: Arnaud Charlet @ 2004-04-19 12:10 UTC (permalink / raw) To: Paolo Bonzini; +Cc: Arnaud Charlet, Andreas Jaeger, gcc-patches > Dense MS Outlook Express. :-( You first patch causes cpu usage problem as mentioned by Laurent, so that's probably not reasonable. In addition, maintaining a baseline of all failures on all these levels of switches will also be very painful. -O0 was clearly the simplest (in particular on platforms where optimizations are somewhat fragile), and has the advantage of being clean on a few platforms, making it easier to perform comparisons. -O2 is a good compromise, since as shown recently, it is often the case that middle-end or optimization bugs only show up in the context of Ada code, although not specifically Ada related. As for your second patch, that's really a temporary work around, since the bugs shown are most likely general bugs not Ada specific, and that will likely appear in complex C/C++ code as well. As such, it should really be marked with comments explaining why the code is there, and that it's temporary. A bugzilla PR should also be opened to remind us that you've put in place this temporary work around. Arno ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:45 ` Paolo Bonzini 2004-04-19 9:56 ` Arnaud Charlet @ 2004-04-19 10:07 ` Andreas Jaeger 2004-04-19 10:41 ` Laurent GUERBY ` (2 subsequent siblings) 4 siblings, 0 replies; 504+ messages in thread From: Andreas Jaeger @ 2004-04-19 10:07 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 4155 bytes --] "Paolo Bonzini" <bonzini@gnu.org> writes: >> Paolo, >> >> on which platform did you bootstrap this? > > i686-pc-linux-gnu, all languages except Ada/treelang. > >> It causes build errors on >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and >> myself on the main GCC list yesterday. >> >> Please fix the regressions that your patch has caused. > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are not > in the code I touched, but only in the code I enabled. All I can do is > disabling -frename-registers on the affected archs, as per the attached > patch disable-ada-rename-regs.patch. The GCC development rules state that you have to fix the code. Even if it's a latent bug that is only introduced by your changes. > Also, I guess would have been found earlier if the Ada testsuite had tested > all optimization levels instead of -O2 only (and it used to be -O0, which > seems really strange to me!). Can you please try the attached > ada-testsuite.patch on a two-three days old gcc, on Linux/x86-64 and/or > Linux/ia64? I'll test the complete patch now, Andreas > Ok to commit both patches? > > Paolo > > > > Index: run_acats > =================================================================== > RCS file: /cvs/gcc/gcc/gcc/testsuite/ada/acats/run_acats,v > retrieving revision 1.5 > diff -u -r1.5 run_acats > --- run_acats 8 Jan 2004 15:19:36 -0000 1.5 > +++ run_acats 19 Apr 2004 09:34:16 -0000 > @@ -51,4 +51,8 @@ > > chmod +x host_gnatmake > > -exec $testdir/run_all.sh "$@" > +gccflags=-O0 $testdir/run_all.sh "$@" > +gccflags=-O1 $testdir/run_all.sh "$@" > +gccflags=-O2 $testdir/run_all.sh "$@" > +gccflags=-O3 $testdir/run_all.sh "$@" > +gccflags=-Os $testdir/run_all.sh "$@" > Index: run_all.sh > =================================================================== > RCS file: /cvs/gcc/gcc/gcc/testsuite/ada/acats/run_all.sh,v > retrieving revision 1.15 > diff -u -r1.15 run_all.sh > --- run_all.sh 17 Apr 2004 17:14:18 -0000 1.15 > +++ run_all.sh 19 Apr 2004 09:34:16 -0000 > @@ -9,8 +9,8 @@ > # gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions" > # gnatflags="-gnatN" > > -gccflags="-O2" > -gnatflags="-gnatws" > +: ${gccflags="-O2"} > +: ${gnatflags="-gnatws"} > > target_run () { > $* > @@ -78,6 +78,9 @@ > display `type gnatmake` > gnatls -v >> $dir/acats.log > display "" > +display gcc options are "${gccflags}" > +display gnatmake options are "${gccflags} ${gnatflags}" > +display "" > > display " === acats support ===" > display_noeol "Generating support files..." > @@ -152,6 +155,9 @@ > display " done." > display "" > display " === acats tests ===" > +display "" > +display gcc options are "${gccflags}" > +display gnatmake options are "${gccflags} ${gnatflags}" > > if [ $# -eq 0 ]; then > chapters=`cd $dir/tests; echo [a-z]*` > > Index: i386/t-linux64 > =================================================================== > RCS file: /cvs/gcc/gcc/gcc/config/i386/t-linux64,v > retrieving revision 1.5 > diff -u -r1.5 t-linux64 > --- i386/t-linux64 28 Nov 2002 14:47:02 -0000 1.5 > +++ i386/t-linux64 19 Apr 2004 09:43:41 -0000 > @@ -18,3 +18,5 @@ > # because then __FRAME_END__ might not be the last thing in .eh_frame > # section. > CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer -fno-asynchronous-unwind-tables > + > +T_ADA_CFLAGS = -fno-rename-registers > Index: ia64/t-ia64 > =================================================================== > RCS file: /cvs/gcc/gcc/gcc/config/ia64/t-ia64,v > retrieving revision 1.21 > diff -u -r1.21 t-ia64 > --- ia64/t-ia64 29 Oct 2003 16:21:36 -0000 1.21 > +++ ia64/t-ia64 19 Apr 2004 09:43:41 -0000 > @@ -49,3 +49,5 @@ > > # genattrtab generates very long string literals. > insn-attrtab.o-warn = -Wno-error > + > +T_ADA_CFLAGS = -fno-rename-registers Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:45 ` Paolo Bonzini 2004-04-19 9:56 ` Arnaud Charlet 2004-04-19 10:07 ` Andreas Jaeger @ 2004-04-19 10:41 ` Laurent GUERBY 2004-04-19 11:13 ` Paolo Bonzini 2004-04-19 11:30 ` Andreas Jaeger 2004-04-19 12:57 ` Andreas Schwab 4 siblings, 1 reply; 504+ messages in thread From: Laurent GUERBY @ 2004-04-19 10:41 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches On Mon, 2004-04-19 at 11:48, Paolo Bonzini wrote: > i686-pc-linux-gnu, all languages except Ada/treelang. ... > Also, I guess would have been found earlier if the Ada testsuite had tested > all optimization levels [...] Well, if you don't include Ada in the build, the Ada testsuite flags don't matter much :). Any reason that Ada is not running on your i686-pc-linux-gnu machine? (most distribution have Ada lying around these days) I suggested some time ago to use -O2 instead of -O0 but the proposition was rejected, hopefully it's now in. For Ada we have to make a trade-off, running once the Ada testsuite takes more time the whole C language test suite (28 minutes vs 17 minutes on my Athlon 2600+), so running 5 times the Ada testsuite is not something that will go unnoticed :). Laurent ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 10:41 ` Laurent GUERBY @ 2004-04-19 11:13 ` Paolo Bonzini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-04-19 11:13 UTC (permalink / raw) To: gcc-patches > > Also, I guess would have been found earlier if the Ada testsuite had tested > > all optimization levels [...] > > Well, if you don't include Ada in the build, the Ada testsuite flags > don't matter much :). Well, failures on ia64 will go unnoticed on i686 even if I include Ada in the build. > Any reason that Ada is not running on your > i686-pc-linux-gnu machine? (most distribution have Ada lying around > these days) I've not spent much time looking at it, but all I could find in Debian (apt-get install gnat) is a gcc-2.8.1 based gnat which is not picked up by configure (its gnatmake does not invoke the installed gcc). > For Ada we have to make a trade-off, running once the Ada testsuite > takes more time the whole C language test suite (28 minutes vs 17 > minutes on my Athlon 2600+), so running 5 times the Ada testsuite > is not something that will go unnoticed :). I see. Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:45 ` Paolo Bonzini ` (2 preceding siblings ...) 2004-04-19 10:41 ` Laurent GUERBY @ 2004-04-19 11:30 ` Andreas Jaeger 2004-04-19 12:38 ` Paolo Bonzini 2004-04-19 12:57 ` Andreas Schwab 4 siblings, 1 reply; 504+ messages in thread From: Andreas Jaeger @ 2004-04-19 11:30 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 1344 bytes --] "Paolo Bonzini" <bonzini@gnu.org> writes: >> Paolo, >> >> on which platform did you bootstrap this? > > i686-pc-linux-gnu, all languages except Ada/treelang. > >> It causes build errors on >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and >> myself on the main GCC list yesterday. >> >> Please fix the regressions that your patch has caused. > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are not > in the code I touched, but only in the code I enabled. All I can do is > disabling -frename-registers on the affected archs, as per the attached > patch disable-ada-rename-regs.patch. > > Also, I guess would have been found earlier if the Ada testsuite had tested > all optimization levels instead of -O2 only (and it used to be -O0, which > seems really strange to me!). Can you please try the attached > ada-testsuite.patch on a two-three days old gcc, on Linux/x86-64 and/or > Linux/ia64? I just tested all patches together and now is build fine for me. Testresults will soon be on the testresults list. But this should be fixed properly instead of worked around. Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 11:30 ` Andreas Jaeger @ 2004-04-19 12:38 ` Paolo Bonzini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-04-19 12:38 UTC (permalink / raw) To: gcc-patches > I just tested all patches together and now is build fine for me. > Testresults will soon be on the testresults list. Thanks. Of course the problem will have to be looked at more carefully, and the workarounds are in general insufficient. Also, on ia64-pc-linux-gnu C++ fails which is more severe, so I'm setting up a combined tree for ia64. Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 9:45 ` Paolo Bonzini ` (3 preceding siblings ...) 2004-04-19 11:30 ` Andreas Jaeger @ 2004-04-19 12:57 ` Andreas Schwab 2004-04-19 13:16 ` Paul Brook 2004-04-19 13:20 ` Richard Earnshaw 4 siblings, 2 replies; 504+ messages in thread From: Andreas Schwab @ 2004-04-19 12:57 UTC (permalink / raw) To: Paolo Bonzini; +Cc: gcc-patches "Paolo Bonzini" <bonzini@gnu.org> writes: >> Paolo, >> >> on which platform did you bootstrap this? > > i686-pc-linux-gnu, all languages except Ada/treelang. > >> It causes build errors on >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and >> myself on the main GCC list yesterday. >> >> Please fix the regressions that your patch has caused. > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are not > in the code I touched, but only in the code I enabled. All I can do is > disabling -frename-registers on the affected archs, as per the attached > patch disable-ada-rename-regs.patch. This has nothing to do with Ada, the same error happens with libstdc++ as well, see <http://gcc.gnu.org/ml/gcc/2004-04/msg00830.html>. It seems like -frename-registers is generally broken, or triggers generally broken code. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 12:57 ` Andreas Schwab @ 2004-04-19 13:16 ` Paul Brook 2004-04-19 15:08 ` Richard Earnshaw 2004-04-19 13:20 ` Richard Earnshaw 1 sibling, 1 reply; 504+ messages in thread From: Paul Brook @ 2004-04-19 13:16 UTC (permalink / raw) To: gcc-patches; +Cc: Andreas Schwab, Paolo Bonzini On Monday 19 April 2004 13:57, Andreas Schwab wrote: > "Paolo Bonzini" <bonzini@gnu.org> writes: > >> Paolo, > >> > >> on which platform did you bootstrap this? > > > > i686-pc-linux-gnu, all languages except Ada/treelang. > > > >> It causes build errors on > >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and > >> myself on the main GCC list yesterday. > >> > >> Please fix the regressions that your patch has caused. > > > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are > > not in the code I touched, but only in the code I enabled. All I can do > > is disabling -frename-registers on the affected archs, as per the > > attached patch disable-ada-rename-regs.patch. > > This has nothing to do with Ada, the same error happens with libstdc++ as > well, see <http://gcc.gnu.org/ml/gcc/2004-04/msg00830.html>. It seems like > -frename-registers is generally broken, or triggers generally broken code. It also breaks libstdc++ on arm/thumb. Paul ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 13:16 ` Paul Brook @ 2004-04-19 15:08 ` Richard Earnshaw 0 siblings, 0 replies; 504+ messages in thread From: Richard Earnshaw @ 2004-04-19 15:08 UTC (permalink / raw) To: Paul Brook; +Cc: gcc-patches, Andreas Schwab, Paolo Bonzini On Mon, 2004-04-19 at 14:16, Paul Brook wrote: > On Monday 19 April 2004 13:57, Andreas Schwab wrote: > > "Paolo Bonzini" <bonzini@gnu.org> writes: > > >> Paolo, > > >> > > >> on which platform did you bootstrap this? > > > > > > i686-pc-linux-gnu, all languages except Ada/treelang. > > > > > >> It causes build errors on > > >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and > > >> myself on the main GCC list yesterday. > > >> > > >> Please fix the regressions that your patch has caused. > > > > > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are > > > not in the code I touched, but only in the code I enabled. All I can do > > > is disabling -frename-registers on the affected archs, as per the > > > attached patch disable-ada-rename-regs.patch. > > > > This has nothing to do with Ada, the same error happens with libstdc++ as > > well, see <http://gcc.gnu.org/ml/gcc/2004-04/msg00830.html>. It seems like > > -frename-registers is generally broken, or triggers generally broken code. > > It also breaks libstdc++ on arm/thumb. > > Paul If you are seeing this bug: /work/rearnsha/gnu/egcs/gcc/xgcc -shared-libgcc -B/work/rearnsha/gnu/egcs/gcc/ - nostdinc++ -L/work/rearnsha/gnu/egcs/arm-elf/libstdc++-v3/src -L/work/rearnsha/g nu/egcs/arm-elf/libstdc++-v3/src/.libs -nostdinc -B/work/rearnsha/gnu/egcs/arm-e lf/newlib/ -isystem /work/rearnsha/gnu/egcs/arm-elf/newlib/targ-include -isystem /home/rearnsha/gnusrc/egcs-cross/newlib/libc/include -B/work/rearnsha/gnu/testi nstall/arm-elf/bin/ -B/work/rearnsha/gnu/testinstall/arm-elf/lib/ -isystem /work /rearnsha/gnu/testinstall/arm-elf/include -isystem /work/rearnsha/gnu/testinstal l/arm-elf/sys-include -L/work/rearnsha/gnu/egcs/ld -I/work/rearnsha/gnu/egcs/arm -elf/libstdc++-v3/include/arm-elf -I/work/rearnsha/gnu/egcs/arm-elf/libstdc++-v3 /include -I/home/rearnsha/gnusrc/egcs-cross/libstdc++-v3/libsupc++ -O2 -g -O2 -g -O2 -fno-implicit-templates -Wall -W -Wwrite-strings -Wcast-qual -fdiagnostics- show-location=once -c /home/rearnsha/gnusrc/egcs-cross/libstdc++-v3/src/complex_ io.cc -o complex_io.o /work/rearnsha/gnu/egcs/arm-elf/libstdc++-v3/include/complex: In function `std:: basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Trai ts>&, conststd::complex<_Tp>&) [with _Tp = float, _CharT = char, _Traits = std:: char_traits<char>]': /work/rearnsha/gnu/egcs/arm-elf/libstdc++-v3/include/complex:1455: error: insn d oes not satisfy its constraints: (insn:HI 2559 6401 6402 47 /work/rearnsha/gnu/egcs/arm-elf/libstdc++-v3/include/ streambuf:187 (set (mem/s:SI (post_modify:SI (reg:SI 12 ip) (plus:SI (reg:SI 12 ip) (const_int 28 [0x1c]))) [9 <variable>._vptr.basic_streambuf+ 0 S4 A32]) (reg/f:SI 3 r3 [314])) 140 {*arm_movsi_insn} (insn_list 2558 (nil)) (expr_list:REG_DEAD (reg/f:SI 3 r3 [314]) (expr_list:REG_INC (reg:SI 12 ip) (nil)))) Then I think this is because arm_legitimate_address_p is doing something wrong. Probably this test: else if ((GET_CODE (x) == POST_MODIFY || GET_CODE (x) == PRE_MODIFY) && GET_MODE_SIZE (mode) <= 4 && arm_address_register_rtx_p (XEXP (x, 0), strict_p) && GET_CODE (XEXP (x, 1)) == PLUS && XEXP (XEXP (x, 1), 0) == XEXP (x, 0)) That final equivalence should probably be using rtx_equal_p(), but I haven't tested that yet. R. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-19 12:57 ` Andreas Schwab 2004-04-19 13:16 ` Paul Brook @ 2004-04-19 13:20 ` Richard Earnshaw 1 sibling, 0 replies; 504+ messages in thread From: Richard Earnshaw @ 2004-04-19 13:20 UTC (permalink / raw) To: Andreas Schwab; +Cc: Paolo Bonzini, gcc-patches On Mon, 2004-04-19 at 13:57, Andreas Schwab wrote: > "Paolo Bonzini" <bonzini@gnu.org> writes: > > >> Paolo, > >> > >> on which platform did you bootstrap this? > > > > i686-pc-linux-gnu, all languages except Ada/treelang. > > > >> It causes build errors on > >> both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and > >> myself on the main GCC list yesterday. > >> > >> Please fix the regressions that your patch has caused. > > > > As I wrote on gcc, I don't think I can be blamed on this. The bugs are not > > in the code I touched, but only in the code I enabled. All I can do is > > disabling -frename-registers on the affected archs, as per the attached > > patch disable-ada-rename-regs.patch. > > This has nothing to do with Ada, the same error happens with libstdc++ as > well, see <http://gcc.gnu.org/ml/gcc/2004-04/msg00830.html>. It seems like > -frename-registers is generally broken, or triggers generally broken code. Not to mention the fact that it also appears to be a major CPU hog. Depending on the platform this can cause up to about 4% increase in compile times. R. ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-04-16 21:16 ` Geoff Keating 2004-04-19 5:37 ` Andreas Jaeger @ 2004-04-19 5:41 ` Andreas Jaeger 1 sibling, 0 replies; 504+ messages in thread From: Andreas Jaeger @ 2004-04-19 5:41 UTC (permalink / raw) To: Geoff Keating, Paolo Bonzini; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 851 bytes --] Geoff Keating <geoffk@geoffk.org> writes: > "Paolo Bonzini" <bonzini@gnu.org> writes: > >> http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00384.html >> Enables -fweb at -O2 and -frename-registers at -O1 if variable >> tracking is available for the target's default debugging information >> format. >> >> Ok for mainline? > > This is OK, assuming you bootstrapped it on at least one platform. Paolo, on which platform did you bootstrap this? It causes build errors on both Linux/x86-64 and Linux/ia64 as reported by Andreas Schwab and myself on the main GCC list yesterday. Please fix the regressions that your patch has caused. Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-03-26 15:38 Ian Lance Taylor 0 siblings, 0 replies; 504+ messages in thread From: Ian Lance Taylor @ 2004-03-26 15:38 UTC (permalink / raw) To: gcc-patches Patch ping: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01585.html Fix PR target/14548, clean up USE_COLLECT2 and make it host-dependent rather than target-dependent http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01445.html Change collect2 to not call vfork, as a step toward making it buildable on hosts which can not fork Thanks. Ian ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping... @ 2004-03-24 2:53 Eric Christopher 0 siblings, 0 replies; 504+ messages in thread From: Eric Christopher @ 2004-03-24 2:53 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01649.html Thanks. -eric -- Eric Christopher <echristo@redhat.com> ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-03-01 13:03 Zdenek Dvorak 2004-03-02 9:33 ` Zack Weinberg 2004-03-19 8:14 ` Zdenek Dvorak 0 siblings, 2 replies; 504+ messages in thread From: Zdenek Dvorak @ 2004-03-01 13:03 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01733.html -- doloop optimization rewrite http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01548.html -- removal of unused code from simple loop analysis Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-03-01 13:03 Patch ping Zdenek Dvorak @ 2004-03-02 9:33 ` Zack Weinberg 2004-03-19 8:14 ` Zack Weinberg 2004-03-19 8:14 ` Zdenek Dvorak 1 sibling, 1 reply; 504+ messages in thread From: Zack Weinberg @ 2004-03-02 9:33 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01733.html > -- doloop optimization rewrite not qualified to review this one, sorry. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01548.html > -- removal of unused code from simple loop analysis this, however, is ok. zw ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2004-03-02 9:33 ` Zack Weinberg @ 2004-03-19 8:14 ` Zack Weinberg 0 siblings, 0 replies; 504+ messages in thread From: Zack Weinberg @ 2004-03-19 8:14 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes: > Hello, > > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01733.html > -- doloop optimization rewrite not qualified to review this one, sorry. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01548.html > -- removal of unused code from simple loop analysis this, however, is ok. zw ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2004-03-01 13:03 Patch ping Zdenek Dvorak 2004-03-02 9:33 ` Zack Weinberg @ 2004-03-19 8:14 ` Zdenek Dvorak 1 sibling, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2004-03-19 8:14 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01733.html -- doloop optimization rewrite http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01548.html -- removal of unused code from simple loop analysis Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-02-17 0:25 Alan Modra 2004-02-21 13:45 ` Alan Modra 0 siblings, 1 reply; 504+ messages in thread From: Alan Modra @ 2004-02-17 0:25 UTC (permalink / raw) To: gcc-patches Move special treatment of relative prefixes into add_sysrooted_prefix. http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00634.html rs6000 va_arg support for long double http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00632.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping 2004-02-17 0:25 patch ping Alan Modra @ 2004-02-21 13:45 ` Alan Modra 0 siblings, 0 replies; 504+ messages in thread From: Alan Modra @ 2004-02-21 13:45 UTC (permalink / raw) To: gcc-patches Move special treatment of relative prefixes into add_sysrooted_prefix. http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00634.html rs6000 va_arg support for long double http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00632.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-02-12 21:22 Zdenek Dvorak 2004-02-21 13:45 ` Zdenek Dvorak 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2004-02-12 21:22 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01348.html -- a rewrite of mark_irreducible_loops function (since I found out that I no longer understand how it works, and was unable to fix a bug in it). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2004-02-12 21:22 Patch ping Zdenek Dvorak @ 2004-02-21 13:45 ` Zdenek Dvorak 0 siblings, 0 replies; 504+ messages in thread From: Zdenek Dvorak @ 2004-02-21 13:45 UTC (permalink / raw) To: gcc-patches Hello, http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01348.html -- a rewrite of mark_irreducible_loops function (since I found out that I no longer understand how it works, and was unable to fix a bug in it). Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping @ 2004-02-06 1:23 Alan Modra 2004-02-06 4:23 ` Roger Sayle ` (2 more replies) 0 siblings, 3 replies; 504+ messages in thread From: Alan Modra @ 2004-02-06 1:23 UTC (permalink / raw) To: gcc-patches I know it's only been a few days, but the rs6000 bit has been OK'd and the rest is just a mechanical change. http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 1:23 patch ping Alan Modra @ 2004-02-06 4:23 ` Roger Sayle 2004-02-21 13:45 ` Roger Sayle 2004-02-06 10:40 ` Andreas Schwab 2004-02-21 13:45 ` Alan Modra 2 siblings, 1 reply; 504+ messages in thread From: Roger Sayle @ 2004-02-06 4:23 UTC (permalink / raw) To: Alan Modra; +Cc: gcc-patches On Fri, 6 Feb 2004, Alan Modra wrote: > I know it's only been a few days, but the rs6000 bit has been OK'd > and the rest is just a mechanical change. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html Ok for mainline. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 4:23 ` Roger Sayle @ 2004-02-21 13:45 ` Roger Sayle 0 siblings, 0 replies; 504+ messages in thread From: Roger Sayle @ 2004-02-21 13:45 UTC (permalink / raw) To: Alan Modra; +Cc: gcc-patches On Fri, 6 Feb 2004, Alan Modra wrote: > I know it's only been a few days, but the rs6000 bit has been OK'd > and the rest is just a mechanical change. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html Ok for mainline. Roger -- ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 1:23 patch ping Alan Modra 2004-02-06 4:23 ` Roger Sayle @ 2004-02-06 10:40 ` Andreas Schwab 2004-02-06 11:02 ` Alan Modra 2004-02-21 13:45 ` Andreas Schwab 2004-02-21 13:45 ` Alan Modra 2 siblings, 2 replies; 504+ messages in thread From: Andreas Schwab @ 2004-02-06 10:40 UTC (permalink / raw) To: Alan Modra; +Cc: gcc-patches Alan Modra <amodra@bigpond.net.au> writes: > I know it's only been a few days, but the rs6000 bit has been OK'd > and the rest is just a mechanical change. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html Breaks bootstrap. gcc -c -O2 -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -fno-common -DHAVE_CONFIG_H -I. -Iada -I../../gcc -I../../gcc/ada -I../../gcc/../include ../../gcc/ada/misc.c -o ada/misc.o ../../gcc/ada/misc.c:867:52: macro "INIT_CUMULATIVE_ARGS" requires 5 arguments, but only 4 given ../../gcc/ada/misc.c: In function `default_pass_by_ref': ../../gcc/ada/misc.c:867: error: `INIT_CUMULATIVE_ARGS' undeclared (first use in this function) ../../gcc/ada/misc.c:867: error: (Each undeclared identifier is reported only once ../../gcc/ada/misc.c:867: error: for each function it appears in.) make[2]: *** [ada/misc.o] Error 1 make[2]: Leaving directory `/tmp/cvs/gcc-20040206/Build/gcc' make[1]: *** [stage1_build] Error 2 make[1]: Leaving directory `/tmp/cvs/gcc-20040206/Build/gcc' make: *** [bootstrap] Error 2 Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Maxfeldstra\xDFe 5, 90409 N\xFCrnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 10:40 ` Andreas Schwab @ 2004-02-06 11:02 ` Alan Modra 2004-02-21 13:45 ` Alan Modra 2004-02-21 13:45 ` Andreas Schwab 1 sibling, 1 reply; 504+ messages in thread From: Alan Modra @ 2004-02-06 11:02 UTC (permalink / raw) To: Andreas Schwab; +Cc: gcc-patches On Fri, Feb 06, 2004 at 11:40:23AM +0100, Andreas Schwab wrote: > ../../gcc/ada/misc.c:867:52: macro "INIT_CUMULATIVE_ARGS" requires 5 arguments, but only 4 given Oops. Fixed with the obvious patch. -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 11:02 ` Alan Modra @ 2004-02-21 13:45 ` Alan Modra 0 siblings, 0 replies; 504+ messages in thread From: Alan Modra @ 2004-02-21 13:45 UTC (permalink / raw) To: Andreas Schwab; +Cc: gcc-patches On Fri, Feb 06, 2004 at 11:40:23AM +0100, Andreas Schwab wrote: > ../../gcc/ada/misc.c:867:52: macro "INIT_CUMULATIVE_ARGS" requires 5 arguments, but only 4 given Oops. Fixed with the obvious patch. -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: patch ping 2004-02-06 10:40 ` Andreas Schwab 2004-02-06 11:02 ` Alan Modra @ 2004-02-21 13:45 ` Andreas Schwab 1 sibling, 0 replies; 504+ messages in thread From: Andreas Schwab @ 2004-02-21 13:45 UTC (permalink / raw) To: Alan Modra; +Cc: gcc-patches Alan Modra <amodra@bigpond.net.au> writes: > I know it's only been a few days, but the rs6000 bit has been OK'd > and the rest is just a mechanical change. > http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html Breaks bootstrap. gcc -c -O2 -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -fno-common -DHAVE_CONFIG_H -I. -Iada -I../../gcc -I../../gcc/ada -I../../gcc/../include ../../gcc/ada/misc.c -o ada/misc.o ../../gcc/ada/misc.c:867:52: macro "INIT_CUMULATIVE_ARGS" requires 5 arguments, but only 4 given ../../gcc/ada/misc.c: In function `default_pass_by_ref': ../../gcc/ada/misc.c:867: error: `INIT_CUMULATIVE_ARGS' undeclared (first use in this function) ../../gcc/ada/misc.c:867: error: (Each undeclared identifier is reported only once ../../gcc/ada/misc.c:867: error: for each function it appears in.) make[2]: *** [ada/misc.o] Error 1 make[2]: Leaving directory `/tmp/cvs/gcc-20040206/Build/gcc' make[1]: *** [stage1_build] Error 2 make[1]: Leaving directory `/tmp/cvs/gcc-20040206/Build/gcc' make: *** [bootstrap] Error 2 Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping 2004-02-06 1:23 patch ping Alan Modra 2004-02-06 4:23 ` Roger Sayle 2004-02-06 10:40 ` Andreas Schwab @ 2004-02-21 13:45 ` Alan Modra 2 siblings, 0 replies; 504+ messages in thread From: Alan Modra @ 2004-02-21 13:45 UTC (permalink / raw) To: gcc-patches I know it's only been a few days, but the rs6000 bit has been OK'd and the rest is just a mechanical change. http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00071.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2004-02-02 9:21 Paolo Bonzini 2004-02-21 13:45 ` Paolo Bonzini 0 siblings, 1 reply; 504+ messages in thread From: Paolo Bonzini @ 2004-02-02 9:21 UTC (permalink / raw) To: gcc-patches Please review these two patches. http://gcc.gnu.org/ml/gcc-patches/2004-01/msg03481.html 1.3% speed improvement on bootstrap http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02845.html Split a 1080-line function Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping 2004-02-02 9:21 Patch ping Paolo Bonzini @ 2004-02-21 13:45 ` Paolo Bonzini 0 siblings, 0 replies; 504+ messages in thread From: Paolo Bonzini @ 2004-02-21 13:45 UTC (permalink / raw) To: gcc-patches Please review these two patches. http://gcc.gnu.org/ml/gcc-patches/2004-01/msg03481.html 1.3% speed improvement on bootstrap http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02845.html Split a 1080-line function Paolo ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2003-10-19 11:11 Zdenek Dvorak 2003-10-19 17:39 ` Zack Weinberg 0 siblings, 1 reply; 504+ messages in thread From: Zdenek Dvorak @ 2003-10-19 11:11 UTC (permalink / raw) To: gcc-patches Hello, could someone please review http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02991.html? I would like to get this in, since it uses value profiling, and I feel wrong about having a piece of unused and therefore untested code in gcc. And of course, it also makes a nice improvement in benchmarks. Zdenek ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2003-10-19 11:11 Zdenek Dvorak @ 2003-10-19 17:39 ` Zack Weinberg 2003-10-19 18:38 ` Jan Hubicka 0 siblings, 1 reply; 504+ messages in thread From: Zack Weinberg @ 2003-10-19 17:39 UTC (permalink / raw) To: Zdenek Dvorak; +Cc: gcc-patches Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes: > Hello, > > could someone please review > > http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02991.html? > > I would like to get this in, since it uses value profiling, and I feel > wrong about having a piece of unused and therefore untested code in gcc. > And of course, it also makes a nice improvement in benchmarks. I don't see anything wrong with the code, but I would like someone more familiar with the profiler to comment. Since this was submitted well before the deadline and only affects a non-default optimization mode, I think it can go in now if (say) Nathan Sidwell thinks the code is sound. You have some English grammar issues with the documentation. zw ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2003-10-19 17:39 ` Zack Weinberg @ 2003-10-19 18:38 ` Jan Hubicka 2003-10-19 18:41 ` Andreas Jaeger 0 siblings, 1 reply; 504+ messages in thread From: Jan Hubicka @ 2003-10-19 18:38 UTC (permalink / raw) To: Zack Weinberg; +Cc: Zdenek Dvorak, gcc-patches > Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes: > > > Hello, > > > > could someone please review > > > > http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02991.html? > > > > I would like to get this in, since it uses value profiling, and I feel > > wrong about having a piece of unused and therefore untested code in gcc. > > And of course, it also makes a nice improvement in benchmarks. > > I don't see anything wrong with the code, but I would like someone > more familiar with the profiler to comment. Since this was submitted > well before the deadline and only affects a non-default optimization > mode, I think it can go in now if (say) Nathan Sidwell thinks the code > is sound. The actual interface to profiling code came in earlier with separate patch. This patch has no consequences to the profiling, just uses the interface we agreed on earlier, so I would say that there is no problem from profiler side. (this is also why I don't feel this belong to area I can approve as gcov maintainer) Honza > > You have some English grammar issues with the documentation. > > zw ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2003-10-19 18:38 ` Jan Hubicka @ 2003-10-19 18:41 ` Andreas Jaeger 2003-10-19 19:54 ` Zack Weinberg 0 siblings, 1 reply; 504+ messages in thread From: Andreas Jaeger @ 2003-10-19 18:41 UTC (permalink / raw) To: Jan Hubicka; +Cc: Zack Weinberg, Zdenek Dvorak, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1422 bytes --] Jan Hubicka <hubicka@ucw.cz> writes: >> Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes: >> >> > Hello, >> > >> > could someone please review >> > >> > http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02991.html? >> > >> > I would like to get this in, since it uses value profiling, and I feel >> > wrong about having a piece of unused and therefore untested code in gcc. >> > And of course, it also makes a nice improvement in benchmarks. >> >> I don't see anything wrong with the code, but I would like someone >> more familiar with the profiler to comment. Since this was submitted >> well before the deadline and only affects a non-default optimization >> mode, I think it can go in now if (say) Nathan Sidwell thinks the code >> is sound. > > The actual interface to profiling code came in earlier with separate > patch. This patch has no consequences to the profiling, just uses the > interface we agreed on earlier, so I would say that there is no problem > from profiler side. (this is also why I don't feel this belong to area I > can approve as gcov maintainer) Zack, since the profiler code is ok, I interpret your message that this is approved. Correct? Thanks, Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2003-10-19 18:41 ` Andreas Jaeger @ 2003-10-19 19:54 ` Zack Weinberg 0 siblings, 0 replies; 504+ messages in thread From: Zack Weinberg @ 2003-10-19 19:54 UTC (permalink / raw) To: Andreas Jaeger; +Cc: Jan Hubicka, Zdenek Dvorak, gcc-patches Andreas Jaeger <aj@suse.de> writes: >> The actual interface to profiling code came in earlier with separate >> patch. This patch has no consequences to the profiling, just uses the >> interface we agreed on earlier, so I would say that there is no problem >> from profiler side. (this is also why I don't feel this belong to area I >> can approve as gcov maintainer) > > Zack, since the profiler code is ok, I interpret your message that > this is approved. Correct? Mm.. yeah, I guess so. zw ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2003-09-10 3:17 Jerry Quinn 2003-09-11 14:49 ` Jim Wilson 0 siblings, 1 reply; 504+ messages in thread From: Jerry Quinn @ 2003-09-10 3:17 UTC (permalink / raw) To: gcc-patches http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00013.html ^ permalink raw reply [flat|nested] 504+ messages in thread
* Re: Patch ping 2003-09-10 3:17 Jerry Quinn @ 2003-09-11 14:49 ` Jim Wilson 0 siblings, 0 replies; 504+ messages in thread From: Jim Wilson @ 2003-09-11 14:49 UTC (permalink / raw) To: Jerry Quinn; +Cc: gcc-patches Jerry Quinn wrote: > http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00013.html You should include a few words about the patch. Otherwise people may assume it isn't their area and not bother to click through. The patch looks correct to me. I checked it in. -- Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com ^ permalink raw reply [flat|nested] 504+ messages in thread
* Patch ping @ 2002-12-18 11:59 Dale Johannesen 0 siblings, 0 replies; 504+ messages in thread From: Dale Johannesen @ 2002-12-18 11:59 UTC (permalink / raw) To: gcc-patches; +Cc: Dale Johannesen Is anybody considering this one? It fixes a crash on legal code. http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00616.html ^ permalink raw reply [flat|nested] 504+ messages in thread
* patch ping... @ 2002-07-12 15:33 Eric Christopher 0 siblings, 0 replies; 504+ messages in thread From: Eric Christopher @ 2002-07-12 15:33 UTC (permalink / raw) To: gcc-patches Chris submitted this a few days ago... any hope for an approval: http://gcc.gnu.org/ml/gcc-patches/2002-07/msg00219.html -eric -- I will not grease the monkey bars ^ permalink raw reply [flat|nested] 504+ messages in thread
end of thread, other threads:[~2024-02-12 16:07 UTC | newest] Thread overview: 504+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-06-20 19:37 Patch ping Jan Hubicka 2005-06-20 22:42 ` Richard Henderson 2005-06-21 8:34 ` Jan Hubicka 2005-06-23 12:40 ` Update RTL passes patch [was Re: Patch ping...] Paolo Bonzini 2005-06-26 21:51 ` Richard Henderson -- strict thread matches above, loose matches on Subject: below -- 2024-02-09 9:44 Patch ping Jakub Jelinek 2024-02-12 16:07 ` Jeff Law 2023-03-01 10:23 Jakub Jelinek 2023-03-04 1:33 ` Joseph Myers 2023-02-13 10:35 Jakub Jelinek 2023-01-30 9:50 Jakub Jelinek 2023-01-30 23:07 ` Richard Sandiford 2023-01-09 16:50 Jakub Jelinek 2022-12-09 15:09 Jakub Jelinek 2022-10-21 7:23 [PATCH] builtins: Add __builtin_nextafterf16b builtin Jakub Jelinek 2022-10-21 15:42 ` [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x} Jakub Jelinek 2022-10-24 16:28 ` Jeff Law 2022-10-25 9:03 ` Patch ping Jakub Jelinek 2022-03-02 9:47 Jakub Jelinek 2022-03-02 18:59 ` Jeff Law 2022-01-04 12:45 Jakub Jelinek 2022-01-03 10:40 Jakub Jelinek 2022-01-03 12:38 ` Richard Biener 2022-01-03 10:25 Jakub Jelinek 2022-01-03 12:39 ` Richard Biener 2022-01-03 13:15 ` Jan Hubicka 2021-12-01 15:15 Jakub Jelinek 2021-03-31 7:07 Jakub Jelinek 2021-03-31 7:10 ` Richard Biener 2021-03-24 11:44 Jakub Jelinek 2021-03-24 15:45 ` Martin Sebor 2021-03-24 16:40 ` Jakub Jelinek 2021-03-24 17:14 ` Martin Sebor 2021-03-25 8:45 ` Richard Biener 2021-03-24 16:12 ` Jeff Law 2021-03-19 9:57 Jakub Jelinek 2021-02-16 8:13 [PATCH] cfgrtl: Fix up fixup_partitions caused ICE [PR99085] Jakub Jelinek 2021-02-23 8:49 ` Patch ping Jakub Jelinek 2021-01-25 9:43 Jakub Jelinek 2021-01-25 22:34 ` Jason Merrill 2020-10-22 9:05 Jakub Jelinek 2020-10-22 20:42 ` Joseph Myers 2020-10-05 9:09 Jakub Jelinek 2020-10-05 12:02 ` Nathan Sidwell 2020-09-25 11:42 Jakub Jelinek 2020-03-10 12:28 Jakub Jelinek 2020-02-10 9:24 Jakub Jelinek 2020-02-12 21:39 ` Jeff Law 2020-02-13 9:54 ` Jakub Jelinek 2020-02-13 17:42 ` Martin Sebor 2020-02-13 19:36 ` Jeff Law 2020-01-07 10:20 Jakub Jelinek 2019-09-14 0:40 [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734) Jakub Jelinek 2019-09-16 6:57 ` Richard Biener 2019-09-21 6:14 ` [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) Jakub Jelinek 2019-09-30 7:03 ` Patch ping Jakub Jelinek 2019-04-16 11:54 Jakub Jelinek 2018-04-30 8:43 Jakub Jelinek 2018-04-16 10:35 Jakub Jelinek 2018-04-17 6:14 ` Kirill Yukhin 2018-04-10 13:35 Jakub Jelinek 2018-04-10 12:34 ` Kirill Yukhin 2018-03-12 17:35 Jakub Jelinek 2018-03-12 23:22 ` Jason Merrill 2018-03-05 18:38 Jakub Jelinek 2018-03-05 16:19 ` Jan Hubicka 2018-03-02 8:49 Jakub Jelinek 2018-03-02 17:17 ` Jeff Law 2018-03-05 15:39 ` Kirill Yukhin 2018-02-14 17:49 Jakub Jelinek 2018-02-19 18:15 ` Jeff Law 2018-02-07 9:01 Jakub Jelinek 2017-11-20 8:31 Jakub Jelinek 2017-11-20 18:31 ` Nathan Sidwell 2017-11-20 19:08 ` Nathan Sidwell 2017-11-21 8:53 ` Jakub Jelinek 2017-11-21 0:16 ` Jim Wilson 2017-11-21 3:01 ` Jim Wilson 2017-11-21 8:14 ` Jakub Jelinek 2017-11-06 16:22 Jakub Jelinek 2017-10-24 11:04 Jakub Jelinek 2017-10-24 18:58 ` Kirill Yukhin 2017-10-16 10:16 Jakub Jelinek 2017-10-06 14:12 Jakub Jelinek 2017-10-06 15:25 ` Nathan Sidwell 2017-10-06 15:27 ` Nathan Sidwell 2017-09-29 9:13 Jakub Jelinek 2017-07-28 16:58 Jakub Jelinek 2017-07-25 9:40 Jakub Jelinek 2017-07-26 10:34 ` Richard Biener 2017-07-26 13:47 ` Jakub Jelinek 2017-07-26 14:13 ` Richard Biener 2017-07-26 17:31 ` Jakub Jelinek 2017-07-27 7:19 ` Richard Biener 2017-07-27 8:35 ` Jakub Jelinek 2017-07-28 7:59 ` Richard Biener 2017-04-10 12:18 Jakub Jelinek 2017-04-10 12:41 ` Nathan Sidwell 2017-04-10 13:22 ` Jakub Jelinek 2017-04-10 14:39 ` Nathan Sidwell 2017-04-05 10:45 Jakub Jelinek 2017-03-31 8:34 Jakub Jelinek 2017-03-31 15:14 ` Jeff Law 2017-03-31 18:50 ` Jakub Jelinek 2017-03-31 15:15 ` Jeff Law 2017-02-07 15:11 Jakub Jelinek 2017-02-07 15:22 ` Uros Bizjak 2017-02-02 10:13 Jakub Jelinek 2017-02-02 10:15 ` Richard Biener 2017-01-26 20:42 Jakub Jelinek 2017-01-10 7:27 Jakub Jelinek 2016-11-18 17:08 Jakub Jelinek 2016-10-08 6:15 [C++ PATCH] Fix -Wimplicit-fallthrough in templates (PR c++/77886) Jakub Jelinek 2016-10-17 17:37 ` Patch ping Jakub Jelinek 2016-09-28 21:18 Bernd Edlinger 2016-09-28 19:31 Jakub Jelinek 2016-09-28 19:35 ` Bernd Schmidt 2016-09-28 19:55 ` Jakub Jelinek 2016-09-28 20:19 ` Jakub Jelinek 2016-09-28 21:41 ` Bernd Schmidt 2016-09-28 21:51 ` Jakub Jelinek 2016-09-29 0:32 ` Bernd Schmidt 2016-09-29 0:41 ` Jakub Jelinek 2016-09-14 21:55 Jakub Jelinek 2016-09-15 11:01 ` Bernd Schmidt 2016-09-05 17:14 [C++ PATCH] Fix constexpr switch handling (PR c++/77467) Jakub Jelinek 2016-09-16 20:00 ` Jason Merrill 2016-09-16 20:51 ` Jakub Jelinek 2016-09-19 18:49 ` Jason Merrill 2016-09-20 16:29 ` [C++ PATCH] Fix constexpr switch handling (PR c++/77467, take 2) Jakub Jelinek 2016-09-27 21:33 ` Patch ping Jakub Jelinek 2016-08-15 8:50 Jakub Jelinek 2016-07-22 14:16 Cesar Philippidis 2016-07-18 18:08 Jakub Jelinek 2016-07-11 13:14 Jakub Jelinek 2016-07-12 8:54 ` Richard Biener 2016-06-02 9:47 Jakub Jelinek 2016-03-18 9:23 Jakub Jelinek 2016-03-17 14:24 Jakub Jelinek 2016-03-17 15:48 ` Jason Merrill 2016-03-04 7:30 Jakub Jelinek 2016-03-04 7:38 ` Jeff Law 2016-03-03 14:36 Jakub Jelinek 2016-03-04 7:10 ` Jeff Law 2016-03-04 7:23 ` Jakub Jelinek 2016-02-11 18:14 Jakub Jelinek 2016-02-10 14:12 Jakub Jelinek 2016-02-10 14:21 ` Richard Biener 2015-05-05 18:52 Jakub Jelinek 2015-05-05 19:10 ` Andreas Krebbel 2015-04-17 8:47 Jakub Jelinek 2015-04-17 15:32 ` Jeff Law 2015-04-11 22:27 patch ping Bernhard Reutner-Fischer 2015-04-13 13:12 ` Jeff Law 2015-04-22 19:47 ` Bernhard Reutner-Fischer 2015-03-18 14:01 Patch ping Jakub Jelinek 2015-02-12 15:37 Jakub Jelinek 2015-02-09 23:06 patch ping Trevor Saunders 2015-02-09 23:15 ` Jan Hubicka 2015-02-04 19:30 Patch ping Jakub Jelinek 2015-01-14 6:29 Jan Hubicka 2015-01-14 21:42 ` Jason Merrill 2015-01-05 13:53 Jakub Jelinek 2015-01-05 21:27 ` Jeff Law 2015-01-05 21:39 ` Jakub Jelinek 2015-01-06 8:23 ` Jakub Jelinek 2015-01-09 5:34 ` Jeff Law 2014-12-12 8:23 Jakub Jelinek 2014-11-01 11:58 nvptx offloading patches [3/n], RFD Bernd Schmidt 2015-02-04 11:38 ` Jakub Jelinek 2015-02-09 10:20 ` Richard Biener 2015-02-16 21:08 ` Jakub Jelinek 2015-02-16 21:35 ` Richard Biener 2015-02-16 21:44 ` Jakub Jelinek 2015-02-17 10:00 ` Richard Biener 2015-02-18 10:00 ` Jakub Jelinek 2015-02-25 8:51 ` Patch ping Jakub Jelinek 2015-02-25 9:30 ` Richard Biener 2015-02-25 16:51 ` Jakub Jelinek 2014-07-19 10:12 Jakub Jelinek 2014-04-09 13:07 Jakub Jelinek 2014-04-09 22:29 ` DJ Delorie 2014-04-10 5:59 ` Jakub Jelinek 2014-04-10 16:01 ` DJ Delorie 2014-04-10 18:42 ` Tobias Burnus 2014-04-14 11:02 ` Jakub Jelinek 2014-04-16 18:45 ` Toon Moene 2014-04-16 19:13 ` DJ Delorie 2014-04-17 12:21 ` Jakub Jelinek 2014-04-10 4:24 ` Jeff Law 2014-02-06 12:12 Jakub Jelinek 2015-04-17 15:46 ` Richard Earnshaw 2015-04-17 15:47 ` Richard Earnshaw 2014-01-13 8:07 Jakub Jelinek 2014-01-13 8:15 ` Uros Bizjak 2014-01-13 8:35 ` Jakub Jelinek 2014-01-13 10:23 ` Richard Biener 2014-01-13 18:26 ` Kirill Yukhin 2014-01-13 18:33 ` Uros Bizjak 2014-01-13 18:40 ` Uros Bizjak 2014-01-13 18:59 ` Jakub Jelinek 2014-01-13 15:15 ` Jeff Law 2014-01-13 16:26 ` Jakub Jelinek 2014-01-13 15:22 ` Jeff Law 2014-04-14 10:56 ` Jakub Jelinek 2014-04-16 21:35 ` Jeff Law 2014-04-17 21:56 ` Uros Bizjak 2014-01-06 9:52 Jakub Jelinek 2013-05-17 6:49 Jakub Jelinek 2013-05-17 15:44 ` Jeff Law 2013-04-26 7:40 Jakub Jelinek 2013-04-26 11:01 ` Gabriel Dos Reis 2013-03-05 13:12 Jakub Jelinek 2013-03-05 13:26 ` Richard Biener 2013-03-05 13:47 ` Jakub Jelinek 2013-03-05 13:52 ` Richard Biener 2013-03-05 15:44 ` Vladimir Makarov 2013-03-05 15:46 ` Vladimir Makarov 2013-02-07 8:24 Jakub Jelinek 2013-02-07 14:34 ` Jeff Law 2013-01-30 10:18 Jakub Jelinek 2012-12-18 14:12 Jakub Jelinek 2012-12-18 21:36 ` Paul Richard Thomas 2012-11-26 12:30 Jakub Jelinek 2012-12-06 9:28 ` Richard Biener 2012-11-16 9:10 Jakub Jelinek 2012-11-17 19:12 ` Richard Henderson 2012-11-17 19:16 ` Richard Henderson 2012-11-17 20:04 ` Richard Henderson 2012-11-19 7:53 ` Jakub Jelinek 2012-11-19 16:56 ` Richard Henderson 2012-10-22 18:31 Jakub Jelinek 2012-08-27 7:44 Jakub Jelinek 2012-09-03 11:34 ` Richard Guenther 2012-06-11 11:28 Jakub Jelinek 2012-03-05 11:09 Jakub Jelinek 2012-03-05 12:18 ` Richard Guenther 2012-03-05 20:08 ` Richard Henderson 2012-02-14 10:07 Jakub Jelinek 2012-02-17 14:56 ` Jan Hubicka 2012-02-03 10:14 Jakub Jelinek 2012-02-03 10:56 ` Paolo Carlini 2012-01-24 10:29 Jakub Jelinek 2012-01-24 10:53 ` Richard Guenther 2012-01-02 10:38 Jakub Jelinek 2012-01-02 12:20 ` Richard Guenther 2011-11-07 21:54 Jakub Jelinek 2011-11-08 13:45 ` Richard Guenther 2011-11-02 20:19 Jakub Jelinek 2011-11-04 10:11 ` Richard Guenther 2011-11-04 10:39 ` Jakub Jelinek 2011-11-04 11:44 ` Richard Guenther 2011-11-04 14:09 ` Michael Matz 2011-09-26 9:30 Jakub Jelinek 2011-09-26 10:08 ` Richard Sandiford 2011-09-12 15:39 Jakub Jelinek 2011-09-12 16:17 ` Jeff Law 2011-08-29 9:41 Jakub Jelinek 2011-08-29 12:00 ` Joseph S. Myers 2011-08-29 12:49 ` Bernd Schmidt 2011-08-29 21:33 ` Jeff Law 2011-08-18 9:45 Jakub Jelinek 2011-06-20 9:22 Jakub Jelinek 2011-06-21 18:37 ` Richard Henderson 2011-06-25 19:39 ` Eric Botcazou 2011-06-25 23:56 ` Mike Stump 2011-05-23 9:34 Jakub Jelinek 2011-05-23 10:11 ` Richard Guenther 2011-05-23 18:13 ` Jeff Law 2011-05-12 16:12 Jakub Jelinek 2011-04-26 12:55 Jakub Jelinek 2011-03-14 20:20 Jakub Jelinek 2011-03-14 20:27 ` Diego Novillo 2011-02-28 10:38 Jakub Jelinek 2011-02-28 16:07 ` Jeff Law 2011-02-28 16:18 ` Jeff Law 2011-02-28 18:12 ` Jeff Law 2011-02-03 11:59 Jakub Jelinek 2011-02-03 16:14 ` Richard Henderson 2011-02-03 16:20 ` Jakub Jelinek 2011-02-03 16:25 ` IainS 2011-02-03 16:27 ` Richard Henderson 2011-02-03 16:38 ` Jakub Jelinek 2011-02-03 16:49 ` IainS 2011-02-03 16:54 ` Jakub Jelinek 2011-02-03 18:44 ` Mike Stump 2011-02-03 19:04 ` IainS 2010-11-05 20:04 Jakub Jelinek 2010-11-09 15:48 ` Jeff Law 2010-09-08 18:13 Jakub Jelinek 2010-07-20 16:59 Jakub Jelinek 2010-07-27 17:39 ` Jeff Law 2010-06-21 10:12 Jakub Jelinek 2010-06-21 11:19 ` Paolo Bonzini 2010-06-21 12:08 ` Jan Kratochvil 2010-06-21 12:20 ` Jan Kratochvil 2010-05-10 17:00 Jakub Jelinek 2010-05-10 23:43 ` Joseph S. Myers 2010-04-19 9:47 Jakub Jelinek 2010-03-02 19:00 Patch Ping Jeff Law 2010-03-03 10:09 ` Richard Guenther 2010-02-23 15:42 Patch ping Jakub Jelinek 2010-02-23 20:12 ` Uros Bizjak 2010-02-09 22:39 Jakub Jelinek 2010-02-09 22:52 ` Richard Guenther 2010-01-14 9:33 Jakub Jelinek 2010-01-14 19:12 ` Richard Henderson 2010-01-04 10:54 Jakub Jelinek 2010-01-04 14:35 ` Richard Guenther 2009-11-02 13:17 Jakub Jelinek 2009-11-02 13:29 ` Richard Guenther 2009-10-19 19:22 Jakub Jelinek 2009-10-19 19:22 ` Richard Henderson 2009-10-19 21:09 ` Joseph S. Myers 2009-10-19 22:06 ` Jason Merrill 2009-10-20 1:25 ` Paolo Carlini 2009-10-12 12:37 Jakub Jelinek 2009-10-12 19:23 ` Tom Tromey 2009-10-12 20:21 ` Jakub Jelinek 2009-10-12 21:29 ` Tom Tromey 2009-08-06 20:57 Jakub Jelinek 2009-05-20 21:07 Jakub Jelinek 2009-04-08 18:16 Jakub Jelinek 2009-01-09 16:41 Jakub Jelinek 2009-01-10 2:39 ` Ian Lance Taylor 2008-11-10 16:53 Jakub Jelinek 2008-11-12 15:51 ` Nick Clifton 2008-11-22 2:49 ` Ian Lance Taylor 2008-09-26 0:33 Jakub Jelinek 2008-09-26 12:53 ` Diego Novillo 2008-09-26 17:36 ` Richard Henderson 2008-07-28 15:02 Jakub Jelinek 2008-06-27 16:11 Jakub Jelinek 2008-05-07 8:38 Jakub Jelinek 2008-05-07 14:59 ` Jason Merrill 2008-05-21 15:05 ` Jakub Jelinek 2008-05-21 15:51 ` Jason Merrill 2008-05-10 19:23 ` Diego Novillo 2008-04-05 16:54 Jan Hubicka 2008-04-05 17:36 ` Richard Guenther 2008-04-05 20:39 ` Jan Hubicka 2008-04-08 20:42 ` Mark Mitchell 2008-04-08 22:52 ` Jan Hubicka 2008-04-08 23:06 ` Mark Mitchell 2008-04-09 7:19 ` Andi Kleen 2008-04-10 13:36 ` Jan Hubicka 2008-04-10 18:36 ` Michael Matz 2008-04-11 8:16 ` Mark Mitchell 2008-04-12 19:10 ` Hans-Peter Nilsson 2008-08-29 22:15 ` Jan Hubicka 2008-08-30 19:06 ` Richard Guenther 2008-09-02 14:38 ` Ian Lance Taylor 2008-02-20 14:35 Jakub Jelinek 2008-02-20 16:26 ` Tom Tromey 2008-02-15 16:47 Jakub Jelinek 2007-09-04 10:02 Jan Hubicka 2007-09-04 10:07 ` Richard Guenther 2007-07-30 18:17 Zdenek Dvorak 2007-07-09 9:03 Zdenek Dvorak 2007-07-09 9:44 ` Richard Guenther 2007-05-24 21:39 Krister Walfridsson 2007-05-23 9:13 Zdenek Dvorak 2007-05-23 20:24 ` Diego Novillo 2007-04-18 1:07 Jan Hubicka 2007-04-17 1:49 Zdenek Dvorak 2006-12-16 0:05 H. J. Lu 2006-12-16 0:35 ` Janis Johnson 2006-12-14 23:53 Zdenek Dvorak 2006-12-15 13:12 ` Richard Guenther 2006-12-16 16:32 ` Zdenek Dvorak 2006-05-02 14:32 Patch Ping Tom Tromey 2006-05-03 2:22 ` Mark Mitchell 2006-03-21 21:26 Patch ping Zdenek Dvorak 2006-03-10 19:33 Uttam Pawar 2006-03-11 20:40 ` Roger Sayle 2006-03-13 19:23 ` Uttam Pawar 2006-03-14 1:02 ` Roger Sayle 2006-03-14 16:49 ` Steve Ellcey 2006-03-14 16:55 ` Andrew Pinski 2006-03-15 4:38 ` Roger Sayle 2006-03-15 19:29 ` Steve Ellcey 2006-03-15 10:23 ` Grigory Zagorodnev 2006-03-15 10:15 ` Andreas Schwab 2006-02-16 23:51 [patch] for PR26327 Uttam Pawar 2006-02-21 19:36 ` patch Ping Uttam Pawar 2006-02-16 15:58 Patch ping Zdenek Dvorak 2006-02-17 2:40 ` Roger Sayle 2006-02-17 9:24 ` Zdenek Dvorak 2006-02-17 10:34 ` Paolo Bonzini 2006-02-17 15:31 ` Roger Sayle 2006-02-21 9:15 ` Zdenek Dvorak 2006-02-21 14:47 ` Roger Sayle 2006-02-21 15:43 ` Zdenek Dvorak 2006-02-21 18:01 ` Richard Henderson 2006-02-21 23:04 ` Zdenek Dvorak 2006-02-21 23:16 ` Richard Henderson 2006-02-22 0:20 ` Zdenek Dvorak 2006-02-14 17:19 Jakub Jelinek 2006-01-28 0:07 Zdenek Dvorak 2006-01-16 21:54 Jakub Jelinek 2006-01-10 21:41 Jan Hubicka 2006-01-10 22:45 ` Ian Lance Taylor 2006-01-10 14:03 Zdenek Dvorak 2006-01-10 14:20 ` Diego Novillo 2006-01-10 16:27 ` Zdenek Dvorak 2005-12-19 19:30 Jan Hubicka 2005-12-19 8:10 patch ping Jan Beulich 2005-12-19 9:26 ` Gerald Pfeifer 2005-11-19 19:14 Rafael Ávila de Espíndola 2005-11-20 9:06 ` Andreas Jaeger 2005-10-30 13:57 Richard Kenner 2005-10-29 1:18 Andrew Pinski 2005-10-29 4:16 ` Ian Lance Taylor 2005-10-29 20:17 ` Andrew Pinski 2005-10-29 20:26 ` Andrew Pinski 2005-10-29 21:08 ` Andrew Pinski 2005-10-30 4:59 ` Ian Lance Taylor 2005-10-04 16:35 Patch ping Ian Lance Taylor 2005-10-04 17:49 ` Richard Henderson 2005-08-29 8:03 Jakub Jelinek 2005-08-29 8:49 ` Ian Lance Taylor 2005-08-01 12:56 Jan Hubicka 2005-06-15 22:34 patch ping Eric Christopher 2005-05-18 11:23 Patch ping Tobias Schlüter 2005-05-12 20:41 Jakub Jelinek 2005-04-04 15:14 Ian Lance Taylor 2005-04-05 2:09 ` Richard Henderson 2005-03-30 19:18 Dale Johannesen 2005-03-30 22:59 ` Tom Tromey 2005-03-30 23:05 ` Geoffrey Keating 2005-03-25 21:26 Zdenek Dvorak 2005-03-09 23:35 Jakub Jelinek 2005-02-27 16:37 Zdenek Dvorak 2004-12-10 17:14 H. J. Lu 2004-12-10 17:02 H. J. Lu 2004-10-11 20:39 Patch Ping Tom Tromey 2004-10-12 23:35 ` Geoffrey Keating 2004-09-03 23:39 Patch ping H. J. Lu 2004-09-03 23:44 ` Richard Henderson [not found] <20040731163035.GA7104@troutmask.apl.washington.edu> 2004-08-06 20:45 ` Paul Brook 2004-07-08 14:50 jlquinn 2004-07-08 14:55 ` Roger Sayle 2004-07-08 15:26 ` Paolo Bonzini 2004-06-24 3:10 patch ping Ziemowit Laski 2004-06-23 19:35 Josef Zlomek 2004-06-21 22:57 Pat Haugen 2004-06-21 17:42 Jerry Quinn 2004-06-21 11:44 Patch ping Paolo Bonzini 2004-06-21 15:20 ` Roger Sayle 2004-06-14 13:11 Paul Brook 2004-06-14 17:14 ` Mark Mitchell 2004-06-14 17:36 ` Daniel Jacobowitz 2004-06-14 18:13 ` Paul Brook 2004-06-14 18:22 ` Daniel Jacobowitz 2004-06-15 0:08 ` Richard Henderson 2004-06-15 16:33 ` Paul Brook 2004-06-15 17:46 ` Richard Henderson 2004-06-10 16:48 Tobias Schlüter 2004-06-11 6:49 ` Steve Kargl 2004-05-29 19:51 patch ping jlquinn 2004-05-20 13:25 Patch ping Ben Elliston 2004-05-16 11:59 Richard Guenther [not found] <c7dcf6$uiq$1@sea.gmane.org> [not found] ` <16538.13954.773875.174452@cuddles.cambridge.redhat.com> 2004-05-06 19:00 ` Patch Ping Ranjit Mathew 2004-05-04 23:01 Patch ping Andrew Pinski 2004-04-28 13:35 Paul Brook 2004-04-28 13:51 ` Richard Earnshaw 2004-04-28 14:02 ` Paul Brook 2004-04-28 15:36 ` Richard Earnshaw 2004-04-28 13:56 ` Roger Sayle 2004-04-23 11:08 Zdenek Dvorak 2004-04-23 13:34 ` Nathan Sidwell 2004-04-23 13:48 ` Zdenek Dvorak 2004-04-23 14:18 ` Roger Sayle 2004-04-24 13:01 ` Aldy Hernandez 2004-04-24 19:40 ` Zdenek Dvorak 2004-04-25 3:39 ` Aldy Hernandez 2004-04-25 16:37 ` Zdenek Dvorak 2004-04-23 9:30 Paolo Bonzini 2004-04-19 19:21 Josef Zlomek 2004-04-20 0:50 ` Roger Sayle 2004-04-16 10:50 Paolo Bonzini 2004-04-16 21:16 ` Geoff Keating 2004-04-19 5:37 ` Andreas Jaeger 2004-04-19 9:45 ` Paolo Bonzini 2004-04-19 9:56 ` Arnaud Charlet 2004-04-19 10:01 ` Paolo Bonzini 2004-04-19 12:10 ` Arnaud Charlet 2004-04-19 10:07 ` Andreas Jaeger 2004-04-19 10:41 ` Laurent GUERBY 2004-04-19 11:13 ` Paolo Bonzini 2004-04-19 11:30 ` Andreas Jaeger 2004-04-19 12:38 ` Paolo Bonzini 2004-04-19 12:57 ` Andreas Schwab 2004-04-19 13:16 ` Paul Brook 2004-04-19 15:08 ` Richard Earnshaw 2004-04-19 13:20 ` Richard Earnshaw 2004-04-19 5:41 ` Andreas Jaeger 2004-03-26 15:38 Ian Lance Taylor 2004-03-24 2:53 patch ping Eric Christopher 2004-03-01 13:03 Patch ping Zdenek Dvorak 2004-03-02 9:33 ` Zack Weinberg 2004-03-19 8:14 ` Zack Weinberg 2004-03-19 8:14 ` Zdenek Dvorak 2004-02-17 0:25 patch ping Alan Modra 2004-02-21 13:45 ` Alan Modra 2004-02-12 21:22 Patch ping Zdenek Dvorak 2004-02-21 13:45 ` Zdenek Dvorak 2004-02-06 1:23 patch ping Alan Modra 2004-02-06 4:23 ` Roger Sayle 2004-02-21 13:45 ` Roger Sayle 2004-02-06 10:40 ` Andreas Schwab 2004-02-06 11:02 ` Alan Modra 2004-02-21 13:45 ` Alan Modra 2004-02-21 13:45 ` Andreas Schwab 2004-02-21 13:45 ` Alan Modra 2004-02-02 9:21 Patch ping Paolo Bonzini 2004-02-21 13:45 ` Paolo Bonzini 2003-10-19 11:11 Zdenek Dvorak 2003-10-19 17:39 ` Zack Weinberg 2003-10-19 18:38 ` Jan Hubicka 2003-10-19 18:41 ` Andreas Jaeger 2003-10-19 19:54 ` Zack Weinberg 2003-09-10 3:17 Jerry Quinn 2003-09-11 14:49 ` Jim Wilson 2002-12-18 11:59 Dale Johannesen 2002-07-12 15:33 patch ping Eric Christopher
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).