re PR tree-optimization/20657 ([tcb] VRP does not get rid of a redundant "if" statement.)

gcc/
	PR tree-optimization/20657
	* tree-vrp.c (extract_range_from_expr): Notice INTEGER_CST to
	create an appropriate range from it.

testsuite/
	PR tree-optimization/20657
	* gcc.dg/tree-ssa/pr20657.c: New.

From-SVN: r98134
This commit is contained in:
Kazu Hirata 2005-04-14 13:34:57 +00:00 committed by Kazu Hirata
parent c44001c643
commit a0ce797889
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-04-14 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/20657
* tree-vrp.c (extract_range_from_expr): Notice INTEGER_CST to
create an appropriate range from it.
2005-04-14 Uros Bizjak <uros@kss-loka.si>
* reg-stack.c (subst_stack_regs_pat): Handle <UNSPEC_FIST_FLOOR> and

View File

@ -1,3 +1,8 @@
2005-04-14 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/20657
* gcc.dg/tree-ssa/pr20657.c: New.
2005-04-14 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/builtins-53.c: Also check (int)trunc* and

View File

@ -0,0 +1,17 @@
/* PR tree-optimization/20657
VRP did not pick up a conditional equivalence from the first "if"
statement, which was needed to eliminate the second "if" statement. */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp-details" } */
int
foo (int a)
{
if (a == 0)
if (a == 0)
return 1;
return 0;
}
/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp"} } */

View File

@ -830,6 +830,8 @@ extract_range_from_expr (value_range *vr, tree expr)
extract_range_from_unary_expr (vr, expr);
else if (expr_computes_nonzero (expr))
set_value_range_to_nonnull (vr, TREE_TYPE (expr));
else if (TREE_CODE (expr) == INTEGER_CST)
set_value_range (vr, VR_RANGE, expr, expr);
else
set_value_range (vr, VR_VARYING, NULL_TREE, NULL_TREE);
}