Commit 2ab8dbf4 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/30317 (VRP cannot extract a range from (unsigned int) i + 0x0ffffffff > 4)

2008-03-28  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/30317
	PR tree-optimization/30911
	PR tree-optimization/34793
	* tree-vrp.c (set_and_canonicalize_value_range): New function.
	(struct assert_locus_d): New member EXPR.
	(register_new_assert_for): Add EXPR parameter to support
	ASSERT_EXPR <name, expr OP limit>.
	(register_edge_assert_for_1): Adjust callers.
	(find_assert_locations): Likewise.
	(process_assert_insertions_for): Build condition from
	expression.
	(extract_range_from_assert): Handle ASSERT_EXPRs
	of the form ASSERT_EXPR <name, expr OP limit>.
	(register_edge_assert_for_2): New helper registering
	asserts for comparisons.  Recognize range tests of the form
	(unsigned)i - CST1 OP CST2.
	(register_edge_assert_for_1): Use it.
	(register_edge_assert_for): Likewise.
	* tree.def (ASSERT_EXPR): Document extra allowed conditional
	expressions.
	(needs_overflow_infinity): Integer sub-types
	do not need overflow infinities.
	(vrp_val_is_max): The extreme values of integer sub-types
	are those of the base type.
	(vrp_val_is_min): Likewise.

	* gcc.dg/tree-ssa/vrp35.c: New testcase.
	* gcc.dg/tree-ssa/vrp36.c: Likewise.
	* gcc.dg/tree-ssa/vrp37.c: Likewise.

From-SVN: r133680
parent b0be8e5c
2008-03-28 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30317
PR tree-optimization/30911
PR tree-optimization/34793
* tree-vrp.c (set_and_canonicalize_value_range): New function.
(struct assert_locus_d): New member EXPR.
(register_new_assert_for): Add EXPR parameter to support
ASSERT_EXPR <name, expr OP limit>.
(register_edge_assert_for_1): Adjust callers.
(find_assert_locations): Likewise.
(process_assert_insertions_for): Build condition from
expression.
(extract_range_from_assert): Handle ASSERT_EXPRs
of the form ASSERT_EXPR <name, expr OP limit>.
(register_edge_assert_for_2): New helper registering
asserts for comparisons. Recognize range tests of the form
(unsigned)i - CST1 OP CST2.
(register_edge_assert_for_1): Use it.
(register_edge_assert_for): Likewise.
(needs_overflow_infinity): Integer sub-types
do not need overflow infinities.
(vrp_val_is_max): The extreme values of integer sub-types
are those of the base type.
(vrp_val_is_min): Likewise.
* tree.def (ASSERT_EXPR): Document extra allowed conditional
expressions.
2008-03-28 Nick Clifton <nickc@redhat.com>
* config/mn10300/mn10300.c (mn10300_secondary_reload_class):
......
2008-03-28 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30317
PR tree-optimization/30911
PR tree-optimization/34793
* gcc.dg/tree-ssa/vrp35.c: New testcase.
* gcc.dg/tree-ssa/vrp36.c: Likewise.
* gcc.dg/tree-ssa/vrp37.c: Likewise.
2008-03-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR target/31334
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */
int test1(int i, int k)
{
if (i > 0 && i <= 5 && k >= 10 && k < 42)
{
int j = i + 1 + k;
return j == 10;
}
return 1;
}
/* { dg-final { scan-tree-dump "Folding predicate j_.* == 10 to 0" "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */
int foo(int i)
{
if (i < 0 || i >= 5)
return i == 1;
return 1;
}
/* { dg-final { scan-tree-dump "Folding predicate i_.* == 1 to 0" "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
/* { dg-do compile } */
/* { dg-options "-O2" } */
unsigned char x;
int foo(void)
{
unsigned long long i = x;
i = i + 0x80000000;
if (i > 0xffffffff)
return x;
return 0;
}
......@@ -937,8 +937,13 @@ DEFTREECODE (VALUE_HANDLE, "value_handle", tcc_exceptional, 0)
two things:
1- X is a copy of Y.
2- EXPR is a GIMPLE conditional expression (as defined by
is_gimple_condexpr) and is known to be true.
2- EXPR is a conditional expression and is known to be true.
Valid and to be expected forms of conditional expressions are
valid GIMPLE condidional expressions (as defined by is_gimple_condexpr)
and conditional expressions with the first operand being a
PLUS_EXPR with a variable possibly wrapped in a NOP_EXPR first
operand and an integer constant second operand.
The type of the expression is the same as Y. */
DEFTREECODE (ASSERT_EXPR, "assert_expr", tcc_expression, 2)
......
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