From 425f5fd4c444a75ea0a7fec02d49d3814c724f67 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 May 2019 10:20:38 +0200 Subject: [PATCH] re PR tree-optimization/90385 (ICE: tree check: expected ssa_name, have real_cst in transform_to_exit_first_loop_alt, at tree-parloops.c:1772) PR tree-optimization/90385 * tree-parloops.c (try_create_reduction_list): Punt on non-SSA_NAME arguments of the exit phis. * gfortran.dg/pr90385.f90: New test. From-SVN: r271059 --- gcc/ChangeLog | 4 ++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gfortran.dg/pr90385.f90 | 6 ++++++ gcc/tree-parloops.c | 10 +++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr90385.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1b912307c0..0379ead802a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-05-10 Jakub Jelinek + PR tree-optimization/90385 + * tree-parloops.c (try_create_reduction_list): Punt on non-SSA_NAME + arguments of the exit phis. + PR c++/90383 * tree-inline.h (struct copy_body_data): Add do_not_fold member. * tree-inline.c (remap_gimple_op_r): Avoid folding expressions if diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ca0b5a2a2e..b42e68cf849 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-05-10 Jakub Jelinek + PR tree-optimization/90385 + * gfortran.dg/pr90385.f90: New test. + PR c++/90383 * g++.dg/cpp1y/constexpr-90383-1.C: New test. * g++.dg/cpp1y/constexpr-90383-2.C: New test. diff --git a/gcc/testsuite/gfortran.dg/pr90385.f90 b/gcc/testsuite/gfortran.dg/pr90385.f90 new file mode 100644 index 00000000000..5ce34aa5bd5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr90385.f90 @@ -0,0 +1,6 @@ +! PR tree-optimization/90385 +! { dg-do compile } +! { dg-require-effective-target pthread } +! { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-forwprop -fno-tree-sink --param parloops-min-per-thread=5" } + +include 'array_constructor_47.f90' diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 968368f7f44..9de154e722f 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2794,8 +2794,16 @@ try_create_reduction_list (loop_p loop, gimple *reduc_phi; tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit); - if (TREE_CODE (val) == SSA_NAME && !virtual_operand_p (val)) + if (!virtual_operand_p (val)) { + if (TREE_CODE (val) != SSA_NAME) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + " FAILED: exit PHI argument invariant.\n"); + return false; + } + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "phi is "); -- 2.30.2