This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR54547
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Nov 2012 13:06:08 +0100 (CET)
- Subject: [PATCH] Fix PR54547
This fixes the FAIL of gcc.dg/tree-ssa/pr37508.c on arm. We fail
to canonicalize anti-ranges of 1-bit precision types correctly.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2012-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/54547
* tree-vrp.c (set_and_canonicalize_value_range): Handle
1-bit anti-ranges explicitely.
(extract_range_from_assert): Properly canonicalize all
built anti-ranges.
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c (revision 193881)
--- gcc/tree-vrp.c (working copy)
*************** set_and_canonicalize_value_range (value_
*** 541,562 ****
return;
}
else if (TYPE_PRECISION (TREE_TYPE (min)) == 1
- && !TYPE_UNSIGNED (TREE_TYPE (min))
&& (is_min || is_max))
{
! /* For signed 1-bit precision, one is not in-range and
! thus adding/subtracting it would result in overflows. */
! if (operand_equal_p (min, max, 0))
! {
! min = max = is_min ? vrp_val_max (TREE_TYPE (min))
! : vrp_val_min (TREE_TYPE (min));
! t = VR_RANGE;
! }
else
! {
! set_value_range_to_varying (vr);
! return;
! }
}
else if (is_min
/* As a special exception preserve non-null ranges. */
--- 541,555 ----
return;
}
else if (TYPE_PRECISION (TREE_TYPE (min)) == 1
&& (is_min || is_max))
{
! /* Non-empty boolean ranges can always be represented
! as a singleton range. */
! if (is_min)
! min = max = vrp_val_max (TREE_TYPE (min));
else
! min = max = vrp_val_min (TREE_TYPE (min));
! t = VR_RANGE;
}
else if (is_min
/* As a special exception preserve non-null ranges. */
*************** extract_range_from_assert (value_range_t
*** 1707,1713 ****
&& vrp_val_is_max (max))
min = max = limit;
! set_value_range (vr_p, VR_ANTI_RANGE, min, max, vr_p->equiv);
}
else if (cond_code == LE_EXPR || cond_code == LT_EXPR)
{
--- 1700,1707 ----
&& vrp_val_is_max (max))
min = max = limit;
! set_and_canonicalize_value_range (vr_p, VR_ANTI_RANGE,
! min, max, vr_p->equiv);
}
else if (cond_code == LE_EXPR || cond_code == LT_EXPR)
{