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, Pointer Bounds Checker 28/x] IPA CP


Hi,

On Wed, Jun 11, 2014 at 05:47:36PM +0400, Ilya Enkovich wrote:
>
> Here is fixed verison.

I'm fine with the ipa-cp hunks but I cannot approve them, Honza is the
right person to ask.

Thanks,

Martin


> 
> Thanks,
> Ilya
> --
> gcc/
> 
> 2014-06-11  Ilya Enkovich  <ilya.enkovich@intel.com>
> 
> 	* cgraph.h (cgraph_local_p): New.
> 	* ipa-cp.c (initialize_node_lattices): Use cgraph_local_p
> 	to handle instrumentation clones properly.
> 	(propagate_constants_accross_call): Do not propagate
> 	through instrumentation thunks.
> 
> 
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 5e702a7..b225ebe 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -1556,4 +1556,17 @@ symtab_in_same_comdat_p (symtab_node *one, symtab_node *two)
>  {
>    return DECL_COMDAT_GROUP (one->decl) == DECL_COMDAT_GROUP (two->decl);
>  }
> +
> +/* Return true if NODE is local.  Instrumentation clones are counted as local
> +   only when originla function is local.  */
> +
> +static inline bool
> +cgraph_local_p (cgraph_node *node)
> +{
> +  if (!node->instrumentation_clone || !node->instrumented_version)
> +    return node->local.local;
> +
> +  return node->local.local && node->instrumented_version->local.local;
> +}
> +
>  #endif  /* GCC_CGRAPH_H  */
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 689378a..4318789 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -699,7 +699,7 @@ initialize_node_lattices (struct cgraph_node *node)
>    int i;
>  
>    gcc_checking_assert (cgraph_function_with_gimple_body_p (node));
> -  if (!node->local.local)
> +  if (!cgraph_local_p (node))
>      {
>        /* When cloning is allowed, we can assume that externally visible
>  	 functions are not called.  We will compensate this by cloning
> @@ -1434,6 +1434,24 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
>    if (parms_count == 0)
>      return false;
>  
> +  /* No propagation through instrumentation thunks is available yet.
> +     It should be possible with proper mapping of call args and
> +     instrumented callee params in the propagation loop below.  But
> +     this case mostly occurs when legacy code calls instrumented code
> +     and it is not a primary target for optimizations.
> +     We detect instrumentation thunks in aliases and thunks chain by
> +     checking instrumentation_clone flag for chain source and target.
> +     Going through instrumentation thunks we always have it changed
> +     from 0 to 1 and all other nodes do not change it.  */
> +  if (!cs->callee->instrumentation_clone
> +      && callee->instrumentation_clone)
> +    {
> +      for (i = 0; i < parms_count; i++)
> +	ret |= set_all_contains_variable (ipa_get_parm_lattices (callee_info,
> +								 i));
> +      return ret;
> +    }
> +
>    /* If this call goes through a thunk we must not propagate to the first (0th)
>       parameter.  However, we might need to uncover a thunk from below a series
>       of aliases first.  */


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