Commit d9c6ca85 by Marc Glisse Committed by Marc Glisse

re PR tree-optimization/54317 (FAIL: c45532m c45532n c45532o c45532p)

2012-08-22  Marc Glisse  <marc.glisse@inria.fr>

	PR tree-optimization/54317

gcc/
	* tree-vrp.c (extract_range_from_binary_expr_1): Test for
	double_int overflow.
	Remove dead tests.

gcc/testsuite/
	* gcc.dg/tree-ssa/vrp79.c: New testcase.

From-SVN: r190591
parent 6f723d33
2012-08-22 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/54317
* tree-vrp.c (extract_range_from_binary_expr_1): Test for
double_int overflow.
Remove dead tests.
2012-08-22 Jakub Jelinek <jakub@redhat.com> 2012-08-22 Jakub Jelinek <jakub@redhat.com>
* tree-vrp.c (find_assert_locations): Skip also edges * tree-vrp.c (find_assert_locations): Skip also edges
......
2012-08-22 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/54317
* gcc.dg/tree-ssa/vrp79.c: New testcase.
2012-08-21 Oleg Endo <olegendo@gcc.gnu.org> 2012-08-21 Oleg Endo <olegendo@gcc.gnu.org>
PR target/39423 PR target/39423
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
#ifdef __SIZEOF_INT128__
typedef unsigned __int128 NT;
#else
typedef unsigned long long NT;
#endif
extern void do_not_go_away ();
void f (NT x, NT y)
{
NT n = 1;
n <<= (__CHAR_BIT__ * sizeof (NT) - 1);
if (x > n) return;
if (y > n) return;
NT z = x + y;
if (z == 42) do_not_go_away ();
}
/* { dg-final { scan-tree-dump "do_not_go_away" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -2474,18 +2474,21 @@ extract_range_from_binary_expr_1 (value_range_t *vr, ...@@ -2474,18 +2474,21 @@ extract_range_from_binary_expr_1 (value_range_t *vr,
{ {
/* Min underflow or max overflow. The range kind /* Min underflow or max overflow. The range kind
changes to VR_ANTI_RANGE. */ changes to VR_ANTI_RANGE. */
bool covers = false;
double_int tem = tmin; double_int tem = tmin;
gcc_assert ((min_ovf == -1 && max_ovf == 0) gcc_assert ((min_ovf == -1 && max_ovf == 0)
|| (max_ovf == 1 && min_ovf == 0)); || (max_ovf == 1 && min_ovf == 0));
type = VR_ANTI_RANGE; type = VR_ANTI_RANGE;
tmin = double_int_add (tmax, double_int_one); tmin = double_int_add (tmax, double_int_one);
if (double_int_cmp (tmin, tmax, uns) < 0)
covers = true;
tmax = double_int_add (tem, double_int_minus_one); tmax = double_int_add (tem, double_int_minus_one);
if (double_int_cmp (tmax, tem, uns) > 0)
covers = true;
/* If the anti-range would cover nothing, drop to varying. /* If the anti-range would cover nothing, drop to varying.
Likewise if the anti-range bounds are outside of the Likewise if the anti-range bounds are outside of the
types values. */ types values. */
if (double_int_cmp (tmin, tmax, uns) > 0 if (covers || double_int_cmp (tmin, tmax, uns) > 0)
|| double_int_cmp (tmin, type_min, uns) < 0
|| double_int_cmp (tmax, type_max, uns) > 0)
{ {
set_value_range_to_varying (vr); set_value_range_to_varying (vr);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment