public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Testcase for PR 88297 and minor fixes
@ 2018-12-06 20:13 Michael Ploujnikov
  2018-12-12 18:01 ` [PING 1] " Michael Ploujnikov
  2018-12-14  0:19 ` [PATCH] " Jeff Law
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ploujnikov @ 2018-12-06 20:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Martin Jambor


[-- Attachment #1.1.1: Type: text/plain, Size: 449 bytes --]

Thanks to Martin we now have a test that exercises (cp) cloning
machinery during the WPA stage of LTO.

Also, during debugging I found that print_all_lattices would trigger
an assert if I tried to call it inside decide_whether_version_node.

Finally I've attached some comment spelling fixes as a bonus.


Bootstrapping (--with-build-config=bootstrap-lto) and regression testing on x86_64.

Ok for trunk after tests pass?


- Michael

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-Skip-constprop-clones-because-we-don-t-make-lattices.patch --]
[-- Type: text/x-patch; name="0001-Skip-constprop-clones-because-we-don-t-make-lattices.patch", Size: 1011 bytes --]

From f8f59d44141726e688cde077aabb5f2ce0bf53e0 Mon Sep 17 00:00:00 2001
From: Michael Ploujnikov <michael.ploujnikov@oracle.com>
Date: Thu, 6 Dec 2018 13:36:51 -0500
Subject: [PATCH 1/3] Skip constprop clones because we don't make lattices for
 them.

gcc/ChangeLog:

2018-12-06  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* ipa-cp.c (print_all_lattices): Skip cp clones.
---
 gcc/ipa-cp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git gcc/ipa-cp.c gcc/ipa-cp.c
index c7c462ab81..c4e879bbc6 100644
--- gcc/ipa-cp.c
+++ 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++)
-- 
2.19.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.3: 0002-Testcase-for-cloning-during-LTO-WPA-stage.patch --]
[-- Type: text/x-patch; name="0002-Testcase-for-cloning-during-LTO-WPA-stage.patch", Size: 2671 bytes --]

From 1ec489bbb30f410144c0bc84f0c160a8fbed0be6 Mon Sep 17 00:00:00 2001
From: Michael Ploujnikov <michael.ploujnikov@oracle.com>
Date: Thu, 6 Dec 2018 13:47:00 -0500
Subject: [PATCH 2/3] Testcase for cloning during LTO WPA stage.

Written with Martin Jambor's help:
https://gcc.gnu.org/ml/gcc/2018-12/msg00043.html

gcc/testsuite/ChangeLog:

2018-12-06  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* gcc.dg/lto/pr88297_0.c: New test.
	* gcc.dg/lto/pr88297_1.c: New test.
---
 gcc/testsuite/gcc.dg/lto/pr88297_0.c | 57 ++++++++++++++++++++++++++++
 gcc/testsuite/gcc.dg/lto/pr88297_1.c | 25 ++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr88297_0.c
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr88297_1.c

diff --git gcc/testsuite/gcc.dg/lto/pr88297_0.c gcc/testsuite/gcc.dg/lto/pr88297_0.c
new file mode 100644
index 0000000000..d415015166
--- /dev/null
+++ 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
+  coldand 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 gcc/testsuite/gcc.dg/lto/pr88297_1.c gcc/testsuite/gcc.dg/lto/pr88297_1.c
new file mode 100644
index 0000000000..65c5321cde
--- /dev/null
+++ 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;
+}
-- 
2.19.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.4: 0003-Spelling-fixes-in-comments.patch --]
[-- Type: text/x-patch; name="0003-Spelling-fixes-in-comments.patch", Size: 3562 bytes --]

From c2db1a6aa7d6787685a28df1e677a66bac6cb9b5 Mon Sep 17 00:00:00 2001
From: Michael Ploujnikov <michael.ploujnikov@oracle.com>
Date: Thu, 6 Dec 2018 14:06:55 -0500
Subject: [PATCH 3/3] Spelling fixes in comments.

gcc/ChangeLog:

2018-12-06  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* ipa-cp.c (ipa_get_indirect_edge_target_1): Fix spelling in
	comments.
---
 gcc/ipa-cp.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git gcc/ipa-cp.c gcc/ipa-cp.c
index c4e879bbc6..8c419e1f53 100644
--- gcc/ipa-cp.c
+++ gcc/ipa-cp.c
@@ -191,7 +191,7 @@ public:
   /* Depth first search number and low link for topological sorting of
      values.  */
   int dfs, low_link;
-  /* True if this valye is currently on the topo-sort stack.  */
+  /* True if this value is currently on the topo-sort stack.  */
   bool on_stack;
 
   ipcp_value()
@@ -883,7 +883,7 @@ ipcp_lattice<valtype>::set_contains_variable ()
   return ret;
 }
 
-/* Set all aggegate lattices in PLATS to bottom and return true if they were
+/* Set all aggregate lattices in PLATS to bottom and return true if they were
    not previously set as such.  */
 
 static inline bool
@@ -894,7 +894,7 @@ set_agg_lats_to_bottom (struct ipcp_param_lattices *plats)
   return ret;
 }
 
-/* Mark all aggegate lattices in PLATS as containing an unknown value and
+/* Mark all aggregate lattices in PLATS as containing an unknown value and
    return true if they were not previously marked as such.  */
 
 static inline bool
@@ -911,7 +911,7 @@ ipcp_vr_lattice::meet_with (const ipcp_vr_lattice &other)
   return meet_with_1 (&other.m_vr);
 }
 
-/* Meet the current value of the lattice with value ranfge described by VR
+/* Meet the current value of the lattice with value range described by VR
    lattice.  */
 
 bool
@@ -1333,7 +1333,7 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc,
     return NULL_TREE;
 }
 
-/* Determie whether JFUNC evaluates to single known polymorphic context, given
+/* Determine whether JFUNC evaluates to single known polymorphic context, given
    that INFO describes the caller node or the one it is inlined to, CS is the
    call graph edge corresponding to JFUNC and CSIDX index of the described
    parameter.  */
@@ -2382,7 +2382,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
 
   t = NULL;
 
-  /* Try to work out value of virtual table pointer value in replacemnets.  */
+  /* Try to work out value of virtual table pointer value in replacements.  */
   if (!t && agg_reps && !ie->indirect_info->by_ref)
     {
       while (agg_reps)
@@ -4603,7 +4603,7 @@ ipcp_val_agg_replacement_ok_p (ipa_agg_replacement_value *aggvals,
   return false;
 }
 
-/* Return true if offset is minus one because source of a polymorphic contect
+/* Return true if offset is minus one because source of a polymorphic context
    cannot be an aggregate value.  */
 
 DEBUG_FUNCTION bool
@@ -4614,7 +4614,7 @@ ipcp_val_agg_replacement_ok_p (ipa_agg_replacement_value *,
   return offset == -1;
 }
 
-/* Decide wheter to create a special version of NODE for value VAL of parameter
+/* Decide whether to create a special version of NODE for value VAL of parameter
    at the given INDEX.  If OFFSET is -1, the value is for the parameter itself,
    otherwise it is stored at the given OFFSET of the parameter.  KNOWN_CSTS,
    KNOWN_CONTEXTS and KNOWN_AGGS describe the other already known values.  */
-- 
2.19.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PING 1] Testcase for PR 88297 and minor fixes
  2018-12-06 20:13 [PATCH] Testcase for PR 88297 and minor fixes Michael Ploujnikov
@ 2018-12-12 18:01 ` Michael Ploujnikov
  2018-12-14  0:19 ` [PATCH] " Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ploujnikov @ 2018-12-12 18:01 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Martin Jambor


[-- Attachment #1.1: Type: text/plain, Size: 546 bytes --]

On 2018-12-06 3:13 p.m., Michael Ploujnikov wrote:
> Thanks to Martin we now have a test that exercises (cp) cloning
> machinery during the WPA stage of LTO.
> 
> Also, during debugging I found that print_all_lattices would trigger
> an assert if I tried to call it inside decide_whether_version_node.
> 
> Finally I've attached some comment spelling fixes as a bonus.
> 
> 
> Bootstrapping (--with-build-config=bootstrap-lto) and regression testing on x86_64.
> 
> Ok for trunk after tests pass?
> 
> 
> - Michael
> 

Ping?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Testcase for PR 88297 and minor fixes
  2018-12-06 20:13 [PATCH] Testcase for PR 88297 and minor fixes Michael Ploujnikov
  2018-12-12 18:01 ` [PING 1] " Michael Ploujnikov
@ 2018-12-14  0:19 ` Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2018-12-14  0:19 UTC (permalink / raw)
  To: Michael Ploujnikov, GCC Patches; +Cc: Jan Hubicka, Martin Jambor

On 12/6/18 1:13 PM, Michael Ploujnikov wrote:
> Thanks to Martin we now have a test that exercises (cp) cloning
> machinery during the WPA stage of LTO.
> 
> Also, during debugging I found that print_all_lattices would trigger
> an assert if I tried to call it inside decide_whether_version_node.
> 
> Finally I've attached some comment spelling fixes as a bonus.
> 
> 
> Bootstrapping (--with-build-config=bootstrap-lto) and regression testing on x86_64.
> 
> Ok for trunk after tests pass?
Thanks.  I went ahead and installed all 3 patches on the trunk.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-14  0:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 20:13 [PATCH] Testcase for PR 88297 and minor fixes Michael Ploujnikov
2018-12-12 18:01 ` [PING 1] " Michael Ploujnikov
2018-12-14  0:19 ` [PATCH] " Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).