public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] Add -flto to all the C and C++ testsuites
@ 2008-10-10 18:23 Diego Novillo
  0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2008-10-10 18:23 UTC (permalink / raw)
  To: gcc-patches

This patch forces -flto on all the C and C++ testsuites.  I may
have missed some, but it covers check-gcc, check-g++ and
check-libstdc++.

We currently do not build many libstdc++ tests because we fail
creating one of the shared libraries used by the testsuite.  All
these failures are being worked on, so they should disappear
shortly.

Tested on x86_64.


Diego.


gcc/ChangeLog.lto

	* opts.c (decode_options): Remove error message about -g
	-flto.

gcc/testsuite/ChangeLog.lto

	* gcc.target/i386/i386.exp: Add -flto by default.
	* gcc.target/i386/math-torture/math-torture.exp: Likewise.
	* gcc.dg/matrix/matrix.exp: Likewise.
	* gcc.dg/struct/struct-reorg.exp: Likewise.
	* gcc.dg/debug/debug.exp: Likewise.
	* gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp: Likewise.
	* gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp: Likewise.
	* gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: Likewise.
	* gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: Likewise.
	* gcc.dg/vect/vect.exp: Likewise.
	* gcc.misc-tests/dectest.exp: Likewise.
	* g++.dg/debug/debug.exp: Likewise.
	* g++.dg/vect/vect.exp: Likewise.
	* g++.dg/pch/pch.exp: Likewise.
	* lib/c-torture.exp: Likewise.
	* lib/gcc-dg.exp: Likewise.

libstdc++-v3/ChangeLog.lto

	* scripts/testsuite_flags.in: Add -flto by default.

Index: gcc/testsuite/gcc.target/i386/i386.exp
===================================================================
--- gcc/testsuite/gcc.target/i386/i386.exp	(revision 141015)
+++ gcc/testsuite/gcc.target/i386/i386.exp	(working copy)
@@ -34,7 +34,7 @@ proc check_effective_target_ssse3 { } {
 	{
 	    return (__m128i) __builtin_ia32_pabsd128 ((__v4si)__X);
 	}
-    } "-O2 -mssse3" ]
+    } "-O2 -mssse3 -flto" ]
 }
 
 # Return 1 if sse4 instructions can be compiled.
@@ -48,7 +48,7 @@ proc check_effective_target_sse4 { } {
 	    return (__m128i) __builtin_ia32_pmulld128 ((__v4si)__X,
 						       (__v4si)__Y);
 	}
-    } "-O2 -msse4.1" ]
+    } "-O2 -msse4.1 -flto" ]
 }
 
 # Return 1 if aes instructions can be compiled.
@@ -61,7 +61,7 @@ proc check_effective_target_aes { } {
 	{
 	    return (__m128i) __builtin_ia32_aesimc128 ((__v2di)__X);
 	}
-    } "-O2 -maes" ]
+    } "-O2 -maes -flto" ]
 }
 
 # Return 1 if vaes instructions can be compiled.
@@ -74,7 +74,7 @@ proc check_effective_target_vaes { } {
 	{
 	    return (__m128i) __builtin_ia32_aesimc128 ((__v2di)__X);
 	}
-    } "-O2 -maes -mavx" ]
+    } "-O2 -maes -mavx -flto" ]
 }
 
 # Return 1 if pclmul instructions can be compiled.
@@ -89,7 +89,7 @@ proc check_effective_target_pclmul { } {
 							  (__v2di)__Y,
 							  1);
 	}
-    } "-O2 -mpclmul" ]
+    } "-O2 -mpclmul -flto" ]
 }
 
 # Return 1 if sse4a instructions can be compiled.
@@ -102,7 +102,7 @@ proc check_effective_target_sse4a { } {
 	{
 	    return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y);
 	}
-    } "-O2 -msse4a" ]
+    } "-O2 -msse4a -flto" ]
 }
 
 # Return 1 if sse5 instructions can be compiled.
@@ -117,7 +117,7 @@ proc check_effective_target_sse5 { } {
 						      (__v8hi)__B,
 						      (__v8hi)__C);
 	}
-    } "-O2 -msse5" ]
+    } "-O2 -msse5 -flto" ]
 }
 
 # If a testcase doesn't have special options, use these.
@@ -133,7 +133,7 @@ dg-init
 # replicate it 10 times.
 foreach type { "" -mmmx -m3dnow -msse -msse2 } {
   foreach level { "" -O } {
-    set flags "$type $level"
+    set flags "$type $level -flto"
     verbose -log "Testing vect-args, $flags" 1
     dg-test $srcdir/$subdir/vect-args.c $flags ""
   }
Index: gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp
===================================================================
--- gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp	(revision 141015)
+++ gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp	(working copy)
@@ -6,28 +6,28 @@ if { ![istarget i?86*-*-*] && ![istarget
 }
 
 set MATH_TORTURE_OPTIONS [list \
-        { -O0 } \
-        { -O0 -mfpmath=387 } \
-        { -O0 -msse -mno-sse2 -mfpmath=sse } \
-        { -O0 -msse -msse2 -mfpmath=sse } \
-        { -O0 -msse -mno-sse2 -mfpmath=sse,387 } \
-        { -O0 -msse -msse2 -mfpmath=sse,387 } \
-        { -O0 -mfpmath=387 -ffast-math } \
-        { -O0 -msse -mno-sse2 -mfpmath=sse -ffast-math } \
-        { -O0 -msse -msse2 -mfpmath=sse -ffast-math } \
-        { -O0 -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
-        { -O0 -msse -msse2 -mfpmath=sse,387 -ffast-math } \
-        { -O2 } \
-        { -O2 -mfpmath=387 } \
-        { -O2 -msse -mno-sse2 -mfpmath=sse } \
-        { -O2 -msse -msse2 -mfpmath=sse } \
-        { -O2 -msse -mno-sse2 -mfpmath=sse,387 } \
-        { -O2 -msse -msse2 -mfpmath=sse,387 } \
-        { -O2 -mfpmath=387 -ffast-math } \
-        { -O2 -msse -mno-sse2 -mfpmath=sse -ffast-math } \
-        { -O2 -msse -msse2 -mfpmath=sse -ffast-math } \
-        { -O2 -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
-        { -O2 -msse -msse2 -mfpmath=sse,387 -ffast-math } \
+        { -O0 -flto } \
+        { -O0 -flto -mfpmath=387 } \
+        { -O0 -flto -msse -mno-sse2 -mfpmath=sse } \
+        { -O0 -flto -msse -msse2 -mfpmath=sse } \
+        { -O0 -flto -msse -mno-sse2 -mfpmath=sse,387 } \
+        { -O0 -flto -msse -msse2 -mfpmath=sse,387 } \
+        { -O0 -flto -mfpmath=387 -ffast-math } \
+        { -O0 -flto -msse -mno-sse2 -mfpmath=sse -ffast-math } \
+        { -O0 -flto -msse -msse2 -mfpmath=sse -ffast-math } \
+        { -O0 -flto -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
+        { -O0 -flto -msse -msse2 -mfpmath=sse,387 -ffast-math } \
+        { -O2 -flto } \
+        { -O2 -flto -mfpmath=387 } \
+        { -O2 -flto -msse -mno-sse2 -mfpmath=sse } \
+        { -O2 -flto -msse -msse2 -mfpmath=sse } \
+        { -O2 -flto -msse -mno-sse2 -mfpmath=sse,387 } \
+        { -O2 -flto -msse -msse2 -mfpmath=sse,387 } \
+        { -O2 -flto -mfpmath=387 -ffast-math } \
+        { -O2 -flto -msse -mno-sse2 -mfpmath=sse -ffast-math } \
+        { -O2 -flto -msse -msse2 -mfpmath=sse -ffast-math } \
+        { -O2 -flto -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
+        { -O2 -flto -msse -msse2 -mfpmath=sse,387 -ffast-math } \
 ]
 
 load_lib gcc-dg.exp
Index: gcc/testsuite/gcc.dg/matrix/matrix.exp
===================================================================
--- gcc/testsuite/gcc.dg/matrix/matrix.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/matrix/matrix.exp	(working copy)
@@ -19,7 +19,7 @@
 load_lib gcc-dg.exp
 load_lib target-supports.exp
 
-set DEFAULT_MATCFLAGS "-O3 -fipa-matrix-reorg -fdump-ipa-matrix-reorg -fwhole-program -combine"
+set DEFAULT_MATCFLAGS "-O3 -flto -fipa-matrix-reorg -fdump-ipa-matrix-reorg -fwhole-program -combine"
 
 # Initialize `dg'.
 dg-init
Index: gcc/testsuite/gcc.dg/struct/struct-reorg.exp
===================================================================
--- gcc/testsuite/gcc.dg/struct/struct-reorg.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/struct/struct-reorg.exp	(working copy)
@@ -20,7 +20,7 @@
 load_lib gcc-dg.exp
 load_lib target-supports.exp
 
-set STRUCT_REORG_CFLAGS "-O3 -fipa-struct-reorg -fdump-ipa-all -fwhole-program -combine -fipa-type-escape"
+set STRUCT_REORG_CFLAGS "-O3 -flto -fipa-struct-reorg -fdump-ipa-all -fwhole-program -combine -fipa-type-escape"
 
 # Initialize `dg'.
 dg-init
Index: gcc/testsuite/gcc.dg/debug/debug.exp
===================================================================
--- gcc/testsuite/gcc.dg/debug/debug.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/debug/debug.exp	(working copy)
@@ -24,7 +24,7 @@ dg-init
 
 # Main loop.
 
-gcc-dg-debug-runtest gcc_target_compile trivial.c [list -O -O3] \
+gcc-dg-debug-runtest gcc_target_compile trivial.c [list "-O -flto" "-O3 -flto"] \
     [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]]
 
 # All done.
Index: gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp	(working copy)
@@ -33,7 +33,7 @@ if ![is-effective-target powerpc_altivec
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2 -flto" "-ftree-vectorize" "-fvect-cost-model"
 
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
Index: gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp	(working copy)
@@ -29,7 +29,7 @@ if { ![istarget spu*-*-*] } then {
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2 -flto" "-ftree-vectorize" "-fvect-cost-model"
 
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
Index: gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp	(working copy)
@@ -28,7 +28,7 @@ if { ![istarget i?86*-*-*] && ![istarget
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2 -flto" "-ftree-vectorize" "-fvect-cost-model"
 
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
Index: gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp	(working copy)
@@ -29,7 +29,7 @@ if { (![istarget x86_64-*-*] && ![istarg
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2 -flto" "-ftree-vectorize" "-fvect-cost-model"
 
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
Index: gcc/testsuite/gcc.dg/vect/vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect.exp	(revision 141015)
+++ gcc/testsuite/gcc.dg/vect/vect.exp	(working copy)
@@ -111,10 +111,10 @@ dg-init
 
 global O1_VECTCFLAGS
 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
-lappend O1_VECTCFLAGS "-O1"
+lappend O1_VECTCFLAGS "-O1 -flto"
 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
 
-lappend DEFAULT_VECTCFLAGS "-O2"
+lappend DEFAULT_VECTCFLAGS "-O2 -flto"
 
 # Tests that should be run without generating dump info
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
@@ -238,13 +238,13 @@ dg-runtest [lsort [glob -nocomplain $src
 
 # With -Os
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
-lappend DEFAULT_VECTCFLAGS "-Os"
+lappend DEFAULT_VECTCFLAGS "-Os -flto"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
         "" $DEFAULT_VECTCFLAGS
 
 # With -O3
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
-lappend DEFAULT_VECTCFLAGS "-O3"
+lappend DEFAULT_VECTCFLAGS "-O3 -flto"
 if  [istarget "spu-*-*"] {
   lappend DEFAULT_VECTCFLAGS "-funroll-loops"
 }
Index: gcc/testsuite/gcc.misc-tests/dectest.exp
===================================================================
--- gcc/testsuite/gcc.misc-tests/dectest.exp	(revision 141015)
+++ gcc/testsuite/gcc.misc-tests/dectest.exp	(working copy)
@@ -20,7 +20,7 @@
 #
 # Contributed by Ben Elliston <bje@au.ibm.com>.
 
-set DEC_TORTURE_OPTIONS [list {} -O1 -O2 -O3 -Os -msoft-float]
+set DEC_TORTURE_OPTIONS [list {} -O1 "-O2 -flto" -O3 -Os -msoft-float]
 
 proc target-specific-flags {} {
   set result "-frounding-math "
Index: gcc/testsuite/g++.dg/debug/debug.exp
===================================================================
--- gcc/testsuite/g++.dg/debug/debug.exp	(revision 141015)
+++ gcc/testsuite/g++.dg/debug/debug.exp	(working copy)
@@ -23,7 +23,7 @@ load_lib g++-dg.exp
 dg-init
 
 # Main loop.
-gcc-dg-debug-runtest g++_target_compile trivial.C [list -O2 -O3] \
+gcc-dg-debug-runtest g++_target_compile trivial.C [list "-O2 -flto" "-O3 -flto"] \
     [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
 
 # All done.
Index: gcc/testsuite/g++.dg/vect/vect.exp
===================================================================
--- gcc/testsuite/g++.dg/vect/vect.exp	(revision 141015)
+++ gcc/testsuite/g++.dg/vect/vect.exp	(working copy)
@@ -39,7 +39,7 @@ set save-dg-do-what-default ${dg-do-what
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
+lappend DEFAULT_VECTCFLAGS "-O2 -flto" "-ftree-vectorize" "-fno-vect-cost-model" \
   "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
 
 # Skip these tests for targets that do not support generating vector
Index: gcc/testsuite/g++.dg/pch/pch.exp
===================================================================
--- gcc/testsuite/g++.dg/pch/pch.exp	(revision 141015)
+++ gcc/testsuite/g++.dg/pch/pch.exp	(working copy)
@@ -30,7 +30,7 @@ set old_dg_do_what_default "${dg-do-what
 foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] {
     # We don't try to use the loop-optimizing options, since they are highly
     # unlikely to make any difference to PCH.
-    dg-pch $subdir $test [list "-g" "-O2 -g" "-O2"] ".H"
+    dg-pch $subdir $test [list "-g" "-O2 -g" "-O2 -flto"] ".H"
 }
 
 set dg-do-what-default "$old_dg_do_what_default"
Index: gcc/testsuite/lib/c-torture.exp
===================================================================
--- gcc/testsuite/lib/c-torture.exp	(revision 141015)
+++ gcc/testsuite/lib/c-torture.exp	(working copy)
@@ -33,14 +33,14 @@ if [info exists TORTURE_OPTIONS] {
     # items below, even though -O3 is also specified, because some ports may
     # choose to disable inlining functions by default, even when optimizing.
     set C_TORTURE_OPTIONS [list \
-	{ -O0 } \
-	{ -O1 } \
+	{ -O0 -flto } \
+	{ -O1 -flto } \
 	{ -O2 -flto } \
-	{ -O3 -fomit-frame-pointer } \
-	{ -O3 -fomit-frame-pointer -funroll-loops } \
-	{ -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+	{ -O3 -flto -fomit-frame-pointer } \
+	{ -O3 -flto -fomit-frame-pointer -funroll-loops } \
+	{ -O3 -flto -fomit-frame-pointer -funroll-all-loops -finline-functions } \
 	{ -O3 -g } \
-	{ -Os } ]
+	{ -Os -flto } ]
 }
 
 global GCC_UNDER_TEST
Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp	(revision 141015)
+++ gcc/testsuite/lib/gcc-dg.exp	(working copy)
@@ -43,14 +43,14 @@ if [info exists TORTURE_OPTIONS] {
     # items below, even though -O3 is also specified, because some ports may
     # choose to disable inlining functions by default, even when optimizing.
     set DG_TORTURE_OPTIONS [list \
-	{ -O0 } \
-	{ -O1 } \
+	{ -O0 -flto } \
+	{ -O1 -flto } \
 	{ -O2 -flto } \
-	{ -O3 -fomit-frame-pointer } \
-	{ -O3 -fomit-frame-pointer -funroll-loops } \
-	{ -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+	{ -O3 -flto -fomit-frame-pointer } \
+	{ -O3 -flto -fomit-frame-pointer -funroll-loops } \
+	{ -O3 -flto -fomit-frame-pointer -funroll-all-loops -finline-functions } \
 	{ -O3 -g } \
-	{ -Os } ]
+	{ -Os -flto } ]
 }
 
 global GCC_UNDER_TEST
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 141015)
+++ gcc/opts.c	(working copy)
@@ -1057,12 +1057,6 @@ decode_options (unsigned int argc, const
 	flag_shlib = 1;
     }
 
-  /* FIXME lto: With -flto, debug information will be incomplete or
-     inaccurate, or worse, may be sufficiently corrupt as to crash the
-     debug info writer.  */
-  if (flag_generate_lto && debug_info_level != DINFO_LEVEL_NONE)
-    inform (input_location, "-g is presently unsupported with -flto");
-
   /* Set flag_no_inline before the post_options () hook.  The C front
      ends use it to determine tree inlining defaults.  FIXME: such
      code should be lang-independent when all front ends use tree
Index: libstdc++-v3/scripts/testsuite_flags.in
===================================================================
--- libstdc++-v3/scripts/testsuite_flags.in	(revision 141015)
+++ libstdc++-v3/scripts/testsuite_flags.in	(working copy)
@@ -54,12 +54,12 @@ case ${query} in
       echo ${CC}
       ;;
     --cxxflags)
-      CXXFLAGS_default="-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
+      CXXFLAGS_default="-O2 -flto -D_GLIBCXX_ASSERT -fmessage-length=0"
       CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@"
       echo ${CXXFLAGS_default} ${CXXFLAGS_config}
       ;;
     --cxxparallelflags)
-      CXXFLAGS_parallel="-D_GLIBCXX_PARALLEL -fopenmp
+      CXXFLAGS_parallel="-flto -D_GLIBCXX_PARALLEL -fopenmp
 			 -B${BUILD_DIR}/../libgomp 
                          -I${BUILD_DIR}/../libgomp 
 			 -L${BUILD_DIR}/../libgomp/.libs -lgomp"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-10 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-10 18:23 [lto] Add -flto to all the C and C++ testsuites Diego Novillo

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).