From patchwork Wed Feb 29 03:12:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix PR52424 Date: Tue, 28 Feb 2012 17:12:20 -0000 From: William J. Schmidt X-Patchwork-Id: 143667 Message-Id: <1330485140.4317.11.camel@gnopaine> To: gcc-patches@gcc.gnu.org Cc: bergner@vnet.ibm.com 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 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))