summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-propagate.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-08 17:39:35 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-08 17:39:35 +0000
commitf2532264859701aa0768c8b00e61456ac9ab22a3 (patch)
treed5a3abe998fec0ea4665a0f7cb5687f9a693ae5f /gcc/tree-ssa-propagate.c
parent41c555b54c5dc5fc2e27fd5c1cbb5c9b241e6dcf (diff)
downloadgcc-f2532264859701aa0768c8b00e61456ac9ab22a3.tar.gz
* tree-ssa-propagate.c (set_rhs): Restructure validity tests as a
test for inclusion rather than as a test for exclusion. * tree-ssa-ccp.c (fold_stmt_r) <COND_EXPR>: Use set_rhs to modify the condition after calling fold_binary. * fold-const.c (fold_inf_compare): Remove in_gimple_form check. (fold_binary) <LT_EXPR, GT_EXPR, LE_EXPR, GE_EXPR>: Likewise. * builtins.c (fold_builtin_isascii): Likewise. (fold_builtin_isdigit): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118593 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r--gcc/tree-ssa-propagate.c74
1 files changed, 61 insertions, 13 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index f9ece62a9a8..e367559f0cf 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -571,26 +571,74 @@ set_rhs (tree *stmt_p, tree expr)
ssa_op_iter iter;
/* Verify the constant folded result is valid gimple. */
- if (TREE_CODE_CLASS (code) == tcc_binary)
+ switch (TREE_CODE_CLASS (code))
{
+ case tcc_declaration:
+ if (!is_gimple_variable(expr))
+ return false;
+ break;
+
+ case tcc_constant:
+ break;
+
+ case tcc_binary:
+ case tcc_comparison:
if (!is_gimple_val (TREE_OPERAND (expr, 0))
|| !is_gimple_val (TREE_OPERAND (expr, 1)))
return false;
- }
- else if (TREE_CODE_CLASS (code) == tcc_unary)
- {
+ break;
+
+ case tcc_unary:
if (!is_gimple_val (TREE_OPERAND (expr, 0)))
return false;
+ break;
+
+ case tcc_expression:
+ switch (code)
+ {
+ case ADDR_EXPR:
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF
+ && !is_gimple_val (TREE_OPERAND (TREE_OPERAND (expr, 0), 1)))
+ return false;
+ break;
+
+ case TRUTH_NOT_EXPR:
+ if (!is_gimple_val (TREE_OPERAND (expr, 0)))
+ return false;
+ break;
+
+ case TRUTH_AND_EXPR:
+ case TRUTH_XOR_EXPR:
+ case TRUTH_OR_EXPR:
+ if (!is_gimple_val (TREE_OPERAND (expr, 0))
+ || !is_gimple_val (TREE_OPERAND (expr, 1)))
+ return false;
+ break;
+
+ case CALL_EXPR:
+ case EXC_PTR_EXPR:
+ case FILTER_EXPR:
+ break;
+
+ default:
+ return false;
+ }
+ break;
+
+ case tcc_exceptional:
+ switch (code)
+ {
+ case SSA_NAME:
+ break;
+
+ default:
+ return false;
+ }
+ break;
+
+ default:
+ return false;
}
- else if (code == ADDR_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF
- && !is_gimple_val (TREE_OPERAND (TREE_OPERAND (expr, 0), 1)))
- return false;
- }
- else if (code == COMPOUND_EXPR
- || code == MODIFY_EXPR)
- return false;
if (EXPR_HAS_LOCATION (stmt)
&& EXPR_P (expr)