From patchwork Tue May 24 20:26:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 97221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 32904B6F8C for ; Wed, 25 May 2011 06:26:29 +1000 (EST) Received: (qmail 772 invoked by alias); 24 May 2011 20:26:23 -0000 Received: (qmail 729 invoked by uid 22791); 24 May 2011 20:26:21 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 May 2011 20:26:07 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4OKQ7F9016542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 May 2011 16:26:07 -0400 Received: from toll.yyz.redhat.com (toll.yyz.redhat.com [10.15.16.165]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4OKQ6Hu016746; Tue, 24 May 2011 16:26:06 -0400 Message-ID: <4DDC145E.7060903@redhat.com> Date: Tue, 24 May 2011 16:26:06 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: gcc-patches CC: Jeffrey Law Subject: RFA: patch for PR48757 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The following patch solves PR48757. It is just a slight modification of code for PR48633. 2011-05-24 Vladimir Makarov 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 PR rtl-optimization/48757 * gfortran.dg/pr48757.f: New test case. The patch was successfully bootstrapped on x86-64. Ok to commit? 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