Re: [PATCH] Do not propagate self-dependent value (PR ipa/93763)

2020-02-24 Thread Christophe Lyon
Hi,

On Fri, 21 Feb 2020 at 21:23, Jeff Law  wrote:
>
> On Fri, 2020-02-21 at 18:59 +0100, Martin Jambor wrote:
> > Hi,
> >
> > On Tue, Feb 18 2020, Feng Xue OS wrote:
> > > Currently, for self-recursive call, we never use value originated from 
> > > non-passthrough
> > > jump function as source to avoid propagation explosion, but 
> > > self-dependent value is
> > > missed. This patch is made to fix the bug.
> > >
> > > Bootstrapped/regtested on x86_64-linux and aarch64-linux.
> > >
> > > Feng
> > > ---
> > > 2020-02-18  Feng Xue  
> > >
> > > PR ipa/93763
> > > * ipa-cp.c (self_recursively_generated_p): Mark self-dependent 
> > > value as
> > > self-recursively generated.
> >
> > Honza, this is OK.
> Thanks.  I went ahead and installed Feng's patch.
>

I'm seeing errors with the new testcase:
 end of struct or union
/gcc/testsuite/gcc.dg/ipa/pr93763.c:8:1: warning: data definition has
no type or storage class
/gcc/testsuite/gcc.dg/ipa/pr93763.c:8:1: warning: type defaults to
'int' in declaration of 'e' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:8:4: warning: type defaults to
'int' in declaration of 'k' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:8:7: warning: type defaults to
'int' in declaration of 'ah' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:8:11: warning: type defaults to
'int' in declaration of 'al' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:9:1: warning: return type defaults
to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:9:1: warning: type of 'aa'
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:14:3: warning: implicit
declaration of function 'h' [-Wimplicit-function-declaration]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:16:1: warning: return type
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:19:5: warning: implicit
declaration of function 'i' [-Wimplicit-function-declaration]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:22:1: warning: return type
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:25:1: warning: return type
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:27:3: warning: implicit
declaration of function 'j' [-Wimplicit-function-declaration]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:29:1: warning: return type
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:33:1: warning: return type
defaults to 'int' [-Wimplicit-int]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:45:6: warning: passing argument 1
of 'ai' from incompatible pointer type [-Wincompatible-pointer-types]
/gcc/testsuite/gcc.dg/ipa/pr93763.c:45:10: warning: passing argument 2 of 'ai'

I thought I could fix what seemed obvious typos, but it seems the
testcase is bogus (missing types, incompatible arguments, )

I'm probably missing something, but I'm not the only one according to
gcc-testresults: that test fails on many targets.

Christophe

> jeff
> >
>


Re: [PATCH] Do not propagate self-dependent value (PR ipa/93763)

2020-02-21 Thread Jeff Law
On Fri, 2020-02-21 at 18:59 +0100, Martin Jambor wrote:
> Hi,
> 
> On Tue, Feb 18 2020, Feng Xue OS wrote:
> > Currently, for self-recursive call, we never use value originated from 
> > non-passthrough
> > jump function as source to avoid propagation explosion, but self-dependent 
> > value is
> > missed. This patch is made to fix the bug.
> > 
> > Bootstrapped/regtested on x86_64-linux and aarch64-linux.
> > 
> > Feng
> > ---
> > 2020-02-18  Feng Xue  
> > 
> > PR ipa/93763
> > * ipa-cp.c (self_recursively_generated_p): Mark self-dependent 
> > value as
> > self-recursively generated.
> 
> Honza, this is OK.
Thanks.  I went ahead and installed Feng's patch.

jeff
> 



Re: [PATCH] Do not propagate self-dependent value (PR ipa/93763)

2020-02-21 Thread Martin Jambor
Hi,

On Tue, Feb 18 2020, Feng Xue OS wrote:
> Currently, for self-recursive call, we never use value originated from 
> non-passthrough
> jump function as source to avoid propagation explosion, but self-dependent 
> value is
> missed. This patch is made to fix the bug.
>
> Bootstrapped/regtested on x86_64-linux and aarch64-linux.
>
> Feng
> ---
> 2020-02-18  Feng Xue  
>
> PR ipa/93763
> * ipa-cp.c (self_recursively_generated_p): Mark self-dependent value 
> as
> self-recursively generated.

Honza, this is OK.

Thanks,

Martin



> From 1ff803f33de0fe86d526deb23af2d08c15028ff9 Mon Sep 17 00:00:00 2001
> From: Feng Xue 
> Date: Mon, 17 Feb 2020 17:07:04 +0800
> Subject: [PATCH] Do not propagate self-dependent value (PR ipa/93763)
>
> ---
>  gcc/ipa-cp.c   | 10 ---
>  gcc/testsuite/g++.dg/ipa/pr93763.C | 15 ++
>  gcc/testsuite/gcc.dg/ipa/pr93763.c | 46 ++
>  3 files changed, 67 insertions(+), 4 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/ipa/pr93763.C
>  create mode 100644 gcc/testsuite/gcc.dg/ipa/pr93763.c
>
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 4f5b72e6994..1d0c1ac0f35 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -1897,8 +1897,8 @@ ipcp_lattice::add_value (valtype newval, 
> cgraph_edge *cs,
>  }
>  
>  /* Return true, if a ipcp_value VAL is orginated from parameter value of
> -   self-feeding recursive function by applying non-passthrough arithmetic
> -   transformation.  */
> +   self-feeding recursive function via some kind of pass-through jump
> +   function.  */
>  
>  static bool
>  self_recursively_generated_p (ipcp_value *val)
> @@ -1909,10 +1909,12 @@ self_recursively_generated_p (ipcp_value *val)
>  {
>cgraph_edge *cs = src->cs;
>  
> -  if (!src->val || cs->caller != cs->callee->function_symbol ()
> -   || src->val == val)
> +  if (!src->val || cs->caller != cs->callee->function_symbol ())
>   return false;
>  
> +  if (src->val == val)
> + continue;
> +
>if (!info)
>   info = IPA_NODE_REF (cs->caller);
>