Patchwork RFA: patch for PR48757

login
register
mail settings
Submitter Vladimir Makarov
Date May 24, 2011, 8:26 p.m.
Message ID <4DDC145E.7060903@redhat.com>
Download mbox | patch
Permalink /patch/97221/
State New
Headers show

Comments

Vladimir Makarov - May 24, 2011, 8:26 p.m.
The following patch solves PR48757.  It is just a slight modification of 
code for PR48633.

2011-05-24  Vladimir Makarov <vmakarov@redhat.com>

         PR rtl-optimization/48757
         * ira-build.c (loop_with_eh_edge_p): Rename to
         loop_with_complex_edge_p, check edges on complexity, make function
         conditional.
         (mark_loops_for_removal): Make call of loop_with_complex_edge_p
         conditional.

2011-05-24  Vladimir Makarov <vmakarov@redhat.com>

         PR rtl-optimization/48757
         * gfortran.dg/pr48757.f:  New test case.


The patch was successfully bootstrapped on x86-64.

Ok to commit?
Jeff Law - May 24, 2011, 9:21 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/24/11 14:26, Vladimir Makarov wrote:
> The following patch solves PR48757.  It is just a slight modification of
> code for PR48633.
> 
> 2011-05-24  Vladimir Makarov <vmakarov@redhat.com>
> 
>         PR rtl-optimization/48757
>         * ira-build.c (loop_with_eh_edge_p): Rename to
>         loop_with_complex_edge_p, check edges on complexity, make function
>         conditional.
>         (mark_loops_for_removal): Make call of loop_with_complex_edge_p
>         conditional.
> 
> 2011-05-24  Vladimir Makarov <vmakarov@redhat.com>
> 
>         PR rtl-optimization/48757
>         * gfortran.dg/pr48757.f:  New test case.
> 
> 
> The patch was successfully bootstrapped on x86-64.
> 
> Ok to commit?
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN3CFtAAoJEBRtltQi2kC78q4H+gJNONmi7W0iMY+ff+oHNUq5
nX8JQMvTJaOLKGdEGBDbg3Dtr1KruRB3EBKM4tyq+Wzwn9lzxCppKJwEJt6IVNMh
dAgy7BrhbWaIGDvAGBqqgMZNNh00UCxPpegLs1pmUc4n0jPYigQqYAtDfeg18mWo
ZOurKAy7JiqWgyKzfos1/b9KKmtrYWTEh9HuPn2DWIJIzEDUIqlXvtNuysHDYIja
N8ycs9RASIOMOtelVgQPOnvObrt17CeIdFz4zka81ftUfOaAQEkhft9ijLHYQkGV
R6LrVKUfmZ4myxryy3pu0LN3wZmt74Y87XUGS7kI8ZOTLIA2xkpbd1weh7kyiO8=
=p73P
-----END PGP SIGNATURE-----

Patch

Index: ira-build.c
===================================================================
--- ira-build.c	(revision 174124)
+++ ira-build.c	(working copy)
@@ -1806,9 +1806,12 @@  low_pressure_loop_node_p (ira_loop_tree_
   return true;
 }
 
-/* Return TRUE if LOOP has a EH enter or exit edge.  */
+#ifdef STACK_REGS
+/* Return TRUE if LOOP has a complex enter or exit edge.  We don't
+   form a region from such loop if the target use stack register
+   because reg-stack.c can not deal with such edges.  */
 static bool
-loop_with_eh_edge_p (struct loop *loop)
+loop_with_complex_edge_p (struct loop *loop)
 {
   int i;
   edge_iterator ei;
@@ -1820,10 +1823,11 @@  loop_with_eh_edge_p (struct loop *loop)
       return true;
   edges = get_loop_exit_edges (loop);
   FOR_EACH_VEC_ELT (edge, edges, i, e)
-    if (e->flags & EDGE_EH)
+    if (e->flags & EDGE_COMPLEX)
       return true;
   return false;
 }
+#endif
 
 /* Sort loops for marking them for removal.  We put already marked
    loops first, then less frequent loops next, and then outer loops
@@ -1884,7 +1888,10 @@  mark_loops_for_removal (void)
 	ira_loop_nodes[i].to_remove_p
 	  = ((low_pressure_loop_node_p (ira_loop_nodes[i].parent)
 	      && low_pressure_loop_node_p (&ira_loop_nodes[i]))
-	     || loop_with_eh_edge_p (ira_loop_nodes[i].loop));
+#ifdef STACK_REGS
+	     || loop_with_complex_edge_p (ira_loop_nodes[i].loop)
+#endif
+	     );
       }
   qsort (sorted_loops, n, sizeof (ira_loop_tree_node_t), loop_compare_func);
   for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++)
Index: testsuite/gfortran.dg/pr48757.f
===================================================================
--- testsuite/gfortran.dg/pr48757.f	(revision 0)
+++ testsuite/gfortran.dg/pr48757.f	(revision 0)
@@ -0,0 +1,54 @@ 
+! { dg-do compile { target i?86-*-* x86_64-*-* } }
+! { dg-options "-O2 -w" }
+C fconc64.F, from CERNLIB (simplified)
+
+      FUNCTION DFCONC(X,TAU,M)
+      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+      COMPLEX*16 WGAMMA,WLOGAM
+      COMPLEX*16 CGM,CLG,CRG,I,A,B,C,TI,R,RR,U(0:3),V(0:3),W(19)
+      LOGICAL LM0,LM1,LTA
+      CHARACTER NAME*(*)
+      CHARACTER*80 ERRTXT
+      PARAMETER (NAME = 'RFCONC/DFCONC')
+      DIMENSION T(7),H(9),S(5),P(11),D(-1:6)
+      PARAMETER (PI  = 3.14159 26535 89793 24D+0)
+      PARAMETER (RPI = 1.77245 38509 05516 03D+0)
+      PARAMETER (I = (0,1))
+      PARAMETER (Z1 = 1, HF = Z1/2, TH = 1+HF, C1 = Z1/10, C2 = Z1/5)
+      PARAMETER (RPH = 2/PI, RPW = 2/RPI, TW = 20, NMAX = 200)
+      DATA EPS /1D-14/
+      ASSIGN 1 TO JP
+      GO TO 20
+    1 ASSIGN 2 TO JP
+      GO TO 20
+    2 IF(LM1) FC=2*FC/SQRT(1-X1)
+      GO TO 99
+   12 ASSIGN 3 TO JP
+      GO TO 20
+    3 IF(LM1) FC=SIGN(HF,1-X)*(TAU**2+HF**2)*SQRT(ABS(X**2-1))*FC
+      GO TO 99
+   13 ASSIGN 4 TO JP
+      GO TO 20
+    4 R1=EXP((TI-HF)*LOG(X+X)+CLG(1+TI)-CLG((TH-FM)+TI))*
+     1        R*((HF-FM)+TI)/TI
+      FC=RPW*R1
+      IF(LM1) FC=FC/SQRT(1-X1)
+      GO TO 99
+   20 IF(LTA) THEN
+       IF(ABS(R-RR) .LT. EPS) GO TO JP, (1,2,3,4)
+      ELSE
+       W(1)=X1*A*B/C
+       R=1+W(1)
+       DO 23 N = 1,NMAX
+       RR=R
+       W(1)=W(1)*X1*(A+FN)*(B+FN)/((C+FN)*(FN+1))
+       IF(ABS(R-RR) .LT. EPS) GO TO JP, (1,2,3,4)
+   23  CONTINUE
+      END IF
+   99 DFCONC=FC
+      RETURN
+  101 FORMAT('ILLEGAL ARGUMENT(S)  X = ',D15.8,' TAU = ',D15.8,
+     1       ' M = ',I3)
+  102 FORMAT('CONVERGENCE PROBLEM FOR HYPERGEOMETRIC FUNCTION, X = ',
+     1        D15.8)
+      END