Bug 21138 - wrong code in sixtrack for -fmodulo-sched
Summary: wrong code in sixtrack for -fmodulo-sched
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2005-04-21 00:51 UTC by Janis Johnson
Modified: 2005-06-01 19:17 UTC (History)
3 users (show)

See Also:
Host: powerpc64-linux
Target: powerpc64-linux
Build: powerpc64-linux
Known to work:
Known to fail:
Last reconfirmed: 2005-04-22 13:56:43


Attachments
minimized testcase (192 bytes, text/plain)
2005-04-21 00:51 UTC, Janis Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-04-21 00:51:03 UTC
The SPEC CPU2000 test sixtrack gets comparison failures on
powerpc64-linux when compiled with current GCC mainline with
"-m64 -O2 -fmodulo-sched".  The minimized testcase demonstrates
the problem.  It starts failing with sources as of 20050405.
Comment 1 Janis Johnson 2005-04-21 00:51:41 UTC
Created attachment 8694 [details]
minimized testcase
Comment 2 Janis Johnson 2005-04-22 00:26:29 UTC
The testcase starts failing with this patch from rakdver:
  http://gcc.gnu.org/ml/gcc-cvs/2005-04/msg00301.html
Comment 3 Zdenek Dvorak 2005-04-22 13:56:41 UTC
As far as I can tell, the code at .final_cleanup dump is correct, 
so the patch most likely reveals some latent bug in sms or one of 
the later passes. 
Comment 4 Janis Johnson 2005-04-28 00:07:11 UTC
There are other SPEC CPU2000 comparison failures on powerpc64-linux
with "-m64 -O2 -fmodulo-sched" that resist attempts to minimize the
testcases.  apsi has been failing since:
                                                                                
  http://gcc.gnu.org/ml/gcc-cvs/2005-04/msg00893.html from kazu
                                                                                
and lucas has been failing since:
                                                                                
  http://gcc.gnu.org/ml/gcc-cvs/2005-04/msg01289.html from radkver.
                                                                                
While trying to minimize the apsi failure I added write statements
that caused apsi to segfault; for example, write the value of I just
inside the loop using it in DCDTZ with:
                                                                                
1327a1328,1329
>             write(6,1001) i
> 1001        format(' i = ',i3)
                                                                                
I'm adding the information to this PR because I don't have test cases
to submit for the apsi and lucas failures in new PRs, and hope that
the information might be useful to Mostafa or anyone else who looks
into this PR.  There were other failures with these options earlier
this month that have since gone away, making it look even more like
latent bugs in the modulo scheduling code.
                                                                                
All of these SPEC CPU2000 failures are with the small "test" input.
Comment 5 mustafa 2005-05-04 12:31:35 UTC
Is seems like this is not an SMS bug, sixtrack is failing for me with -m64 -O2
without -fmodulo-sched. 
Jania, have you checked that and have a different results?
Comment 6 Janis Johnson 2005-05-09 19:32:31 UTC
sixtrack works fine for me with "-m64 -O2" with both SPEC's test input and its
ref output, for all of my daily builds since 20050503, while with the addition
of -fmodulo-sched it gets miscompares.  lucas is now passing again, but apsi is
still gettting miscompares with "-m64 -O2 -fmodulo-sched".

Every week or so I run SPEC CPU2000 with GCC mainline built the previous night
and run the tests using "test" input, for each of about 40 sets of GCC command
line options with -m32 and then with -m64.  This has found several regressions
(21272, 21155, 21054, 21048, 21030, 20813 in the last month).  Almost all of
the failures I see are ICEs; the ones reported here with -fmodulo-sched are
the only runtime failures I've seen for a long time.

I'm running the tests now with the 20050508 compiler (last night's build
failed) and will let you know if failures with other options look related
to this one.  The only known problem right now is PR 21155, intermittent
ICEs with -ftree-vectorize.
Comment 7 Janis Johnson 2005-05-16 20:27:06 UTC
sixtrack and the testcase smsbug.f still fail on powerpc64-linux when compiled
with mainline GCC with the options "-m64 -O2 -fmodulo-sched".  The other
failures with those options mentioned in comment #4 have gone away.
Comment 8 mustafa 2005-05-17 15:05:31 UTC
Janis, can you try this patch?

Index: modulo-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/modulo-sched.c,v
retrieving revision 1.29
diff -c -p -r1.29 modulo-sched.c
*** modulo-sched.c      28 Apr 2005 02:25:22 -0000      1.29
--- modulo-sched.c      17 May 2005 11:47:00 -0000
*************** undo_generate_reg_moves (partial_schedul
*** 597,602 ****
--- 597,603 ----
          delete_insn (crr);
          crr = prev;
        }
+       SCHED_FIRST_REG_MOVE (u) = NULL_RTX;
      }
   
    while (reg_move_replaces)
Comment 9 janis187 2005-05-17 20:01:09 UTC
Subject: Re:  wrong code in sixtrack for -fmodulo-sched

The patch fixes the problem with sixtrack.

I suspected that a latent problem was causing the earlier failures in
lucas and apsi which have since gone away.  They failed on 20050429,
but with the patch applied to sources from that date they pass.  Yea!
Comment 10 GCC Commits 2005-06-01 05:26:54 UTC
Subject: Bug 21138

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hagog@gcc.gnu.org	2005-06-01 05:26:45

Modified files:
	gcc            : ChangeLog modulo-sched.c 

Log message:
	2005-06-01 Mostafa Hagog <mustafa@il.ibm.com>
	
	* modulo-sched.c (undo_generate_reg_moves ): Fix PR 21138.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8968&r2=2.8969
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/modulo-sched.c.diff?cvsroot=gcc&r1=1.30&r2=1.31

Comment 11 Andrew Pinski 2005-06-01 19:17:05 UTC
Fixed.