diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2005-05-17 19:55:53 +0000 |
---|---|---|
committer | Zdenek Dvorak <dvorakz@suse.cz> | 2005-05-17 19:55:53 +0000 |
commit | 62429fccb4b46c664614ae7cea4cf9243a25c832 (patch) | |
tree | d5471dc3f0c17a518b2a28a858669d705b2a853d /gcc/tree-ssa-ccp.c | |
parent | 2054e1625220eec1a21aed7f9c0f84d89844b54e (diff) |
* tree-cfg.c (tree_can_merge_blocks_p): Allow phi nodes in the
merged block.
(replace_uses_by): New function.
(tree_merge_blocks): Eliminate the phi nodes in the merged block.
* tree-flow.h (fold_stmt_inplace): Declare.
* tree-ssa-ccp.c (fold_stmt_inplace): New function.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update dominance
info after cfg cleanup.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@99850 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 85753bdd764..45472f402ab 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2308,6 +2308,32 @@ fold_stmt (tree *stmt_p) return changed; } +/* Perform the minimal folding on statement STMT. Only operations like + *&x created by constant propagation are handled. The statement cannot + be replaced with a new one. */ + +bool +fold_stmt_inplace (tree stmt) +{ + tree old_stmt = stmt, rhs, new_rhs; + bool changed = false; + + walk_tree (&stmt, fold_stmt_r, &changed, NULL); + gcc_assert (stmt == old_stmt); + + rhs = get_rhs (stmt); + if (!rhs || rhs == stmt) + return changed; + + new_rhs = fold (rhs); + if (new_rhs == rhs) + return changed; + + changed |= set_rhs (&stmt, new_rhs); + gcc_assert (stmt == old_stmt); + + return changed; +} /* Convert EXPR into a GIMPLE value suitable for substitution on the RHS of an assignment. Insert the necessary statements before |