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]

Re: Put scope blocks on a diet


On Jul 24, 2007, Jan Hubicka <jh@suse.cz> wrote:

> With debugging disabled gimplifier also knows to not assign statements
> to block so we can remove more of them.  This seems to be safe to do
> concerning consistency in between -g and no -g (we still keep enough
> block around to support some of other tests made)

Is it a hunch that it is safe, or do you have any actual arguments to
justify this claim?  It's actually caused major regressions to
bootstrap-debug (introduced with the yet-to-be-submitted patch below)
on a tree in which I have a large patch in progress that adds debug
annotations without any changes to the generated code.

I still haven't tried a bootstrap-debug with your patch but without
mine, and I don't know whether we'd pass bootstrap-debug before our
patches, but over the past two weeks I've come to appreciate how easy
it is to get changes into the compiler output by adding no-effect
statements all over the place ;-)

When inlining refrains from copying decls, this affects DECL_UIDs,
which affects the placement of decls in hash tables, which affects the
order in which they're visited in hash table walks, which affects SSA
version numbering, and in the end we optimize the code differently
(coalescing comes to mind), breaking the -g invariant.

Would you verify that your references to the debug level don't break
bootstrap-debug?  Thanks in advance,


I've left the Makefile.in out of the patch below, because it's such a
large (200k) repetitive change.  This means you have to run autogen
after installing the patch to get a bootstrap-debug target.


for  ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.def (STAGE2_CFLAGS, STAGE3_CFLAGS, STAGE4_CFLAGS):
	Add to flags_to_pass.  Adjust uses of BOOT_CFLAGS.
	(bootstrap2-debug, bootstrap-debug): New bootstrap stages.
	* Makefile.tpl (STAGE2_CFLAGS, STAGE3_CFLAGS, STAGE4_CFLAGS): New.
	(do-compare, do-compare3, do-compare-debug): New.
	([+compare-target+]): Use them.

for  contrib/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* compare-debug: New.

Index: Makefile.def
===================================================================
--- Makefile.def.orig	2007-07-31 18:44:50.000000000 -0300
+++ Makefile.def	2007-07-31 18:46:57.000000000 -0300
@@ -4,7 +4,7 @@ AutoGen definitions Makefile.tpl;
 // Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
 // This file was originally written by Nathanael Nerode.
 //
-//   Copyright 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+//   Copyright 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
 //
 // This file is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -236,6 +236,9 @@ flags_to_pass = { flag= LIBCXXFLAGS ; };
 flags_to_pass = { flag= STAGE1_CFLAGS ; };
 flags_to_pass = { flag= STAGE1_CHECKING ; };
 flags_to_pass = { flag= STAGE1_LANGUAGES ; };
+flags_to_pass = { flag= STAGE2_CFLAGS ; };
+flags_to_pass = { flag= STAGE3_CFLAGS ; };
+flags_to_pass = { flag= STAGE4_CFLAGS ; };
 flags_to_pass = { flag= GNATBIND ; };
 flags_to_pass = { flag= GNATMAKE ; };
 
@@ -512,26 +515,38 @@ bootstrap_stage = {
 	id=2 ; prev=1 ;
 	bootstrap_target=bootstrap2 ;
 	stage_configure_flags="@stage2_werror_flag@" ;
-	stage_cflags="$(BOOT_CFLAGS)" ; };
+	stage_cflags="$(STAGE2_CFLAGS)" ; };
+bootstrap_stage = {
+	id=b2g0 ; prev=1 ;
+	bootstrap_target=bootstrap2-debug ;
+	stage_configure_flags="@stage2_werror_flag@" ;
+	stage_cflags="$(STAGE2_CFLAGS) -g0" ; };
 bootstrap_stage = {
 	id=3 ; prev=2 ; lean=1 ;
 	compare_target=compare ;
 	bootstrap_target=bootstrap ;
 	cleanstrap_target=cleanstrap ;
 	stage_configure_flags="@stage2_werror_flag@" ;
-	stage_cflags="$(BOOT_CFLAGS)" ; };
+	stage_cflags="$(STAGE3_CFLAGS)" ; };
+bootstrap_stage = {
+	id=b3g2 ; prev=b2g0 ; lean=1 ;
+	compare_target=compare-debug ;
+	bootstrap_target=bootstrap-debug ;
+	cleanstrap_target=cleanstrap-debug ;
+	stage_configure_flags="@stage2_werror_flag@" ;
+	stage_cflags="$(STAGE3_CFLAGS) -g2" ; };
 bootstrap_stage = {
 	id=4 ; prev=3 ; lean=2 ;
 	compare_target=compare3 ;
 	bootstrap_target=bootstrap4 ;
 	stage_configure_flags="@stage2_werror_flag@" ;
-	stage_cflags="$(BOOT_CFLAGS)" ; };
+	stage_cflags="$(STAGE4_CFLAGS)" ; };
 bootstrap_stage = {
 	id=profile ; prev=1 ;
 	stage_configure_flags="@stage2_werror_flag@" ;
-	stage_cflags='$(BOOT_CFLAGS) -fprofile-generate' ; };
+	stage_cflags='$(STAGE2_CFLAGS) -fprofile-generate' ; };
 bootstrap_stage = {
 	id=feedback ; prev=profile ;
 	bootstrap_target=profiledbootstrap ;
 	stage_configure_flags="@stage2_werror_flag@" ;
-	stage_cflags='$(BOOT_CFLAGS) -fprofile-use' ; };
+	stage_cflags='$(STAGE3_CFLAGS) -fprofile-use' ; };
Index: Makefile.tpl
===================================================================
--- Makefile.tpl.orig	2007-07-31 18:44:50.000000000 -0300
+++ Makefile.tpl	2007-07-31 18:46:57.000000000 -0300
@@ -6,7 +6,7 @@ in
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -323,6 +323,14 @@ STAGE1_CFLAGS=@stage1_cflags@
 STAGE1_CHECKING=@stage1_checking@
 STAGE1_LANGUAGES=@stage1_languages@
 
+STAGE2_CFLAGS=$(BOOT_CFLAGS)
+STAGE3_CFLAGS=$(BOOT_CFLAGS)
+STAGE4_CFLAGS=$(BOOT_CFLAGS)
+
+do-compare = @do_compare@
+do-compare3 = $(do-compare)
+do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
+
 # -----------------------------------------------
 # Programs producing files for the TARGET machine
 # -----------------------------------------------
@@ -1316,7 +1324,7 @@ do-clean: clean-stage[+id+]
 	cd .. ; \
 	for file in $${files} ; do \
 	  f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
-	  @do_compare@ > /dev/null 2>&1; \
+	  $(do-[+compare-target+]) > /dev/null 2>&1; \
 	  if test $$? -eq 1; then \
 	    case $$file in \
 	      ./cc*-checksum$(objext) | ./libgcc/* ) \
Index: contrib/compare-debug
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ contrib/compare-debug	2007-08-02 05:44:22.000000000 -0300
@@ -0,0 +1,67 @@
+#! /bin/sh
+
+# Compare stripped copies of two given object files.
+
+# Copyright (C) 2007 Free Software Foundation
+# Originally by Alexandre Oliva <aoliva@redhat.com>
+
+# 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 3, 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 COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+if test $# != 2; then
+  echo 'usage: compare-debug file1.o file2.o' >&2
+  exit 1
+fi
+
+if test ! -f "$1"; then
+  echo "$1" does not exist >&2
+  exit 1
+fi
+
+if test ! -f "$2"; then
+  echo "$2" does not exist >&2
+  exit 1
+fi
+
+if test -f "$1".stripped; then
+  echo "$1".stripped already exists, overwriting >&2
+  exit 1
+fi
+
+if test -f "$2".stripped; then
+  echo "$2".stripped already exists, overwriting >&2
+  exit 1
+fi
+
+trap 'rm -f "$1".stripped "$2".stripped' 0 1 2 15
+
+cp "$1" "$1".stripped
+strip "$1".stripped
+
+cp "$2" "$2".stripped
+strip "$2".stripped
+
+if cmp "$1".stripped "$2".stripped; then
+  status=0
+else
+  status=1
+fi
+
+rm -f "$1".stripped "$2".stripped
+
+trap "exit $status; exit" 0 1 2 15
+
+exit $status


-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


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