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, PR 39259] Set calls_setjmp and calls_alloca if necessary when versioning functions


On Tue, Feb 24, 2009 at 2:43 PM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> the following patch removes the assert ?that was hit in PR 39259 which
> was hit when a function calling setjump was being versioned altogether
> with a ?similar one ?for functions calling ?alloca. ?It also ?sets the
> flags ?for the ?new ?version if ?it ?detects such ?calls when ?copying
> function bodies.
>
> Honza suggested I do this rather than simply copying the flags because
> in near ?future we are likely to ?do copies of only ?selected parts of
> functions.
>
> It ?does ?fix ?the ?reported ?testcase and ?I ?have ?bootstrapped ?and
> regression tested ?this patch ?(on x86_64-linux-gnu, rev ?144403) with
> extra asserts to ?make sure the flags in the old ?and new version were
> the same. ?I will redo this ?with this exact patch to follow the rules
> but I do not expect any problems.
>
> I do ?not really know what a ?testcase for a removed ?assert like this
> should look like.
>
> Is this ok for trunk if it rebootstraps fine?

Ok if you add the testcase from the PR to g++.dg/torture/

Thanks,
Richard.

> Thanks,
>
> Martin
>
>
> 2009-02-24 ?Martin Jambor ?<mjambor@suse.cz>
>
> ? ? ? ?* tree-inline.c (initialize_cfun): Remove asserts for calls_setjmp and
> ? ? ? ?alls_alloca function flags.
> ? ? ? ?(copy_bb): Set calls_setjmp and alls_alloca function flags if such
> ? ? ? ?calls are detected.
>
> Index: gcc/tree-inline.c
> ===================================================================
> --- gcc/tree-inline.c ? (revision 144380)
> +++ gcc/tree-inline.c ? (working copy)
> @@ -1398,6 +1398,7 @@ copy_bb (copy_body_data *id, basic_block
> ? ? ? ? ? ?{
> ? ? ? ? ? ? ?struct cgraph_node *node;
> ? ? ? ? ? ? ?struct cgraph_edge *edge;
> + ? ? ? ? ? ? int flags;
>
> ? ? ? ? ? ? ?switch (id->transform_call_graph_edges)
> ? ? ? ? ? ? ? ?{
> @@ -1429,6 +1430,13 @@ copy_bb (copy_body_data *id, basic_block
> ? ? ? ? ? ? ?default:
> ? ? ? ? ? ? ? ?gcc_unreachable ();
> ? ? ? ? ? ? ? ?}
> +
> + ? ? ? ? ? ? flags = gimple_call_flags (stmt);
> +
> + ? ? ? ? ? ? if (flags & ECF_MAY_BE_ALLOCA)
> + ? ? ? ? ? ? ? cfun->calls_alloca = true;
> + ? ? ? ? ? ? if (flags & ECF_RETURNS_TWICE)
> + ? ? ? ? ? ? ? cfun->calls_setjmp = true;
> ? ? ? ? ? ?}
>
> ? ? ? ? ?/* If you think we can abort here, you are wrong.
> @@ -1745,10 +1753,6 @@ initialize_cfun (tree new_fndecl, tree c
> ? gcc_assert (cfun->cfg == NULL);
> ? gcc_assert (cfun->decl == new_fndecl);
>
> - ?/* No need to copy; this is initialized later in compilation. ?*/
> - ?gcc_assert (!src_cfun->calls_setjmp);
> - ?gcc_assert (!src_cfun->calls_alloca);
> -
> ? /* Copy items we preserve during clonning. ?*/
> ? cfun->static_chain_decl = src_cfun->static_chain_decl;
> ? cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area;
>


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