This patch fixes PR52424 by pushing a missing marker onto
const_and_copies_stack before calling dom_thread_across_edge.  This bug
has resulted in lost copy propagation opportunities in the presence of
edge threading.

Bootstrapped and tested with no regressions on powerpc64-linux-gnu.  I'm
waiting on Jiangning Liu to verify the patch fixes his performance
concern.  Provided it does, is this OK for trunk?

Also, this bug has apparently been there for a long time.  Should we
consider backporting the fix to 4.6 and/or 4.5?

Thanks,
Bill


2012-02-28  Bill Schmidt  <wschm...@linux.vnet.ibm.com>

        PR tree-optimization/52424
        * tree-ssa-dom.c (dom_opt_leave_block): Push a marker before
        calling dom_thread_across_edge.


Index: gcc/tree-ssa-dom.c
===================================================================
--- gcc/tree-ssa-dom.c  (revision 184625)
+++ gcc/tree-ssa-dom.c  (working copy)
@@ -1779,6 +1779,9 @@ dom_opt_leave_block (struct dom_walk_data *walk_da
       && (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0
       && potentially_threadable_block (single_succ (bb)))
     {
+      /* Push a marker on the stack, which thread_across_edge expects
+        and will remove.  */
+      VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
       dom_thread_across_edge (walk_data, single_succ_edge (bb));
     }
   else if ((last = last_stmt (bb))


Reply via email to