diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2005-07-27 15:26:55 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2005-07-27 13:26:55 +0000 |
commit | 3ac01fdeef1976c9150d3efa1b5c2915f210a78f (patch) | |
tree | 6e79a38332103beceb652d9c10b349aa8b01cb3c /gcc/tree-ssa-loop-ivopts.c | |
parent | 77fcaf4b701894705944491ea1aa46b68ac271a3 (diff) | |
download | gcc-3ac01fdeef1976c9150d3efa1b5c2915f210a78f.zip gcc-3ac01fdeef1976c9150d3efa1b5c2915f210a78f.tar.gz gcc-3ac01fdeef1976c9150d3efa1b5c2915f210a78f.tar.bz2 |
re PR tree-optimization/22325 (missed optimization in loop)
PR tree-optimization/22325
* tree-flow.h (compute_phi_arg_on_exit, force_expr_to_var_cost):
Declare.
* tree-scalar-evolution.c (scev_const_prop): Add generic final
value replacement.
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Split from ...
(force_var_cost): ... this function.
(compute_phi_arg_on_exit): Export.
From-SVN: r102426
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index fda17f9..e5a8d85 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3415,12 +3415,11 @@ get_address_cost (bool symbol_present, bool var_present, return cost + acost; } -/* Estimates cost of forcing EXPR into a variable. DEPENDS_ON is a set of the - invariants the computation depends on. */ -static unsigned -force_var_cost (struct ivopts_data *data, - tree expr, bitmap *depends_on) +/* Estimates cost of forcing expression EXPR into a variable. */ + +unsigned +force_expr_to_var_cost (tree expr) { static bool costs_initialized = false; static unsigned integer_cost; @@ -3452,7 +3451,7 @@ force_var_cost (struct ivopts_data *data, build_int_cst_type (type, 2000))) + 1; if (dump_file && (dump_flags & TDF_DETAILS)) { - fprintf (dump_file, "force_var_cost:\n"); + fprintf (dump_file, "force_expr_to_var_cost:\n"); fprintf (dump_file, " integer %d\n", (int) integer_cost); fprintf (dump_file, " symbol %d\n", (int) symbol_cost); fprintf (dump_file, " address %d\n", (int) address_cost); @@ -3465,12 +3464,6 @@ force_var_cost (struct ivopts_data *data, STRIP_NOPS (expr); - if (depends_on) - { - fd_ivopts_data = data; - walk_tree (&expr, find_depends, depends_on, NULL); - } - if (SSA_VAR_P (expr)) return 0; @@ -3505,12 +3498,12 @@ force_var_cost (struct ivopts_data *data, if (is_gimple_val (op0)) cost0 = 0; else - cost0 = force_var_cost (data, op0, NULL); + cost0 = force_expr_to_var_cost (op0); if (is_gimple_val (op1)) cost1 = 0; else - cost1 = force_var_cost (data, op1, NULL); + cost1 = force_expr_to_var_cost (op1); break; @@ -3550,6 +3543,22 @@ force_var_cost (struct ivopts_data *data, return cost < target_spill_cost ? cost : target_spill_cost; } +/* Estimates cost of forcing EXPR into a variable. DEPENDS_ON is a set of the + invariants the computation depends on. */ + +static unsigned +force_var_cost (struct ivopts_data *data, + tree expr, bitmap *depends_on) +{ + if (depends_on) + { + fd_ivopts_data = data; + walk_tree (&expr, find_depends, depends_on, NULL); + } + + return force_expr_to_var_cost (expr); +} + /* Estimates cost of expressing address ADDR as var + symbol + offset. The value of offset is added to OFFSET, SYMBOL_PRESENT and VAR_PRESENT are set to false if the corresponding part is missing. DEPENDS_ON is a set of the @@ -5600,7 +5609,7 @@ protect_loop_closed_ssa_form (edge exit, tree stmt) so that they are emitted on the correct place, and so that the loop closed ssa form is preserved. */ -static void +void compute_phi_arg_on_exit (edge exit, tree stmts, tree op) { tree_stmt_iterator tsi; |