From: Kugan Vivekanandarajah Date: Tue, 24 May 2016 10:50:01 +0000 (+0000) Subject: re PR tree-optimization/71252 (ICE: verify_ssa failed : definition in block 7 does... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca6f60bc49de2ff3d150b6393148bdc468967eec;p=gcc.git re PR tree-optimization/71252 (ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6) gcc/testsuite/ChangeLog: 2016-05-24 Kugan Vivekanandarajah PR middle-end/71252 * gfortran.dg/pr71252.f90: New test. gcc/ChangeLog: 2016-05-24 Kugan Vivekanandarajah PR middle-end/71252 * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Add stmt_to_insert after build_and_add_sum creates new use stmt. From-SVN: r236634 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f726b2c649..4dc6e7de1a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-24 Kugan Vivekanandarajah + + PR middle-end/71252 + * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Add stmt_to_insert after + build_and_add_sum creates new use stmt. + 2016-05-24 Richard Sandiford * tree-vect-stmts.c (vectorizable_load): Reorder checks so that diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb78cc2c580..47ddcf0bd58 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-24 Kugan Vivekanandarajah + + PR middle-end/71252 + * gfortran.dg/pr71252.f90: New test. + 2016-05-24 Richard Sandiford * gcc.dg/vect/vect-load-lanes-peeling-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr71252.f90 b/gcc/testsuite/gfortran.dg/pr71252.f90 new file mode 100644 index 00000000000..dae210b27a2 --- /dev/null +++ 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 fb683adc9cc..28823a2c7e6 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 ");