From: Richard Sandiford Date: Wed, 16 Nov 2016 14:21:32 +0000 (+0000) Subject: Fix nb_iterations calculation in tree-vect-loop-manip.c X-Git-Tag: basepoints/gcc-8~3095 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=711188895e4d910aef399ac37084627e003433a8;p=thirdparty%2Fgcc.git Fix nb_iterations calculation in tree-vect-loop-manip.c We previously stored the number of loop iterations rather than the number of latch iterations. gcc/ 2016-11-15 Richard Sandiford Alan Hayward David Sherwood * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Set nb_iterations to the number of latch iterations rather than the number of loop iterations. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r242493 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 722b94bff35b..cd59b0280c83 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-11-16 Richard Sandiford + Alan Hayward + David Sherwood + + * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Set + nb_iterations to the number of latch iterations rather than the + number of loop iterations. + 2016-11-16 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 6bfd332a1019..4c6b8c7459c4 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -285,7 +285,10 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters) LOCATION_LINE (loop_loc)); dump_gimple_stmt (MSG_NOTE, TDF_SLIM, cond_stmt, 0); } - loop->nb_iterations = niters; + + /* Record the number of latch iterations. */ + loop->nb_iterations = fold_build2 (MINUS_EXPR, TREE_TYPE (niters), niters, + build_int_cst (TREE_TYPE (niters), 1)); } /* Helper routine of slpeel_tree_duplicate_loop_to_edge_cfg.