From: Michael Ploujnikov Date: Fri, 14 Dec 2018 00:19:08 +0000 (+0000) Subject: ipa-cp.c (print_all_lattices): Skip cp clones. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ee465524042b1244ac20b3c1083d818c32d9bfc;p=gcc.git ipa-cp.c (print_all_lattices): Skip cp clones. * ipa-cp.c (print_all_lattices): Skip cp clones. * gcc.dg/lto/pr88297_0.c: New test. * gcc.dg/lto/pr88297_1.c: New test. From-SVN: r267118 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5816ebb3995..e3baaa6026b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,7 @@ 2018-12-13 Michael Ploujnikov + * ipa-cp.c (print_all_lattices): Skip cp clones. + * ipa-cp.c: Fix various comment typos. 2018-12-13 Jakub Jelinek diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 8c183110b10..57589153614 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -542,6 +542,9 @@ print_all_lattices (FILE * f, bool dump_sources, bool dump_benefits) struct ipa_node_params *info; info = IPA_NODE_REF (node); + /* Skip constprop clones since we don't make lattices for them. */ + if (info->ipcp_orig_node) + continue; fprintf (f, " Node: %s:\n", node->dump_name ()); count = ipa_get_param_count (info); for (i = 0; i < count; i++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ce50c8a05c..8128ea99969 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-13 Michael Ploujnikov + + * gcc.dg/lto/pr88297_0.c: New test. + * gcc.dg/lto/pr88297_1.c: New test. + 2018-12-13 Jakub Jelinek PR tree-optimization/88444 diff --git a/gcc/testsuite/gcc.dg/lto/pr88297_0.c b/gcc/testsuite/gcc.dg/lto/pr88297_0.c new file mode 100644 index 00000000000..1a144491603 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr88297_0.c @@ -0,0 +1,57 @@ +/* { dg-require-effective-target lto } */ +/* { dg-lto-options { { -flto -O3 -fipa-cp -fipa-cp-clone } } } */ +/* { dg-lto-do run } */ + +/* In order to trigger IPA-CP cloning we have to: + + 1. Put the calls in main into a loop; otherwise everything is + cold and we would not clone. + + 2. Make different foos and bars actually semantically different; + otherwise IPA-ICF unified them (as it should). + +*/ + +volatile int g; + +void __attribute__ ((noipa)) +use (int v) +{ + g = v; +} + +static int __attribute__ ((noinline)) +foo (int arg) +{ + return 7 * arg; +} + +static int __attribute__ ((noinline)) +bar (int arg) +{ + return arg * arg; +} + +extern int __attribute__ ((noinline)) +entry2 (void); + +int __attribute__ ((noipa)) +get_opaque_number (void) +{ + return 1; +} + +int main (void) +{ + int i; + for (i = 0; i < get_opaque_number (); i++) + { + use (bar (3)); + use (bar (4)); + use (foo (5)); + use (foo (6)); + + entry2 (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr88297_1.c b/gcc/testsuite/gcc.dg/lto/pr88297_1.c new file mode 100644 index 00000000000..65c5321cde5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr88297_1.c @@ -0,0 +1,25 @@ +extern void __attribute__ ((noipa)) +use (int v); + + +static int __attribute__ ((noinline)) +foo (int arg) +{ + return 8 * arg; +} + +static int __attribute__ ((noinline)) +bar (int arg) +{ + return arg * arg + 3; +} + +int __attribute__ ((noinline)) +entry2 (void) +{ + use (bar (3)); + use (bar (4)); + use (foo (5)); + use (foo (6)); + return 0; +}