summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-04 09:40:54 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-04 09:40:54 +0000
commit38758f382f5fdf8873871e3ff2eec11566ac79ca (patch)
treed9d97843e418653cad9a6488ed10bd7ed6d8223d
parent693a749962d87d61fd1a1a244f8577d56ce03708 (diff)
downloadgcc-38758f382f5fdf8873871e3ff2eec11566ac79ca.tar.gz
2015-08-04 Richard Biener <rguenther@suse.de>
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Remove dispatching to fold_binary for GIMPLE_BINARY_RHS and for comparisons embedded in [VEC_]COND_EXPRs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226551 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimple-fold.c54
2 files changed, 25 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fdc4a7e4e12..10f4ff1975b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-04 Richard Biener <rguenther@suse.de>
+
+ * gimple-fold.c (gimple_fold_stmt_to_constant_1): Remove
+ dispatching to fold_binary for GIMPLE_BINARY_RHS and for
+ comparisons embedded in [VEC_]COND_EXPRs.
+
2015-08-03 Abe Skolnik <a.skolnik@samsung.com>
* tree-if-conv.c: Fix various typos in comments.
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index c624689e726..6c53bac027b 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -5008,28 +5008,26 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree),
return NULL_TREE;
case GIMPLE_BINARY_RHS:
- {
- /* Handle binary operators that can appear in GIMPLE form. */
- tree op0 = (*valueize) (gimple_assign_rhs1 (stmt));
- tree op1 = (*valueize) (gimple_assign_rhs2 (stmt));
-
- /* Translate &x + CST into an invariant form suitable for
- further propagation. */
- if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
- && TREE_CODE (op0) == ADDR_EXPR
- && TREE_CODE (op1) == INTEGER_CST)
- {
- tree off = fold_convert (ptr_type_node, op1);
- return build_fold_addr_expr_loc
- (loc,
- fold_build2 (MEM_REF,
- TREE_TYPE (TREE_TYPE (op0)),
- unshare_expr (op0), off));
- }
+ /* Translate &x + CST into an invariant form suitable for
+ further propagation. */
+ if (subcode == POINTER_PLUS_EXPR)
+ {
+ /* Handle binary operators that can appear in GIMPLE form. */
+ tree op0 = (*valueize) (gimple_assign_rhs1 (stmt));
+ tree op1 = (*valueize) (gimple_assign_rhs2 (stmt));
- return fold_binary_loc (loc, subcode,
- gimple_expr_type (stmt), op0, op1);
- }
+ if (TREE_CODE (op0) == ADDR_EXPR
+ && TREE_CODE (op1) == INTEGER_CST)
+ {
+ tree off = fold_convert (ptr_type_node, op1);
+ return build_fold_addr_expr_loc
+ (loc,
+ fold_build2 (MEM_REF,
+ TREE_TYPE (TREE_TYPE (op0)),
+ unshare_expr (op0), off));
+ }
+ }
+ return NULL_TREE;
case GIMPLE_TERNARY_RHS:
{
@@ -5037,20 +5035,6 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree),
tree op0 = (*valueize) (gimple_assign_rhs1 (stmt));
tree op1 = (*valueize) (gimple_assign_rhs2 (stmt));
tree op2 = (*valueize) (gimple_assign_rhs3 (stmt));
-
- /* Fold embedded expressions in ternary codes. */
- if ((subcode == COND_EXPR
- || subcode == VEC_COND_EXPR)
- && COMPARISON_CLASS_P (op0))
- {
- tree op00 = (*valueize) (TREE_OPERAND (op0, 0));
- tree op01 = (*valueize) (TREE_OPERAND (op0, 1));
- tree tem = fold_binary_loc (loc, TREE_CODE (op0),
- TREE_TYPE (op0), op00, op01);
- if (tem)
- op0 = tem;
- }
-
return fold_ternary_loc (loc, subcode,
gimple_expr_type (stmt), op0, op1, op2);
}