diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-11 09:43:25 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-11 09:43:25 +0000 |
commit | 1c6d350bdf1969384e29cda6125f9ea07e2877b5 (patch) | |
tree | a59a2918eee22f42930a6b43e324b024d35f724e /gcc/tree-ssa-propagate.c | |
parent | ee453562d200acec074f86af3eb87d4c9221365c (diff) | |
download | gcc-1c6d350bdf1969384e29cda6125f9ea07e2877b5.tar.gz |
PR tree-optimization/32589
* doc/tree-ssa.texi (Rough GIMPLE Grammar): Add missing rule.
* tree-gimple.c (is_gimple_min_invariant): Clarify head comment.
* tree-ssa-propagate.c (valid_gimple_expression_p): New
predicate, extracted from...
(set_rhs): ...here. Call it for the expression on entry.
* tree-ssa-propagate.h (valid_gimple_expression_p): Declare.
* tree-ssa-sccvn.c: Include tree-ssa-propagate.h.
(simplify_binary_expression): Use valid_gimple_expression_p
to validate the simplification.
* Makefile.in (tree-ssa-sccvn.o): Depends on tree-ssa-propagate.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126545 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index df31e25f8ff..096664d90d1 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -573,24 +573,17 @@ get_rhs (tree stmt) } -/* Set the main expression of *STMT_P to EXPR. If EXPR is not a valid - GIMPLE expression no changes are done and the function returns - false. */ +/* Return true if EXPR is a valid GIMPLE expression. */ bool -set_rhs (tree *stmt_p, tree expr) +valid_gimple_expression_p (tree expr) { - tree stmt = *stmt_p, op; enum tree_code code = TREE_CODE (expr); - stmt_ann_t ann; - tree var; - ssa_op_iter iter; - /* Verify the constant folded result is valid gimple. */ switch (TREE_CODE_CLASS (code)) { case tcc_declaration: - if (!is_gimple_variable(expr)) + if (!is_gimple_variable (expr)) return false; break; @@ -665,6 +658,25 @@ set_rhs (tree *stmt_p, tree expr) return false; } + return true; +} + + +/* Set the main expression of *STMT_P to EXPR. If EXPR is not a valid + GIMPLE expression no changes are done and the function returns + false. */ + +bool +set_rhs (tree *stmt_p, tree expr) +{ + tree stmt = *stmt_p, op; + stmt_ann_t ann; + tree var; + ssa_op_iter iter; + + if (!valid_gimple_expression_p (expr)) + return false; + if (EXPR_HAS_LOCATION (stmt) && (EXPR_P (expr) || GIMPLE_STMT_P (expr)) |