From 3d9bab5a54c1a0757cd88276f44b6fe6fa7ed51b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Feb 2015 13:36:00 +0000 Subject: [PATCH] re PR tree-optimization/61917 (ICE on valid code at -O3 on x86_64-linux-gnu in vectorizable_reduction, at tree-vect-loop.c:4913) 2015-02-25 Richard Biener Kai Tietz PR tree-optimization/61917 * tree-vect-loop.c (vectorizable_reduction): Allow vect_internal_def without reduction to exit graceful. Co-Authored-By: Kai Tietz From-SVN: r220966 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-loop.c | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6034118729..d4304cd71ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-02-25 Richard Biener + Kai Tietz + + PR tree-optimization/61917 + * tree-vect-loop.c (vectorizable_reduction): Allow + vect_internal_def without reduction to exit graceful. + 2015-02-25 Georg-Johann Lay PR target/65196 diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 3e7c701e636..5a151fc1859 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4981,6 +4981,12 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, if (!vectype_in) vectype_in = tem; gcc_assert (is_simple_use); + if (!found_nested_cycle_def) + reduc_def_stmt = def_stmt; + + if (gimple_code (reduc_def_stmt) != GIMPLE_PHI) + return false; + if (!(dt == vect_reduction_def || dt == vect_nested_cycle || ((dt == vect_internal_def || dt == vect_external_def @@ -4993,10 +4999,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, gcc_assert (orig_stmt); return false; } - if (!found_nested_cycle_def) - reduc_def_stmt = def_stmt; - gcc_assert (gimple_code (reduc_def_stmt) == GIMPLE_PHI); if (orig_stmt) gcc_assert (orig_stmt == vect_is_simple_reduction (loop_vinfo, reduc_def_stmt, -- 2.30.2