This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -fvar-tracking default on ia64


Hi!

On all arches, but ia64, -fvar-tracking defaults to on for -O1+
and -g with debugging format that supports it (ATM just dwarf{2,3} I think).
Unfortunately on ia64, -fvar-tracking is on all the time unless
-fno-var-tracking has been explicitely used.
The problem is that the generic
flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING
handling in toplev.c (process_options) happens after OVERRIDE_OPTIONS
which in ia64's case saves flag_var_tracking in a local variable and clears
it (so that toplev.c doesn't invoke variable_tracking_main ()
itself and instead ia64_reorg can do it after it is done with its work).

To fix this, either we'd have to duplicate a part of process_options
inside of ia64_override_options (particularly debug_hooks computation,
clearing of ia64_flag_var_tracking if not -g or debug info doesn't
support it, issue a warning about it and not set it by default for -O0),
or we can add some other options override hook used at the end of
process_options, or perhaps move OVERRIDE_OPTIONS a little bit further
into process_options (but here I'm afraid some target needs to override
whatever would be moved above it), or as the following patch add it
into some other hook that is known to run after process_options, but before
first functios gets to rest_of_compilation.
The patch below implements the last choice, the shortest change.

This patch fixes the g++.dg/opt/longbranch1.C testcase on IA-64.
Without it, it times out (g++ -O0 -ftime-report longbranch1.C, this is on
a 2GB RAM box, maybe if I had more it would be much faster):
Execution times (seconds)
 callgraph construction:   0.05 ( 0%) usr   0.01 ( 0%) sys   0.06 ( 0%) wall
 cfg cleanup           :   0.02 ( 0%) usr   0.00 ( 0%) sys   0.02 ( 0%) wall
 trivially dead code   :   0.04 ( 0%) usr   0.00 ( 0%) sys   0.04 ( 0%) wall
 life analysis         :   0.26 ( 0%) usr   0.00 ( 0%) sys   0.26 ( 0%) wall
 life info update      :   0.06 ( 0%) usr   0.00 ( 0%) sys   0.07 ( 0%) wall
 register scan         :   0.03 ( 0%) usr   0.00 ( 0%) sys   0.03 ( 0%) wall
 rebuild jump labels   :   0.03 ( 0%) usr   0.00 ( 0%) sys   0.03 ( 0%) wall
 preprocessing         :   0.01 ( 0%) usr   0.02 ( 0%) sys   0.04 ( 0%) wall
 parser                :   0.14 ( 0%) usr   0.04 ( 0%) sys   0.21 ( 0%) wall
 name lookup           :   0.06 ( 0%) usr   0.03 ( 0%) sys   0.08 ( 0%) wall
 tree gimplify         :   0.05 ( 0%) usr   0.00 ( 0%) sys   0.06 ( 0%) wall
 tree CFG construction :   0.03 ( 0%) usr   0.00 ( 0%) sys   0.03 ( 0%) wall
 expand                :   0.20 ( 0%) usr   0.00 ( 0%) sys   0.67 ( 0%) wall
 varconst              :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.05 ( 0%) wall
 jump                  :   0.04 ( 0%) usr   0.00 ( 0%) sys   0.04 ( 0%) wall
 flow analysis         :   0.05 ( 0%) usr   0.00 ( 0%) sys   0.05 ( 0%) wall
 local alloc           :   0.30 ( 0%) usr   0.00 ( 0%) sys   0.31 ( 0%) wall
 global alloc          :   0.52 ( 1%) usr   0.00 ( 0%) sys   0.52 ( 0%) wall
 machine dep reorg     :   0.12 ( 0%) usr   0.00 ( 0%) sys   0.17 ( 0%) wall
 shorten branches      :   0.01 ( 0%) usr   0.01 ( 0%) sys   0.85 ( 0%) wall
 final                 :   0.17 ( 0%) usr   0.00 ( 0%) sys   0.96 ( 0%) wall
 variable tracking     :  65.37 (96%) usr  10.95 (99%) sys1908.60 (100%) wall
 rest of compilation   :   0.20 ( 0%) usr   0.00 ( 0%) sys   1.73 ( 0%) wall
 TOTAL                 :  67.77            11.09          1914.94

while with this patch it is reasonably fast for -O0:
Execution times (seconds)
 callgraph construction:   0.06 ( 2%) usr   0.00 ( 4%) sys   0.06 ( 2%) wall
 cfg cleanup           :   0.02 ( 1%) usr   0.00 ( 0%) sys   0.02 ( 1%) wall
 trivially dead code   :   0.04 ( 2%) usr   0.00 ( 0%) sys   0.04 ( 1%) wall
 life analysis         :   0.26 (11%) usr   0.00 ( 2%) sys   0.26 ( 9%) wall
 life info update      :   0.06 ( 3%) usr   0.00 ( 0%) sys   0.07 ( 2%) wall
 register scan         :   0.03 ( 1%) usr   0.00 ( 0%) sys   0.03 ( 1%) wall
 rebuild jump labels   :   0.03 ( 1%) usr   0.00 ( 0%) sys   0.03 ( 1%) wall
 preprocessing         :   0.01 ( 1%) usr   0.02 (17%) sys   0.03 ( 1%) wall
 parser                :   0.15 ( 6%) usr   0.04 (33%) sys   0.21 ( 8%) wall
 name lookup           :   0.05 ( 2%) usr   0.03 (22%) sys   0.09 ( 3%) wall
 tree gimplify         :   0.05 ( 2%) usr   0.00 ( 2%) sys   0.06 ( 2%) wall
 tree CFG construction :   0.03 ( 1%) usr   0.00 ( 2%) sys   0.04 ( 1%) wall
 expand                :   0.20 ( 8%) usr   0.01 ( 5%) sys   0.26 ( 9%) wall
 jump                  :   0.04 ( 2%) usr   0.00 ( 0%) sys   0.04 ( 1%) wall
 flow analysis         :   0.05 ( 2%) usr   0.00 ( 0%) sys   0.05 ( 2%) wall
 local alloc           :   0.30 (13%) usr   0.00 ( 3%) sys   0.31 (11%) wall
 global alloc          :   0.52 (22%) usr   0.00 ( 4%) sys   0.53 (19%) wall
 machine dep reorg     :   0.12 ( 5%) usr   0.00 ( 2%) sys   0.12 ( 4%) wall
 shorten branches      :   0.01 ( 0%) usr   0.00 ( 0%) sys   0.01 ( 0%) wall
 final                 :   0.17 ( 7%) usr   0.00 ( 2%) sys   0.17 ( 6%) wall
 rest of compilation   :   0.19 ( 8%) usr   0.00 ( 0%) sys   0.19 ( 7%) wall
 TOTAL                 :   2.41             0.12             2.74

2005-05-07  Jakub Jelinek  <jakub@redhat.com>

	* config/ia64/ia64.c (ia64_override_options): Don't set
	ia64_flag_var_tracking and clear flag_var_tracking here...
	(ia64_file_start): ... but here.

--- gcc/config/ia64/ia64.c.jj	2005-04-24 14:25:58.000000000 +0200
+++ gcc/config/ia64/ia64.c	2005-05-07 13:11:27.000000000 +0200
@@ -1673,6 +1673,13 @@ ia64_split_call (rtx retval, rtx addr, r
 static void
 ia64_file_start (void)
 {
+  /* Variable tracking should be run after all optimizations which change order
+     of insns.  It also needs a valid CFG.  This can't be done in
+     ia64_override_options, because flag_var_tracking is finallized after
+     that.  */
+  ia64_flag_var_tracking = flag_var_tracking;
+  flag_var_tracking = 0;
+
   default_file_start ();
   emit_safe_across_calls ();
 }
@@ -4716,11 +4723,6 @@ ia64_override_options (void)
   ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
   flag_schedule_insns_after_reload = 0;
 
-  /* Variable tracking should be run after all optimizations which change order
-     of insns.  It also needs a valid CFG.  */
-  ia64_flag_var_tracking = flag_var_tracking;
-  flag_var_tracking = 0;
-
   ia64_section_threshold = g_switch_set ? g_switch_value : IA64_DEFAULT_GVALUE;
 
   init_machine_status = ia64_init_machine_status;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]