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]

[lto] Use LTO flags only when LTO is enabled


Janis,

Based on http://gcc.gnu.org/ml/gcc/2009-05/msg00422.html and our
IRC chat, this is what I committed to the lto branch.  I needed
to commit this so I can work on the next patch that relies on
this one.  If you find anything that needs fixing, please let me
know.  This version at least fixes a bunch of spurious failures
that were producing noise in the results.

The patch adds a new argument to set-torture-options and a new
check to detect if LTO is enabled.  If LTO is working,
c-torture.exp and gcc-dg.exp will set LTO_TORTURE_OPTIONS which
can then be used by each individual .exp file if it wants to test
the LTO flags.


Thanks.  Diego.



gcc/ChangeLog.lto

2009-05-19  Diego Novillo  <dnovillo@google.com>

	* opts.c (complain_wrong_lang): Remove workaround to
	quell warning message when LTO is not supported.


gcc/testsuite/ChangeLog.lto

2009-05-19  Diego Novillo  <dnovillo@google.com>

	* lib/target-supports.exp (check_effective_target_lto): New.
	* lib/c-torture.exp: Call it to set LTO_TORTURE_OPTIONS.
	* lib/gcc-dg.exp: Likewise.
	* lib/torture-options.exp (set-torture-options): Add 3rd
	argument.  Append it to 'torture_with_loops' and
	'torture_without_loops'.
	* gcc.c-torture/execute/execute.exp: Add LTO_TORTURE_OPTIONS 
	when calling set-torture-options.
	* gcc.c-torture/execute/builtins/builtins.exp: Likewise.
	* gcc.c-torture/execute/ieee/ieee.exp: Likewise.
	* gcc.c-torture/unsorted/unsorted.exp: Likewise.
	* gcc.target/i386/math-torture/math-torture.exp: Likewise.
	* gcc.target/x86_64/abi/abi-x86_64.exp: Likewise.
	* gcc.target/x86_64/abi/avx/abi-avx.exp: Likewise.
	* gcc.misc-tests/i386-prefetch.exp: Likewise.
	* gcc.misc-tests/dectest.exp: Likewise.

libstdc++-v3/ChangeLog.lto

2009-05-19  Diego Novillo  <dnovillo@google.com>

	* libstdc++-v3/scripts/testsuite_flags.in: Do not always
	add -fwhopr.
	* libstdc++-v3/testsuite/lib/libstdc++.exp: Call
	check_effective_target_lto to determine if -fwhopr should
	be added.

Index: gcc/testsuite/gcc.c-torture/execute/execute.exp
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/execute.exp	(revision 147720)
+++ gcc/testsuite/gcc.c-torture/execute/execute.exp	(revision 147721)
@@ -32,7 +32,7 @@ load_lib torture-options.exp
 load_lib c-torture.exp
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 #
 # main test loop
Index: gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp	(revision 147720)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp	(revision 147721)
@@ -35,7 +35,7 @@ load_lib torture-options.exp
 load_lib c-torture.exp
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 set additional_flags ""
 if [istarget "powerpc-*-darwin*"] {
Index: gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp	(revision 147720)
+++ gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp	(revision 147721)
@@ -35,7 +35,7 @@ if $tracelevel then {
 }
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 set additional_flags ""
 
Index: gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
===================================================================
--- gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp	(revision 147720)
+++ gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp	(revision 147721)
@@ -33,7 +33,7 @@ load_lib c-torture.exp
 load_lib torture-options.exp
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 #
 # This loop will run c-torture on any *.c file found in this directory.
Index: gcc/testsuite/gcc.target/i386/i386.exp
===================================================================
--- gcc/testsuite/gcc.target/i386/i386.exp	(revision 147720)
+++ gcc/testsuite/gcc.target/i386/i386.exp	(revision 147721)
@@ -34,7 +34,7 @@ proc check_effective_target_ssse3 { } {
 	{
 	    return (__m128i) __builtin_ia32_pabsd128 ((__v4si)__X);
 	}
-    } "-O2 -mssse3 -flto" ]
+    } "-O2 -mssse3" ]
 }
 
 # 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 -flto" ]
+    } "-O2 -msse4.1" ]
 }
 
 # 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 -flto" ]
+    } "-O2 -maes" ]
 }
 
 # 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 -flto" ]
+    } "-O2 -maes -mavx" ]
 }
 
 # Return 1 if pclmul instructions can be compiled.
@@ -89,7 +89,7 @@ proc check_effective_target_pclmul { } {
 							  (__v2di)__Y,
 							  1);
 	}
-    } "-O2 -mpclmul -flto" ]
+    } "-O2 -mpclmul" ]
 }
 
 # Return 1 if vpclmul instructions can be compiled.
@@ -117,7 +117,7 @@ proc check_effective_target_sse4a { } {
 	{
 	    return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y);
 	}
-    } "-O2 -msse4a -flto" ]
+    } "-O2 -msse4a" ]
 }
 
 # Return 1 if sse5 instructions can be compiled.
@@ -132,7 +132,7 @@ proc check_effective_target_sse5 { } {
 						      (__v8hi)__B,
 						      (__v8hi)__C);
 	}
-    } "-O2 -msse5 -flto" ]
+    } "-O2 -msse5" ]
 }
 
 # If a testcase doesn't have special options, use these.
@@ -148,7 +148,7 @@ dg-init
 # replicate it 10 times.
 foreach type { "" -mmmx -m3dnow -msse -msse2 } {
   foreach level { "" -O } {
-    set flags "$type $level -flto"
+    set flags "$type $level"
     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 147720)
+++ gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp	(revision 147721)
@@ -24,35 +24,35 @@ if { ![istarget i?86*-*-*] && ![istarget
 }
 
 set MATH_TORTURE_OPTIONS [list \
-        { -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 } \
+        { -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 } \
 ]
 
 load_lib gcc-dg.exp
 load_lib torture-options.exp
 
 torture-init
-set-torture-options $MATH_TORTURE_OPTIONS
+set-torture-options $MATH_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 dg-init
 gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] ""
Index: gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp
===================================================================
--- gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp	(revision 147720)
+++ gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp	(revision 147721)
@@ -28,7 +28,7 @@ if { (![istarget x86_64-*-*] && ![istarg
 
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 set additional_flags "-W -Wall -Wno-abi"
 
 foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
Index: gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp
===================================================================
--- gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp	(revision 147720)
+++ gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp	(revision 147721)
@@ -29,7 +29,7 @@ if { (![istarget x86_64-*-*] && ![istarg
 
 
 torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 set additional_flags "-W -Wall -mavx"
 
 foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
Index: gcc/testsuite/ChangeLog.lto
===================================================================
--- gcc/testsuite/ChangeLog.lto	(revision 147720)
+++ gcc/testsuite/ChangeLog.lto	(revision 147721)
@@ -1,3 +1,22 @@
+2009-05-19  Diego Novillo  <dnovillo@google.com>
+
+	* lib/target-supports.exp (check_effective_target_lto): New.
+	* lib/c-torture.exp: Call it to set LTO_TORTURE_OPTIONS.
+	* lib/gcc-dg.exp: Likewise.
+	* lib/torture-options.exp (set-torture-options): Add 3rd
+	argument.  Append it to 'torture_with_loops' and
+	'torture_without_loops'.
+	* gcc.c-torture/execute/execute.exp: Add LTO_TORTURE_OPTIONS 
+	when calling set-torture-options.
+	* gcc.c-torture/execute/builtins/builtins.exp: Likewise.
+	* gcc.c-torture/execute/ieee/ieee.exp: Likewise.
+	* gcc.c-torture/unsorted/unsorted.exp: Likewise.
+	* gcc.target/i386/math-torture/math-torture.exp: Likewise.
+	* gcc.target/x86_64/abi/abi-x86_64.exp: Likewise.
+	* gcc.target/x86_64/abi/avx/abi-avx.exp: Likewise.
+	* gcc.misc-tests/i386-prefetch.exp: Likewise.
+	* gcc.misc-tests/dectest.exp: Likewise.
+
 2009-05-15  Diego Novillo  <dnovillo@google.com>
 
 	* gcc.dg/lto/20090206-1_0.c: Add -fPIC.
Index: gcc/testsuite/gcc.dg/matrix/matrix.exp
===================================================================
--- gcc/testsuite/gcc.dg/matrix/matrix.exp	(revision 147720)
+++ gcc/testsuite/gcc.dg/matrix/matrix.exp	(revision 147721)
@@ -19,7 +19,7 @@
 load_lib gcc-dg.exp
 load_lib target-supports.exp
 
-set DEFAULT_MATCFLAGS "-O3 -flto -fipa-matrix-reorg -fdump-ipa-matrix-reorg -fwhole-program -combine"
+set DEFAULT_MATCFLAGS "-O3 -fipa-matrix-reorg -fdump-ipa-matrix-reorg -fwhole-program -combine"
 
 # Initialize `dg'.
 dg-init
Index: gcc/testsuite/gcc.dg/debug/debug.exp
===================================================================
--- gcc/testsuite/gcc.dg/debug/debug.exp	(revision 147720)
+++ gcc/testsuite/gcc.dg/debug/debug.exp	(revision 147721)
@@ -24,7 +24,7 @@ dg-init
 
 # Main loop.
 
-gcc-dg-debug-runtest gcc_target_compile trivial.c [list -O -O3 -flto] \
+gcc-dg-debug-runtest gcc_target_compile trivial.c [list -O -O3] \
     [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]]
 
 # All done.
Index: gcc/testsuite/gcc.dg/struct/struct-reorg.exp
===================================================================
--- gcc/testsuite/gcc.dg/struct/struct-reorg.exp	(revision 147720)
+++ gcc/testsuite/gcc.dg/struct/struct-reorg.exp	(revision 147721)
@@ -20,7 +20,7 @@
 load_lib gcc-dg.exp
 load_lib target-supports.exp
 
-set STRUCT_REORG_CFLAGS "-O3 -flto -fipa-struct-reorg -fdump-ipa-all -fwhole-program -combine -fipa-type-escape"
+set STRUCT_REORG_CFLAGS "-O3 -fipa-struct-reorg -fdump-ipa-all -fwhole-program -combine -fipa-type-escape"
 
 # Initialize `dg'.
 dg-init
Index: gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp	(revision 147720)
+++ gcc/testsuite/gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp	(revision 147721)
@@ -33,7 +33,7 @@ if ![is-effective-target powerpc_altivec
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-flto" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2" "-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 147720)
+++ gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp	(revision 147721)
@@ -29,7 +29,7 @@ if { ![istarget spu*-*-*] } then {
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-flto" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2" "-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 147720)
+++ gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp	(revision 147721)
@@ -29,7 +29,7 @@ if { ![istarget i?86*-*-*] && ![istarget
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-flto" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2" "-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 147720)
+++ gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp	(revision 147721)
@@ -30,7 +30,7 @@ if { (![istarget x86_64-*-*] && ![istarg
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-flto" "-ftree-vectorize" "-fvect-cost-model"
+lappend DEFAULT_VECTCFLAGS "-O2" "-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 147720)
+++ gcc/testsuite/gcc.dg/vect/vect.exp	(revision 147721)
@@ -113,11 +113,9 @@ dg-init
 global O1_VECTCFLAGS
 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
 lappend O1_VECTCFLAGS "-O1"
-lappend O1_VECTCFLAGS "-flto"
 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
 
 lappend DEFAULT_VECTCFLAGS "-O2"
-lappend DEFAULT_VECTCFLAGS "-flto"
 
 # Tests that should be run without generating dump info
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
@@ -242,7 +240,6 @@ dg-runtest [lsort [glob -nocomplain $src
 # With -Os
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-Os"
-lappend DEFAULT_VECTCFLAGS "-flto"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
         "" $DEFAULT_VECTCFLAGS
 
@@ -255,7 +252,6 @@ dg-runtest [lsort [glob -nocomplain $src
 # With -O3
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-O3"
-lappend DEFAULT_VECTCFLAGS "-flto"
 if  [istarget "spu-*-*"] {
   lappend DEFAULT_VECTCFLAGS "-funroll-loops"
 }
Index: gcc/testsuite/gcc.misc-tests/i386-prefetch.exp
===================================================================
--- gcc/testsuite/gcc.misc-tests/i386-prefetch.exp	(revision 147720)
+++ gcc/testsuite/gcc.misc-tests/i386-prefetch.exp	(revision 147721)
@@ -90,16 +90,16 @@ load_lib torture-options.exp
 dg-init
 torture-init
 
-set-torture-options $PREFETCH_NONE
+set-torture-options $PREFETCH_NONE {{}} $LTO_TORTURE_OPTIONS
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] ""
 
-set-torture-options $PREFETCH_SSE
+set-torture-options $PREFETCH_SSE {{}} $LTO_TORTURE_OPTIONS
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] ""
 
-set-torture-options $PREFETCH_3DNOW
+set-torture-options $PREFETCH_3DNOW {{}} $LTO_TORTURE_OPTIONS
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] ""
 
-set-torture-options $PREFETCH_ATHLON
+set-torture-options $PREFETCH_ATHLON {{}} $LTO_TORTURE_OPTIONS
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] ""
 
 torture-finish
Index: gcc/testsuite/gcc.misc-tests/dectest.exp
===================================================================
--- gcc/testsuite/gcc.misc-tests/dectest.exp	(revision 147720)
+++ gcc/testsuite/gcc.misc-tests/dectest.exp	(revision 147721)
@@ -20,7 +20,7 @@
 #
 # Contributed by Ben Elliston <bje@au.ibm.com>.
 
-set DEC_TORTURE_OPTIONS [list {} -O1 {-O2 -flto} -O3 -Os -msoft-float]
+set DEC_TORTURE_OPTIONS [list {} -O1 -O2 -O3 -Os -msoft-float]
 
 proc target-specific-flags {} {
   set result "-frounding-math "
@@ -518,7 +518,7 @@ if [catch {set testdir $env(DECTEST)}] {
 }
 
 torture-init
-set-torture-options $DEC_TORTURE_OPTIONS
+set-torture-options $DEC_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
 
 note "Using tests in $testdir"
 dfp-run-tests [lsort [glob -nocomplain $testdir/*.decTest]]
Index: gcc/testsuite/g++.dg/debug/debug.exp
===================================================================
--- gcc/testsuite/g++.dg/debug/debug.exp	(revision 147720)
+++ gcc/testsuite/g++.dg/debug/debug.exp	(revision 147721)
@@ -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 -flto] \
+gcc-dg-debug-runtest g++_target_compile trivial.C [list -O2 -O3] \
     [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
 
 # All done.
Index: gcc/testsuite/g++.dg/vect/vect.exp
===================================================================
--- gcc/testsuite/g++.dg/vect/vect.exp	(revision 147720)
+++ gcc/testsuite/g++.dg/vect/vect.exp	(revision 147721)
@@ -39,8 +39,8 @@ set save-dg-do-what-default ${dg-do-what
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-flto" "-ftree-vectorize" \
-  "-fno-vect-cost-model" "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
+lappend DEFAULT_VECTCFLAGS "-O2" "-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
 # code.  Set additional target-dependent vector flags, which can be
Index: gcc/testsuite/g++.dg/pch/pch.exp
===================================================================
--- gcc/testsuite/g++.dg/pch/pch.exp	(revision 147720)
+++ gcc/testsuite/g++.dg/pch/pch.exp	(revision 147721)
@@ -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 -flto"] ".H"
+    dg-pch $subdir $test [list "-g" "-O2 -g" "-O2"] ".H"
 }
 
 set dg-do-what-default "$old_dg_do_what_default"
Index: gcc/testsuite/lib/lto.exp
===================================================================
--- gcc/testsuite/lib/lto.exp	(revision 147720)
+++ gcc/testsuite/lib/lto.exp	(revision 147721)
@@ -33,7 +33,7 @@ proc lto_init { args } {
 	    {-O2 -fwhopr}	\
 	    {-O0 -flto}		\
 	    {-O2 -flto}		\
-	    ]
+	]
     }
 }
 
Index: gcc/testsuite/lib/c-torture.exp
===================================================================
--- gcc/testsuite/lib/c-torture.exp	(revision 147720)
+++ gcc/testsuite/lib/c-torture.exp	(revision 147721)
@@ -17,6 +17,7 @@
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
+load_lib target-supports.exp
 load_lib file-format.exp
 load_lib target-libpath.exp
 
@@ -34,16 +35,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 -flto } \
-	{ -O0 -fwhopr } \
-	{ -O1 -flto } \
-	{ -O2 -flto } \
-	{ -O2 -fwhopr } \
-	{ -O3 -flto -fomit-frame-pointer } \
-	{ -O3 -flto -fomit-frame-pointer -funroll-loops } \
-	{ -O3 -flto -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+	{ -O0 } \
+	{ -O1 } \
+	{ -O2 } \
+	{ -O3 -fomit-frame-pointer } \
+	{ -O3 -fomit-frame-pointer -funroll-loops } \
+	{ -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
 	{ -O3 -g } \
-	{ -Os -flto } ]
+	{ -Os } ]
 }
 
 if [info exists ADDITIONAL_TORTURE_OPTIONS] {
@@ -51,6 +50,18 @@ if [info exists ADDITIONAL_TORTURE_OPTIO
 	[concat $C_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
 }
 
+set LTO_TORTURE_OPTIONS ""
+if [check_effective_target_lto] {
+    set LTO_TORTURE_OPTIONS [list \
+	{ -O0 -flto } \
+	{ -O2 -flto } \
+	{ -O3 -flto } \
+	{ -O0 -fwhopr } \
+	{ -O2 -fwhopr } \
+	{ -O3 -fwhopr }
+    ]
+}
+
 global GCC_UNDER_TEST
 if ![info exists GCC_UNDER_TEST] {
     set GCC_UNDER_TEST "[find_gcc]"
Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp	(revision 147720)
+++ gcc/testsuite/lib/gcc-dg.exp	(revision 147721)
@@ -45,16 +45,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 -flto } \
-	{ -O0 -fwhopr } \
-	{ -O1 -flto } \
-	{ -O2 -flto } \
-	{ -O2 -fwhopr } \
-	{ -O3 -flto -fomit-frame-pointer } \
-	{ -O3 -flto -fomit-frame-pointer -funroll-loops } \
-	{ -O3 -flto -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+	{ -O0 } \
+	{ -O1 } \
+	{ -O2 } \
+	{ -O3 -fomit-frame-pointer } \
+	{ -O3 -fomit-frame-pointer -funroll-loops } \
+	{ -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
 	{ -O3 -g } \
-	{ -Os -flto } ]
+	{ -Os } ]
 }
 
 if [info exists ADDITIONAL_TORTURE_OPTIONS] {
@@ -62,6 +60,19 @@ if [info exists ADDITIONAL_TORTURE_OPTIO
 	[concat $DG_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
 }
 
+set LTO_TORTURE_OPTIONS ""
+if [check_effective_target_lto] {
+    set LTO_TORTURE_OPTIONS [list \
+	{ -O0 -flto } \
+	{ -O2 -flto } \
+	{ -O3 -flto } \
+	{ -O0 -fwhopr } \
+	{ -O2 -fwhopr } \
+	{ -O3 -fwhopr }
+    ]
+}
+
+
 global GCC_UNDER_TEST
 if ![info exists GCC_UNDER_TEST] {
     set GCC_UNDER_TEST "[find_gcc]"
@@ -243,9 +254,9 @@ proc gcc-dg-runtest { testcases default-
     # Some callers set torture options themselves; don't override those.
     set existing_torture_options [torture-options-exist]
     if { $existing_torture_options == 0 } {
-	global DG_TORTURE_OPTIONS
+	global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
 	torture-init
-	set-torture-options $DG_TORTURE_OPTIONS
+	set-torture-options $DG_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
     }
     dump-torture-options
 
Index: gcc/testsuite/lib/torture-options.exp
===================================================================
--- gcc/testsuite/lib/torture-options.exp	(revision 147720)
+++ gcc/testsuite/lib/torture-options.exp	(revision 147721)
@@ -48,17 +48,25 @@ proc contains-loop-option-p { arg } {
 #
 # Argument 0 is the list to use as torture options
 # Argument 1 is the list to combine with the torture options.
+# Argument 2 is the list to be appended to the torture options after
+# combining argument 0 and 1.
 proc set-torture-options { args } {
     global torture_with_loops torture_without_loops
 
     set torture_list [lindex $args 0]
 
-    if { [llength $args] != 1 } {
+    if { [llength $args] > 1 } {
 	set other_list [lindex $args 1]
     } else {
 	set other_list [list {}]
     }
 
+    if { [llength $args] > 2 } {
+	set append_list [lindex $args 2]
+    } else {
+	set append_list [list {}]
+    }
+
     set torture_with_loops ""
     set torture_without_loops ""
     foreach torture_opts $torture_list {
@@ -71,6 +79,9 @@ proc set-torture-options { args } {
 	    lappend torture_with_loops "$torture_opts $other_opts"
 	}
     }
+
+    append torture_with_loops " $append_list"
+    append torture_without_loops " $append_list"
 }
 
 # Finish up after using a set of torture options.
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 147720)
+++ gcc/testsuite/lib/target-supports.exp	(revision 147721)
@@ -2925,3 +2925,12 @@ proc check_effective_target_correct_iso_
 	#endif
     }]
 }
+
+# Return 1 if the compiler has been configure with link-time optimization
+# (LTO) support.
+
+proc check_effective_target_lto { } {
+    return [check_no_compiler_messages lto executable {
+	int main (void) { return 0; }
+    } "-O0 -flto"]
+}
Index: gcc/ChangeLog.lto
===================================================================
--- gcc/ChangeLog.lto	(revision 147720)
+++ gcc/ChangeLog.lto	(revision 147721)
@@ -1,3 +1,8 @@
+2009-05-19  Diego Novillo  <dnovillo@google.com>
+
+	* opts.c (complain_wrong_lang): Remove workaround to
+	quell warning message when LTO is not supported.
+
 2009-05-15  Diego Novillo  <dnovillo@google.com>
 
 	* lto-symtab.c (lto_symtab_merge_decl): Remove stale comment.
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 147720)
+++ gcc/opts.c	(revision 147721)
@@ -441,12 +441,6 @@ complain_wrong_lang (const char *text, c
   if (lang_mask & CL_LTO)
     return;
 
-  /* FIXME lto.  Hack.  Do not merge.  This merely hides this warning
-     to avoid spurious failures in non-C/C++ testsuites.  It would be
-     much better to fix the testsuites.  */
-  if (option->flag_var == &flag_lto || option->flag_var == &flag_whopr)
-    return;
-
   ok_langs = write_langs (option->flags);
   bad_lang = write_langs (lang_mask);
 
Index: libstdc++-v3/scripts/testsuite_flags.in
===================================================================
--- libstdc++-v3/scripts/testsuite_flags.in	(revision 147720)
+++ libstdc++-v3/scripts/testsuite_flags.in	(revision 147721)
@@ -54,12 +54,12 @@ case ${query} in
       echo ${CC}
       ;;
     --cxxflags)
-      CXXFLAGS_default="-O2 -fwhopr -D_GLIBCXX_ASSERT -fmessage-length=0"
+      CXXFLAGS_default="-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
       CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@"
       echo ${CXXFLAGS_default} ${CXXFLAGS_config}
       ;;
     --cxxparallelflags)
-      CXXFLAGS_parallel="-fwhopr -D_GLIBCXX_PARALLEL -fopenmp
+      CXXFLAGS_parallel="-D_GLIBCXX_PARALLEL -fopenmp
 			 -B${BUILD_DIR}/../libgomp 
                          -I${BUILD_DIR}/../libgomp 
 			 -L${BUILD_DIR}/../libgomp/.libs -lgomp"
Index: libstdc++-v3/ChangeLog.lto
===================================================================
--- libstdc++-v3/ChangeLog.lto	(revision 147720)
+++ libstdc++-v3/ChangeLog.lto	(revision 147721)
@@ -1,3 +1,11 @@
+2009-05-19  Diego Novillo  <dnovillo@google.com>
+
+	* libstdc++-v3/scripts/testsuite_flags.in: Do not always
+	add -fwhopr.
+	* libstdc++-v3/testsuite/lib/libstdc++.exp: Call
+	check_effective_target_lto to determine if -fwhopr should
+	be added.
+
 2008-12-02  Diego Novillo  <dnovillo@google.com>
 
 	* scripts/testsuite_flags.in: Replace -flto with -fwhopr.
Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 147720)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 147721)
@@ -239,6 +239,11 @@ proc libstdc++_init { testfile } {
     append cxxflags [getenv CXXFLAGS]
     v3track cxxflags 2
 
+    # If the compiler supports LTO, use it.
+    if [check_effective_target_lto] {
+      append cxxflags " -fwhopr"
+    }
+
     # Always use MO files built by this test harness.
     set cxxflags "$cxxflags -DLOCALEDIR=\".\""
     set ccflags "$cxxflags -DLOCALEDIR=\".\""


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