]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Don't cycle through option list for gfortran.dg and libgomp.fortran dg...
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Mar 2025 19:29:31 +0000 (20:29 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 Mar 2025 19:29:31 +0000 (20:29 +0100)
Here is a new version of the patch.

The current behavior in gfortran.dg/ and libgomp.fortran/libgomp.oacc-fortran
is that tests without any dg-do directive are implicitly dg-do compile
and tests with dg-do compile or without dg-do don't cycle through options
(-O is implicitly added but can be overridden), while test with dg-do run
cycle through the optimization options.
The following patch modifies this, so that even tests with dg-do run
with -O in dg-options or dg-additional-options (after [ \t"{]) don't cycle
either and also get implicit -O which is overridden by that
-O{,0,1,2,3,s,z,g,fast} in dg-{,additional-}options.  Previously we were
mostly wasting test time on those, because e.g.
-O0 -O2
-O1 -O2
-O2 -O2
-Os -O2
are still effectively -O2 and so the same thing, while
-O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -O2
and
-O3 -g -O2
are not the same thing (effectively
-fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -O2
and
-g -O2) I think it isn't worth to test those combinations (especially when
with e.g. -O0 in dg-options it mostly doesn't do much).

Tested with make check-gfortran where this results in slight decrease of
tests:
 # of expected passes            73809
 # of expected failures          343
 # of unsupported tests          78
with unmodified trunk vs.
 # of expected passes            72734
 # of expected failures          343
 # of unsupported tests          73
with the patch, and on the libgomp side
 # of expected passes            11162
 # of expected failures          238
 # of unsupported tests          274
to
 # of expected passes            11092
 # of expected failures          238
 # of unsupported tests          274
(when counting just fortran.exp tests).

Before the patch I see
grep -- '-O[^ ].*-O' testsuite/gfortran/gfortran.log | grep -v '/vect/\|/graphite/' | wc -l
1008
and with the patch
grep -- '-O[^ ].*-O' testsuite/gfortran/gfortran.log | grep -v '/vect/\|/graphite/' | wc -l
0
(vect and graphite have a few occurrences, but not too much).

2025-03-28  Jakub Jelinek  <jakub@redhat.com>

* lib/gfortran-dg.exp: Don't cycle through the option list if
dg-options or dg-additional-options contains -O after space, tab,
double quote or open curly bracket.
* gfortran.dg/cray_pointers_2.f90: Remove extraneous space between
dg-do and run and remove comment about it.

gcc/testsuite/gfortran.dg/cray_pointers_2.f90
gcc/testsuite/lib/gfortran-dg.exp

index 4351874825edfe3353a6bd151fe869aad7ff18f5..e646fc86b802cbc3d9a07d6c2268a6cac0430e7e 100644 (file)
@@ -1,6 +1,4 @@
-! Using two spaces between dg-do and run is a hack to keep gfortran-dg-runtest
-! from cycling through optimization options for this expensive test.
-! { dg-do  run }
+! { dg-do run }
 ! { dg-options "-O3 -fcray-pointer -fbounds-check -fno-inline" }
 ! { dg-timeout-factor 4 }
 !
index a516babdc3bed8ca3fa0881b2afb7a752d19c675..4abf2fe5dccfcb1c7da297bc808fb976df8805aa 100644 (file)
@@ -149,7 +149,13 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
        # look if this is dg-do run test, in which case
        # we cycle through the option list, otherwise we don't
        if [expr [search_for $test "dg-do run"]] {
-           set option_list $torture_with_loops
+           if { [ expr [search_for $test "dg-options*\[ \t\"\{]-O"] ] \
+                || [ expr [search_for $test \
+                           "dg-additional-options*\[ \t\"\{]-O"] ] } {
+               set option_list [list { -O } ]
+           } else {
+               set option_list $torture_with_loops
+           }
        } else {
            set option_list [list { -O } ]
        }