aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-07-09 18:58:20 +0000
committerSebastian Pop <sebastian.pop@amd.com>2010-07-09 18:58:20 +0000
commitdc9a775d19721bbf2ef86f84add3ae5c2369902e (patch)
tree42613a44f64bae3d05bcf6a83581318c98e0392e /gcc/tree-if-conv.c
parent0baeb223da6fcae41becb25f7f63b8d16807ea8b (diff)
Outline fold_or_predicates from add_to_predicate_list.
2010-07-09 Sebastian Pop <sebastian.pop@amd.com> * tree-if-conv.c (fold_or_predicates): New. (add_to_predicate_list): Call it. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@162007 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 7058ee4c274..0f1caaa3dbc 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -300,6 +300,26 @@ parse_predicate (tree cond, tree *op0, tree *op1)
return ERROR_MARK;
}
+/* Returns the fold of predicate C1 OR C2 at location LOC. */
+
+static tree
+fold_or_predicates (location_t loc, tree c1, tree c2)
+{
+ tree op1a, op1b, op2a, op2b;
+ enum tree_code code1 = parse_predicate (c1, &op1a, &op1b);
+ enum tree_code code2 = parse_predicate (c2, &op2a, &op2b);
+
+ if (code1 != ERROR_MARK && code2 != ERROR_MARK)
+ {
+ tree t = maybe_fold_or_comparisons (code1, op1a, op1b,
+ code2, op2a, op2b);
+ if (t)
+ return t;
+ }
+
+ return fold_build2_loc (loc, TRUTH_OR_EXPR, boolean_type_node, c1, c2);
+}
+
/* Add condition NC to the predicate list of basic block BB. */
static inline void
@@ -314,25 +334,8 @@ add_to_predicate_list (basic_block bb, tree nc)
bc = nc;
else
{
- enum tree_code code1, code2;
- tree op1a, op1b, op2a, op2b;
-
bc = bb_predicate (bb);
- code1 = parse_predicate (bc, &op1a, &op1b);
- code2 = parse_predicate (nc, &op2a, &op2b);
-
- if (code1 != ERROR_MARK && code2 != ERROR_MARK)
- {
- tree t = maybe_fold_or_comparisons (code1, op1a, op1b,
- code2, op2a, op2b);
- if (!t)
- t = fold_build2_loc (EXPR_LOCATION (bc), TRUTH_OR_EXPR,
- boolean_type_node, bc, nc);
- bc = t;
- }
- else
- bc = fold_build2_loc (EXPR_LOCATION (bc), TRUTH_OR_EXPR,
- boolean_type_node, bc, nc);
+ bc = fold_or_predicates (EXPR_LOCATION (bc), nc, bc);
}
if (!is_gimple_condexpr (bc))