summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-14 21:26:33 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-14 21:26:33 +0000
commit4eb4e1338947e8c05debb30298be1c40545b2846 (patch)
tree6f94ed6b70d7fbbb088dda9f4a7bb7cde1535afa /gcc
parent451bd60a01ac10d2d3f5bb6e40163d69828894bc (diff)
downloadgcc-4eb4e1338947e8c05debb30298be1c40545b2846.tar.gz
* tree-vrp.c (local_fold): Remove.
(simplify_using_ranges): Use fold_convert, not local_fold. Tweak DIV/MOD case slightly for readability. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-vrp.c32
2 files changed, 16 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 023b85db884..d566bff9409 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-14 Jeff Law <law@redhat.com>
+
+ * tree-vrp.c (local_fold): Remove.
+ (simplify_using_ranges): Use fold_convert, not local_fold. Tweak
+ DIV/MOD case slightly for readability.
+
2005-06-14 Frank Ch. Eigler <fche@redhat.com>
PR mudflap/21023
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 89dae4b850d..24078a7cb77 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -94,21 +94,6 @@ static sbitmap blocks_visited;
of values that SSA name N_I may take. */
static value_range_t **vr_value;
-/* Local version of fold that doesn't introduce cruft. */
-
-static tree
-local_fold (tree t)
-{
- t = fold (t);
-
- /* Strip away useless type conversions. Both the NON_LVALUE_EXPR that
- may have been added by fold, and "useless" type conversions that might
- now be apparent due to propagation. */
- STRIP_USELESS_TYPE_CONVERSION (t);
-
- return t;
-}
-
/* 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.
@@ -3466,14 +3451,17 @@ simplify_using_ranges (void)
tree op1 = TREE_OPERAND (rhs, 1);
if (rhs_code == TRUNC_DIV_EXPR)
- t = build (RSHIFT_EXPR, TREE_TYPE (op0), op0,
- build_int_cst (NULL_TREE, tree_log2 (op1)));
+ {
+ t = build_int_cst (NULL_TREE, tree_log2 (op1));
+ t = build (RSHIFT_EXPR, TREE_TYPE (op0), op0, t);
+ }
else
- t = build (BIT_AND_EXPR, TREE_TYPE (op0), op0,
- local_fold (build (MINUS_EXPR,
- TREE_TYPE (op1),
- op1,
- integer_one_node)));
+ {
+ t = build_int_cst (TREE_TYPE (op1), 1);
+ t = int_const_binop (MINUS_EXPR, op1, t, 0);
+ t = fold_convert (TREE_TYPE (op0), t);
+ t = build2 (BIT_AND_EXPR, TREE_TYPE (op0), op0, t);
+ }
TREE_OPERAND (stmt, 1) = t;
update_stmt (stmt);