From ae7f3143a3876378d051e64c8e68718f27c41075 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 21 Oct 2019 11:32:25 +0000 Subject: [PATCH] re PR tree-optimization/92161 (ICE in vect_get_vec_def_for_stmt_copy, at tree-vect-stmts.c:1687) 2019-10-21 Richard Biener PR tree-optimization/92161 * tree-vect-loop.c (vect_analyze_loop_2): Reset stmts def-type for reductions. * gfortran.dg/pr92161.f: New testcase. From-SVN: r277240 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr92161.f | 23 +++++++++++++++++++++++ gcc/tree-vect-loop.c | 11 +++++++++++ 4 files changed, 45 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr92161.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b274478d1f1..259550ffc41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-21 Richard Biener + + PR tree-optimization/92161 + * tree-vect-loop.c (vect_analyze_loop_2): Reset stmts def-type + for reductions. + 2019-10-21 Kyrylo Tkachov * config/aarch64/aarch64.md (UNSPEC_RNDR, UNSPEC_RNDRRS): Define. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fd1fd56f24..d958e642ee0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-21 Richard Biener + + PR tree-optimization/92161 + * gfortran.dg/pr92161.f: New testcase. + 2019-10-21 Kyrylo Tkachov * gcc.target/aarch64/acle/rng_1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr92161.f b/gcc/testsuite/gfortran.dg/pr92161.f new file mode 100644 index 00000000000..11f1edf6ac0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr92161.f @@ -0,0 +1,23 @@ +! { dg-do compile } +! { dg-options "-O1 -ftree-loop-vectorize -fno-signed-zeros -fno-trapping-math" } +! { dg-additional-options "-mvsx" { target { powerpc*-*-* } } } + COMPLEX FUNCTION R1 (ZR, CC, EA, U6) + + INTEGER ZR, U6, FZ, J2 + COMPLEX EA(*), CC + DOUBLE PRECISION OS, GA, YU, XT + + OS = DBLE(REAL(CC)) + GA = DBLE(AIMAG(CC)) + J2 = 1 + + DO 5 FZ = 1, ZR + YU = DBLE(REAL(EA(J2))) + XT = DBLE(AIMAG(EA(J2))) + OS = OS + (YU * 2) - (XT * 2) + GA = GA + (YU * 3) + (XT * 3) + J2 = J2 + U6 + 5 CONTINUE + R1 = CMPLX(REAL(OS), REAL(GA)) + RETURN + END diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index d073620befb..a7f19ca4beb 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2260,6 +2260,17 @@ again: { stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); STMT_SLP_TYPE (stmt_info) = loop_vect; + if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def + || STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def) + { + /* vectorizable_reduction adjusts reduction stmt def-types, + restore them to that of the PHI. */ + STMT_VINFO_DEF_TYPE (STMT_VINFO_REDUC_DEF (stmt_info)) + = STMT_VINFO_DEF_TYPE (stmt_info); + STMT_VINFO_DEF_TYPE (vect_stmt_to_vectorize + (STMT_VINFO_REDUC_DEF (stmt_info))) + = STMT_VINFO_DEF_TYPE (stmt_info); + } } for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) -- 2.30.2