+2007-09-07 Richard Guenther <rguenther@suse.de>
+
+ Revert
+ 2007-09-06 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32586
+ * tree-ssa-sccvn.c (simplify_binary_expression): Avoid
+ folding if nothing changed.
+ (simplify_unary_expression): New function. Do tree combining
+ on conversion like codes.
+ (try_to_simplify): Call it.
+
2007-09-07 Richard Guenther <rguenther@suse.de>
Uros Bizjak <ubizjak@gmail.com>
+2007-09-07 Richard Guenther <rguenther@suse.de>
+
+ Revert
+ 2007-09-06 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32586
+ * g++.dg/tree-ssa/pr27090.C: Remove XFAILs.
+ * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-5.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-4.c: Likewise, remove scan for
+ now obsolete simplification.
+
2007-09-07 Uros Bizjak <ubizjak@gmail.com>
PR tree-optimization/32821
op1 = SSA_VAL (op1);
}
- /* Avoid folding if nothing changed. */
- if (op0 == TREE_OPERAND (rhs, 0)
- && op1 == TREE_OPERAND (rhs, 1))
- return NULL_TREE;
-
result = fold_binary (TREE_CODE (rhs), TREE_TYPE (rhs), op0, op1);
/* Make sure result is not a complex expression consisting
return NULL_TREE;
}
-/* Simplify the unary expression RHS, and return the result if
- simplified. */
-
-static tree
-simplify_unary_expression (tree rhs)
-{
- tree result = NULL_TREE;
- tree op0 = TREE_OPERAND (rhs, 0);
-
- if (TREE_CODE (op0) != SSA_NAME)
- return NULL_TREE;
-
- if (VN_INFO (op0)->has_constants)
- op0 = valueize_expr (VN_INFO (op0)->expr);
- else if (TREE_CODE (rhs) == NOP_EXPR
- || TREE_CODE (rhs) == CONVERT_EXPR
- || TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR)
- {
- /* We want to do tree-combining on conversion-like expressions.
- Make sure we feed only SSA_NAMEs or constants to fold though. */
- tree tem = valueize_expr (VN_INFO (op0)->expr);
- if (UNARY_CLASS_P (tem)
- || BINARY_CLASS_P (tem)
- || TREE_CODE (tem) == SSA_NAME
- || is_gimple_min_invariant (tem))
- op0 = tem;
- }
-
- /* Avoid folding if nothing changed, but remember the expression. */
- if (op0 == TREE_OPERAND (rhs, 0))
- return rhs;
-
- result = fold_unary (TREE_CODE (rhs), TREE_TYPE (rhs), op0);
- if (result)
- {
- STRIP_USELESS_TYPE_CONVERSION (result);
- if (valid_gimple_expression_p (result))
- return result;
- }
-
- return rhs;
-}
-
/* Try to simplify RHS using equivalences and constant folding. */
static tree
if (result)
return result;
}
- /* Fallthrough for some codes. */
- if (!(TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR))
- break;
+ break;
/* We could do a little more with unary ops, if they expand
into binary ops, but it's debatable whether it is worth it. */
case tcc_unary:
- return simplify_unary_expression (rhs);
+ {
+ tree result = NULL_TREE;
+ tree op0 = TREE_OPERAND (rhs, 0);
+ if (TREE_CODE (op0) == SSA_NAME && VN_INFO (op0)->has_constants)
+ op0 = VN_INFO (op0)->expr;
+ else if (TREE_CODE (op0) == SSA_NAME && SSA_VAL (op0) != op0)
+ op0 = SSA_VAL (op0);
+ result = fold_unary (TREE_CODE (rhs), TREE_TYPE (rhs), op0);
+ if (result)
+ return result;
+ }
break;
case tcc_comparison:
case tcc_binary: