PR tree-optimization/20913
* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Fold COND_EXPR.
+ PR tree-optimization/20702
+ * tree-vrp.c (maybe_add_assert_expr): Recurse into
+ dominator children that haven't been walked into.
+
2005-04-13 Julian Brown <julian@codesourcery.com>
* config/elfos.h (MAKE_DECL_ONE_ONLY): Redefined to stop DECL_WEAK from
PR tree-optimization/20913
* gcc.dg/tree-ssa/pr20913.c: New.
+ PR tree-optimization/20702
+ * gcc.dg/tree-ssa/pr20702.c: New.
+
2005-04-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/13744
--- /dev/null
+/* PR tree-optimization/20702
+ VRP did not insert ASSERT_EXPRs into dominator dominator children
+ of a basic block ending with COND_EXPR unless the children are also
+ immediate successors of the basic block. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp-details" } */
+
+extern void bar (int);
+
+int
+foo (int *p, int b)
+{
+ int a;
+
+ if (b)
+ bar (123);
+ else
+ bar (321);
+
+ a = *p;
+ if (p == 0)
+ return 0;
+
+ return a;
+}
+
+/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp"} } */
edge e;
edge_iterator ei;
tree op, cond;
+ basic_block son;
cond = COND_EXPR_COND (last);
/* Finally, mark all the COND_EXPR operands as found. */
SET_BIT (found, SSA_NAME_VERSION (op));
+
+ /* Recurse into the dominator children of BB that are not BB's
+ immediate successors. Note that we have already visited BB's
+ other dominator children above. */
+ for (son = first_dom_son (CDI_DOMINATORS, bb);
+ son;
+ son = next_dom_son (CDI_DOMINATORS, son))
+ {
+ if (find_edge (bb, son) == NULL)
+ added |= maybe_add_assert_expr (son);
+ }
}
else
{