diff options
author | Richard Guenther <rguenther@suse.de> | 2008-05-31 13:01:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-05-31 13:01:10 +0000 |
commit | 39f8a3b00c99fff50a211449cd10e326eabca8f4 (patch) | |
tree | 4a655a0ae6f945ac1614484f03ea84124a685c78 | |
parent | 2643f14e4453151004d8026128dd929dc4d7eb8e (diff) | |
download | gcc-39f8a3b00c99fff50a211449cd10e326eabca8f4.zip gcc-39f8a3b00c99fff50a211449cd10e326eabca8f4.tar.gz gcc-39f8a3b00c99fff50a211449cd10e326eabca8f4.tar.bz2 |
re PR tree-optimization/34244 (VRP/SCEV miscompiles Firefox)
2008-05-31 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34244
* fold-const.c (tree_expr_nonnegative_warnv_p): Do not ask VRP.
(tree_expr_nonzero_warnv_p): Likewise.
* tree-vrp.c (vrp_expr_computes_nonnegative): Call
ssa_name_nonnegative_p.
(vrp_expr_computes_nonzero): Call ssa_name_nonzero_p.
(extract_range_from_unary_expr): Use vrp_expr_computes_nonzero,
not tree_expr_nonzero_warnv_p.
PR tree-optimization/36262
Revert
2007-11-29 Zdenek Dvorak <ook@ucw.cz>
PR tree-optimization/34244
* tree-vrp.c (adjust_range_with_scev): Clear scev cache.
(record_numbers_of_iterations): New function.
(execute_vrp): Cache the numbers of iterations of loops.
* tree-scalar-evolution.c (scev_reset_except_niters):
New function.
(scev_reset): Use scev_reset_except_niters.
* tree-scalar-evolution.h (scev_reset_except_niters): Declare.
From-SVN: r136237
-rw-r--r-- | gcc/ChangeLog | 24 | ||||
-rw-r--r-- | gcc/fold-const.c | 10 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.c | 13 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.h | 1 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 40 |
5 files changed, 31 insertions, 57 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd4d66c..41a7306 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2008-05-31 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/34244 + * fold-const.c (tree_expr_nonnegative_warnv_p): Do not ask VRP. + (tree_expr_nonzero_warnv_p): Likewise. + * tree-vrp.c (vrp_expr_computes_nonnegative): Call + ssa_name_nonnegative_p. + (vrp_expr_computes_nonzero): Call ssa_name_nonzero_p. + (extract_range_from_unary_expr): Use vrp_expr_computes_nonzero, + not tree_expr_nonzero_warnv_p. + + PR tree-optimization/36262 + Revert + 2007-11-29 Zdenek Dvorak <ook@ucw.cz> + + PR tree-optimization/34244 + * tree-vrp.c (adjust_range_with_scev): Clear scev cache. + (record_numbers_of_iterations): New function. + (execute_vrp): Cache the numbers of iterations of loops. + * tree-scalar-evolution.c (scev_reset_except_niters): + New function. + (scev_reset): Use scev_reset_except_niters. + * tree-scalar-evolution.h (scev_reset_except_niters): Declare. + 2008-05-31 Bernd Schmidt <bernd.schmidt@analog.com> * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4a9d55f..609217b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14074,11 +14074,6 @@ tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p) switch (TREE_CODE (t)) { - case SSA_NAME: - /* Query VRP to see if it has recorded any information about - the range of this object. */ - return ssa_name_nonnegative_p (t); - case INTEGER_CST: return tree_int_cst_sgn (t) >= 0; @@ -14563,11 +14558,6 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p) bool sub_strict_overflow_p; switch (TREE_CODE (t)) { - case SSA_NAME: - /* Query VRP to see if it has recorded any information about - the range of this object. */ - return ssa_name_nonzero_p (t); - case INTEGER_CST: return !integer_zerop (t); diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 7c9736a..2cc0080 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2645,16 +2645,6 @@ scev_initialize (void) } } -/* Clean the scalar evolution analysis cache, but preserve the cached - numbers of iterations for the loops. */ - -void -scev_reset_except_niters (void) -{ - if (scalar_evolution_info) - htab_empty (scalar_evolution_info); -} - /* Cleans up the information cached by the scalar evolutions analysis. */ void @@ -2666,8 +2656,7 @@ scev_reset (void) if (!scalar_evolution_info || !current_loops) return; - scev_reset_except_niters (); - + htab_empty (scalar_evolution_info); FOR_EACH_LOOP (li, loop, 0) { loop->nb_iterations = NULL_TREE; diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h index 54e543c..472b194 100644 --- a/gcc/tree-scalar-evolution.h +++ b/gcc/tree-scalar-evolution.h @@ -27,7 +27,6 @@ extern tree get_loop_exit_condition (const struct loop *); extern void scev_initialize (void); extern void scev_reset (void); -extern void scev_reset_except_niters (void); extern void scev_finalize (void); extern tree analyze_scalar_evolution (struct loop *, tree); extern tree instantiate_scev (struct loop *, struct loop *, tree); diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 15e7ee5..fe39a24 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -772,7 +772,9 @@ usable_range_p (value_range_t *vr, bool *strict_overflow_p) static bool vrp_expr_computes_nonnegative (tree expr, bool *strict_overflow_p) { - return tree_expr_nonnegative_warnv_p (expr, strict_overflow_p); + return (tree_expr_nonnegative_warnv_p (expr, strict_overflow_p) + || (TREE_CODE (expr) == SSA_NAME + && ssa_name_nonnegative_p (expr))); } /* Like tree_expr_nonzero_warnv_p, but this function uses value ranges @@ -781,7 +783,9 @@ vrp_expr_computes_nonnegative (tree expr, bool *strict_overflow_p) static bool vrp_expr_computes_nonzero (tree expr, bool *strict_overflow_p) { - if (tree_expr_nonzero_warnv_p (expr, strict_overflow_p)) + if (tree_expr_nonzero_warnv_p (expr, strict_overflow_p) + || (TREE_CODE (expr) == SSA_NAME + && ssa_name_nonzero_p (expr))) return true; /* If we have an expression of the form &X->a, then the expression @@ -2799,13 +2803,6 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt, if (vr->type == VR_ANTI_RANGE) return; - /* Ensure that there are not values in the scev cache based on assumptions - on ranges of ssa names that were changed - (in set_value_range/set_value_range_to_varying). Preserve cached numbers - of iterations, that were computed before the start of VRP (we do not - recompute these each time to save the compile time). */ - scev_reset_except_niters (); - chrec = instantiate_parameters (loop, analyze_scalar_evolution (loop, var)); /* Like in PR19590, scev can return a constant function. */ @@ -6636,20 +6633,6 @@ vrp_finalize (void) vr_phi_edge_counts = NULL; } -/* Calculates number of iterations for all loops, to ensure that they are - cached. */ - -static void -record_numbers_of_iterations (void) -{ - loop_iterator li; - struct loop *loop; - - FOR_EACH_LOOP (li, loop, 0) - { - number_of_latch_executions (loop); - } -} /* Main entry point to VRP (Value Range Propagation). This pass is loosely based on J. R. C. Patterson, ``Accurate Static Branch @@ -6708,17 +6691,6 @@ execute_vrp (void) insert_range_assertions (); - /* Compute the # of iterations for each loop before we start the VRP - analysis. The value ranges determined by VRP are used in expression - simplification, that is also used by the # of iterations analysis. - However, in the middle of the VRP analysis, the value ranges do not take - all the possible paths in CFG into account, so they do not have to be - correct, and the # of iterations analysis can obtain wrong results. - This is a problem, since the results of the # of iterations analysis - are cached, so these mistakes would not be corrected when the value - ranges are corrected. */ - record_numbers_of_iterations (); - to_remove_edges = VEC_alloc (edge, heap, 10); to_update_switch_stmts = VEC_alloc (switch_update, heap, 5); |