Commit 86290011 by Richard Guenther Committed by Richard Biener

Makefile.in (tree-ssa-copy.o): Add $(CFGLOOP_H) dependency.

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.

From-SVN: r145551
parent a4d674fc
2009-04-04 Richard Guenther <rguenther@suse.de> 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.
2009-04-04 Richard Guenther <rguenther@suse.de>
* tree-ssa-operands.c (pop_stmt_changes): Remove automatic * tree-ssa-operands.c (pop_stmt_changes): Remove automatic
renaming code. renaming code.
......
...@@ -2124,7 +2124,8 @@ tree-nrv.o : tree-nrv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ...@@ -2124,7 +2124,8 @@ tree-nrv.o : tree-nrv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-ssa-copy.o : tree-ssa-copy.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ tree-ssa-copy.o : tree-ssa-copy.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \
$(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \ $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(BASIC_BLOCK_H) tree-pass.h langhooks.h tree-ssa-propagate.h $(FLAGS_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h tree-ssa-propagate.h $(FLAGS_H) \
$(CFGLOOP_H)
tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \ tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
$(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
......
...@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h" #include "tree-pass.h"
#include "tree-ssa-propagate.h" #include "tree-ssa-propagate.h"
#include "langhooks.h" #include "langhooks.h"
#include "cfgloop.h"
/* This file implements the copy propagation pass and provides a /* This file implements the copy propagation pass and provides a
handful of interfaces for performing const/copy propagation and handful of interfaces for performing const/copy propagation and
...@@ -885,7 +886,13 @@ init_copy_prop (void) ...@@ -885,7 +886,13 @@ init_copy_prop (void)
tree def; tree def;
def = gimple_phi_result (phi); def = gimple_phi_result (phi);
if (!is_gimple_reg (def)) if (!is_gimple_reg (def)
/* In loop-closed SSA form do not copy-propagate through
PHI nodes. Technically this is only needed for loop
exit PHIs, but this is difficult to query. */
|| (current_loops
&& gimple_phi_num_args (phi) == 1
&& loops_state_satisfies_p (LOOP_CLOSED_SSA)))
prop_set_simulate_again (phi, false); prop_set_simulate_again (phi, false);
else else
prop_set_simulate_again (phi, true); prop_set_simulate_again (phi, true);
......
...@@ -3388,23 +3388,33 @@ vect_transform_loop (loop_vec_info loop_vinfo) ...@@ -3388,23 +3388,33 @@ vect_transform_loop (loop_vec_info loop_vinfo)
bool strided_store; bool strided_store;
bool slp_scheduled = false; bool slp_scheduled = false;
unsigned int nunits; 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)) if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vec_transform_loop ==="); 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)) if (VEC_length (gimple, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo))
|| VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (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 /* CHECKME: we wouldn't need this if we called update_ssa once
for all loops. */ for all loops. */
bitmap_zero (vect_memsyms_to_rename); 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 /* 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 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) ...@@ -3414,10 +3424,9 @@ vect_transform_loop (loop_vec_info loop_vinfo)
will remain scalar and will compute the remaining (n%VF) iterations. will remain scalar and will compute the remaining (n%VF) iterations.
(VF is the vectorization factor). */ (VF is the vectorization factor). */
if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) if (do_peeling_for_loop_bound)
|| (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) vect_do_peeling_for_loop_bound (loop_vinfo, &ratio,
&& LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0)) cond_expr, cond_expr_stmt_list);
vect_do_peeling_for_loop_bound (loop_vinfo, &ratio);
else else
ratio = build_int_cst (TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)), ratio = build_int_cst (TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)),
LOOP_VINFO_INT_NITERS (loop_vinfo) / vectorization_factor); LOOP_VINFO_INT_NITERS (loop_vinfo) / vectorization_factor);
......
...@@ -706,8 +706,9 @@ extern bitmap vect_memsyms_to_rename; ...@@ -706,8 +706,9 @@ extern bitmap vect_memsyms_to_rename;
in tree-vect-loop-manip.c. */ in tree-vect-loop-manip.c. */
extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree); extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge); extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
extern void vect_loop_versioning (loop_vec_info); extern void vect_loop_versioning (loop_vec_info, bool, tree *, gimple_seq *);
extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree *); extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree *,
tree, gimple_seq);
extern void vect_do_peeling_for_alignment (loop_vec_info); extern void vect_do_peeling_for_alignment (loop_vec_info);
extern LOC find_loop_location (struct loop *); extern LOC find_loop_location (struct loop *);
extern bool vect_can_advance_ivs_p (loop_vec_info); extern bool vect_can_advance_ivs_p (loop_vec_info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment