From fadb01364d36a50836201bc9a6a03e525d267967 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Sep 2019 13:09:25 +0000 Subject: [PATCH] re PR tree-optimization/91896 (ICE in vect_get_vec_def_for_stmt_copy, at tree-vect-stmts.c:1687) 2019-09-25 Richard Biener PR tree-optimization/91896 * tree-vect-loop.c (vectorizable_reduction): The single def-use cycle optimization cannot apply when there's more than one pattern stmt involved. * gcc.dg/torture/pr91896.c: New testcase. From-SVN: r276123 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr91896.c | 18 ++++++++++++++++++ gcc/tree-vect-loop.c | 4 ++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr91896.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6450f18b53f..f14a598e434 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-25 Richard Biener + + PR tree-optimization/91896 + * tree-vect-loop.c (vectorizable_reduction): The single + def-use cycle optimization cannot apply when there's more + than one pattern stmt involved. + 2019-09-24 Iain Sandoe * config/rs6000/rs6000.md (load_macho_picbase_): New, using diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f94813385e8..bf03a5e3c9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-25 Richard Biener + + PR tree-optimization/91896 + * gcc.dg/torture/pr91896.c: New testcase. + 2019-09-25 Martin Liska * gcc.target/s390/pr91014.c: Move to ... diff --git a/gcc/testsuite/gcc.dg/torture/pr91896.c b/gcc/testsuite/gcc.dg/torture/pr91896.c new file mode 100644 index 00000000000..e728538bb9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91896.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +unsigned int +zj (unsigned int et) +{ + signed char jr = 0; + + do { + et *= 3; + jr += 2; + } while (jr >= 0); + + if (et == (unsigned int) jr) + et = 0; + + return et; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index bc705d8e9be..ec00912e67d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6101,6 +6101,8 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, if (ncopies > 1 && STMT_VINFO_RELEVANT (reduc_stmt_info) <= vect_used_only_live && (use_stmt_info = loop_vinfo->lookup_single_use (phi_result)) + && (!STMT_VINFO_IN_PATTERN_P (use_stmt_info) + || !STMT_VINFO_PATTERN_DEF_SEQ (use_stmt_info)) && vect_stmt_to_vectorize (use_stmt_info) == reduc_stmt_info) single_defuse_cycle = true; @@ -6868,6 +6870,8 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, if (ncopies > 1 && (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live) && (use_stmt_info = loop_vinfo->lookup_single_use (reduc_phi_result)) + && (!STMT_VINFO_IN_PATTERN_P (use_stmt_info) + || !STMT_VINFO_PATTERN_DEF_SEQ (use_stmt_info)) && vect_stmt_to_vectorize (use_stmt_info) == stmt_info) { single_defuse_cycle = true; -- 2.30.2