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] Speed up the compiler/bootstrap on IA-32


The following simple patch allows GCC itself to take advantage of
the recent ability to debug x86 executables without a frame pointer,
and the associated performance improvements.  This patch makes use
of the recently added ability to override the default BOOT_CFLAGS
in host Makefile fragments, to add "-fomit-frame-pointer" to the
stage2 and stage3 compiler flags on selected i[3456]86 systems.

On a 2.8GHz Pentium4 system running RedHat 9, i686-pc-linux-gnu, this
change reproducably reduces the user time reported by "time make
bootstrap", for all default languages and runtime librarues, from 65m48
(3948s) to 64m53 (3893s), a saving of 55 seconds, or about 1.4% of total
bootstrap time.  Considering the fraction of time spent in as, ld, sh,
make, etc... the actual improvements to compiler performance are
significantly larger.

[Of course, if we omitted the frame pointer by default, we'd also speed
up the as, ld, sh and make above, which is something people might think
about in their extra minute of free time per bootstrap :>]


The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.

Ok for mainline?



2004-09-19  Roger Sayle  <roger@eyesopen.com>

	* config/mh-x86omitfp: New host makefile fragment.  Add
	-fomit-frame-pointer to the default BOOT_CFLAGS.
	* configure.in: Use it to speed up bootstrap on some IA-32 hosts.
	* configure: Regenerate.


*** /dev/null	2003-01-30 03:24:37.000000000 -0700
--- config/mh-x86omitfp	2004-09-19 10:04:08.000000000 -0600
***************
*** 0 ****
--- 1,2 ----
+ # Add -fomit-frame-pointer to the usual BOOT_CFLAGS to speed up the compiler.
+ BOOT_CFLAGS = -O2 -g -fomit-frame-pointer


Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.319
diff -c -3 -p -r1.319 configure.in
*** configure.in	16 Sep 2004 06:57:28 -0000	1.319
--- configure.in	18 Sep 2004 22:31:40 -0000
*************** case "${host}" in
*** 937,942 ****
--- 937,947 ----
    *-*-sysv4*)
      host_makefile_frag="config/mh-sysv4"
      ;;
+   # This is placed last to prevent interfering with the cases above.
+   i[[3456789]]86-*-*)
+     # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
+     host_makefile_frag="config/mh-x86omitfp"
+     ;;
  esac
  fi


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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