This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Avoid copy propagation of inlined function arguments at -O0
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Sun, 1 Mar 2009 11:19:28 +0100
- Subject: Re: Avoid copy propagation of inlined function arguments at -O0
- References: <20090228224448.GB14292@kam.mff.cuni.cz>
On Sat, Feb 28, 2009 at 11:44 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> we miss function arguments when inlining even at -O0 because
> setup_one_parameter is bit eager to do copy propagation on SSA.
>
> Bootstrapped/regtested x86_64-linux, OK?
Ok.
Thanks,
Richard.
> ? ? ? ?* gcc.dg/debug/dwarf2/inline1.c: New testcase.
>
> ? ? ? ?* tree-inline.c (setup_one_parameter): Do not copy propagate
> ? ? ? ?arguments when not optimizing.
>
> Index: testsuite/gcc.dg/debug/dwarf2/inline1.c
> ===================================================================
> *** testsuite/gcc.dg/debug/dwarf2/inline1.c ? ? (revision 0)
> --- testsuite/gcc.dg/debug/dwarf2/inline1.c ? ? (revision 0)
> ***************
> *** 0 ****
> --- 1,18 ----
> + /* { dg-do compile } */
> + /* { dg-options "-O0 -gdwarf-2 -dA" } */
> + void e(int);
> + __attribute__ ((always_inline)) inline int
> + t(int function_parameter)
> + {
> + ? e(function_parameter);
> + }
> +
> + void test (int function_parameter2)
> + {
> + ? t(function_parameter2);
> + }
> +
> + /* Verify that we get both function_parameter and function_parameter2 declared
> + ? ?in test. ?Overall we should have 3 variables with location defined (also
> + ? ?function_parameter in offline copy of t. ?*/
> + /* { dg-final { scan-assembler-times " DW_AT_location" 3 } } */
> Index: tree-inline.c
> ===================================================================
> *** tree-inline.c ? ? ? (revision 144497)
> --- tree-inline.c ? ? ? (working copy)
> *************** setup_one_parameter (copy_body_data *id,
> *** 2048,2053 ****
> --- 2048,2054 ----
> ? ? ? We might want to introduce a notion that single SSA_NAME might
> ? ? ? represent multiple variables for purposes of debugging. */
> ? ?if (gimple_in_ssa_p (cfun) && rhs && def && is_gimple_reg (p)
> + ? ? ? && optimize
> ? ? ? ?&& (TREE_CODE (rhs) == SSA_NAME
> ? ? ? ? ?|| is_gimple_min_invariant (rhs))
> ? ? ? ?&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def))
> *************** setup_one_parameter (copy_body_data *id,
> *** 2058,2064 ****
>
> ? ?/* If the value of argument is never used, don't care about initializing
> ? ? ? it. ?*/
> ! ? if (gimple_in_ssa_p (cfun) && !def && is_gimple_reg (p))
> ? ? ?{
> ? ? ? ?gcc_assert (!value || !TREE_SIDE_EFFECTS (value));
> ? ? ? ?return NULL;
> --- 2059,2065 ----
>
> ? ?/* If the value of argument is never used, don't care about initializing
> ? ? ? it. ?*/
> ! ? if (optimize && gimple_in_ssa_p (cfun) && !def && is_gimple_reg (p))
> ? ? ?{
> ? ? ? ?gcc_assert (!value || !TREE_SIDE_EFFECTS (value));
> ? ? ? ?return NULL;
>