Find matched aggregate lattice for self-recursive CP (PR ipa/93084)

2020-01-08  Feng Xue  <fxue@os.amperecomputing.com>

        PR ipa/93084
        * ipa-cp.c (self_recursively_generated_p): Find matched aggregate
        lattice for a value to check.
        (propagate_vals_across_arith_jfunc): Add an assertion to ensure
        finite propagation in self-recursive scc.

2020-01-08  Feng Xue  <fxue@os.amperecomputing.com>

        PR ipa/93084
        * gcc.dg/ipa/ipa-clone-3.c: New test.

From-SVN: r279987
This commit is contained in:
Feng Xue 2020-01-08 02:55:00 +00:00 committed by Feng Xue
parent 709d7838e7
commit 42d73fa9d5
4 changed files with 74 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2020-01-08 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/93084
* ipa-cp.c (self_recursively_generated_p): Find matched aggregate
lattice for a value to check.
(propagate_vals_across_arith_jfunc): Add an assertion to ensure
finite propagation in self-recursive scc.
2020-01-08 Luo Xiong Hu <luoxhu@linux.ibm.com>
* ipa-inline.c (caller_growth_limits): Restore the AND.

View File

@ -1917,10 +1917,25 @@ self_recursively_generated_p (ipcp_value<tree> *val)
class ipcp_param_lattices *plats = ipa_get_parm_lattices (info,
src->index);
ipcp_lattice<tree> *src_lat = src->offset == -1 ? &plats->itself
: plats->aggs;
ipcp_lattice<tree> *src_lat;
ipcp_value<tree> *src_val;
if (src->offset == -1)
src_lat = &plats->itself;
else
{
struct ipcp_agg_lattice *src_aglat;
for (src_aglat = plats->aggs; src_aglat; src_aglat = src_aglat->next)
if (src_aglat->offset == src->offset)
break;
if (!src_aglat)
return false;
src_lat = src_aglat;
}
for (src_val = src_lat->values; src_val; src_val = src_val->next)
if (src_val == val)
break;
@ -2017,6 +2032,8 @@ propagate_vals_across_arith_jfunc (cgraph_edge *cs,
val_seeds.safe_push (src_val);
}
gcc_assert ((int) val_seeds.length () <= param_ipa_cp_value_list_size);
/* Recursively generate lattice values with a limited count. */
FOR_EACH_VEC_ELT (val_seeds, i, src_val)
{

View File

@ -1,3 +1,8 @@
2020-01-08 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/93084
* gcc.dg/ipa/ipa-clone-3.c: New test.
2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
* g++.old-deja/g++.bugs/900208_03.C: Check locations too.

View File

@ -0,0 +1,42 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-ipa-cp-details -fno-early-inlining --param ipa-cp-max-recursive-depth=8 --param ipa-cp-eval-threshold=1" } */
struct V {
int f0;
int f1;
};
int data[100];
int fn ();
int recur_fn (struct V * __restrict v)
{
int i = v->f0;
int j = v->f1;
struct V t;
if (j > 100)
{
fn ();
return 1;
}
data[i] = i;
t.f0 = i - 2;
t.f1 = j + 1;
recur_fn (&t);
return i * j;
}
int main ()
{
struct V v = {1, 3};
return recur_fn (&v);
}
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of recur_fn/\[0-9\]*\\." 8 "cp" } } */