aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-11-06 14:49:30 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2012-11-06 13:49:30 +0000
commit22458c5af737bc36c02ff575f397cf40cb180dd6 (patch)
tree44114c90b1d256643a9aab059bc90c1f26b5f113 /gcc/tree-vect-loop.c
parentc8fef899e88a4978b1391d2cae4cd240c644afbe (diff)
downloadgcc-22458c5af737bc36c02ff575f397cf40cb180dd6.zip
gcc-22458c5af737bc36c02ff575f397cf40cb180dd6.tar.gz
gcc-22458c5af737bc36c02ff575f397cf40cb180dd6.tar.bz2
l_fma_float_?.c: Update.
* gcc.target/i386/l_fma_float_?.c: Update. * gcc.target/i386/l_fma_double_?.c: Update. * tree-vect-loop-manip.c (vect_do_peeling_for_loop_bound, vect_do_peeling_for_alignment): Fix loop bound computation. * tree-vect-loop.c (vect_transform_loop): Maintain loop bounds. From-SVN: r193241
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 908caed..5e99857 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -5448,10 +5448,16 @@ vect_transform_loop (loop_vec_info loop_vinfo)
bool transform_pattern_stmt = false;
bool check_profitability = false;
int th;
+ /* Record number of iterations before we started tampering with the profile. */
+ gcov_type expected_iterations = expected_loop_iterations_unbounded (loop);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "=== vec_transform_loop ===");
+ /* If profile is inprecise, we have chance to fix it up. */
+ if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
+ expected_iterations = LOOP_VINFO_INT_NITERS (loop_vinfo);
+
/* Use the more conservative vectorization threshold. If the number
of iterations is constant assume the cost check has been performed
by our caller. If the threshold makes all loops profitable that
@@ -5735,6 +5741,25 @@ vect_transform_loop (loop_vec_info loop_vinfo)
slpeel_make_loop_iterate_ntimes (loop, ratio);
+ /* Reduce loop iterations by the vectorization factor. */
+ scale_loop_profile (loop, RDIV (REG_BR_PROB_BASE , vectorization_factor),
+ expected_iterations / vectorization_factor);
+ loop->nb_iterations_upper_bound
+ = loop->nb_iterations_upper_bound.udiv (double_int::from_uhwi (vectorization_factor),
+ FLOOR_DIV_EXPR);
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
+ && loop->nb_iterations_upper_bound != double_int_zero)
+ loop->nb_iterations_upper_bound = loop->nb_iterations_upper_bound - double_int_one;
+ if (loop->any_estimate)
+ {
+ loop->nb_iterations_estimate
+ = loop->nb_iterations_estimate.udiv (double_int::from_uhwi (vectorization_factor),
+ FLOOR_DIV_EXPR);
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
+ && loop->nb_iterations_estimate != double_int_zero)
+ loop->nb_iterations_estimate = loop->nb_iterations_estimate - double_int_one;
+ }
+
/* The memory tags and pointers in vectorized statements need to
have their SSA forms updated. FIXME, why can't this be delayed
until all the loops have been transformed? */