From 51e28fffbec42be94bd281b0234a38774bdf6c21 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 20 Oct 2017 13:43:47 +0000 Subject: [PATCH] re PR tree-optimization/82473 (ICE in vect_get_vec_def_for_stmt_copy, at tree-vect-stmts.c:1524) 2017-10-20 Richard Biener PR tree-optimization/82473 * tree-vect-loop.c (vectorizable_reduction): Properly get at the largest input type. * gcc.dg/torture/pr82473.c: New testcase. From-SVN: r253937 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr82473.c | 22 ++++++++++++++++++++++ gcc/tree-vect-loop.c | 7 +++++-- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr82473.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d2bb89..054907b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-20 Richard Biener + + PR tree-optimization/82473 + * tree-vect-loop.c (vectorizable_reduction): Properly get at + the largest input type. + 2017-10-20 Igor Tsimbalist * c-attribs.c (handle_nocf_check_attribute): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2744146..d3d10dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-10-20 Richard Biener + PR tree-optimization/82473 + * gcc.dg/torture/pr82473.c: New testcase. + +2017-10-20 Richard Biener + PR tree-optimization/82603 * gcc.dg/torture/pr82603.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/torture/pr82473.c b/gcc/testsuite/gcc.dg/torture/pr82473.c new file mode 100644 index 0000000..b12de21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr82473.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +void +zz (int x9, short int gt) +{ + if (0) + { + while (gt < 1) + { + int pz; + +k6: + for (pz = 0; pz < 3; ++pz) + x9 += gt; + ++gt; + } + } + + if (x9 != 0) + goto k6; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7a0f9d5..7fb09c4 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5836,9 +5836,12 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, reduc_index = i; continue; } - else + else if (tem) { - if (!vectype_in) + /* To properly compute ncopies we are interested in the widest + input type in case we're looking at a widening accumulation. */ + if (!vectype_in + || TYPE_VECTOR_SUBPARTS (vectype_in) > TYPE_VECTOR_SUBPARTS (tem)) vectype_in = tem; } -- 2.7.4