Patchwork Fix PR52424

login
register
mail settings
Submitter William J. Schmidt
Date Feb. 29, 2012, 3:12 a.m.
Message ID <1330485140.4317.11.camel@gnopaine>
Download mbox | patch
Permalink /patch/143667/
State New
Headers show

Comments

William J. Schmidt - Feb. 29, 2012, 3:12 a.m.
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  <wschmidt@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.
Richard Guenther - Feb. 29, 2012, 9:37 a.m.
On Wed, Feb 29, 2012 at 4:12 AM, William J. Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> 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?

Ok.

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

It's even present on the 4.1 branch, so I guess it has been there forever.
Not worth backporting IMHO.

Thanks,
Richard.

> Thanks,
> Bill
>
>
> 2012-02-28  Bill Schmidt  <wschmidt@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))
>
>

Patch

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))