tree-vrp.c (vrp_meet): Intersect the equivalency sets when meeting a VR_ANTI_RANGE with a VR_RANGE.

* tree-vrp.c (vrp_meet): Intersect the equivalency sets when
        meeting a VR_ANTI_RANGE with a VR_RANGE.  When intersecting
        equivalency sets, correctly handle the case were vr0 has an
        equivalency set, but vr1 does not.

        * gcc.c-torture/execute/pr22630.c: New test.

From-SVN: r102432
This commit is contained in:
Jeff Law 2005-07-27 10:21:48 -06:00 committed by Jeff Law
parent b940ce0e35
commit 880031e1f9
4 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2005-07-27 Jeff Law <law@redhat.com>
* tree-vrp.c (vrp_meet): Intersect the equivalency sets when
meeting a VR_ANTI_RANGE with a VR_RANGE. When intersecting
equivalency sets, correctly handle the case were vr0 has an
equivalency set, but vr1 does not.
2005-07-27 Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/23073

View File

@ -1,3 +1,7 @@
2005-07-27 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/pr22630.c: New test.
2005-07-27 Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/23073

View File

@ -0,0 +1,23 @@
void abort (void);
int j;
void bla (int *r)
{
int *p, *q;
p = q = r;
if (!p)
p = &j;
if (p != q)
j = 1;
}
int main (void)
{
bla (0);
if (!j)
abort ();
return 0;
}

View File

@ -3297,6 +3297,8 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
the two sets. */
if (vr0->equiv && vr1->equiv && vr0->equiv != vr1->equiv)
bitmap_and_into (vr0->equiv, vr1->equiv);
else if (vr0->equiv && !vr1->equiv)
bitmap_clear (vr0->equiv);
set_value_range (vr0, vr0->type, min, max, vr0->equiv);
}
@ -3314,6 +3316,8 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
the two sets. */
if (vr0->equiv && vr1->equiv && vr0->equiv != vr1->equiv)
bitmap_and_into (vr0->equiv, vr1->equiv);
else if (vr0->equiv && !vr1->equiv)
bitmap_clear (vr0->equiv);
}
else
goto no_meet;
@ -3329,6 +3333,13 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
{
if (vr1->type == VR_ANTI_RANGE)
copy_value_range (vr0, vr1);
/* The resulting set of equivalences is the intersection of
the two sets. */
if (vr0->equiv && vr1->equiv && vr0->equiv != vr1->equiv)
bitmap_and_into (vr0->equiv, vr1->equiv);
else if (vr0->equiv && !vr1->equiv)
bitmap_clear (vr0->equiv);
}
else
goto no_meet;