summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-07 12:31:29 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-07 12:31:29 +0000
commit238ad80e4b5a27ccaa276fa8544b7da0f42c78e2 (patch)
tree6302ef291529a9f7d84576775cadb3ee62a10839 /gcc/tree-vrp.c
parent429231e24b18a177c896a1c2d36fc425bf5c816c (diff)
downloadgcc-238ad80e4b5a27ccaa276fa8544b7da0f42c78e2.tar.gz
2006-07-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/28187 * tree-vrp.c (vrp_operand_equal_p): New function. (vrp_bitmap_equal_p): Likewise. (update_value_range): Use them to compare old and new max and min values. * gcc.dg/pr28187.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115255 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 9eac7e9b67d..64f292e89c4 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -290,6 +290,25 @@ get_value_range (tree var)
return vr;
}
+/* Return true, if VAL1 and VAL2 are equal values for VRP purposes. */
+
+static inline bool
+vrp_operand_equal_p (tree val1, tree val2)
+{
+ return (val1 == val2
+ || (val1 && val2
+ && operand_equal_p (val1, val2, 0)));
+}
+
+/* Return true, if the bitmaps B1 and B2 are equal. */
+
+static inline bool
+vrp_bitmap_equal_p (bitmap b1, bitmap b2)
+{
+ return (b1 == b2
+ || (b1 && b2
+ && bitmap_equal_p (b1, b2)));
+}
/* Update the value range and equivalence set for variable VAR to
NEW_VR. Return true if NEW_VR is different from VAR's previous
@@ -310,11 +329,9 @@ update_value_range (tree var, value_range_t *new_vr)
/* Update the value range, if necessary. */
old_vr = get_value_range (var);
is_new = old_vr->type != new_vr->type
- || old_vr->min != new_vr->min
- || old_vr->max != new_vr->max
- || (old_vr->equiv == NULL && new_vr->equiv)
- || (old_vr->equiv && new_vr->equiv == NULL)
- || (!bitmap_equal_p (old_vr->equiv, new_vr->equiv));
+ || !vrp_operand_equal_p (old_vr->min, new_vr->min)
+ || !vrp_operand_equal_p (old_vr->max, new_vr->max)
+ || !vrp_bitmap_equal_p (old_vr->equiv, new_vr->equiv);
if (is_new)
set_value_range (old_vr, new_vr->type, new_vr->min, new_vr->max,