aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2005-05-17 21:55:53 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2005-05-17 19:55:53 +0000
commit38965eb29c94c187538489f6874c5b54f98f2ed1 (patch)
treed5471dc3f0c17a518b2a28a858669d705b2a853d /gcc/tree-ssa-ccp.c
parent6c878b231db4f5886d79c187083f0e0b65c8cf8c (diff)
downloadgcc-38965eb29c94c187538489f6874c5b54f98f2ed1.zip
gcc-38965eb29c94c187538489f6874c5b54f98f2ed1.tar.gz
gcc-38965eb29c94c187538489f6874c5b54f98f2ed1.tar.bz2
tree-cfg.c (tree_can_merge_blocks_p): Allow phi nodes in the merged block.
* 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. From-SVN: r99850
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 85753bd..45472f4 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