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-sccvn.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-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 755fb1d31e8..5c3acb2a6a7 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -43,6 +43,7 @@ Boston, MA 02110-1301, USA. */ #include "bitmap.h" #include "langhooks.h" #include "cfgloop.h" +#include "tree-ssa-propagate.h" #include "tree-ssa-sccvn.h" /* This algorithm is based on the SCC algorithm presented by Keith @@ -1397,42 +1398,16 @@ simplify_binary_expression (tree rhs) else if (SSA_VAL (op1) != VN_TOP && SSA_VAL (op1) != op1) op1 = VN_INFO (op1)->valnum; } + result = fold_binary (TREE_CODE (rhs), TREE_TYPE (rhs), op0, op1); /* Make sure result is not a complex expression consisting of operators of operators (IE (a + b) + (a + c)) Otherwise, we will end up with unbounded expressions if fold does anything at all. */ - if (result) - { - if (is_gimple_min_invariant (result)) - return result; - else if (SSA_VAR_P (result)) - return result; - else if (EXPR_P (result)) - { - switch (TREE_CODE_CLASS (TREE_CODE (result))) - { - case tcc_unary: - { - tree op0 = TREE_OPERAND (result, 0); - if (!EXPR_P (op0)) - return result; - } - break; - case tcc_binary: - { - tree op0 = TREE_OPERAND (result, 0); - tree op1 = TREE_OPERAND (result, 1); - if (!EXPR_P (op0) && !EXPR_P (op1)) - return result; - } - break; - default: - break; - } - } - } + if (result && valid_gimple_expression_p (result)) + return result; + return NULL_TREE; } |