aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-04-27 16:27:08 +0000
committerRichard Guenther <rguenther@suse.de>2008-04-27 16:27:08 +0000
commitba8e97a594e972d4673308a055664c69236750c3 (patch)
tree9a909683a7cb44b23b9f7839b7acb08f6bf9a976 /gcc/tree-ssa-loop.c
parentf72703622e14832a2818a5660d19d9aea81f9978 (diff)
2008-04-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/18754 PR tree-optimization/34223 * tree-pass.h (pass_complete_unrolli): Declare. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Print loop size before and after unconditionally of UL_NO_GROWTH in effect. Rewrite loop into loop closed SSA form if it is not already. (tree_unroll_loops_completely): Re-structure to iterate over innermost loops with intermediate CFG cleanups. Unroll outermost loops only if requested or the code does not grow doing so. * tree-ssa-loop.c (gate_tree_vectorize): Don't shortcut if no loops are available. (tree_vectorize): Instead do so here. (tree_complete_unroll): Also unroll outermost loops. (tree_complete_unroll_inner): New function. (gate_tree_complete_unroll_inner): Likewise. (pass_complete_unrolli): New pass. * tree-ssa-loop-manip.c (find_uses_to_rename_use): Only record uses outside of the loop. (tree_duplicate_loop_to_header_edge): Only verify loop-closed SSA form if it is available. * tree-flow.h (tree_unroll_loops_completely): Add extra parameter. * passes.c (init_optimization_passes): Schedule complete inner loop unrolling pass before the first CCP pass after final inlining. * gcc.dg/tree-ssa/loop-36.c: New testcase. * gcc.dg/tree-ssa/loop-37.c: Likewise. * gcc.dg/vect/vect-118.c: Likewise. * gcc.dg/Wunreachable-8.c: XFAIL bogus warning. * gcc.dg/vect/vect-66.c: Increase loop trip count. * gcc.dg/vect/no-section-anchors-vect-66.c: Likewise. * gcc.dg/vect/no-section-anchors-vect-69.c: Likewise. * gcc.dg/vect/vect-76.c: Likewise. * gcc.dg/vect/vect-outer-6.c: Likewise. * gcc.dg/vect/vect-outer-1.c: Likewise. * gcc.dg/vect/vect-outer-1a.c: Likewise. * gcc.dg/vect/vect-11a.c: Likewise. * gcc.dg/vect/vect-shift-1.c: Likewise. * gcc.target/i386/vectorize1.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@134730 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop.c')
-rw-r--r--gcc/tree-ssa-loop.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 639fb10a393..52f5a7f58f8 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -223,13 +223,16 @@ struct gimple_opt_pass pass_predcom =
static unsigned int
tree_vectorize (void)
{
+ if (number_of_loops () <= 1)
+ return 0;
+
return vectorize_loops ();
}
static bool
gate_tree_vectorize (void)
{
- return flag_tree_vectorize && number_of_loops () > 1;
+ return flag_tree_vectorize;
}
struct gimple_opt_pass pass_vectorize =
@@ -466,7 +469,7 @@ tree_complete_unroll (void)
return tree_unroll_loops_completely (flag_unroll_loops
|| flag_peel_loops
- || optimize >= 3);
+ || optimize >= 3, true);
}
static bool
@@ -495,6 +498,53 @@ struct gimple_opt_pass pass_complete_unroll =
}
};
+/* Complete unrolling of inner loops. */
+
+static unsigned int
+tree_complete_unroll_inner (void)
+{
+ unsigned ret = 0;
+
+ loop_optimizer_init (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS);
+ if (number_of_loops () > 1)
+ {
+ scev_initialize ();
+ ret = tree_unroll_loops_completely (optimize >= 3, false);
+ free_numbers_of_iterations_estimates ();
+ scev_finalize ();
+ }
+ loop_optimizer_finalize ();
+
+ return ret;
+}
+
+static bool
+gate_tree_complete_unroll_inner (void)
+{
+ return optimize >= 2;
+}
+
+struct gimple_opt_pass pass_complete_unrolli =
+{
+ {
+ GIMPLE_PASS,
+ "cunrolli", /* name */
+ gate_tree_complete_unroll_inner, /* gate */
+ tree_complete_unroll_inner, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_COMPLETE_UNROLL, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_verify_loops
+ | TODO_ggc_collect /* todo_flags_finish */
+ }
+};
+
/* Parallelization. */
static bool