This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta,vta4.3] don't require optimization for -fvar-tracking-assignments
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Sep 2008 05:54:57 -0300
- Subject: [vta,vta4.3] don't require optimization for -fvar-tracking-assignments
With SSA enabled at -O0, there's no reason to force
-fvar-tracking-assignments off when not optimizing.
It would be possible to adjust var-tracking to just drop debug insns,
if -fvar-tracking-assignments is enabled with -fvar-tracking disabled,
but this would be useless except for testing that vta doesn't cause
codegen changes.
I think it makes more sense to just disable it, unless -fvar-tracking
is also enabled, to avoid accidental overheads, but with
-fcompare-debug, it might make some sense to support this. Thoughts?
Meanwhile, I'm checking this in. For 4.3, removing optimize is not an
option, but there were simplifications available that I made in
parallel with this patch. The two patches follow.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* toplev.c (process_options): Disregard optimize in
flag_var_tracking_assignments auto-detect. Warn and disable if
it's enabled without -fvar-tracking.
* doc/invoke.texi (-fvar-tracking-assignments): Update.
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c.orig 2008-09-11 05:31:07.000000000 -0300
+++ gcc/toplev.c 2008-09-11 05:37:01.000000000 -0300
@@ -1863,22 +1863,18 @@ process_options (void)
flag_var_tracking = optimize >= 1;
if (flag_var_tracking_assignments == AUTODETECT_VALUE)
- flag_var_tracking_assignments = flag_var_tracking && optimize;
- else if (flag_var_tracking_assignments)
- {
- if (!optimize)
- {
- warning (0, "variable tracking in assignments requested, "
- "but useless without optimization");
- flag_var_tracking_assignments = 0;
- }
- }
+ flag_var_tracking_assignments = flag_var_tracking;
if (flag_var_tracking_assignments_toggle)
flag_var_tracking_assignments = !flag_var_tracking_assignments
- && flag_var_tracking && optimize
- && (debug_info_level < DINFO_LEVEL_NORMAL
- || debug_hooks->var_location == do_nothing_debug_hooks.var_location);
+ && flag_var_tracking;
+
+ if (flag_var_tracking_assignments && !flag_var_tracking)
+ {
+ warning (0, "variable tracking in assignments requested, "
+ "but useless without variable tracking");
+ flag_var_tracking_assignments = 0;
+ }
if (flag_tree_cselim == AUTODETECT_VALUE)
#ifdef HAVE_conditional_move
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi.orig 2008-09-11 05:31:08.000000000 -0300
+++ gcc/doc/invoke.texi 2008-09-11 05:45:50.000000000 -0300
@@ -5100,8 +5100,8 @@ the debug info format supports it.
Annotate assignments to user variables early in the compilation and
attempt to carry the annotations over throughout the compilation all the
way to the end, in an attempt to improve debug information while
-optimizing. It is silently disabled if debug information generation,
-optimization or var-tracking are disabled.
+optimizing. It is verbosely disabled if it's enabled with var-tracking
+disabled.
@item -fvar-tracking-assignments-toggle
@opindex fvar-tracking-assignments-toggle
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* toplev.c (process_options): Disregard implied debug
generation in flag_var_tracking_assignments auto-detect. Warn
and disable if it's enabled without -fvar-tracking or optimization.
* doc/invoke.texi (-fvar-tracking-assignments): Update.
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c.orig 2008-09-11 05:39:51.000000000 -0300
+++ gcc/toplev.c 2008-09-11 05:45:10.000000000 -0300
@@ -1,6 +1,6 @@
/* Top level of GCC compilers (cc1, cc1plus, etc.)
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1953,21 +1953,17 @@ process_options (void)
if (flag_var_tracking_assignments == AUTODETECT_VALUE)
flag_var_tracking_assignments = flag_var_tracking && optimize;
- else if (flag_var_tracking_assignments)
- {
- if (!optimize)
- {
- warning (0, "variable tracking in assignments requested, "
- "but useless without optimization");
- flag_var_tracking_assignments = 0;
- }
- }
if (flag_var_tracking_assignments_toggle)
flag_var_tracking_assignments = !flag_var_tracking_assignments
- && flag_var_tracking && optimize
- && (debug_info_level < DINFO_LEVEL_NORMAL
- || debug_hooks->var_location == do_nothing_debug_hooks.var_location);
+ && flag_var_tracking && optimize;
+
+ if (flag_var_tracking_assignments && !(flag_var_tracking || optimize))
+ {
+ warning (0, "variable tracking in assignments requested, "
+ "but useless without variable tracking or optimization");
+ flag_var_tracking_assignments = 0;
+ }
if (flag_tree_cselim == AUTODETECT_VALUE)
#ifdef HAVE_conditional_move
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi.orig 2008-09-11 05:39:51.000000000 -0300
+++ gcc/doc/invoke.texi 2008-09-11 05:45:32.000000000 -0300
@@ -5096,8 +5096,8 @@ the debug info format supports it.
Annotate assignments to user variables early in the compilation and
attempt to carry the annotations over throughout the compilation all the
way to the end, in an attempt to improve debug information while
-optimizing. It is silently disabled if debug information generation,
-optimization or var-tracking are disabled.
+optimizing. It is verbosely disabled if it's enabled with var-tracking
+or optimization disabled.
@item -fvar-tracking-assignments-toggle
@opindex fvar-tracking-assignments-toggle
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}