|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
[4.4 PATCH] Fix tailr caused ICE with -fno-tree-dce (PR tree-optimization/41643)Hi!
The following testcase fails on the 4.4 branch, because the tailr optimization pass doesn't expect the first bb to contain any PHI nodes and assumes all the PHI nodes added there are the ones added by this pass. But with -fno-tree-dce the first bb can contain also degenerate PHI nodes. On the trunk this doesn't fail because the IR is quite different before the pass. Incidentally this is something that got fixed on the trunk already as part of a much larger patch. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for 4.4 and the testcase also for trunk? 2009-11-07 Jakub Jelinek <jakub@...> PR tree-optimization/41643 Backport from mainline 2009-04-03 Richard Guenther <rguenther@...> * tree-tailcall.c (tree_optimize_tail_calls_1): Also split the edge from the entry block if we have degenerate PHI nodes in the first basic block. * gcc.dg/pr41643.c: New test. --- gcc/tree-tailcall.c.jj 2009-07-07 20:18:03.000000000 +0200 +++ gcc/tree-tailcall.c 2009-11-07 15:51:54.000000000 +0100 @@ -920,8 +920,10 @@ tree_optimize_tail_calls_1 (bool opt_tai if (!phis_constructed) { - /* Ensure that there is only one predecessor of the block. */ - if (!single_pred_p (first)) + /* Ensure that there is only one predecessor of the block + or if there are existing degenerate PHI nodes. */ + if (!single_pred_p (first) + || !gimple_seq_empty_p (phi_nodes (first))) first = split_edge (single_succ_edge (ENTRY_BLOCK_PTR)); /* Copy the args if needed. */ --- gcc/testsuite/gcc.dg/pr41643.c.jj 2009-11-07 15:43:17.000000000 +0100 +++ gcc/testsuite/gcc.dg/pr41643.c 2009-11-07 15:42:58.000000000 +0100 @@ -0,0 +1,15 @@ +/* PR tree-optimization/41643 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dce" } */ + +struct S { int a; }; + +int +f (struct S *x) +{ + int a = x->a; + if (a) + return f (x) + a; + else + return f (x); +} Jakub |
|
|
Re: [4.4 PATCH] Fix tailr caused ICE with -fno-tree-dce (PR tree-optimization/41643)On Sat, Nov 7, 2009 at 6:23 PM, Jakub Jelinek <jakub@...> wrote:
> Hi! > > The following testcase fails on the 4.4 branch, because the tailr > optimization pass doesn't expect the first bb to contain any PHI nodes and > assumes all the PHI nodes added there are the ones added by this pass. > But with -fno-tree-dce the first bb can contain also degenerate PHI nodes. > On the trunk this doesn't fail because the IR is quite different before the > pass. Incidentally this is something that got fixed on the trunk already as > part of a much larger patch. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for 4.4 and the > testcase also for trunk? Ok. Thanks, Richard. > 2009-11-07 Jakub Jelinek <jakub@...> > > PR tree-optimization/41643 > Backport from mainline > 2009-04-03 Richard Guenther <rguenther@...> > > * tree-tailcall.c (tree_optimize_tail_calls_1): Also split the > edge from the entry block if we have degenerate PHI nodes in > the first basic block. > > * gcc.dg/pr41643.c: New test. > > --- gcc/tree-tailcall.c.jj 2009-07-07 20:18:03.000000000 +0200 > +++ gcc/tree-tailcall.c 2009-11-07 15:51:54.000000000 +0100 > @@ -920,8 +920,10 @@ tree_optimize_tail_calls_1 (bool opt_tai > > if (!phis_constructed) > { > - /* Ensure that there is only one predecessor of the block. */ > - if (!single_pred_p (first)) > + /* Ensure that there is only one predecessor of the block > + or if there are existing degenerate PHI nodes. */ > + if (!single_pred_p (first) > + || !gimple_seq_empty_p (phi_nodes (first))) > first = split_edge (single_succ_edge (ENTRY_BLOCK_PTR)); > > /* Copy the args if needed. */ > --- gcc/testsuite/gcc.dg/pr41643.c.jj 2009-11-07 15:43:17.000000000 +0100 > +++ gcc/testsuite/gcc.dg/pr41643.c 2009-11-07 15:42:58.000000000 +0100 > @@ -0,0 +1,15 @@ > +/* PR tree-optimization/41643 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fno-tree-dce" } */ > + > +struct S { int a; }; > + > +int > +f (struct S *x) > +{ > + int a = x->a; > + if (a) > + return f (x) + a; > + else > + return f (x); > +} > > Jakub > |
| Free embeddable forum powered by Nabble | Forum Help |