summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-04 20:53:39 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-04 20:53:39 +0000
commit23a3430de3127bdade43a22298b23d1f0291d892 (patch)
tree26dd248daf0fd14b57c7421d9111153fca35cc05 /gcc/tree-vect-loop.c
parenta409f9278ec98a2124072df78c9553d5c0066900 (diff)
downloadgcc-23a3430de3127bdade43a22298b23d1f0291d892.tar.gz
2009-04-04 Richard Guenther <rguenther@suse.de>
* Makefile.in (tree-ssa-copy.o): Add $(CFGLOOP_H) dependency. * tree-ssa-copy.c (init_copy_prop): Do not propagate through single-argument PHIs if we are in loop-closed SSA form. * tree-vect-loop-manip.c (slpeel_add_loop_guard): Pass extra guards for the pre-condition. (slpeel_tree_peel_loop_to_edge): Likewise. (vect_build_loop_niters): Take an optional sequence to append stmts. (vect_generate_tmps_on_preheader): Likewise. (vect_do_peeling_for_loop_bound): Take extra guards for the pre-condition. (vect_do_peeling_for_alignment): Adjust. Unconditionally apply the cost model check. (vect_loop_versioning): Take stmt and stmt list to put pre-condition guards if we are going to peel. Do not apply versioning in that case. * tree-vectorizer.h (vect_loop_versioning): Adjust declaration. (vect_do_peeling_for_loop_bound): Likewise. * tree-vect-loop.c (vect_transform_loop): If we are peeling for loop bound only record extra pre-conditions, do not apply loop versioning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145551 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 77dcdd6137a..9ae4403f38c 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3388,23 +3388,33 @@ vect_transform_loop (loop_vec_info loop_vinfo)
bool strided_store;
bool slp_scheduled = false;
unsigned int nunits;
+ tree cond_expr = NULL_TREE;
+ gimple_seq cond_expr_stmt_list = NULL;
+ bool do_peeling_for_loop_bound;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vec_transform_loop ===");
+ /* Peel the loop if there are data refs with unknown alignment.
+ Only one data ref with unknown store is allowed. */
+
+ if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
+ vect_do_peeling_for_alignment (loop_vinfo);
+
+ do_peeling_for_loop_bound
+ = (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ || (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0));
+
if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
|| VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)))
- vect_loop_versioning (loop_vinfo);
+ vect_loop_versioning (loop_vinfo,
+ !do_peeling_for_loop_bound,
+ &cond_expr, &cond_expr_stmt_list);
/* CHECKME: we wouldn't need this if we called update_ssa once
for all loops. */
bitmap_zero (vect_memsyms_to_rename);
-
- /* Peel the loop if there are data refs with unknown alignment.
- Only one data ref with unknown store is allowed. */
-
- if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
- vect_do_peeling_for_alignment (loop_vinfo);
/* If the loop has a symbolic number of iterations 'n' (i.e. it's not a
compile time constant), or it is a constant that doesn't divide by the
@@ -3414,10 +3424,9 @@ vect_transform_loop (loop_vec_info loop_vinfo)
will remain scalar and will compute the remaining (n%VF) iterations.
(VF is the vectorization factor). */
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- || (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0))
- vect_do_peeling_for_loop_bound (loop_vinfo, &ratio);
+ if (do_peeling_for_loop_bound)
+ vect_do_peeling_for_loop_bound (loop_vinfo, &ratio,
+ cond_expr, cond_expr_stmt_list);
else
ratio = build_int_cst (TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)),
LOOP_VINFO_INT_NITERS (loop_vinfo) / vectorization_factor);