This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix inlining regimplification (PR tree-optimization/37084)


On Tue, Aug 12, 2008 at 7:21 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> id->regimplify can be set not just on one operand GIMPLE_ASSIGNs,
> but on many other statements.  copy_bb already has
>      else if (id->regimplify)
>        gimple_regimplify_operands (stmt, &copy_gsi);
> right below this if, which would never trigger, as this
> if had || id->regimplify too (and didn't handle it correctly).
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2008-08-12  Jakub Jelinek  <jakub@redhat.com>
>
>        PR tree-optimization/37084
>        * tree-inline.c (copy_bb): Call gimple_regimplify_operands
>        if id->regimplify, don't assume stmt is a cast assignment.
>
>        * g++.dg/tree-ssa/pr37084.C: New test.
>
> --- gcc/tree-inline.c.jj        2008-08-11 10:54:27.000000000 +0200
> +++ gcc/tree-inline.c   2008-08-12 11:23:46.000000000 +0200
> @@ -1260,10 +1260,9 @@ copy_bb (copy_body_data *id, basic_block
>
>       /* With return slot optimization we can end up with
>         non-gimple (foo *)&this->m, fix that here.  */
> -      if ((is_gimple_assign (stmt)
> -           && gimple_assign_rhs_code (stmt) == NOP_EXPR
> -           && !is_gimple_val (gimple_assign_rhs1 (stmt)))
> -         || id->regimplify)
> +      if (is_gimple_assign (stmt)
> +         && gimple_assign_rhs_code (stmt) == NOP_EXPR
> +         && !is_gimple_val (gimple_assign_rhs1 (stmt)))
>        {
>          tree new_rhs;
>          new_rhs = force_gimple_operand_gsi (&copy_gsi,
> --- gcc/testsuite/g++.dg/tree-ssa/pr37084.C.jj  2008-08-12 11:26:58.000000000 +0200
> +++ gcc/testsuite/g++.dg/tree-ssa/pr37084.C     2008-08-12 11:25:11.000000000 +0200
> @@ -0,0 +1,16 @@
> +// PR tree-optimization/37084
> +// { dg-do compile }
> +// { dg-options "-O" }
> +
> +struct A
> +{
> +  A ();
> +};
> +
> +inline A
> +foo ()
> +{
> +  return A ();
> +}
> +
> +const A a (foo ());
>
>        Jakub
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]