From patchwork Tue May 24 10:38:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 68474 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp555089qge; Tue, 24 May 2016 03:45:39 -0700 (PDT) X-Received: by 10.98.16.150 with SMTP id 22mr5639810pfq.165.1464086739606; Tue, 24 May 2016 03:45:39 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id bm3si4071433pad.35.2016.05.24.03.45.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 03:45:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-428134-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-428134-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-428134-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=V768Cx/ccPCH3IcluvqvDxpJqYuHRBl3nuR6uvv4CBmtfe 7eumyqG/6KWsFsdrtrTIY9w+mA5z7rCwTw4plyrxO7oSgE+20c7m3SSRp3OWdqDY Xsw/GF7HPqbzz0UKgcmD1+YM4/9BCDnDB7xtkic7WurV2Kwma60Beghh6MFTk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=KG2sDjgoQGqUSkyFJYrjaHgeqt8=; b=TFYFtAZjGElUPUQ0wpob yqhNledNKTEFQZ4N2yAGiDgEho9fZEQ6VnhxbnPmYKeqQ1g4TBpk3mnrAXnNXdJ3 acJ6dc5w8gIUHe/TMb+YCesaQqBGYkdAPNSH6XzEtEn1XJ/zAs4ktE1xZy4bkQ3l wQmwhdlP+HJO58bEAIuxqnk= Received: (qmail 9992 invoked by alias); 24 May 2016 10:43:41 -0000 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 Received: (qmail 2255 invoked by uid 89); 24 May 2016 10:43:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=PRIVATE X-HELO: mail-qk0-f173.google.com Received: from mail-qk0-f173.google.com (HELO mail-qk0-f173.google.com) (209.85.220.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 24 May 2016 10:38:45 +0000 Received: by mail-qk0-f173.google.com with SMTP id x7so7747596qkd.3 for ; Tue, 24 May 2016 03:38:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=1xv5QMa4OEljIo/+L4P0YlqQareSmJDAoPmpvGmH3vY=; b=Euw38dQlcyeuO8Gmirgqyp06fderg3GjLWTMStOe8P2JSW++PMOnxu9CIgdp7v/z1i a1orMMLlOgHwZAVyPrFKrLlRVS2nX/mnJy5k/ebhPUtifi61gYB5wrB3kyVpMNzEnYEg ecLNsLkrz3KVpIx/v5wSIYOLAYzxnXtNd7eOmCbxS6jcqcG1duBdZDwTVUbK6aQk7ShW 343x1XzdcgcskNMvFcSh+LbbpVvH8aIvlytBzU5AZiNBuSiFKiMPIrrAs85gfV+QdL5b FYMfvLMvNapxRzhhg2i8O/z4EeF8SM8iLDvRygdk3uZ9Iy8nodkbPvMccw2k+H5QQH7V 6DAg== X-Gm-Message-State: ALyK8tKJ4d8TyYZ6Ibxqxm5iwmac8K1UoA+LfWcKCS6GQkgtVjpRzL8A0Djxqe2fqbVgsxgQt8iflDoACg4LxiW+ MIME-Version: 1.0 X-Received: by 10.55.172.6 with SMTP id v6mr2357587qke.98.1464086309765; Tue, 24 May 2016 03:38:29 -0700 (PDT) Received: by 10.200.42.71 with HTTP; Tue, 24 May 2016 03:38:29 -0700 (PDT) Date: Tue, 24 May 2016 20:38:29 +1000 Message-ID: Subject: [PR71252][PATCH] ICE: verify_ssa failed From: Kugan Vivekanandarajah To: "gcc-patches@gcc.gnu.org" , Richard Biener X-IsSubscribed: yes Hi, In build_and_add_sum, new stmt is created and inserted (which is the actual use stmt). Therefore stmt_to_insert has to be inserted after this is created. This patch moves it after. I don’t know how I can reduce the Fortran test-case so adding the test-case from bug report. Any help in reducing the test-case is appreciated. Regression testing on x86_64-linux-gnu and bootstrap didn’t find any new issues. Is this OK for trunk? Thanks, Kugan gcc/testsuite/ChangeLog: 2016-05-24 Kugan Vivekanandarajah * gfortran.dg/pr71252.f90: New test. gcc/ChangeLog: 2016-05-24 Kugan Vivekanandarajah * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Add stmt_to_insert after build_and_add_sum creates new use stmt. diff --git a/gcc/testsuite/gfortran.dg/pr71252.f90 b/gcc/testsuite/gfortran.dg/pr71252.f90 index e69de29..dae210b 100644 --- a/gcc/testsuite/gfortran.dg/pr71252.f90 +++ b/gcc/testsuite/gfortran.dg/pr71252.f90 @@ -0,0 +1,88 @@ + +! { dg-do compile } +! { dg-options "-O1 -ffast-math" } + +MODULE xc_b97 + INTEGER, PARAMETER :: dp=8 + PRIVATE + PUBLIC :: b97_lda_info, b97_lsd_info, b97_lda_eval, b97_lsd_eval +CONTAINS + SUBROUTINE b97_lsd_eval(rho_set,deriv_set,grad_deriv,b97_params) + INTEGER, INTENT(in) :: grad_deriv + INTEGER :: handle, npoints, param, stat + LOGICAL :: failure + REAL(kind=dp) :: epsilon_drho, epsilon_rho, & + scale_c, scale_x + REAL(kind=dp), DIMENSION(:, :, :), POINTER :: dummy, e_0, e_ndra, & + e_ndra_ndra, e_ndra_ndrb, e_ndra_ra, e_ndra_rb, e_ndrb, e_ndrb_ndrb, & + e_ndrb_ra, e_ndrb_rb, e_ra, e_ra_ra, e_ra_rb, e_rb, e_rb_rb, & + norm_drhoa, norm_drhob, rhoa, rhob + IF (.NOT. failure) THEN + CALL b97_lsd_calc(& + rhoa=rhoa, rhob=rhob, norm_drhoa=norm_drhoa,& + norm_drhob=norm_drhob, e_0=e_0, & + e_ra=e_ra, e_rb=e_rb, & + e_ndra=e_ndra, e_ndrb=e_ndrb, & + e_ra_ra=e_ra_ra, e_ra_rb=e_ra_rb, e_rb_rb=e_rb_rb,& + e_ra_ndra=e_ndra_ra, e_ra_ndrb=e_ndrb_ra, & + e_rb_ndrb=e_ndrb_rb, e_rb_ndra=e_ndra_rb,& + e_ndra_ndra=e_ndra_ndra, e_ndrb_ndrb=e_ndrb_ndrb,& + e_ndra_ndrb=e_ndra_ndrb,& + grad_deriv=grad_deriv, npoints=npoints, & + epsilon_rho=epsilon_rho,epsilon_drho=epsilon_drho,& + param=param,scale_c_in=scale_c,scale_x_in=scale_x) + END IF + END SUBROUTINE b97_lsd_eval + SUBROUTINE b97_lsd_calc(rhoa, rhob, norm_drhoa, norm_drhob,& + e_0, e_ra, e_rb, e_ndra, e_ndrb, & + e_ra_ndra,e_ra_ndrb, e_rb_ndra, e_rb_ndrb,& + e_ndra_ndra, e_ndrb_ndrb, e_ndra_ndrb, & + e_ra_ra, e_ra_rb, e_rb_rb,& + grad_deriv,npoints,epsilon_rho,epsilon_drho, & + param, scale_c_in, scale_x_in) + REAL(kind=dp), DIMENSION(*), INTENT(in) :: rhoa, rhob, norm_drhoa, & + norm_drhob + REAL(kind=dp), DIMENSION(*), INTENT(inout) :: e_0, e_ra, e_rb, e_ndra, & + e_ndrb, e_ra_ndra, e_ra_ndrb, e_rb_ndra, e_rb_ndrb, e_ndra_ndra, & + e_ndrb_ndrb, e_ndra_ndrb, e_ra_ra, e_ra_rb, e_rb_rb + INTEGER, INTENT(in) :: grad_deriv, npoints + REAL(kind=dp), INTENT(in) :: epsilon_rho, epsilon_drho + INTEGER, INTENT(in) :: param + REAL(kind=dp), INTENT(in) :: scale_c_in, scale_x_in + REAL(kind=dp) :: A_1, A_2, A_3, alpha_1_1, alpha_1_2, alpha_1_3, alpha_c, & + t133, t134, t1341, t1348, t1351, t1360, t1368, t138, t1388, t139, & + u_x_bnorm_drhobnorm_drhob, u_x_brhob, u_x_brhobnorm_drhob, u_x_brhobrhob + SELECT CASE(grad_deriv) + CASE default + DO ii=1,npoints + IF (rho>epsilon_rho) THEN + IF (grad_deriv/=0) THEN + IF (grad_deriv>1 .OR. grad_deriv<-1) THEN + alpha_c1rhob = alpha_crhob + f1rhob = frhob + t1360 = -0.4e1_dp * t105 * t290 * chirhobrhob + (-0.2e1_dp * t239 & + * t257 + t709 * t1236 * t711 * t62 / 0.2e1_dp - e_c_u_0rhobrhob) * f& + * t108 + t438 * f1rhob * t108 + 0.4e1_dp * t439 * t443 + t1341 * & + 0.4e1_dp * t1348 * t443 + 0.4e1_dp * t1351 * t443 + 0.12e2_dp * t113& + * t107 * t1299 + 0.4e1_dp * t113 * t289 * chirhobrhob + IF (grad_deriv>1 .OR. grad_deriv==-2) THEN + exc_rhob_rhob = scale_x * (-t4 * t6 / t1152 * gx_b / & + 0.6e1_dp + e_lsda_x_brhob * (u_x_b1rhob * t31 + u_x_b * u_x_b1rhob *& + u_x_brhobrhob * c_x_2)) + scale_c * (((e_c_u_0rhobrhob + (0.2e1_dp *& + t726 * t1270 * t278 - t266 * (-t731 * t1205 / 0.4e1_dp + t267 * & + t1205 * t647) * t278 - t757 * t1270 * t759 * t80 / 0.2e1_dp) * f * & + t110 + alpha_crhob * f1rhob * t110 - 0.4e1_dp * t431 * t435 + & + alpha_c1rhob * frhob * t110 + alpha_c * frhobrhob * t110 - 0.4e1_dp & + * t433 * t435 - 0.4e1_dp * t1321 * t435 - 0.4e1_dp * t1324 * t435 - & + 0.12e2_dp * t105 * t796 * t1299 + t1360) * rho + epsilon_c_unifrhob & + * c_css_2)) + e_rb_rb(ii)=e_rb_rb(ii)+exc_rhob_rhob + END IF + END IF ! <1 || >1 + END IF ! /=0 + END IF ! rho>epsilon_rho + END DO + END SELECT + END SUBROUTINE b97_lsd_calc +END MODULE xc_b97 + diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index fb683ad..28823a2 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -4091,24 +4091,30 @@ rewrite_expr_tree_parallel (gassign *stmt, int width, print_gimple_stmt (dump_file, stmts[i], 0, 0); } - /* If the stmt that defines operand has to be inserted, insert it - before the use. */ - if (stmt1) - insert_stmt_before_use (stmts[i], stmt1); - if (stmt2) - insert_stmt_before_use (stmts[i], stmt2); - /* We keep original statement only for the last one. All others are recreated. */ if (i == stmt_num - 1) { + /* If the stmt that defines operand has to be inserted, insert it + before the use. */ + if (stmt1) + insert_stmt_before_use (stmts[i], stmt1); + if (stmt2) + insert_stmt_before_use (stmts[i], stmt2); gimple_assign_set_rhs1 (stmts[i], op1); gimple_assign_set_rhs2 (stmts[i], op2); update_stmt (stmts[i]); } else - stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode); - + { + stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode); + /* If the stmt that defines operand has to be inserted, insert it + before new build_and_add stmt after it is created. */ + if (stmt1) + insert_stmt_before_use (stmts[i], stmt1); + if (stmt2) + insert_stmt_before_use (stmts[i], stmt2); + } if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " into ");