From f3cd574f6b2a45b1cd9153636d0ad1aba1cde806 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Sat, 25 Sep 2004 14:53:26 +0200 Subject: [PATCH] tree-optimize.c (init_tree_optimization_passes): Add pass_record_bounds. * tree-optimize.c (init_tree_optimization_passes): Add pass_record_bounds. * tree-pass.h (pass_record_bounds): Declare. * tree-ssa-loop.c (tree_ssa_loop_bounds, pass_record_bounds): New pass. From-SVN: r88097 --- gcc/ChangeLog | 8 ++++++++ gcc/tree-optimize.c | 1 + gcc/tree-pass.h | 1 + gcc/tree-ssa-loop.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63d20983690..f267169a8d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-25 Zdenek Dvorak + + * tree-optimize.c (init_tree_optimization_passes): Add + pass_record_bounds. + * tree-pass.h (pass_record_bounds): Declare. + * tree-ssa-loop.c (tree_ssa_loop_bounds, pass_record_bounds): + New pass. + 2004-09-25 Zdenek Dvorak PR tree-optimization/17474 diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 3bcc1cde47b..aa3df9e787c 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -393,6 +393,7 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_lim); NEXT_PASS (pass_unswitch); NEXT_PASS (pass_iv_canon); + NEXT_PASS (pass_record_bounds); NEXT_PASS (pass_if_conversion); NEXT_PASS (pass_vectorize); NEXT_PASS (pass_linear_transform); diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index ae19e2de517..6250ae6140b 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -127,6 +127,7 @@ extern struct tree_opt_pass pass_loop_init; extern struct tree_opt_pass pass_lim; extern struct tree_opt_pass pass_unswitch; extern struct tree_opt_pass pass_iv_canon; +extern struct tree_opt_pass pass_record_bounds; extern struct tree_opt_pass pass_if_conversion; extern struct tree_opt_pass pass_vectorize; extern struct tree_opt_pass pass_complete_unroll; diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 19f784d9bbf..b1d854e9acd 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -297,6 +297,35 @@ struct tree_opt_pass pass_iv_canon = 0 /* letter */ }; +/* Record bounds on numbers of iterations of loops. */ + +static void +tree_ssa_loop_bounds (void) +{ + if (!current_loops) + return; + + estimate_numbers_of_iterations (current_loops); + scev_reset (); +} + +struct tree_opt_pass pass_record_bounds = +{ + "bounds", /* name */ + NULL, /* gate */ + tree_ssa_loop_bounds, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + PROP_cfg | PROP_ssa, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + /* Complete unrolling of loops. */ static void -- 2.30.2