diff options
author | Richard Biener <rguenther@suse.de> | 2019-11-04 14:50:11 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-11-04 14:50:11 +0000 |
commit | a6ba623777513e31721030092e4d786f461a0f06 (patch) | |
tree | 50191fd7a90f87d35c5946d77884152bb82d1e39 /gcc | |
parent | 7237f93eb3aaecb27800ce1688ece4c4cbcb790b (diff) | |
download | gcc-a6ba623777513e31721030092e4d786f461a0f06.zip gcc-a6ba623777513e31721030092e4d786f461a0f06.tar.gz gcc-a6ba623777513e31721030092e4d786f461a0f06.tar.bz2 |
re PR tree-optimization/92345 (ICE in vec<_stmt_vec_info*, va_heap, vl_embed>::space (vect_get_and_check_slp_defs))
2019-11-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/92345
* tree-vect-loop.c (vect_is_simple_reduction): Return whether
we produced a reduction chain.
(vect_analyze_scalar_cycles_1): Do not add reduction chains to
LOOP_VINFO_REDUCTIONS.
* gcc.dg/torture/pr92345.c: New testcase.
From-SVN: r277782
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr92345.c | 18 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 13 |
4 files changed, 39 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9222a8..ae177e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-11-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/92345 + * tree-vect-loop.c (vect_is_simple_reduction): Return whether + we produced a reduction chain. + (vect_analyze_scalar_cycles_1): Do not add reduction chains to + LOOP_VINFO_REDUCTIONS. + 2019-11-04 Jan Hubicka <jh@suse.cz> * cgraphclones.c (cgraph_node::create_version_clone): Do not diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f7acb3..a44eca5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/92345 + * gcc.dg/torture/pr92345.c: New testcase. + 2019-11-04 Jozef Lawrynowicz <jozef.l@mittosystems.com> * gcc.target/msp430/tiny-printf.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr92345.c b/gcc/testsuite/gcc.dg/torture/pr92345.c new file mode 100644 index 0000000..331615b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr92345.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +long int x1; +int fr; + +int +us (int sk, int jx) +{ + while (sk < 1) + { + jx *= 2; + fr += x1 + 1; + ++sk; + } + + return jx; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index fa873e9..9d31381 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -155,7 +155,7 @@ along with GCC; see the file COPYING3. If not see static void vect_estimate_min_profitable_iters (loop_vec_info, int *, int *); static stmt_vec_info vect_is_simple_reduction (loop_vec_info, stmt_vec_info, - bool *); + bool *, bool *); /* Subroutine of vect_determine_vf_for_stmt that handles only one statement. VECTYPE_MAYBE_SET_P is true if STMT_VINFO_VECTYPE @@ -489,7 +489,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, class loop *loop) tree init, step; auto_vec<stmt_vec_info, 64> worklist; gphi_iterator gsi; - bool double_reduc; + bool double_reduc, reduc_chain; DUMP_VECT_SCOPE ("vect_analyze_scalar_cycles"); @@ -561,7 +561,8 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, class loop *loop) && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_unknown_def_type); stmt_vec_info reduc_stmt_info - = vect_is_simple_reduction (loop_vinfo, stmt_vinfo, &double_reduc); + = vect_is_simple_reduction (loop_vinfo, stmt_vinfo, &double_reduc, + &reduc_chain); if (reduc_stmt_info) { STMT_VINFO_REDUC_DEF (stmt_vinfo) = reduc_stmt_info; @@ -596,7 +597,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, class loop *loop) /* Store the reduction cycles for possible vectorization in loop-aware SLP if it was not detected as reduction chain. */ - if (! REDUC_GROUP_FIRST_ELEMENT (reduc_stmt_info)) + if (! reduc_chain) LOOP_VINFO_REDUCTIONS (loop_vinfo).safe_push (reduc_stmt_info); } @@ -2854,7 +2855,7 @@ check_reduction_path (dump_user_location_t loc, loop_p loop, gphi *phi, static stmt_vec_info vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, - bool *double_reduc) + bool *double_reduc, bool *reduc_chain_p) { gphi *phi = as_a <gphi *> (phi_info->stmt); gimple *phi_use_stmt = NULL; @@ -2862,6 +2863,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, use_operand_p use_p; *double_reduc = false; + *reduc_chain_p = false; STMT_VINFO_REDUC_TYPE (phi_info) = TREE_CODE_REDUCTION; tree phi_name = PHI_RESULT (phi); @@ -3036,6 +3038,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, LOOP_VINFO_REDUCTION_CHAINS (loop_info).safe_push (reduc_chain[0]); REDUC_GROUP_SIZE (reduc_chain[0]) = reduc_chain.length (); + *reduc_chain_p = true; if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "reduction: detected reduction chain\n"); |