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


> 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.

Just put it into compile directory to verify that compiler no longer
ICE.
> 
> Is this ok for trunk if it rebootstraps fine?
> 
> 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;

You want notice_special_calls (stmt).  Otherwise it is OK.

Honza


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