From 2679730bab0202e7591adc6ac0ea1347b8954983 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 2 Dec 2019 10:50:45 +0000 Subject: [PATCH] re PR tree-optimization/92742 (ICE in info_for_reduction, at tree-vect-loop.c:4367) 2019-12-02 Richard Biener PR tree-optimization/92742 * tree-vect-loop.c (vect_fixup_reduc_chain): Do not touch the def-type but verify it is consistent with the original stmts. * gcc.dg/torture/pr92742.c: New testcase. From-SVN: r278896 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr92742.c | 20 ++++++++++++++++++++ gcc/tree-vect-loop.c | 3 ++- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr92742.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b324211554..1d342f4cf10 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-12-02 Richard Biener + + PR tree-optimization/92742 + * tree-vect-loop.c (vect_fixup_reduc_chain): Do not + touch the def-type but verify it is consistent with the + original stmts. + 2019-12-02 Jakub Jelinek PR tree-optimization/92712 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12abe735bbf..03fb4d9ed80 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-02 Richard Biener + + PR tree-optimization/92742 + * gcc.dg/torture/pr92742.c: New testcase. + 2019-12-02 Jakub Jelinek PR tree-optimization/92712 diff --git a/gcc/testsuite/gcc.dg/torture/pr92742.c b/gcc/testsuite/gcc.dg/torture/pr92742.c new file mode 100644 index 00000000000..59e74c0616b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr92742.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +unsigned int qw; + +int +rs (int iq, int wg) +{ + for (qw = 0; qw < 2; ++qw) + { + } + + while (iq < 1) + { + wg *= qw * 2; + ++iq; + } + + return wg; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 77c5a9816e2..83b0e0b8ce9 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -643,6 +643,8 @@ vect_fixup_reduc_chain (stmt_vec_info stmt_info) do { stmtp = STMT_VINFO_RELATED_STMT (stmt_info); + gcc_checking_assert (STMT_VINFO_DEF_TYPE (stmtp) + == STMT_VINFO_DEF_TYPE (stmt_info)); REDUC_GROUP_FIRST_ELEMENT (stmtp) = firstp; stmt_info = REDUC_GROUP_NEXT_ELEMENT (stmt_info); if (stmt_info) @@ -650,7 +652,6 @@ vect_fixup_reduc_chain (stmt_vec_info stmt_info) = STMT_VINFO_RELATED_STMT (stmt_info); } while (stmt_info); - STMT_VINFO_DEF_TYPE (stmtp) = vect_reduction_def; } /* Fixup scalar cycles that now have their stmts detected as patterns. */ -- 2.30.2