aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Ploujnikov <michael.ploujnikov@oracle.com>2018-12-14 00:19:08 +0000
committerJeff Law <law@gcc.gnu.org>2018-12-13 17:19:08 -0700
commit9ee465524042b1244ac20b3c1083d818c32d9bfc (patch)
tree0265609b39b4109a2aab16c11d59467d3e14c094 /gcc
parente8e50c1bd77d781acf09ca9868da60b79ad70d33 (diff)
downloadgcc-9ee465524042b1244ac20b3c1083d818c32d9bfc.zip
gcc-9ee465524042b1244ac20b3c1083d818c32d9bfc.tar.gz
gcc-9ee465524042b1244ac20b3c1083d818c32d9bfc.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog2
-rw-r--r--gcc/ipa-cp.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr88297_0.c57
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr88297_1.c25
5 files changed, 92 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5816ebb..e3baaa6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,7 @@
2018-12-13 Michael Ploujnikov <michael.ploujnikov@oracle.com>
+ * ipa-cp.c (print_all_lattices): Skip cp clones.
+
* ipa-cp.c: Fix various comment typos.
2018-12-13 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 8c18311..5758915 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 3ce50c8..8128ea9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-13 Michael Ploujnikov <michael.ploujnikov@oracle.com>
+
+ * gcc.dg/lto/pr88297_0.c: New test.
+ * gcc.dg/lto/pr88297_1.c: New test.
+
2018-12-13 Jakub Jelinek <jakub@redhat.com>
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 0000000..1a14449
--- /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 0000000..65c5321
--- /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;
+}