diff options
author | Richard Biener <rguenther@suse.de> | 2014-11-14 13:32:56 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-11-14 13:32:56 +0000 |
commit | d2a858011c4d9c1ff8d45484ef6d40aeaffeaf10 (patch) | |
tree | e4d71de012905eda50a0432c5be7efd7d50f5e4a /gcc/tree-vrp.c | |
parent | a5dde6ddac80b3a6e4cb3d988c5c449108411704 (diff) | |
download | gcc-d2a858011c4d9c1ff8d45484ef6d40aeaffeaf10.zip gcc-d2a858011c4d9c1ff8d45484ef6d40aeaffeaf10.tar.gz gcc-d2a858011c4d9c1ff8d45484ef6d40aeaffeaf10.tar.bz2 |
gimple-fold.h (gimple_fold_stmt_to_constant_1): Add 2nd valueization hook defaulted to no_follow_ssa_edges.
2014-11-14 Richard Biener <rguenther@suse.de>
* gimple-fold.h (gimple_fold_stmt_to_constant_1): Add 2nd
valueization hook defaulted to no_follow_ssa_edges.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Pass
2nd valueization hook to gimple_simplify.
* tree-ssa-ccp.c (valueize_op_1): New function to be
used for gimple_simplify called via gimple_fold_stmt_to_constant_1.
(ccp_fold): Adjust.
* tree-vrp.c (vrp_valueize_1): New function to be
used for gimple_simplify called via gimple_fold_stmt_to_constant_1.
(vrp_visit_assignment_or_call): Adjust.
From-SVN: r217560
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index b287282..13b7c79 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7025,6 +7025,27 @@ vrp_valueize (tree name) return name; } +/* Return the singleton value-range for NAME if that is a constant + but signal to not follow SSA edges. */ + +static inline tree +vrp_valueize_1 (tree name) +{ + if (TREE_CODE (name) == SSA_NAME) + { + value_range_t *vr = get_value_range (name); + if (range_int_cst_singleton_p (vr)) + return vr->min; + /* If the definition may be simulated again we cannot follow + this SSA edge as the SSA propagator does not necessarily + re-visit the use. */ + gimple def_stmt = SSA_NAME_DEF_STMT (name); + if (prop_simulate_again_p (def_stmt)) + return NULL_TREE; + } + return name; +} + /* Visit assignment STMT. If it produces an interesting range, record the SSA name in *OUTPUT_P. */ @@ -7048,8 +7069,9 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p) value_range_t new_vr = VR_INITIALIZER; /* Try folding the statement to a constant first. */ - tree tem = gimple_fold_stmt_to_constant (stmt, vrp_valueize); - if (tem) + tree tem = gimple_fold_stmt_to_constant_1 (stmt, vrp_valueize, + vrp_valueize_1); + if (tem && is_gimple_min_invariant (tem)) set_value_range_to_value (&new_vr, tem, NULL); /* Then dispatch to value-range extracting functions. */ else if (code == GIMPLE_CALL) |