aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2005-06-20 02:33:52 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2005-06-20 02:33:52 +0000
commit09b2f9e8c91f9a245330f49cfee65d3642b98114 (patch)
treed643478192e3bd2111176dee180dc26f4b51715b
parent115766b691bab20c8c9748fae898dc93246c1e18 (diff)
downloadgcc-09b2f9e8c91f9a245330f49cfee65d3642b98114.zip
gcc-09b2f9e8c91f9a245330f49cfee65d3642b98114.tar.gz
gcc-09b2f9e8c91f9a245330f49cfee65d3642b98114.tar.bz2
fold-const.c (swap_tree_comparison): Add support for unordered floating point comparisons.
* fold-const.c (swap_tree_comparison): Add support for unordered floating point comparisons. * tree-vrp.c (opposite_comparison): Delete. (extract_range_from_assert): Replace calls to opposite_comparison with calls to swap_tree_comparison. (register_edge_assert_for): Likewise. (vrp_evaluate_conditional): Likewise. From-SVN: r101201
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/fold-const.c12
-rw-r--r--gcc/tree-vrp.c48
3 files changed, 26 insertions, 44 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6e9fd5c..d459e07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-19 Roger Sayle <roger@eyesopen.com>
+
+ * fold-const.c (swap_tree_comparison): Add support for unordered
+ floating point comparisons.
+ * tree-vrp.c (opposite_comparison): Delete.
+ (extract_range_from_assert): Replace calls to opposite_comparison
+ with calls to swap_tree_comparison.
+ (register_edge_assert_for): Likewise.
+ (vrp_evaluate_conditional): Likewise.
+
2005-06-20 Kaz Kojima <kkojima@gcc.gnu.org>
* integrate.c (allocate_initial_values): Update the references
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 335e556..5d25cb9 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2169,6 +2169,10 @@ swap_tree_comparison (enum tree_code code)
{
case EQ_EXPR:
case NE_EXPR:
+ case ORDERED_EXPR:
+ case UNORDERED_EXPR:
+ case LTGT_EXPR:
+ case UNEQ_EXPR:
return code;
case GT_EXPR:
return LT_EXPR;
@@ -2178,6 +2182,14 @@ swap_tree_comparison (enum tree_code code)
return GT_EXPR;
case LE_EXPR:
return GE_EXPR;
+ case UNGT_EXPR:
+ return UNLT_EXPR;
+ case UNGE_EXPR:
+ return UNLE_EXPR;
+ case UNLT_EXPR:
+ return UNGT_EXPR;
+ case UNLE_EXPR:
+ return UNGE_EXPR;
default:
gcc_unreachable ();
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index e040f41..217ecc3 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -94,46 +94,6 @@ static sbitmap blocks_visited;
of values that SSA name N_I may take. */
static value_range_t **vr_value;
-/* Given a comparison code, return its opposite. Note that this is *not*
- the same as inverting its truth value (invert_tree_comparison). Here we
- just want to literally flip the comparison around.
-
- So, '<' gets '>', '<=' gets '>='. Both '==' and '!=' are returned
- unchanged. */
-
-static enum tree_code
-opposite_comparison (enum tree_code code)
-{
- switch (code)
- {
- case EQ_EXPR:
- case NE_EXPR:
- case ORDERED_EXPR:
- case UNORDERED_EXPR:
- case LTGT_EXPR:
- case UNEQ_EXPR:
- return code;
- case GT_EXPR:
- return LT_EXPR;
- case GE_EXPR:
- return LE_EXPR;
- case LT_EXPR:
- return GT_EXPR;
- case LE_EXPR:
- return GE_EXPR;
- case UNGT_EXPR:
- return UNLT_EXPR;
- case UNGE_EXPR:
- return UNLE_EXPR;
- case UNLT_EXPR:
- return UNGT_EXPR;
- case UNLE_EXPR:
- return UNGE_EXPR;
- default:
- gcc_unreachable ();
- }
-}
-
/* Return true if EXPR computes a non-zero value. */
@@ -711,7 +671,7 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
to flip around the comparison code to create the proper range
for VAR. */
limit = TREE_OPERAND (cond, 0);
- cond_code = opposite_comparison (TREE_CODE (cond));
+ cond_code = swap_tree_comparison (TREE_CODE (cond));
}
type = TREE_TYPE (limit);
@@ -2231,7 +2191,7 @@ register_edge_assert_for (tree name, edge e, block_stmt_iterator si)
/* If the predicate is of the form VAL COMP NAME, flip
COMP around because we need to register NAME as the
first operand in the predicate. */
- comp_code = opposite_comparison (TREE_CODE (cond));
+ comp_code = swap_tree_comparison (TREE_CODE (cond));
val = TREE_OPERAND (cond, 0);
}
else
@@ -3023,7 +2983,7 @@ vrp_evaluate_conditional (tree cond, bool use_equiv_p)
return compare_name_with_value (TREE_CODE (cond), op0, op1);
else if (TREE_CODE (op1) == SSA_NAME)
return compare_name_with_value (
- opposite_comparison (TREE_CODE (cond)), op1, op0);
+ swap_tree_comparison (TREE_CODE (cond)), op1, op0);
}
else
{
@@ -3038,7 +2998,7 @@ vrp_evaluate_conditional (tree cond, bool use_equiv_p)
return compare_range_with_value (TREE_CODE (cond), vr0, op1);
else if (vr0 == NULL && vr1)
return compare_range_with_value (
- opposite_comparison (TREE_CODE (cond)), vr1, op0);
+ swap_tree_comparison (TREE_CODE (cond)), vr1, op0);
}
}