This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR28238, inliner producing non-gimple
- From: Martin Michlmayr <tbm at cyrius dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Jul 2006 14:57:09 +0100
- Subject: Re: [PATCH] Fix PR28238, inliner producing non-gimple
- References: <Pine.LNX.4.64.0607061648220.4374@nyjnma.fhfr.qr>
* Richard Guenther <rguenther@suse.de> [2006-07-06 16:51]:
> Again some corner case with NRV and inlining. The fix is to
> gimplify (foo *)&this->m if it occurs.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> Ok for mainline and 4.1?
Patch ping - can someone please review.
> :ADDPATCH middle-end:
>
> 2006-07-07 Richard Guenther <rguenther@suse.de>
>
> PR tree-optimization/28238
> * tree-inline.c (copy_bb): Check if we produced valid
> gimple copying and substituting a stmt. If not, gimplify
> it.
>
> * g++.dg/tree-ssa/pr28238.C: New testcase.
>
> Index: tree-inline.c
> ===================================================================
> *** tree-inline.c (revision 115221)
> --- tree-inline.c (working copy)
> *************** copy_bb (copy_body_data *id, basic_block
> *** 704,709 ****
> --- 704,717 ----
> if (stmt)
> {
> tree call, decl;
> +
> + /* With return slot optimization we can end up with
> + non-gimple (foo *)&this->m, fix that here. */
> + if (TREE_CODE (stmt) == MODIFY_EXPR
> + && TREE_CODE (TREE_OPERAND (stmt, 1)) == NOP_EXPR
> + && !is_gimple_val (TREE_OPERAND (TREE_OPERAND (stmt, 1), 0)))
> + gimplify_stmt (&stmt);
> +
> bsi_insert_after (©_bsi, stmt, BSI_NEW_STMT);
> call = get_call_expr_in (stmt);
> /* We're duplicating a CALL_EXPR. Find any corresponding
> Index: testsuite/g++.dg/tree-ssa/pr28238.C
> ===================================================================
> *** testsuite/g++.dg/tree-ssa/pr28238.C (revision 0)
> --- testsuite/g++.dg/tree-ssa/pr28238.C (revision 0)
> ***************
> *** 0 ****
> --- 1,22 ----
> + /* { dg-do compile } */
> + /* { dg-options "-O" } */
> +
> + struct iterator{};
> + struct ByteIterator : iterator
> + {
> + ByteIterator (){}
> + int a[1024];
> + };
> + inline ByteIterator f ()
> + {
> + return ByteIterator ();
> + }
> + class ConfLexerCore
> + {
> + ConfLexerCore ();
> + ByteIterator m_matchStart;
> + };
> + ConfLexerCore::ConfLexerCore ()
> + : m_matchStart (f ())
> + { }
> +
--
Martin Michlmayr
tbm@cyrius.com