diff mbox series

[06/10] ipa: add 'final' and 'override' to call_summary_base vfunc impls

Message ID 20220523192834.3785673-7-dmalcolm@redhat.com
State New
Headers show
Series Add 'final' and 'override' where missing | expand

Commit Message

David Malcolm May 23, 2022, 7:28 p.m. UTC
gcc/ChangeLog:
	* ipa-cp.cc: Add "final" and "override" to call_summary_base vfunc
	implementations, removing redundant "virtual" as appropriate.
	* ipa-fnsummary.h: Likewise.
	* ipa-modref.cc: Likewise.
	* ipa-param-manipulation.cc: Likewise.
	* ipa-profile.cc: Likewise.
	* ipa-prop.h: Likewise.
	* ipa-pure-const.cc: Likewise.
	* ipa-reference.cc: Likewise.
	* ipa-sra.cc: Likewise.
	* symbol-summary.h: Likewise.
	* symtab-thunks.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/ipa-cp.cc                 |  6 +++---
 gcc/ipa-fnsummary.h           | 21 ++++++++++----------
 gcc/ipa-modref.cc             | 36 +++++++++++++++++------------------
 gcc/ipa-param-manipulation.cc |  8 ++++----
 gcc/ipa-profile.cc            |  6 +++---
 gcc/ipa-prop.h                | 26 ++++++++++++-------------
 gcc/ipa-pure-const.cc         |  8 ++++----
 gcc/ipa-reference.cc          | 10 +++++-----
 gcc/ipa-sra.cc                | 14 +++++++-------
 gcc/symbol-summary.h          |  8 ++++----
 gcc/symtab-thunks.cc          |  8 ++++----
 11 files changed, 76 insertions(+), 75 deletions(-)

Comments

Martin Liška May 24, 2022, 7:36 a.m. UTC | #1
On 5/23/22 21:28, David Malcolm via Gcc-patches wrote:
> gcc/ChangeLog:
> 	* ipa-cp.cc: Add "final" and "override" to call_summary_base vfunc
> 	implementations, removing redundant "virtual" as appropriate.
> 	* ipa-fnsummary.h: Likewise.
> 	* ipa-modref.cc: Likewise.
> 	* ipa-param-manipulation.cc: Likewise.
> 	* ipa-profile.cc: Likewise.
> 	* ipa-prop.h: Likewise.
> 	* ipa-pure-const.cc: Likewise.
> 	* ipa-reference.cc: Likewise.
> 	* ipa-sra.cc: Likewise.
> 	* symbol-summary.h: Likewise.
> 	* symtab-thunks.cc: Likewise.
> 
> Signed-off-by: David Malcolm <dmalcolm@redhat.com>

Ok.

Martin

> ---
>  gcc/ipa-cp.cc                 |  6 +++---
>  gcc/ipa-fnsummary.h           | 21 ++++++++++----------
>  gcc/ipa-modref.cc             | 36 +++++++++++++++++------------------
>  gcc/ipa-param-manipulation.cc |  8 ++++----
>  gcc/ipa-profile.cc            |  6 +++---
>  gcc/ipa-prop.h                | 26 ++++++++++++-------------
>  gcc/ipa-pure-const.cc         |  8 ++++----
>  gcc/ipa-reference.cc          | 10 +++++-----
>  gcc/ipa-sra.cc                | 14 +++++++-------
>  gcc/symbol-summary.h          |  8 ++++----
>  gcc/symtab-thunks.cc          |  8 ++++----
>  11 files changed, 76 insertions(+), 75 deletions(-)
> 
> diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
> index 38a21b17e39..bb2d611cbcd 100644
> --- a/gcc/ipa-cp.cc
> +++ b/gcc/ipa-cp.cc
> @@ -4190,9 +4190,9 @@ public:
>        m_initialize_when_cloning = true;
>      }
>  
> -  virtual void duplicate (cgraph_edge *src_edge, cgraph_edge *dst_edge,
> -			  edge_clone_summary *src_data,
> -			  edge_clone_summary *dst_data);
> +  void duplicate (cgraph_edge *src_edge, cgraph_edge *dst_edge,
> +		  edge_clone_summary *src_data,
> +		  edge_clone_summary *dst_data) final override;
>  };
>  
>  /* Edge duplication hook.  */
> diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h
> index e1f1d1b839c..941fea6de0d 100644
> --- a/gcc/ipa-fnsummary.h
> +++ b/gcc/ipa-fnsummary.h
> @@ -236,14 +236,15 @@ public:
>    /* Remove ipa_fn_summary for all callees of NODE.  */
>    void remove_callees (cgraph_node *node);
>  
> -  virtual void insert (cgraph_node *, ipa_fn_summary *);
> -  virtual void remove (cgraph_node *node, ipa_fn_summary *)
> +  void insert (cgraph_node *, ipa_fn_summary *) final override;
> +  void remove (cgraph_node *node, ipa_fn_summary *) final override
>    {
>      remove_callees (node);
>    }
>  
> -  virtual void duplicate (cgraph_node *src, cgraph_node *dst,
> -			  ipa_fn_summary *src_data, ipa_fn_summary *dst_data);
> +  void duplicate (cgraph_node *src, cgraph_node *dst,
> +		  ipa_fn_summary *src_data, ipa_fn_summary *dst_data)
> +    final override;
>  };
>  
>  extern GTY(()) fast_function_summary <ipa_fn_summary *, va_gc>
> @@ -259,9 +260,9 @@ public:
>      disable_insertion_hook ();
>    }
>  
> -  virtual void duplicate (cgraph_node *, cgraph_node *,
> -			  ipa_size_summary *src_data,
> -			  ipa_size_summary *dst_data)
> +  void duplicate (cgraph_node *, cgraph_node *,
> +		  ipa_size_summary *src_data,
> +		  ipa_size_summary *dst_data) final override
>    {
>      *dst_data = *src_data;
>    }
> @@ -311,9 +312,9 @@ public:
>      fast_call_summary <ipa_call_summary *, va_heap> (symtab) {}
>  
>    /* Hook that is called by summary when an edge is duplicated.  */
> -  virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
> -			  ipa_call_summary *src_data,
> -			  ipa_call_summary *dst_data);
> +  void duplicate (cgraph_edge *src, cgraph_edge *dst,
> +		  ipa_call_summary *src_data,
> +		  ipa_call_summary *dst_data) final override;
>  };
>  
>  /* Estimated execution times, code sizes and other information about the
> diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
> index 7c1f974bc7a..0d9abacf0a6 100644
> --- a/gcc/ipa-modref.cc
> +++ b/gcc/ipa-modref.cc
> @@ -119,10 +119,10 @@ public:
>    fnspec_summaries_t (symbol_table *symtab)
>        : call_summary <fnspec_summary *> (symtab) {}
>    /* Hook that is called by summary when an edge is duplicated.  */
> -  virtual void duplicate (cgraph_edge *,
> -			  cgraph_edge *,
> -			  fnspec_summary *src,
> -			  fnspec_summary *dst)
> +  void duplicate (cgraph_edge *,
> +		  cgraph_edge *,
> +		  fnspec_summary *src,
> +		  fnspec_summary *dst) final override
>    {
>      dst->fnspec = xstrdup (src->fnspec);
>    }
> @@ -194,10 +194,10 @@ public:
>    escape_summaries_t (symbol_table *symtab)
>        : call_summary <escape_summary *> (symtab) {}
>    /* Hook that is called by summary when an edge is duplicated.  */
> -  virtual void duplicate (cgraph_edge *,
> -			  cgraph_edge *,
> -			  escape_summary *src,
> -			  escape_summary *dst)
> +  void duplicate (cgraph_edge *,
> +		  cgraph_edge *,
> +		  escape_summary *src,
> +		  escape_summary *dst) final override
>    {
>      dst->esc = src->esc.copy ();
>    }
> @@ -217,11 +217,11 @@ class GTY((user)) modref_summaries
>  public:
>    modref_summaries (symbol_table *symtab)
>        : fast_function_summary <modref_summary *, va_gc> (symtab) {}
> -  virtual void insert (cgraph_node *, modref_summary *state);
> -  virtual void duplicate (cgraph_node *src_node,
> -			  cgraph_node *dst_node,
> -			  modref_summary *src_data,
> -			  modref_summary *dst_data);
> +  void insert (cgraph_node *, modref_summary *state) final override;
> +  void duplicate (cgraph_node *src_node,
> +		  cgraph_node *dst_node,
> +		  modref_summary *src_data,
> +		  modref_summary *dst_data) final override;
>    static modref_summaries *create_ggc (symbol_table *symtab)
>    {
>      return new (ggc_alloc_no_dtor<modref_summaries> ())
> @@ -241,11 +241,11 @@ public:
>    modref_summaries_lto (symbol_table *symtab)
>        : fast_function_summary <modref_summary_lto *, va_gc> (symtab),
>  	propagated (false) {}
> -  virtual void insert (cgraph_node *, modref_summary_lto *state);
> -  virtual void duplicate (cgraph_node *src_node,
> -			  cgraph_node *dst_node,
> -			  modref_summary_lto *src_data,
> -			  modref_summary_lto *dst_data);
> +  void insert (cgraph_node *, modref_summary_lto *state) final override;
> +  void duplicate (cgraph_node *src_node,
> +		  cgraph_node *dst_node,
> +		  modref_summary_lto *src_data,
> +		  modref_summary_lto *dst_data) final override;
>    static modref_summaries_lto *create_ggc (symbol_table *symtab)
>    {
>      return new (ggc_alloc_no_dtor<modref_summaries_lto> ())
> diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
> index 38328c3e8d0..23a8cb84d48 100644
> --- a/gcc/ipa-param-manipulation.cc
> +++ b/gcc/ipa-param-manipulation.cc
> @@ -114,10 +114,10 @@ class ipa_edge_modification_sum
>  
>    /* Hook that is called by summary when an edge is duplicated.  */
>  
> -  virtual void duplicate (cgraph_edge *,
> -			  cgraph_edge *,
> -			  ipa_edge_modification_info *old_info,
> -			  ipa_edge_modification_info *new_info)
> +  void duplicate (cgraph_edge *,
> +		  cgraph_edge *,
> +		  ipa_edge_modification_info *old_info,
> +		  ipa_edge_modification_info *new_info) final override
>    {
>      new_info->index_map.safe_splice (old_info->index_map);
>      new_info->pass_through_map.safe_splice (old_info->pass_through_map);
> diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc
> index 496f292acba..e0acc5d0188 100644
> --- a/gcc/ipa-profile.cc
> +++ b/gcc/ipa-profile.cc
> @@ -198,9 +198,9 @@ public:
>    {}
>  
>    /* Duplicate info when an edge is cloned.  */
> -  virtual void duplicate (cgraph_edge *, cgraph_edge *,
> -			  speculative_call_summary *old_sum,
> -			  speculative_call_summary *new_sum);
> +  void duplicate (cgraph_edge *, cgraph_edge *,
> +		  speculative_call_summary *old_sum,
> +		  speculative_call_summary *new_sum) final override;
>  };
>  
>  static ipa_profile_call_summaries *call_sums = NULL;
> diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
> index b22dfb5315c..8811e0ea987 100644
> --- a/gcc/ipa-prop.h
> +++ b/gcc/ipa-prop.h
> @@ -1004,10 +1004,10 @@ public:
>    }
>  
>    /* Hook that is called by summary when a node is duplicated.  */
> -  virtual void duplicate (cgraph_node *node,
> -			  cgraph_node *node2,
> -			  ipa_node_params *data,
> -			  ipa_node_params *data2);
> +  void duplicate (cgraph_node *node,
> +		  cgraph_node *node2,
> +		  ipa_node_params *data,
> +		  ipa_node_params *data2) final override;
>  };
>  
>  /* Summary to manange ipa_edge_args structures.  */
> @@ -1024,12 +1024,12 @@ class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
>    }
>  
>    /* Hook that is called by summary when an edge is removed.  */
> -  virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
> +  void remove (cgraph_edge *cs, ipa_edge_args *args) final override;
>    /* Hook that is called by summary when an edge is duplicated.  */
> -  virtual void duplicate (cgraph_edge *src,
> -			  cgraph_edge *dst,
> -			  ipa_edge_args *old_args,
> -			  ipa_edge_args *new_args);
> +  void duplicate (cgraph_edge *src,
> +		  cgraph_edge *dst,
> +		  ipa_edge_args *old_args,
> +		  ipa_edge_args *new_args) final override;
>  };
>  
>  /* Function summary where the parameter infos are actually stored. */
> @@ -1055,10 +1055,10 @@ public:
>      return summary;
>    }
>    /* Hook that is called by summary when a node is duplicated.  */
> -  virtual void duplicate (cgraph_node *node,
> -			  cgraph_node *node2,
> -			  ipcp_transformation *data,
> -			  ipcp_transformation *data2);
> +  void duplicate (cgraph_node *node,
> +		  cgraph_node *node2,
> +		  ipcp_transformation *data,
> +		  ipcp_transformation *data2) final override;
>  };
>  
>  /* Function summary where the IPA CP transformations are actually stored.  */
> diff --git a/gcc/ipa-pure-const.cc b/gcc/ipa-pure-const.cc
> index 0e55fc4bfc5..572a6da274f 100644
> --- a/gcc/ipa-pure-const.cc
> +++ b/gcc/ipa-pure-const.cc
> @@ -137,10 +137,10 @@ public:
>    funct_state_summary_t (symbol_table *symtab):
>      fast_function_summary <funct_state_d *, va_heap> (symtab) {}
>  
> -  virtual void insert (cgraph_node *, funct_state_d *state);
> -  virtual void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
> -			  funct_state_d *src_data,
> -			  funct_state_d *dst_data);
> +  void insert (cgraph_node *, funct_state_d *state) final override;
> +  void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
> +		  funct_state_d *src_data,
> +		  funct_state_d *dst_data) final override;
>  };
>  
>  static funct_state_summary_t *funct_state_summaries = NULL;
> diff --git a/gcc/ipa-reference.cc b/gcc/ipa-reference.cc
> index b5a2350ce72..bd6ee0d8c57 100644
> --- a/gcc/ipa-reference.cc
> +++ b/gcc/ipa-reference.cc
> @@ -133,11 +133,11 @@ public:
>    ipa_ref_opt_summary_t (symbol_table *symtab):
>      fast_function_summary <ipa_reference_optimization_summary_d *, va_heap> (symtab) {}
>  
> -  virtual void remove (cgraph_node *src_node,
> -		       ipa_reference_optimization_summary_d *data);
> -  virtual void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
> -			  ipa_reference_optimization_summary_d *src_data,
> -			  ipa_reference_optimization_summary_d *dst_data);
> +  void remove (cgraph_node *src_node,
> +	       ipa_reference_optimization_summary_d *data) final override;
> +  void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
> +		  ipa_reference_optimization_summary_d *src_data,
> +		  ipa_reference_optimization_summary_d *dst_data) final override;
>  };
>  
>  static ipa_ref_opt_summary_t *ipa_ref_opt_sum_summaries = NULL;
> diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
> index 4f705a3febf..2237ac6d92f 100644
> --- a/gcc/ipa-sra.cc
> +++ b/gcc/ipa-sra.cc
> @@ -376,10 +376,10 @@ public:
>    ipa_sra_function_summaries (symbol_table *table, bool ggc):
>      function_summary<isra_func_summary *> (table, ggc) { }
>  
> -  virtual void duplicate (cgraph_node *, cgraph_node *,
> -			  isra_func_summary *old_sum,
> -			  isra_func_summary *new_sum);
> -  virtual void insert (cgraph_node *, isra_func_summary *);
> +  void duplicate (cgraph_node *, cgraph_node *,
> +		  isra_func_summary *old_sum,
> +		  isra_func_summary *new_sum) final override;
> +  void insert (cgraph_node *, isra_func_summary *) final override;
>  };
>  
>  /* Hook that is called by summary when a node is duplicated.  */
> @@ -458,9 +458,9 @@ public:
>      call_summary<isra_call_summary *> (table) { }
>  
>    /* Duplicate info when an edge is cloned.  */
> -  virtual void duplicate (cgraph_edge *, cgraph_edge *,
> -			  isra_call_summary *old_sum,
> -			  isra_call_summary *new_sum);
> +  void duplicate (cgraph_edge *, cgraph_edge *,
> +		  isra_call_summary *old_sum,
> +		  isra_call_summary *new_sum) final override;
>  };
>  
>  static ipa_sra_call_summaries *call_sums;
> diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
> index c54d3084cc4..45fa250e3f9 100644
> --- a/gcc/symbol-summary.h
> +++ b/gcc/symbol-summary.h
> @@ -248,7 +248,7 @@ protected:
>  
>  private:
>    /* Indication if we use ggc summary.  */
> -  virtual bool is_ggc ()
> +  bool is_ggc () final override
>    {
>      return m_ggc;
>    }
> @@ -439,7 +439,7 @@ public:
>  				  void *data);
>  
>  private:
> -  virtual bool is_ggc ();
> +  bool is_ggc () final override;
>  
>    /* Summary is stored in the vector.  */
>    vec <T *, V> *m_vector;
> @@ -744,7 +744,7 @@ protected:
>  
>  private:
>    /* Indication if we use ggc summary.  */
> -  virtual bool is_ggc ()
> +  bool is_ggc () final override
>    {
>      return m_ggc;
>    }
> @@ -910,7 +910,7 @@ public:
>  				  void *data);
>  
>  private:
> -  virtual bool is_ggc ();
> +  bool is_ggc () final override;
>  
>    /* Summary is stored in the vector.  */
>    vec <T *, V> *m_vector;
> diff --git a/gcc/symtab-thunks.cc b/gcc/symtab-thunks.cc
> index 73f810dc217..b1d9c5ddb53 100644
> --- a/gcc/symtab-thunks.cc
> +++ b/gcc/symtab-thunks.cc
> @@ -71,10 +71,10 @@ public:
>      function_summary<thunk_info *> (table, ggc) { }
>  
>    /* Hook that is called by summary when a node is duplicated.  */
> -  virtual void duplicate (cgraph_node *node,
> -			  cgraph_node *node2,
> -			  thunk_info *data,
> -			  thunk_info *data2);
> +  void duplicate (cgraph_node *node,
> +		  cgraph_node *node2,
> +		  thunk_info *data,
> +		  thunk_info *data2) final override;
>  };
>  
>  /* Duplication hook.  */
diff mbox series

Patch

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 38a21b17e39..bb2d611cbcd 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -4190,9 +4190,9 @@  public:
       m_initialize_when_cloning = true;
     }
 
-  virtual void duplicate (cgraph_edge *src_edge, cgraph_edge *dst_edge,
-			  edge_clone_summary *src_data,
-			  edge_clone_summary *dst_data);
+  void duplicate (cgraph_edge *src_edge, cgraph_edge *dst_edge,
+		  edge_clone_summary *src_data,
+		  edge_clone_summary *dst_data) final override;
 };
 
 /* Edge duplication hook.  */
diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h
index e1f1d1b839c..941fea6de0d 100644
--- a/gcc/ipa-fnsummary.h
+++ b/gcc/ipa-fnsummary.h
@@ -236,14 +236,15 @@  public:
   /* Remove ipa_fn_summary for all callees of NODE.  */
   void remove_callees (cgraph_node *node);
 
-  virtual void insert (cgraph_node *, ipa_fn_summary *);
-  virtual void remove (cgraph_node *node, ipa_fn_summary *)
+  void insert (cgraph_node *, ipa_fn_summary *) final override;
+  void remove (cgraph_node *node, ipa_fn_summary *) final override
   {
     remove_callees (node);
   }
 
-  virtual void duplicate (cgraph_node *src, cgraph_node *dst,
-			  ipa_fn_summary *src_data, ipa_fn_summary *dst_data);
+  void duplicate (cgraph_node *src, cgraph_node *dst,
+		  ipa_fn_summary *src_data, ipa_fn_summary *dst_data)
+    final override;
 };
 
 extern GTY(()) fast_function_summary <ipa_fn_summary *, va_gc>
@@ -259,9 +260,9 @@  public:
     disable_insertion_hook ();
   }
 
-  virtual void duplicate (cgraph_node *, cgraph_node *,
-			  ipa_size_summary *src_data,
-			  ipa_size_summary *dst_data)
+  void duplicate (cgraph_node *, cgraph_node *,
+		  ipa_size_summary *src_data,
+		  ipa_size_summary *dst_data) final override
   {
     *dst_data = *src_data;
   }
@@ -311,9 +312,9 @@  public:
     fast_call_summary <ipa_call_summary *, va_heap> (symtab) {}
 
   /* Hook that is called by summary when an edge is duplicated.  */
-  virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
-			  ipa_call_summary *src_data,
-			  ipa_call_summary *dst_data);
+  void duplicate (cgraph_edge *src, cgraph_edge *dst,
+		  ipa_call_summary *src_data,
+		  ipa_call_summary *dst_data) final override;
 };
 
 /* Estimated execution times, code sizes and other information about the
diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index 7c1f974bc7a..0d9abacf0a6 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -119,10 +119,10 @@  public:
   fnspec_summaries_t (symbol_table *symtab)
       : call_summary <fnspec_summary *> (symtab) {}
   /* Hook that is called by summary when an edge is duplicated.  */
-  virtual void duplicate (cgraph_edge *,
-			  cgraph_edge *,
-			  fnspec_summary *src,
-			  fnspec_summary *dst)
+  void duplicate (cgraph_edge *,
+		  cgraph_edge *,
+		  fnspec_summary *src,
+		  fnspec_summary *dst) final override
   {
     dst->fnspec = xstrdup (src->fnspec);
   }
@@ -194,10 +194,10 @@  public:
   escape_summaries_t (symbol_table *symtab)
       : call_summary <escape_summary *> (symtab) {}
   /* Hook that is called by summary when an edge is duplicated.  */
-  virtual void duplicate (cgraph_edge *,
-			  cgraph_edge *,
-			  escape_summary *src,
-			  escape_summary *dst)
+  void duplicate (cgraph_edge *,
+		  cgraph_edge *,
+		  escape_summary *src,
+		  escape_summary *dst) final override
   {
     dst->esc = src->esc.copy ();
   }
@@ -217,11 +217,11 @@  class GTY((user)) modref_summaries
 public:
   modref_summaries (symbol_table *symtab)
       : fast_function_summary <modref_summary *, va_gc> (symtab) {}
-  virtual void insert (cgraph_node *, modref_summary *state);
-  virtual void duplicate (cgraph_node *src_node,
-			  cgraph_node *dst_node,
-			  modref_summary *src_data,
-			  modref_summary *dst_data);
+  void insert (cgraph_node *, modref_summary *state) final override;
+  void duplicate (cgraph_node *src_node,
+		  cgraph_node *dst_node,
+		  modref_summary *src_data,
+		  modref_summary *dst_data) final override;
   static modref_summaries *create_ggc (symbol_table *symtab)
   {
     return new (ggc_alloc_no_dtor<modref_summaries> ())
@@ -241,11 +241,11 @@  public:
   modref_summaries_lto (symbol_table *symtab)
       : fast_function_summary <modref_summary_lto *, va_gc> (symtab),
 	propagated (false) {}
-  virtual void insert (cgraph_node *, modref_summary_lto *state);
-  virtual void duplicate (cgraph_node *src_node,
-			  cgraph_node *dst_node,
-			  modref_summary_lto *src_data,
-			  modref_summary_lto *dst_data);
+  void insert (cgraph_node *, modref_summary_lto *state) final override;
+  void duplicate (cgraph_node *src_node,
+		  cgraph_node *dst_node,
+		  modref_summary_lto *src_data,
+		  modref_summary_lto *dst_data) final override;
   static modref_summaries_lto *create_ggc (symbol_table *symtab)
   {
     return new (ggc_alloc_no_dtor<modref_summaries_lto> ())
diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
index 38328c3e8d0..23a8cb84d48 100644
--- a/gcc/ipa-param-manipulation.cc
+++ b/gcc/ipa-param-manipulation.cc
@@ -114,10 +114,10 @@  class ipa_edge_modification_sum
 
   /* Hook that is called by summary when an edge is duplicated.  */
 
-  virtual void duplicate (cgraph_edge *,
-			  cgraph_edge *,
-			  ipa_edge_modification_info *old_info,
-			  ipa_edge_modification_info *new_info)
+  void duplicate (cgraph_edge *,
+		  cgraph_edge *,
+		  ipa_edge_modification_info *old_info,
+		  ipa_edge_modification_info *new_info) final override
   {
     new_info->index_map.safe_splice (old_info->index_map);
     new_info->pass_through_map.safe_splice (old_info->pass_through_map);
diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc
index 496f292acba..e0acc5d0188 100644
--- a/gcc/ipa-profile.cc
+++ b/gcc/ipa-profile.cc
@@ -198,9 +198,9 @@  public:
   {}
 
   /* Duplicate info when an edge is cloned.  */
-  virtual void duplicate (cgraph_edge *, cgraph_edge *,
-			  speculative_call_summary *old_sum,
-			  speculative_call_summary *new_sum);
+  void duplicate (cgraph_edge *, cgraph_edge *,
+		  speculative_call_summary *old_sum,
+		  speculative_call_summary *new_sum) final override;
 };
 
 static ipa_profile_call_summaries *call_sums = NULL;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index b22dfb5315c..8811e0ea987 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -1004,10 +1004,10 @@  public:
   }
 
   /* Hook that is called by summary when a node is duplicated.  */
-  virtual void duplicate (cgraph_node *node,
-			  cgraph_node *node2,
-			  ipa_node_params *data,
-			  ipa_node_params *data2);
+  void duplicate (cgraph_node *node,
+		  cgraph_node *node2,
+		  ipa_node_params *data,
+		  ipa_node_params *data2) final override;
 };
 
 /* Summary to manange ipa_edge_args structures.  */
@@ -1024,12 +1024,12 @@  class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
   }
 
   /* Hook that is called by summary when an edge is removed.  */
-  virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
+  void remove (cgraph_edge *cs, ipa_edge_args *args) final override;
   /* Hook that is called by summary when an edge is duplicated.  */
-  virtual void duplicate (cgraph_edge *src,
-			  cgraph_edge *dst,
-			  ipa_edge_args *old_args,
-			  ipa_edge_args *new_args);
+  void duplicate (cgraph_edge *src,
+		  cgraph_edge *dst,
+		  ipa_edge_args *old_args,
+		  ipa_edge_args *new_args) final override;
 };
 
 /* Function summary where the parameter infos are actually stored. */
@@ -1055,10 +1055,10 @@  public:
     return summary;
   }
   /* Hook that is called by summary when a node is duplicated.  */
-  virtual void duplicate (cgraph_node *node,
-			  cgraph_node *node2,
-			  ipcp_transformation *data,
-			  ipcp_transformation *data2);
+  void duplicate (cgraph_node *node,
+		  cgraph_node *node2,
+		  ipcp_transformation *data,
+		  ipcp_transformation *data2) final override;
 };
 
 /* Function summary where the IPA CP transformations are actually stored.  */
diff --git a/gcc/ipa-pure-const.cc b/gcc/ipa-pure-const.cc
index 0e55fc4bfc5..572a6da274f 100644
--- a/gcc/ipa-pure-const.cc
+++ b/gcc/ipa-pure-const.cc
@@ -137,10 +137,10 @@  public:
   funct_state_summary_t (symbol_table *symtab):
     fast_function_summary <funct_state_d *, va_heap> (symtab) {}
 
-  virtual void insert (cgraph_node *, funct_state_d *state);
-  virtual void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
-			  funct_state_d *src_data,
-			  funct_state_d *dst_data);
+  void insert (cgraph_node *, funct_state_d *state) final override;
+  void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
+		  funct_state_d *src_data,
+		  funct_state_d *dst_data) final override;
 };
 
 static funct_state_summary_t *funct_state_summaries = NULL;
diff --git a/gcc/ipa-reference.cc b/gcc/ipa-reference.cc
index b5a2350ce72..bd6ee0d8c57 100644
--- a/gcc/ipa-reference.cc
+++ b/gcc/ipa-reference.cc
@@ -133,11 +133,11 @@  public:
   ipa_ref_opt_summary_t (symbol_table *symtab):
     fast_function_summary <ipa_reference_optimization_summary_d *, va_heap> (symtab) {}
 
-  virtual void remove (cgraph_node *src_node,
-		       ipa_reference_optimization_summary_d *data);
-  virtual void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
-			  ipa_reference_optimization_summary_d *src_data,
-			  ipa_reference_optimization_summary_d *dst_data);
+  void remove (cgraph_node *src_node,
+	       ipa_reference_optimization_summary_d *data) final override;
+  void duplicate (cgraph_node *src_node, cgraph_node *dst_node,
+		  ipa_reference_optimization_summary_d *src_data,
+		  ipa_reference_optimization_summary_d *dst_data) final override;
 };
 
 static ipa_ref_opt_summary_t *ipa_ref_opt_sum_summaries = NULL;
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 4f705a3febf..2237ac6d92f 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -376,10 +376,10 @@  public:
   ipa_sra_function_summaries (symbol_table *table, bool ggc):
     function_summary<isra_func_summary *> (table, ggc) { }
 
-  virtual void duplicate (cgraph_node *, cgraph_node *,
-			  isra_func_summary *old_sum,
-			  isra_func_summary *new_sum);
-  virtual void insert (cgraph_node *, isra_func_summary *);
+  void duplicate (cgraph_node *, cgraph_node *,
+		  isra_func_summary *old_sum,
+		  isra_func_summary *new_sum) final override;
+  void insert (cgraph_node *, isra_func_summary *) final override;
 };
 
 /* Hook that is called by summary when a node is duplicated.  */
@@ -458,9 +458,9 @@  public:
     call_summary<isra_call_summary *> (table) { }
 
   /* Duplicate info when an edge is cloned.  */
-  virtual void duplicate (cgraph_edge *, cgraph_edge *,
-			  isra_call_summary *old_sum,
-			  isra_call_summary *new_sum);
+  void duplicate (cgraph_edge *, cgraph_edge *,
+		  isra_call_summary *old_sum,
+		  isra_call_summary *new_sum) final override;
 };
 
 static ipa_sra_call_summaries *call_sums;
diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index c54d3084cc4..45fa250e3f9 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -248,7 +248,7 @@  protected:
 
 private:
   /* Indication if we use ggc summary.  */
-  virtual bool is_ggc ()
+  bool is_ggc () final override
   {
     return m_ggc;
   }
@@ -439,7 +439,7 @@  public:
 				  void *data);
 
 private:
-  virtual bool is_ggc ();
+  bool is_ggc () final override;
 
   /* Summary is stored in the vector.  */
   vec <T *, V> *m_vector;
@@ -744,7 +744,7 @@  protected:
 
 private:
   /* Indication if we use ggc summary.  */
-  virtual bool is_ggc ()
+  bool is_ggc () final override
   {
     return m_ggc;
   }
@@ -910,7 +910,7 @@  public:
 				  void *data);
 
 private:
-  virtual bool is_ggc ();
+  bool is_ggc () final override;
 
   /* Summary is stored in the vector.  */
   vec <T *, V> *m_vector;
diff --git a/gcc/symtab-thunks.cc b/gcc/symtab-thunks.cc
index 73f810dc217..b1d9c5ddb53 100644
--- a/gcc/symtab-thunks.cc
+++ b/gcc/symtab-thunks.cc
@@ -71,10 +71,10 @@  public:
     function_summary<thunk_info *> (table, ggc) { }
 
   /* Hook that is called by summary when a node is duplicated.  */
-  virtual void duplicate (cgraph_node *node,
-			  cgraph_node *node2,
-			  thunk_info *data,
-			  thunk_info *data2);
+  void duplicate (cgraph_node *node,
+		  cgraph_node *node2,
+		  thunk_info *data,
+		  thunk_info *data2) final override;
 };
 
 /* Duplication hook.  */