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-ssa-ccp.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-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 31ca0e1..b3efa99 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1126,6 +1126,27 @@ valueize_op (tree op) return op; } +/* Return the constant value for OP, but signal to not follow SSA + edges if the definition may be simulated again. */ + +static tree +valueize_op_1 (tree op) +{ + if (TREE_CODE (op) == SSA_NAME) + { + tree tem = get_constant_value (op); + if (tem) + return tem; + /* 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 (op); + if (prop_simulate_again_p (def_stmt)) + return NULL_TREE; + } + return op; +} + /* CCP specific front-end to the non-destructive constant folding routines. @@ -1158,7 +1179,8 @@ ccp_fold (gimple stmt) case GIMPLE_ASSIGN: case GIMPLE_CALL: - return gimple_fold_stmt_to_constant_1 (stmt, valueize_op); + return gimple_fold_stmt_to_constant_1 (stmt, + valueize_op, valueize_op_1); default: gcc_unreachable (); |