[PR16464] testsuite: account for fortran loop-constructs
diff mbox

Message ID 1330696891-32461-1-git-send-email-rep.dot.nop@gmail.com
State New
Headers show

Commit Message

Bernhard Reutner-Fischer March 2, 2012, 2:01 p.m. UTC
Hi,

PR testsuite/16464 notes that some g77/*.f that contain loops were not
compiled with loop flags.
Compiling only testcases with loop optimization that contain
"endfor/enddo" will lead to ~25% fewer tests (some 30000 instead of
previously 40000).

Testing in progess, ok if this completes successfully?

gcc/testsuite/ChangeLog:

2012-03-02  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	PR testsuite/16464
	* lib/gfortran-dg.exp (gfortran-dg-runtest): Depend options
	on weather the testcase is just preprocessed/compiled or
	contains loop statements.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 gcc/testsuite/lib/gfortran-dg.exp |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

Comments

Jakub Jelinek March 2, 2012, 2:05 p.m. UTC | #1
On Fri, Mar 02, 2012 at 03:01:31PM +0100, Bernhard Reutner-Fischer wrote:
> PR testsuite/16464 notes that some g77/*.f that contain loops were not
> compiled with loop flags.
> Compiling only testcases with loop optimization that contain
> "endfor/enddo" will lead to ~25% fewer tests (some 30000 instead of
> previously 40000).
> 
> Testing in progess, ok if this completes successfully?

There are tons of other loop constructs in Fortran, so I don't think this is
a good idea.

> 2012-03-02  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
> 
> 	PR testsuite/16464
> 	* lib/gfortran-dg.exp (gfortran-dg-runtest): Depend options
> 	on weather the testcase is just preprocessed/compiled or
> 	contains loop statements.

	Jakub
Richard Biener March 2, 2012, 2:09 p.m. UTC | #2
On Fri, Mar 2, 2012 at 3:05 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Mar 02, 2012 at 03:01:31PM +0100, Bernhard Reutner-Fischer wrote:
>> PR testsuite/16464 notes that some g77/*.f that contain loops were not
>> compiled with loop flags.
>> Compiling only testcases with loop optimization that contain
>> "endfor/enddo" will lead to ~25% fewer tests (some 30000 instead of
>> previously 40000).
>>
>> Testing in progess, ok if this completes successfully?
>
> There are tons of other loop constructs in Fortran, so I don't think this is
> a good idea.

Indeed.  The focus on -O2 testing seems odd to me though, as well as
doing -g only at -O3.  But well ...

Richard.
Richard Biener March 2, 2012, 2:37 p.m. UTC | #3
On Fri, Mar 2, 2012 at 3:25 PM, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
> On Mar 2, 2012 3:09 PM, "Richard Guenther" <richard.guenther@gmail.com>
> wrote:
>>
>> On Fri, Mar 2, 2012 at 3:05 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Fri, Mar 02, 2012 at 03:01:31PM +0100, Bernhard Reutner-Fischer
>> > wrote:
>> >> PR testsuite/16464 notes that some g77/*.f that contain loops were not
>> >> compiled with loop flags.
>> >> Compiling only testcases with loop optimization that contain
>> >> "endfor/enddo" will lead to ~25% fewer tests (some 30000 instead of
>> >> previously 40000).
>> >>
>> >> Testing in progess, ok if this completes successfully?
>> >
>> > There are tons of other loop constructs in Fortran, so I don't think
>> > this is
>> > a good idea.
>>
>> Indeed.  The focus on -O2 testing seems odd to me though, as well as
>> doing -g only at -O3.  But well ...
>
> OK, so what should we do about the PR?
> Should we just close it, compile the 2 tests mentioned with loop unrolling
> or perhaps use just -O for "dg-do preprocess" instead of "compile" so we
> compile more testcases with the full option_list?

We can't possibly accomodate all (or even all sensible) compiler options
for testcases.  So I'd close the bug as wontfix.  Btw, -funroll-loops is
not exactly triggering very many loop optimizations.

Richard.

>> Richard.

Patch
diff mbox

diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 50753df..56ecc69 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -90,7 +90,7 @@  proc gfortran-dg-prune { system text } {
 # as c-torture does.
 proc gfortran-dg-runtest { testcases default-extra-flags } {
     global runtests
-    global DG_TORTURE_OPTIONS torture_with_loops
+    global DG_TORTURE_OPTIONS torture_with_loops torture_without_loops
 
     torture-init
     set-torture-options $DG_TORTURE_OPTIONS
@@ -102,12 +102,26 @@  proc gfortran-dg-runtest { testcases default-extra-flags } {
 	    continue
         }
 
-	# 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
-	} else {
-	    set option_list [list { -O } ]
+	# look if this is a dg-do-preprocess or dg-to-compile test,
+	# in which case we do not need to cycle through all options.
+	set option_list $torture_without_loops
+	set tmp [grep $test "(dg-do\[ \t\]+(preprocess|compile)|^(?:\[^!\]*\[ \t\]*)\[eE\]\[nN\]\[dD\]\[ \t\]*(\[fF\]\[oO\]\[rR\]|\[dD\]\[oO\]))" line]
+	foreach i $tmp {
+	    regexp "(\[0-9\]+)\[ \t\]+(?:dg-do\[ \t\]+)(preprocess|compile)" $i i lineno what
+	    if {[info exists what]} {
+		set option_list [list { -O } ]
+		verbose "Line $lineno: dg-do $what, trimming option_list" 3
+		break
+	    } else {
+		regexp "(\[0-9\]+)(?:.*)(\[eE\]\[nN\]\[dD\]\[ \t\]*(\[fF\]\[oO\]\[rR\]|\[dD\]\[oO\]))" $i i lineno loop
+		if {[info exists loop]} {
+		    set option_list $torture_with_loops
+		    verbose "Line $lineno: extending option_list: loop detected: `$loop'" 3
+		    break
+		# } else {
+		#    set option_list $torture_without_loops
+		}
+	    }
 	}
 
 	set nshort [file tail [file dirname $test]]/[file tail $test]