[PR 82027] Also stream opt_info of former_clones
authorMartin Jambor <mjambor@suse.cz>
Fri, 22 Dec 2017 17:03:16 +0000 (18:03 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Fri, 22 Dec 2017 17:03:16 +0000 (18:03 +0100)
2017-12-22  Martin Jambor  <mjambor@suse.cz>

PR lto/82027
* lto-cgraph.c (output_cgraph_opt_summary_p): Also check former
clones.

testsuite/
* g++.dg/lto/pr82027_0.C: New test.

From-SVN: r255978

gcc/ChangeLog
gcc/lto-cgraph.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr82027_0.C [new file with mode: 0644]

index 084718852be23c76668e5383ffd0a0fdc5757d6d..fed24f776d5ceeec7c8f3bb0cbfeb86766c26c60 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-22  Martin Jambor  <mjambor@suse.cz>
+
+       PR lto/82027
+       * lto-cgraph.c (output_cgraph_opt_summary_p): Also check former
+       clones.
+
 2017-12-22  Julia Koval  <julia.koval@intel.com>
        Sebastian Peryt <sebastian.peryt@intel.com>
 
index a19f8a13dfb892cc8c06ed9b2b9ae4ee90788777..ed3df15b14389535f0f1b997bac8e72544ea58e5 100644 (file)
@@ -1958,7 +1958,7 @@ input_offload_tables (bool do_force_output)
 static int
 output_cgraph_opt_summary_p (struct cgraph_node *node)
 {
-  return (node->clone_of
+  return ((node->clone_of || node->former_clone_of)
          && (node->clone.tree_map
              || node->clone.args_to_skip
              || node->clone.combined_args_to_skip));
index fb9c339ea3f3aee7031c0e611a3dc1b6af9b4d93..209d4fc7e558e818060f907df904d2b11ab56046 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-22  Martin Jambor  <mjambor@suse.cz>
+
+       PR lto/82027
+       * g++.dg/lto/pr82027_0.C: New test.
+
 2017-12-22  Julia Koval  <julia.koval@intel.com>
        Sebastian Peryt <sebastian.peryt@intel.com>
 
diff --git a/gcc/testsuite/g++.dg/lto/pr82027_0.C b/gcc/testsuite/g++.dg/lto/pr82027_0.C
new file mode 100644 (file)
index 0000000..70cc776
--- /dev/null
@@ -0,0 +1,73 @@
+// { dg-lto-do run }
+// { dg-lto-options { { -O3 -flto } } }
+
+class Position
+{
+  public:
+    Position( void ) {}
+    virtual ~Position() {}
+
+    virtual void calcPercent( const char *name,int pos,int size ) {}
+};
+
+
+class Looper
+{
+  public:
+    Looper( Position *cc,int size )
+      : m_cc(cc), m_size(size) {}
+    virtual ~Looper() {}
+
+    void loop( void )
+    {
+      for( int pos=0; pos<m_size; pos++ )
+      {
+        m_cc->calcPercent( "",pos,m_size );
+      }
+    }
+
+  private:
+    Position *m_cc;
+    int m_size;
+};
+
+
+class EmptyClass
+{
+  public:
+    EmptyClass( void ) {}
+    virtual ~EmptyClass() {}
+};
+
+
+class Combined : public EmptyClass, public Position
+{
+  public:
+    Combined( void ) : m_percent(0) {}
+    ~Combined() {}
+
+    void calcPercent( const char *name,int pos,int size )
+    {
+      int percent = 100*pos/size;
+      if( percent!=m_percent )
+        m_percent = percent;
+    }
+
+  private:
+    int m_percent;
+};
+
+
+
+int main( int argc,char **argv )
+{
+  Combined *comb = new Combined();
+  Looper *looper = new Looper( comb,argc );
+
+  looper->loop();
+
+  delete comb;
+  delete looper;
+
+  return( 0 );
+}