Patchwork [tree-sra] Fix to set up correct context for call to compute_inline_parameter (PR44768)

login
register
mail settings
Submitter Ramana Radhakrishnan
Date July 7, 2010, 7:57 a.m.
Message ID <1278489425.17030.13.camel@e102325-lin.cambridge.arm.com>
Download mbox | patch
Permalink /patch/58083/
State New
Headers show

Comments

Ramana Radhakrishnan - July 7, 2010, 7:57 a.m.
Hi, 

When the fix for PR12392 went in or specifically this commit
(http://gcc.gnu.org/viewcvs?view=revision&revision=152368), the loop in
tree-sra.c was split into 2 but the context for the call to
compute_inline_parameters wasn't moved as a part of the loop split. This
led to a latent bug being introduced which after the recent fix to
PR43905 caused it to manifest itself as PR44768 on arm-linux-gnueabi. C
only bootstrap completed successfully. A full bootstrap and test run is
on currently with trunk.

I believe this problem is latent on the gcc 4.5 branch and probably
needs fixing there as well but I don't have a testcase that exposes this
specific problem on 4.5 branch. 

Ok to commit to trunk and 4.5 branch after regression testing ? 
	
cheers
Ramana
Richard Guenther - July 7, 2010, 9:33 a.m.
On Wed, Jul 7, 2010 at 9:57 AM, Ramana Radhakrishnan
<ramana.radhakrishnan@arm.com> wrote:
> Hi,
>
> When the fix for PR12392 went in or specifically this commit
> (http://gcc.gnu.org/viewcvs?view=revision&revision=152368), the loop in
> tree-sra.c was split into 2 but the context for the call to
> compute_inline_parameters wasn't moved as a part of the loop split. This
> led to a latent bug being introduced which after the recent fix to
> PR43905 caused it to manifest itself as PR44768 on arm-linux-gnueabi. C
> only bootstrap completed successfully. A full bootstrap and test run is
> on currently with trunk.
>
> I believe this problem is latent on the gcc 4.5 branch and probably
> needs fixing there as well but I don't have a testcase that exposes this
> specific problem on 4.5 branch.
>
> Ok to commit to trunk and 4.5 branch after regression testing ?
>
> cheers
> Ramana
>

ChangeLog entry missing.

>
>
> Index: gcc/tree-sra.c
> ===================================================================
> --- gcc/tree-sra.c      (revision 161899)
> +++ gcc/tree-sra.c      (working copy)
> @@ -4209,8 +4209,11 @@ convert_callers (struct cgraph_node *nod
>   for (cs = node->callers; cs; cs = cs->next_caller)
>     if (!bitmap_bit_p (recomputed_callers, cs->caller->uid))
>       {
> +       current_function_decl = cs->caller->decl;
> +       push_cfun (DECL_STRUCT_FUNCTION (cs->caller->decl));

Switching cfun is expensive.  Why and where does
compute_inline_parameters end up using cfun?  We should fix
that instead.

Richard.

>        compute_inline_parameters (cs->caller);
>        bitmap_set_bit (recomputed_callers, cs->caller->uid);
> +       pop_cfun ();
>       }
>   BITMAP_FREE (recomputed_callers);
>
>
>
>

Patch

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c      (revision 161899)
+++ gcc/tree-sra.c      (working copy)
@@ -4209,8 +4209,11 @@  convert_callers (struct cgraph_node *nod
   for (cs = node->callers; cs; cs = cs->next_caller)
     if (!bitmap_bit_p (recomputed_callers, cs->caller->uid))
       {
+       current_function_decl = cs->caller->decl;
+       push_cfun (DECL_STRUCT_FUNCTION (cs->caller->decl));
        compute_inline_parameters (cs->caller);
        bitmap_set_bit (recomputed_callers, cs->caller->uid);
+       pop_cfun ();
       }
   BITMAP_FREE (recomputed_callers);