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]

[PATCH] Fix PR optimization/5891 (take 2)


On Wed, Mar 13, 2002 at 11:19:19AM -0800, Richard Henderson wrote:
> On Wed, Mar 13, 2002 at 02:10:06PM +0100, Jakub Jelinek wrote:
> > The problem is that ar.lc is not fixed and is therefore not considered
> > live at exit block, so propagate_one_insn decides to delete it.
> 
> Err, all call-saved registers are considered live at exit.
> This cannot be the explanation.

Here is a better fix.
Loop unrolling was not copying SIBLING_CALL_P flag and thus flow
became confused.
Ok to commit?
Still don't know what to do with the testcase, whether we can put it in or
not.

2002-03-14  Jakub Jelinek  <jakub@redhat.com>

	PR optimization/5891
	* unroll.c (copy_loop_body) [CALL_INSN]: Copy SIBLING_CALL_P flag.

	* g77.dg/pr5891.f: New test.

--- gcc/unroll.c.jj	Thu Feb 28 15:42:32 2002
+++ gcc/unroll.c	Thu Mar 14 12:35:46 2002
@@ -2222,6 +2222,7 @@ copy_loop_body (loop, copy_start, copy_e
 	  pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
 	  copy = emit_call_insn (pattern);
 	  REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+	  SIBLING_CALL_P (copy) = SIBLING_CALL_P (insn);
 
 	  /* Because the USAGE information potentially contains objects other
 	     than hard registers, we need to copy it.  */
--- gcc/testsuite/g77.dg/pr5891.f.jj	Thu Aug 30 22:30:55 2001
+++ gcc/testsuite/g77.dg/pr5891.f	Thu Mar 14 13:38:45 2002
@@ -0,0 +1,73 @@
+C  This is file eig66.f from benchmark program 200.sixtrack in
+C  SPEC CPU2000.  SPEC has given permission to provide this file as
+C  a test case for a GCC problem report, and for use in the GCC
+C  testsuite.  Several lines of unused parameter statements were
+C  removed from the file, but otherwise there are no changes.
+C
+C PR optimization/5891
+C { dg-do compile }
+C { dg-options "-O2 -funroll-loops" }
+C
+********************************************************************
+C      
+C ANFANG UNTERPROGRAMM
+      subroutine eig66(fm,reval,aieval,revec,aievec)
+      implicit real*8 (a-h,o-z)
+      parameter(one=1.0d0)
+      parameter(c1m10=1.0d-10)
+C  THIS ROUTINE FINDS THE EIGENVALUES AND EIGENVECTORS
+C  OF THE FULL MATRIX FM.
+C  THE EIGENVECTORS ARE NORMALIZED SO THAT THE REAL AND
+C  IMAGINARY PART OF VECTORS 1, 3, AND 5 HAVE +1 ANTISYMMETRIC
+C  PRODUCT:
+C      REVEC1 J AIVEC1 = 1 ; REVEC3 J AIVEC3 = 1 ;
+C      REVEC5 J AIVEC5 = 1.
+C  THE EIGENVECTORS 2 ,4, AND 6 HAVE THE OPPOSITE NORMALIZATION.
+C  WRITTEN BY F. NERI, FEB 26 1986.
+C      
+      parameter (ndim2=6)
+      integer nn
+      integer ilo,ihi,mdim,info
+C     integer nnr
+      real*8 reval(ndim2),aieval(ndim2),
+     @revec(ndim2,ndim2),aievec(ndim2,ndim2)
+      real*8 fm(ndim2,ndim2),aa(ndim2,ndim2)
+      integer i,i1
+C    &            ,j
+      real*8 ort(ndim2),vv(ndim2,ndim2)
+C     real*8 pbkt(ndim2)
+      save
+C  COPY MATRIX TO TEMPORARY STORAGE (THE MATRIX AA IS DESTROYED)
+      do 10 i=1,ndim2
+        do 10 i1=1,ndim2
+          aa(i1,i) = fm(i1,i)
+   10 continue
+      ilo = 1
+      ihi = ndim2
+      mdim = ndim2
+      nn = ndim2
+C  COMPUTE EIGENVALUES AND EIGENVECTORS USING DOUBLE
+C  PRECISION EISPACK ROUTINES:
+      call ety(mdim,nn,ilo,ihi,aa,ort)
+      call etyt(mdim,nn,ilo,ihi,aa,ort,vv)
+      call ety2(mdim,nn,ilo,ihi,aa,reval,aieval,vv,info)
+      if ( info .ne. 0 ) then
+        write(6,*) '  ERROR IN EIG6'
+        return
+      endif
+C      CALL NEIGV(VV,PBKT)
+      do 30 i=1,ndim2/2
+        do 20 jet=1,ndim2
+          revec(jet,2*i-1)=vv(jet,2*i-1)
+          revec(jet,2*i)=vv(jet,2*i-1)
+          aievec(jet,2*i-1)=vv(jet,2*i)
+   20   aievec(jet,2*i)=-vv(jet,2*i)
+   30 continue
+      do 40 i=1,ndim2
+        if(abs(reval(i)**2+aieval(i)**2 -one).gt.c1m10) then
+          write(6,*) ' EIG6: EIGENVALUES OFF THE UNIT CIRCLE!'
+          return
+        endif
+   40 continue
+      return
+      end

	Jakub


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