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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98134
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
+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
--- /dev/null
+/* 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"} } */
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);
}