public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/4] Fix small coding style issues (PR fortran/87394).
  2018-09-24  7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
  2018-09-24  7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
@ 2018-09-24  7:37 ` marxin
  2018-09-24 14:39   ` Jeff Law
  2018-09-24  7:37 ` [PATCH 4/4] Fix scaling of a sreal number marxin
  2018-09-24  7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
  3 siblings, 1 reply; 25+ messages in thread
From: marxin @ 2018-09-24  7:37 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]


gcc/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	PR fortran/87394
	* dbgcnt.c (dbg_cnt_process_single_pair): Return false
	instead of NULL.
	* dumpfile.c (dump_enable_all): Remove extra parenthesis.
	* gcov-tool.c: Declare the function with ATTRIBUTE_NORETURN.
	* godump.c (go_format_type): Remove extra parenthesis.

gcc/fortran/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	PR fortran/87394
	* decl.c (add_hidden_procptr_result): Simplify condition
	as we are in branch witch 'case1 || case2'.
---
 gcc/dbgcnt.c       | 2 +-
 gcc/dumpfile.c     | 4 ++--
 gcc/fortran/decl.c | 2 +-
 gcc/gcov-tool.c    | 2 +-
 gcc/godump.c       | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-Fix-small-coding-style-issues-PR-fortran-87394.patch --]
[-- Type: text/x-patch; name="0003-Fix-small-coding-style-issues-PR-fortran-87394.patch", Size: 2398 bytes --]

diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c
index ddb0e8e76d9..1eea65889a8 100644
--- a/gcc/dbgcnt.c
+++ b/gcc/dbgcnt.c
@@ -138,7 +138,7 @@ dbg_cnt_process_single_pair (const char *arg)
   int high, low;
 
   if (value1 == NULL)
-    return NULL;
+    return false;
 
   if (value2 == NULL)
     {
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index a81ab3ed3c6..54f86237561 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -1511,7 +1511,7 @@ dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename)
 
   for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
     {
-      if ((dump_files[i].dkind == dkind))
+      if (dump_files[i].dkind == dkind)
         {
           const char *old_filename = dump_files[i].pfilename;
           dump_files[i].pstate = -1;
@@ -1532,7 +1532,7 @@ dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename)
 
   for (i = 0; i < m_extra_dump_files_in_use; i++)
     {
-      if ((m_extra_dump_files[i].dkind == dkind))
+      if (m_extra_dump_files[i].dkind == dkind)
         {
           const char *old_filename = m_extra_dump_files[i].pfilename;
           m_extra_dump_files[i].pstate = -1;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 91a1f34d7f1..7f79811d152 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -6463,7 +6463,7 @@ add_hidden_procptr_result (gfc_symbol *sym)
       gfc_symtree *stree;
       if (case1)
 	gfc_get_sym_tree ("ppr@", gfc_current_ns, &stree, false);
-      else if (case2)
+      else
 	{
 	  gfc_symtree *st2;
 	  gfc_get_sym_tree ("ppr@", gfc_current_ns->parent, &stree, false);
diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c
index 88539f9647f..173ed5e5af2 100644
--- a/gcc/gcov-tool.c
+++ b/gcc/gcov-tool.c
@@ -438,7 +438,7 @@ static const struct option overlap_options[] =
 
 /* Print overlap usage and exit.  */
 
-static void
+static void ATTRIBUTE_NORETURN
 overlap_usage (void)
 {
   fnotice (stderr, "Overlap subcomand usage:");
diff --git a/gcc/godump.c b/gcc/godump.c
index 88e1a7782f1..baf21e27eec 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -961,7 +961,7 @@ go_format_type (struct godump_container *container, tree type,
 		   unions.  */
 		if (!is_anon_substructure)
 		  {
-		    if ((DECL_NAME (field) == NULL))
+		    if (DECL_NAME (field) == NULL)
 		      *p_art_i = go_append_artificial_name (ob, *p_art_i);
 		    else
 		      go_append_decl_name

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

* [PATCH 4/4] Fix scaling of a sreal number.
  2018-09-24  7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
  2018-09-24  7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
  2018-09-24  7:37 ` [PATCH 3/4] Fix small coding style issues (PR fortran/87394) marxin
@ 2018-09-24  7:37 ` marxin
  2018-09-24 14:42   ` Jeff Law
  2018-09-24  7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
  3 siblings, 1 reply; 25+ messages in thread
From: marxin @ 2018-09-24  7:37 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]


The patch is addressing following LLVM warning:
gcc/ipa-fnsummary.c:2745:54:Value Conversion Issue: implicit conversion from 'double' to 'int64_t' (aka 'long') changes value from 0.99 to 0: -Wliteral-conversion

Taking look at GIMPLE IR we end up with:

  <bb 45> :
  D.107433 ={v} {CLOBBER};
  sreal::sreal (&D.107437, -1, 0);
  sreal::sreal (&D.107434, 0, 0);
  D.107435 = sreal::operator* (&time, &D.107434);
  D.107436 = sreal::operator- (&nonspecialized_time, &D.107435);
  _65 = operator>= (&D.107436, &D.107437);
  _66 = ~_65;
  if (_66 != 0)
    goto <bb 46>; [INV]
  else
    goto <bb 47>; [INV]

  <bb 46> :
  fancy_abort ("/home/marxin/Programming/gcc/gcc/ipa-fnsummary.c", 2745, &__FUNCTION__);

which confirms the warning.

gcc/ChangeLog:

2018-09-23  Martin Liska  <mliska@suse.cz>

	* ipa-fnsummary.c (estimate_node_size_and_time): Scale by two
	integers and not by a float value.
---
 gcc/ipa-fnsummary.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-Fix-scaling-of-a-sreal-number.patch --]
[-- Type: text/x-patch; name="0004-Fix-scaling-of-a-sreal-number.patch", Size: 677 bytes --]

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 62095c6cf6f..9cb7d41ccc5 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -2742,7 +2742,7 @@ estimate_node_size_and_time (struct cgraph_node *node,
   gcc_checking_assert (time >= 0);
   /* nonspecialized_time should be always bigger than specialized time.
      Roundoff issues however may get into the way.  */
-  gcc_checking_assert ((nonspecialized_time - time * 0.99) >= -1);
+  gcc_checking_assert ((nonspecialized_time - time * 99 / 100) >= -1);
 
   /* Roundoff issues may make specialized time bigger than nonspecialized
      time.  We do not really want that to happen because some heurstics

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

* [PATCH 0/4] Clean-up warnings spotted by Rtags
@ 2018-09-24  7:37 marxin
  2018-09-24  7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: marxin @ 2018-09-24  7:37 UTC (permalink / raw)
  To: gcc-patches

Hello.

For quite some time I've been using Rtags for code completion and other
related stuff. Recently I noticed they provide diagnostics for an entire project.
Doing so, one can get quite some extra warning reported by Clang and I consider some
of them useful.

So that I would like to install my Python script that filters the warnings and few
patches that address the relevant warnings seen.

Patch survives bootstrap and regression tests on ppc64le-linux-gnu machine.

Martin

marxin (4):
  Add filter-rtags-warnings.py script.
  Remove unused functions and fields.
  Fix small coding style issues (PR fortran/87394).
  Fix scaling of a sreal number.

 contrib/filter-rtags-warnings.py |  71 ++++++++++++++++
 gcc/alias.c                      |   9 --
 gcc/config/i386/i386.c           |  15 ----
 gcc/cp/name-lookup.c             |  15 ----
 gcc/cp/parser.c                  |   8 --
 gcc/dbgcnt.c                     |   2 +-
 gcc/diagnostic-show-locus.c      |   2 -
 gcc/dump-context.h               |   1 -
 gcc/dumpfile.c                   |   4 +-
 gcc/dwarf2out.c                  | 141 -------------------------------
 gcc/edit-context.c               |   3 +-
 gcc/fortran/decl.c               |   2 +-
 gcc/fortran/trans.c              |  20 -----
 gcc/gcov-tool.c                  |   2 +-
 gcc/go/gofrontend/escape.cc      |  20 ++---
 gcc/go/gofrontend/expressions.cc |   2 +-
 gcc/go/gofrontend/gogo.h         |   2 +-
 gcc/go/gofrontend/types.cc       |  13 +--
 gcc/go/gofrontend/types.h        |   2 +-
 gcc/go/gofrontend/wb.cc          |  10 +--
 gcc/godump.c                     |   2 +-
 gcc/graphite-sese-to-poly.c      |   8 --
 gcc/ipa-cp.c                     |  10 ---
 gcc/ipa-fnsummary.c              |   2 +-
 gcc/lra-constraints.c            |  27 ------
 gcc/tree-chrec.c                 |  47 -----------
 gcc/tree-if-conv.c               |  13 ---
 gcc/tree-ssa-coalesce.c          |  16 ----
 gcc/tree-ssa-pre.c               |   6 --
 gcc/tree-ssa-uninit.c            |  10 ---
 gcc/tree-vrp.c                   |  38 ---------
 31 files changed, 96 insertions(+), 427 deletions(-)
 create mode 100755 contrib/filter-rtags-warnings.py

-- 
2.19.0

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

* [PATCH 1/4] Add filter-rtags-warnings.py script.
  2018-09-24  7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
@ 2018-09-24  7:37 ` marxin
  2018-09-24 14:45   ` Jeff Law
  2018-09-24  7:37 ` [PATCH 3/4] Fix small coding style issues (PR fortran/87394) marxin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 25+ messages in thread
From: marxin @ 2018-09-24  7:37 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]


contrib/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	* filter-rtags-warnings.py: New file.
---
 contrib/filter-rtags-warnings.py | 71 ++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100755 contrib/filter-rtags-warnings.py


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-filter-rtags-warnings.py-script.patch --]
[-- Type: text/x-patch; name="0001-Add-filter-rtags-warnings.py-script.patch", Size: 2825 bytes --]

diff --git a/contrib/filter-rtags-warnings.py b/contrib/filter-rtags-warnings.py
new file mode 100755
index 00000000000..ee27e7c8942
--- /dev/null
+++ b/contrib/filter-rtags-warnings.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python3
+#
+# Script to analyze warnings produced by rtags command (using LLVM):
+# rc --diagnose-all --synchronous-diagnostics --json
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.  */
+#
+#
+#
+
+import sys
+import json
+import argparse
+
+def skip_warning(filename, warning):
+    ignores = {
+            '': ['-Warray-bounds', '-Wmismatched-tags', 'gcc_gfc: -Wignored-attributes', '-Wchar-subscripts',
+                'string literal (potentially insecure): -Wformat-security', '-Wdeprecated-register',
+                '-Wvarargs', 'keyword is hidden by macro definition', "but the argument has type 'char *': -Wformat-pedantic",
+                '-Wnested-anon-types', 'qualifier in explicit instantiation of', 'attribute argument not supported: asm_fprintf'],
+            'insn-modes.c': ['-Wshift-count-overflow'],
+            'insn-emit.c': ['-Wtautological-compare'],
+            'insn-attrtab.c': ['-Wparentheses-equality'],
+            'gimple-match.c': ['-Wunused-', '-Wtautological-compare'],
+            'generic-match.c': ['-Wunused-', '-Wtautological-compare'],
+    }
+
+    message = warning['message']
+
+    if warning['type'] == 'fixit':
+        return True
+
+    for name, ignores in ignores.items():
+        for i in ignores:
+            if name in filename and i in message:
+                return True
+
+    return False
+
+parser = argparse.ArgumentParser()
+parser.add_argument('json_file', help = 'Rtags JSON file with diagnostics')
+parser.add_argument('-n', '--no-filter', action = 'store_true', help = 'No filter')
+
+args = parser.parse_args()
+
+data = json.load(open(args.json_file))
+file_warnings = data['checkStyle']
+
+total = 0
+for filename, warnings in file_warnings.items():
+    if warnings:
+        for w in warnings:
+            if args.no_filter or not skip_warning(filename, w):
+                total += 1
+                print('%s:%d:%d:%s' % (filename, w['line'], w['column'], w['message']))
+
+print('Total: %d' % total)

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

* [PATCH 2/4] Remove unused functions and fields.
  2018-09-24  7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
                   ` (2 preceding siblings ...)
  2018-09-24  7:37 ` [PATCH 4/4] Fix scaling of a sreal number marxin
@ 2018-09-24  7:39 ` marxin
  2018-09-24 14:42   ` Jeff Law
  2018-10-18 23:55   ` [PATCH 2/4] Remove unused functions and fields Ian Lance Taylor
  3 siblings, 2 replies; 25+ messages in thread
From: marxin @ 2018-09-24  7:39 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3441 bytes --]


gcc/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	* alias.c (set_dest_equal_p): Remove unused function.
	* config/i386/i386.c (def_builtin_pure2): Likewise.
	* diagnostic-show-locus.c (class layout): Remove
	unused field.
	(layout::layout): Likewise here.
	* dump-context.h (class temp_dump_context): Likewise.
	* dwarf2out.c (add_AT_fde_ref): Remove unused function.
	(add_AT_loclistsptr): Likewise.
	(add_AT_offset): Likewise.
	(get_AT_hi_pc): Likewise.
	(is_comdat_die): Likewise.
	(type_is_enum): Likewise.
	(ceiling): Likewise.
	(add_AT_vms_delta): Likewise.
	(is_class_die): Likewise.
	* edit-context.c (class line_event): Remove unused field.
	* graphite-sese-to-poly.c (tree_int_to_gmp): Remove
	unused function.
	* ipa-cp.c (ipa_get_vr_lat): Likewise.
	* lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
	(ok_for_base_p_nonstrict): Likewise.
	* tree-chrec.c (is_not_constant_evolution): Likewise.
	(chrec_fold_poly_cst): Likewise.
	* tree-if-conv.c (has_pred_critical_p): Likewise.
	* tree-ssa-coalesce.c (print_exprs): Likewise.
	* tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
	* tree-ssa-uninit.c (is_and_or_or_p): Likewise.
	* tree-vrp.c (value_ranges_intersect_p): Likewise.
	(value_range_nonnegative_p): Likewise.

gcc/cp/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	* name-lookup.c (namespace_scope_ht_size): Remove
	unused function.
	* parser.c (cp_lexer_next_token_is_not_keyword): Likewise.

gcc/fortran/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	* trans.c (remove_suffix): Remove
	unused function.

gcc/go/ChangeLog:

2018-09-24  Martin Liska  <mliska@suse.cz>

	* gofrontend/escape.cc (Gogo::analyze_escape): Remove
	usage of a parameter.
	(Gogo::assign_connectivity): Likewise.
	(class Escape_analysis_tag): Likewise.
	(Gogo::tag_function): Likewise.
	* gofrontend/expressions.cc (Call_expression::do_type): Likewise.
	* gofrontend/gogo.h (class Gogo): Likewise.
	* gofrontend/types.cc (class Call_multiple_result_type): Likewise.
	(Type::make_call_multiple_result_type): Likewise.
	* gofrontend/types.h (class Type): Likewise.
	* gofrontend/wb.cc (class Check_escape): Likewise.
	(Gogo::add_write_barriers): Likewise.
---
 gcc/alias.c                      |   9 --
 gcc/config/i386/i386.c           |  15 ----
 gcc/cp/name-lookup.c             |  15 ----
 gcc/cp/parser.c                  |   8 --
 gcc/diagnostic-show-locus.c      |   2 -
 gcc/dump-context.h               |   1 -
 gcc/dwarf2out.c                  | 141 -------------------------------
 gcc/edit-context.c               |   3 +-
 gcc/fortran/trans.c              |  20 -----
 gcc/go/gofrontend/escape.cc      |  20 ++---
 gcc/go/gofrontend/expressions.cc |   2 +-
 gcc/go/gofrontend/gogo.h         |   2 +-
 gcc/go/gofrontend/types.cc       |  13 +--
 gcc/go/gofrontend/types.h        |   2 +-
 gcc/go/gofrontend/wb.cc          |  10 +--
 gcc/graphite-sese-to-poly.c      |   8 --
 gcc/ipa-cp.c                     |  10 ---
 gcc/lra-constraints.c            |  27 ------
 gcc/tree-chrec.c                 |  47 -----------
 gcc/tree-if-conv.c               |  13 ---
 gcc/tree-ssa-coalesce.c          |  16 ----
 gcc/tree-ssa-pre.c               |   6 --
 gcc/tree-ssa-uninit.c            |  10 ---
 gcc/tree-vrp.c                   |  38 ---------
 24 files changed, 18 insertions(+), 420 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Remove-unused-functions-and-fields.patch --]
[-- Type: text/x-patch; name="0002-Remove-unused-functions-and-fields.patch", Size: 28623 bytes --]

diff --git a/gcc/alias.c b/gcc/alias.c
index 748da2b6951..7963ece291a 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -3270,15 +3270,6 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
   return memory_modified;
 }
 
-/* Return TRUE if the destination of a set is rtx identical to
-   ITEM.  */
-static inline bool
-set_dest_equal_p (const_rtx set, const_rtx item)
-{
-  rtx dest = SET_DEST (set);
-  return rtx_equal_p (dest, item);
-}
-
 /* Initialize the aliasing machinery.  Initialize the REG_KNOWN_VALUE
    array.  */
 
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0c86303b9fa..e50aa037c49 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -30224,21 +30224,6 @@ def_builtin_const2 (HOST_WIDE_INT mask, const char *name,
   return decl;
 }
 
-/* Like def_builtin, but also marks the function decl "pure".  */
-
-static inline tree
-def_builtin_pure2 (HOST_WIDE_INT mask, const char *name,
-		   enum ix86_builtin_func_type tcode, enum ix86_builtins code)
-{
-  tree decl = def_builtin2 (mask, name, tcode, code);
-  if (decl)
-    DECL_PURE_P (decl) = 1;
-  else
-    ix86_builtins_isa[(int) code].pure_p = true;
-
-  return decl;
-}
-
 /* Add any new builtin functions for a given ISA that may not have been
    declared.  This saves a bit of space compared to adding all of the
    declarations to the tree, even if we didn't use them.  */
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index c56bfe58a19..95d2845dd91 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3291,21 +3291,6 @@ cp_binding_level_debug (cp_binding_level *scope, int line, const char *action)
     verbatim ("%s %s %p %d\n", action, desc, (void *) scope, line);
 }
 
-/* Return the estimated initial size of the hashtable of a NAMESPACE
-   scope.  */
-
-static inline size_t
-namespace_scope_ht_size (tree ns)
-{
-  tree name = DECL_NAME (ns);
-
-  return name == std_identifier
-    ? NAMESPACE_STD_HT_SIZE
-    : (name == global_identifier
-       ? GLOBAL_SCOPE_HT_SIZE
-       : NAMESPACE_ORDINARY_HT_SIZE);
-}
-
 /* A chain of binding_level structures awaiting reuse.  */
 
 static GTY((deletable)) cp_binding_level *free_binding_level;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6e68f2c41dc..6696f174d75 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -922,14 +922,6 @@ cp_lexer_nth_token_is_keyword (cp_lexer* lexer, size_t n, enum rid keyword)
   return cp_lexer_peek_nth_token (lexer, n)->keyword == keyword;
 }
 
-/* Return true if the next token is not the indicated KEYWORD.  */
-
-static inline bool
-cp_lexer_next_token_is_not_keyword (cp_lexer* lexer, enum rid keyword)
-{
-  return cp_lexer_peek_token (lexer)->keyword != keyword;
-}
-
 /* Return true if KEYWORD can start a decl-specifier.  */
 
 bool
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index 7dfb0a036cd..43a49ea8913 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -289,7 +289,6 @@ class layout
  private:
   diagnostic_context *m_context;
   pretty_printer *m_pp;
-  diagnostic_t m_diagnostic_kind;
   location_t m_primary_loc;
   expanded_location m_exploc;
   colorizer m_colorizer;
@@ -886,7 +885,6 @@ layout::layout (diagnostic_context * context,
 		diagnostic_t diagnostic_kind)
 : m_context (context),
   m_pp (context->printer),
-  m_diagnostic_kind (diagnostic_kind),
   m_primary_loc (richloc->get_range (0)->m_loc),
   m_exploc (richloc->get_expanded_location (0)),
   m_colorizer (context, diagnostic_kind),
diff --git a/gcc/dump-context.h b/gcc/dump-context.h
index 5ac9dd60e8d..5b20c15cb8b 100644
--- a/gcc/dump-context.h
+++ b/gcc/dump-context.h
@@ -147,7 +147,6 @@ class temp_dump_context
   pretty_printer m_pp;
   dump_context m_context;
   dump_context *m_saved;
-  bool m_saved_flag_remarks;
 };
 
 #endif /* CHECKING_P */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 55fcb7be4af..66ee839b5cb 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3649,7 +3649,6 @@ static void add_AT_specification (dw_die_ref, dw_die_ref);
 static inline dw_die_ref AT_ref (dw_attr_node *);
 static inline int AT_ref_external (dw_attr_node *);
 static inline void set_AT_ref_external (dw_attr_node *, int);
-static void add_AT_fde_ref (dw_die_ref, enum dwarf_attribute, unsigned);
 static void add_AT_loc (dw_die_ref, enum dwarf_attribute, dw_loc_descr_ref);
 static inline dw_loc_descr_ref AT_loc (dw_attr_node *);
 static void add_AT_loc_list (dw_die_ref, enum dwarf_attribute,
@@ -3665,16 +3664,11 @@ static void add_AT_symview (dw_die_ref, enum dwarf_attribute, const char *);
 static void add_AT_lbl_id (dw_die_ref, enum dwarf_attribute, const char *);
 static void add_AT_lineptr (dw_die_ref, enum dwarf_attribute, const char *);
 static void add_AT_macptr (dw_die_ref, enum dwarf_attribute, const char *);
-static void add_AT_loclistsptr (dw_die_ref, enum dwarf_attribute,
-				const char *);
-static void add_AT_offset (dw_die_ref, enum dwarf_attribute,
-			   unsigned HOST_WIDE_INT);
 static void add_AT_range_list (dw_die_ref, enum dwarf_attribute,
                                unsigned long, bool);
 static inline const char *AT_lbl (dw_attr_node *);
 static dw_attr_node *get_AT (dw_die_ref, enum dwarf_attribute);
 static const char *get_AT_low_pc (dw_die_ref);
-static const char *get_AT_hi_pc (dw_die_ref);
 static const char *get_AT_string (dw_die_ref, enum dwarf_attribute);
 static int get_AT_flag (dw_die_ref, enum dwarf_attribute);
 static unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute);
@@ -3716,7 +3710,6 @@ static int same_dw_val_p (const dw_val_node *, const dw_val_node *, int *);
 static int same_attr_p (dw_attr_node *, dw_attr_node *, int *);
 static int same_die_p (dw_die_ref, dw_die_ref, int *);
 static int is_type_die (dw_die_ref);
-static int is_comdat_die (dw_die_ref);
 static inline bool is_template_instantiation (dw_die_ref);
 static int is_declaration_die (dw_die_ref);
 static int should_move_die_to_comdat (dw_die_ref);
@@ -3773,7 +3766,6 @@ static int decl_quals (const_tree);
 static dw_die_ref modified_type_die (tree, int, bool, dw_die_ref);
 static dw_die_ref generic_parameter_die (tree, tree, bool, dw_die_ref);
 static dw_die_ref template_parameter_pack_die (tree, tree, dw_die_ref);
-static int type_is_enum (const_tree);
 static unsigned int dbx_reg_number (const_rtx);
 static void add_loc_descr_op_piece (dw_loc_descr_ref *, int);
 static dw_loc_descr_ref reg_loc_descriptor (rtx, enum var_init_status);
@@ -3796,7 +3788,6 @@ static dw_loc_list_ref loc_list_from_tree (tree, int,
 					   struct loc_descr_context *);
 static dw_loc_descr_ref loc_descriptor_from_tree (tree, int,
 						  struct loc_descr_context *);
-static HOST_WIDE_INT ceiling (HOST_WIDE_INT, unsigned int);
 static tree field_type (const_tree);
 static unsigned int simple_type_align_in_bits (const_tree);
 static unsigned int simple_decl_align_in_bits (const_tree);
@@ -3910,8 +3901,6 @@ static void prune_unused_types (void);
 static int maybe_emit_file (struct dwarf_file_data *fd);
 static inline const char *AT_vms_delta1 (dw_attr_node *);
 static inline const char *AT_vms_delta2 (dw_attr_node *);
-static inline void add_AT_vms_delta (dw_die_ref, enum dwarf_attribute,
-				     const char *, const char *);
 static void append_entry_to_tmpl_value_parm_die_table (dw_die_ref, tree);
 static void gen_remaining_tmpl_value_param_die_attribute (void);
 static bool generic_type_p (tree);
@@ -4836,20 +4825,6 @@ set_AT_ref_external (dw_attr_node *a, int i)
   a->dw_attr_val.v.val_die_ref.external = i;
 }
 
-/* Add an FDE reference attribute value to a DIE.  */
-
-static inline void
-add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int targ_fde)
-{
-  dw_attr_node attr;
-
-  attr.dw_attr = attr_kind;
-  attr.dw_attr_val.val_class = dw_val_class_fde_ref;
-  attr.dw_attr_val.val_entry = NULL;
-  attr.dw_attr_val.v.val_fde_index = targ_fde;
-  add_dwarf_attr (die, &attr);
-}
-
 /* Add a location description attribute value to a DIE.  */
 
 static inline void
@@ -5160,22 +5135,6 @@ AT_file (dw_attr_node *a)
   return a->dw_attr_val.v.val_file;
 }
 
-/* Add a vms delta attribute value to a DIE.  */
-
-static inline void
-add_AT_vms_delta (dw_die_ref die, enum dwarf_attribute attr_kind,
-		  const char *lbl1, const char *lbl2)
-{
-  dw_attr_node attr;
-
-  attr.dw_attr = attr_kind;
-  attr.dw_attr_val.val_class = dw_val_class_vms_delta;
-  attr.dw_attr_val.val_entry = NULL;
-  attr.dw_attr_val.v.val_vms_delta.lbl1 = xstrdup (lbl1);
-  attr.dw_attr_val.v.val_vms_delta.lbl2 = xstrdup (lbl2);
-  add_dwarf_attr (die, &attr);
-}
-
 /* Add a symbolic view identifier attribute value to a DIE.  */
 
 static inline void
@@ -5226,22 +5185,6 @@ add_AT_lineptr (dw_die_ref die, enum dwarf_attribute attr_kind,
   add_dwarf_attr (die, &attr);
 }
 
-/* Add a section offset attribute value to a DIE, an offset into the
-   debug_loclists section.  */
-
-static inline void
-add_AT_loclistsptr (dw_die_ref die, enum dwarf_attribute attr_kind,
-		    const char *label)
-{
-  dw_attr_node attr;
-
-  attr.dw_attr = attr_kind;
-  attr.dw_attr_val.val_class = dw_val_class_loclistsptr;
-  attr.dw_attr_val.val_entry = NULL;
-  attr.dw_attr_val.v.val_lbl_id = xstrdup (label);
-  add_dwarf_attr (die, &attr);
-}
-
 /* Add a section offset attribute value to a DIE, an offset into the
    debug_macinfo section.  */
 
@@ -5258,21 +5201,6 @@ add_AT_macptr (dw_die_ref die, enum dwarf_attribute attr_kind,
   add_dwarf_attr (die, &attr);
 }
 
-/* Add an offset attribute value to a DIE.  */
-
-static inline void
-add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind,
-	       unsigned HOST_WIDE_INT offset)
-{
-  dw_attr_node attr;
-
-  attr.dw_attr = attr_kind;
-  attr.dw_attr_val.val_class = dw_val_class_offset;
-  attr.dw_attr_val.val_entry = NULL;
-  attr.dw_attr_val.v.val_offset = offset;
-  add_dwarf_attr (die, &attr);
-}
-
 /* Add a range_list attribute value to a DIE.  When using
    dwarf_split_debug_info, address attributes in dies destined for the
    final executable should be direct references--setting the parameter
@@ -5383,18 +5311,6 @@ get_AT_low_pc (dw_die_ref die)
   return a ? AT_lbl (a) : NULL;
 }
 
-/* Return the "high pc" attribute value, typically associated with a subprogram
-   DIE.  Return null if the "high pc" attribute is either not present, or if it
-   cannot be represented as an assembler label identifier.  */
-
-static inline const char *
-get_AT_hi_pc (dw_die_ref die)
-{
-  dw_attr_node *a = get_AT (die, DW_AT_high_pc);
-
-  return a ? AT_lbl (a) : NULL;
-}
-
 /* Return the value of the string attribute designated by ATTR_KIND, or
    NULL if it is not present.  */
 
@@ -7907,36 +7823,6 @@ is_type_die (dw_die_ref die)
     }
 }
 
-/* Returns 1 iff C is the sort of DIE that should go into a COMDAT CU.
-   Basically, we want to choose the bits that are likely to be shared between
-   compilations (types) and leave out the bits that are specific to individual
-   compilations (functions).  */
-
-static int
-is_comdat_die (dw_die_ref c)
-{
-  /* I think we want to leave base types and __vtbl_ptr_type in the main CU, as
-     we do for stabs.  The advantage is a greater likelihood of sharing between
-     objects that don't include headers in the same order (and therefore would
-     put the base types in a different comdat).  jason 8/28/00 */
-
-  if (c->die_tag == DW_TAG_base_type)
-    return 0;
-
-  if (c->die_tag == DW_TAG_pointer_type
-      || c->die_tag == DW_TAG_reference_type
-      || c->die_tag == DW_TAG_rvalue_reference_type
-      || c->die_tag == DW_TAG_const_type
-      || c->die_tag == DW_TAG_volatile_type)
-    {
-      dw_die_ref t = get_AT_ref (c, DW_AT_type);
-
-      return t ? is_comdat_die (t) : 0;
-    }
-
-  return is_type_die (c);
-}
-
 /* Returns true iff C is a compile-unit DIE.  */
 
 static inline bool
@@ -7965,15 +7851,6 @@ is_namespace_die (dw_die_ref c)
   return c && c->die_tag == DW_TAG_namespace;
 }
 
-/* Returns true iff C is a class or structure DIE.  */
-
-static inline bool
-is_class_die (dw_die_ref c)
-{
-  return c && (c->die_tag == DW_TAG_class_type
-               || c->die_tag == DW_TAG_structure_type);
-}
-
 /* Return non-zero if this DIE is a template parameter.  */
 
 static inline bool
@@ -13703,15 +13580,6 @@ template_parameter_pack_die (tree parm_pack,
   return die;
 }
 
-/* Given a pointer to an arbitrary ..._TYPE tree node, return true if it is
-   an enumerated type.  */
-
-static inline int
-type_is_enum (const_tree type)
-{
-  return TREE_CODE (type) == ENUMERAL_TYPE;
-}
-
 /* Return the DBX register number described by a given RTL node.  */
 
 static unsigned int
@@ -18933,15 +18801,6 @@ loc_descriptor_from_tree (tree loc, int want_address,
   return ret->expr;
 }
 
-/* Given a value, round it up to the lowest multiple of `boundary'
-   which is not less than the value itself.  */
-
-static inline HOST_WIDE_INT
-ceiling (HOST_WIDE_INT value, unsigned int boundary)
-{
-  return (((value + boundary - 1) / boundary) * boundary);
-}
-
 /* Given a pointer to what is assumed to be a FIELD_DECL node, return a
    pointer to the declared type for the relevant field variable, or return
    `integer_type_node' if the given node turns out to be an
diff --git a/gcc/edit-context.c b/gcc/edit-context.c
index 3cdb88d565c..85afc4a2ec7 100644
--- a/gcc/edit-context.c
+++ b/gcc/edit-context.c
@@ -182,7 +182,7 @@ class line_event
 {
  public:
   line_event (int start, int next, int len) : m_start (start),
-    m_next (next), m_delta (len - (next - start)) {}
+    m_delta (len - (next - start)) {}
 
   int get_effective_column (int orig_column) const
   {
@@ -194,7 +194,6 @@ class line_event
 
  private:
   int m_start;
-  int m_next;
   int m_delta;
 };
 
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 153bab63396..03dc7a284b5 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -61,26 +61,6 @@ gfc_advance_chain (tree t, int n)
   return t;
 }
 
-
-/* Strip off a legitimate source ending from the input
-   string NAME of length LEN.  */
-
-static inline void
-remove_suffix (char *name, int len)
-{
-  int i;
-
-  for (i = 2; i < 8 && len > i; i++)
-    {
-      if (name[len - i] == '.')
-	{
-	  name[len - i] = '\0';
-	  break;
-	}
-    }
-}
-
-
 /* Creates a variable declaration with a given TYPE.  */
 
 tree
diff --git a/gcc/go/gofrontend/escape.cc b/gcc/go/gofrontend/escape.cc
index 9c31525eb95..d9dcc8993f4 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -979,7 +979,7 @@ Gogo::analyze_escape()
       for (std::vector<Named_object*>::iterator fn = stack.begin();
            fn != stack.end();
            ++fn)
-        this->tag_function(context, *fn);
+	this->tag_function(*fn);
 
       if (this->debug_escape_level() != 0)
 	{
@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s)
 class Escape_analysis_assign : public Traverse
 {
 public:
-  Escape_analysis_assign(Escape_context* context, Named_object* fn)
+  Escape_analysis_assign(Escape_context* context)
     : Traverse(traverse_statements
 	       | traverse_expressions),
-      context_(context), fn_(fn)
+      context_(context)
   { }
 
   // Model statements within a function as assignments and flows between nodes.
@@ -1272,8 +1272,6 @@ public:
 private:
   // The escape context for this set of functions.
   Escape_context* context_;
-  // The current function being analyzed.
-  Named_object* fn_;
 };
 
 // Helper function to detect self assignment like the following.
@@ -2703,7 +2701,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn)
   int save_depth = context->loop_depth();
   context->set_loop_depth(1);
 
-  Escape_analysis_assign ea(context, fn);
+  Escape_analysis_assign ea(context);
   Function::Results* res = fn->func_value()->result_variables();
   if (res != NULL)
     {
@@ -3266,17 +3264,13 @@ Gogo::propagate_escape(Escape_context* context, Node* dst)
 class Escape_analysis_tag
 {
  public:
-  Escape_analysis_tag(Escape_context* context)
-    : context_(context)
+  Escape_analysis_tag()
   { }
 
   // Add notes to the function's type about the escape information of its
   // input parameters.
   void
   tag(Named_object* fn);
-
- private:
-  Escape_context* context_;
 };
 
 void
@@ -3384,9 +3378,9 @@ Escape_analysis_tag::tag(Named_object* fn)
 // retain analysis results across imports.
 
 void
-Gogo::tag_function(Escape_context* context, Named_object* fn)
+Gogo::tag_function(Named_object* fn)
 {
-  Escape_analysis_tag eat(context);
+  Escape_analysis_tag eat;
   eat.tag(fn);
 }
 
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 46a1e693d50..91cc30e30b5 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -10089,7 +10089,7 @@ Call_expression::do_type()
   else if (results->size() == 1)
     ret = results->begin()->type();
   else
-    ret = Type::make_call_multiple_result_type(this);
+    ret = Type::make_call_multiple_result_type();
 
   this->type_ = ret;
 
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 0864ee1d72a..07d08c2dc60 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -680,7 +680,7 @@ class Gogo
   // Add notes about the escape level of a function's input and output
   // parameters for exporting and importing top level functions. 
   void
-  tag_function(Escape_context*, Named_object*);
+  tag_function(Named_object*);
 
   // Reclaim memory of escape analysis Nodes.
   void
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index cc07bfc25bd..ad0704cc2da 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -5466,9 +5466,8 @@ Type::make_nil_type()
 class Call_multiple_result_type : public Type
 {
  public:
-  Call_multiple_result_type(Call_expression* call)
-    : Type(TYPE_CALL_MULTIPLE_RESULT),
-      call_(call)
+  Call_multiple_result_type()
+    : Type(TYPE_CALL_MULTIPLE_RESULT)
   { }
 
  protected:
@@ -5501,18 +5500,14 @@ class Call_multiple_result_type : public Type
   void
   do_mangled_name(Gogo*, std::string*) const
   { go_assert(saw_errors()); }
-
- private:
-  // The expression being called.
-  Call_expression* call_;
 };
 
 // Make a call result type.
 
 Type*
-Type::make_call_multiple_result_type(Call_expression* call)
+Type::make_call_multiple_result_type()
 {
-  return new Call_multiple_result_type(call);
+  return new Call_multiple_result_type();
 }
 
 // Class Struct_field.
diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h
index e011236cba5..85e7c51c302 100644
--- a/gcc/go/gofrontend/types.h
+++ b/gcc/go/gofrontend/types.h
@@ -511,7 +511,7 @@ class Type
   make_nil_type();
 
   static Type*
-  make_call_multiple_result_type(Call_expression*);
+  make_call_multiple_result_type();
 
   static Struct_type*
   make_struct_type(Struct_field_list* fields, Location);
diff --git a/gcc/go/gofrontend/wb.cc b/gcc/go/gofrontend/wb.cc
index 4f84d9950f1..52db71046fe 100644
--- a/gcc/go/gofrontend/wb.cc
+++ b/gcc/go/gofrontend/wb.cc
@@ -189,9 +189,8 @@ Mark_address_taken::expression(Expression** pexpr)
 class Check_escape : public Traverse
 {
  public:
-  Check_escape(Gogo* gogo)
-    : Traverse(traverse_expressions | traverse_variables),
-      gogo_(gogo)
+  Check_escape()
+    : Traverse(traverse_expressions | traverse_variables)
   { }
 
   int
@@ -199,9 +198,6 @@ class Check_escape : public Traverse
 
   int
   variable(Named_object*);
-
- private:
-  Gogo* gogo_;
 };
 
 int
@@ -621,7 +617,7 @@ Gogo::add_write_barriers()
     {
       this->propagate_writebarrierrec();
 
-      Check_escape chk(this);
+      Check_escape chk;
       this->traverse(&chk);
     }
 
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 4dcc013f6bb..69898d4ffd8 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -58,14 +58,6 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "graphite.h"
 
-/* Assigns to RES the value of the INTEGER_CST T.  */
-
-static inline void
-tree_int_to_gmp (tree t, mpz_t res)
-{
-  wi::to_mpz (wi::to_wide (t), res, TYPE_SIGN (TREE_TYPE (t)));
-}
-
 /* Return an isl identifier for the polyhedral basic block PBB.  */
 
 static isl_id *
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index afc45969558..27ae8e0fe27 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -405,16 +405,6 @@ ipa_get_poly_ctx_lat (struct ipa_node_params *info, int i)
   return &plats->ctxlat;
 }
 
-/* Return the lattice corresponding to the value range of the Ith formal
-   parameter of the function described by INFO.  */
-
-static inline ipcp_vr_lattice *
-ipa_get_vr_lat (struct ipa_node_params *info, int i)
-{
-  struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
-  return &plats->m_value_range;
-}
-
 /* Return whether LAT is a lattice with a single constant and without an
    undefined value.  */
 
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 8be4d46c8ad..774d1ff3aaa 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -630,33 +630,6 @@ get_reload_reg (enum op_type type, machine_mode mode, rtx original,
 }
 
 \f
-
-/* The page contains code to extract memory address parts.  */
-
-/* Wrapper around REGNO_OK_FOR_INDEX_P, to allow pseudos.  */
-static inline bool
-ok_for_index_p_nonstrict (rtx reg)
-{
-  unsigned regno = REGNO (reg);
-
-  return regno >= FIRST_PSEUDO_REGISTER || REGNO_OK_FOR_INDEX_P (regno);
-}
-
-/* A version of regno_ok_for_base_p for use here, when all pseudos
-   should count as OK.	Arguments as for regno_ok_for_base_p.  */
-static inline bool
-ok_for_base_p_nonstrict (rtx reg, machine_mode mode, addr_space_t as,
-			 enum rtx_code outer_code, enum rtx_code index_code)
-{
-  unsigned regno = REGNO (reg);
-
-  if (regno >= FIRST_PSEUDO_REGISTER)
-    return true;
-  return ok_for_base_p_1 (regno, mode, as, outer_code, index_code);
-}
-
-\f
-
 /* The page contains major code to choose the current insn alternative
    and generate reloads for it.	 */
 
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index fa8c2ee2a20..2717b40485b 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -41,53 +41,6 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Extended folder for chrecs.  */
 
-/* Determines whether CST is not a constant evolution.  */
-
-static inline bool
-is_not_constant_evolution (const_tree cst)
-{
-  return (TREE_CODE (cst) == POLYNOMIAL_CHREC);
-}
-
-/* Fold CODE for a polynomial function and a constant.  */
-
-static inline tree
-chrec_fold_poly_cst (enum tree_code code,
-		     tree type,
-		     tree poly,
-		     tree cst)
-{
-  gcc_assert (poly);
-  gcc_assert (cst);
-  gcc_assert (TREE_CODE (poly) == POLYNOMIAL_CHREC);
-  gcc_checking_assert (!is_not_constant_evolution (cst));
-  gcc_checking_assert (useless_type_conversion_p (type, chrec_type (poly)));
-
-  switch (code)
-    {
-    case PLUS_EXPR:
-      return build_polynomial_chrec
-	(CHREC_VARIABLE (poly),
-	 chrec_fold_plus (type, CHREC_LEFT (poly), cst),
-	 CHREC_RIGHT (poly));
-
-    case MINUS_EXPR:
-      return build_polynomial_chrec
-	(CHREC_VARIABLE (poly),
-	 chrec_fold_minus (type, CHREC_LEFT (poly), cst),
-	 CHREC_RIGHT (poly));
-
-    case MULT_EXPR:
-      return build_polynomial_chrec
-	(CHREC_VARIABLE (poly),
-	 chrec_fold_multiply (type, CHREC_LEFT (poly), cst),
-	 chrec_fold_multiply (type, CHREC_RIGHT (poly), cst));
-
-    default:
-      return chrec_dont_know;
-    }
-}
-
 /* Fold the addition of two polynomial functions.  */
 
 static inline tree
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 77eefac4e34..52aa5756c94 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1114,19 +1114,6 @@ all_preds_critical_p (basic_block bb)
   return true;
 }
 
-/* Returns true if at least one successor in on critical edge.  */
-static inline bool
-has_pred_critical_p (basic_block bb)
-{
-  edge e;
-  edge_iterator ei;
-
-  FOR_EACH_EDGE (e, ei, bb->preds)
-    if (EDGE_COUNT (e->src->succs) > 1)
-      return true;
-  return false;
-}
-
 /* Return true when BB is if-convertible.  This routine does not check
    basic block's statements and phis.
 
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index c123449bdda..a17c7749482 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -988,22 +988,6 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
   return graph;
 }
 
-
-/* Shortcut routine to print messages to file F of the form:
-   "STR1 EXPR1 STR2 EXPR2 STR3."  */
-
-static inline void
-print_exprs (FILE *f, const char *str1, tree expr1, const char *str2,
-	     tree expr2, const char *str3)
-{
-  fprintf (f, "%s", str1);
-  print_generic_expr (f, expr1, TDF_SLIM);
-  fprintf (f, "%s", str2);
-  print_generic_expr (f, expr2, TDF_SLIM);
-  fprintf (f, "%s", str3);
-}
-
-
 /* Print a failure to coalesce a MUST_COALESCE pair X and Y.  */
 
 static inline void
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 267086cdf48..d1b0cc0c26f 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -825,12 +825,6 @@ bitmap_set_contains_value (bitmap_set_t set, unsigned int value_id)
   return bitmap_bit_p (&set->values, value_id);
 }
 
-static inline bool
-bitmap_set_contains_expr (bitmap_set_t set, const pre_expr expr)
-{
-  return bitmap_bit_p (&set->expressions, get_expression_id (expr));
-}
-
 /* Return true if two bitmap sets are equal.  */
 
 static bool
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index f3e42ddbd7f..d2c50344f71 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -1586,16 +1586,6 @@ is_superset_of (pred_chain_union preds1, pred_chain_union preds2)
   return true;
 }
 
-/* Returns true if TC is AND or OR.  */
-
-static inline bool
-is_and_or_or_p (enum tree_code tc, tree type)
-{
-  return (tc == BIT_IOR_EXPR
-	  || (tc == BIT_AND_EXPR
-	      && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
-}
-
 /* Returns true if X1 is the negate of X2.  */
 
 static inline bool
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 622ccbc2df7..3731f6c7b3e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -848,27 +848,6 @@ value_inside_range (tree val, tree min, tree max)
 }
 
 
-/* Return true if value ranges VR0 and VR1 have a non-empty
-   intersection.
-
-   Benchmark compile/20001226-1.c compilation time after changing this
-   function.
-   */
-
-static inline bool
-value_ranges_intersect_p (const value_range *vr0, const value_range *vr1)
-{
-  /* The value ranges do not intersect if the maximum of the first range is
-     less than the minimum of the second range or vice versa.
-     When those relations are unknown, we can't do any better.  */
-  if (operand_less_p (vr0->max, vr1->min) != 0)
-    return false;
-  if (operand_less_p (vr1->max, vr0->min) != 0)
-    return false;
-  return true;
-}
-
-
 /* Return TRUE if *VR includes the value zero.  */
 
 bool
@@ -890,23 +869,6 @@ range_includes_zero_p (const value_range *vr)
   return value_inside_range (zero, vr->min, vr->max) != 0;
 }
 
-/* Return true if *VR is know to only contain nonnegative values.  */
-
-static inline bool
-value_range_nonnegative_p (const value_range *vr)
-{
-  /* Testing for VR_ANTI_RANGE is not useful here as any anti-range
-     which would return a useful value should be encoded as a 
-     VR_RANGE.  */
-  if (vr->type == VR_RANGE)
-    {
-      int result = compare_values (vr->min, integer_zero_node);
-      return (result == 0 || result == 1);
-    }
-
-  return false;
-}
-
 /* If *VR has a value rante that is a single constant value return that,
    otherwise return NULL_TREE.  */
 

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

* Re: [PATCH 3/4] Fix small coding style issues (PR fortran/87394).
  2018-09-24  7:37 ` [PATCH 3/4] Fix small coding style issues (PR fortran/87394) marxin
@ 2018-09-24 14:39   ` Jeff Law
  0 siblings, 0 replies; 25+ messages in thread
From: Jeff Law @ 2018-09-24 14:39 UTC (permalink / raw)
  To: marxin, gcc-patches

On 9/22/18 1:17 PM, marxin wrote:
> 
> gcc/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	PR fortran/87394
> 	* dbgcnt.c (dbg_cnt_process_single_pair): Return false
> 	instead of NULL.
> 	* dumpfile.c (dump_enable_all): Remove extra parenthesis.
> 	* gcov-tool.c: Declare the function with ATTRIBUTE_NORETURN.
> 	* godump.c (go_format_type): Remove extra parenthesis.
> 
> gcc/fortran/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	PR fortran/87394
> 	* decl.c (add_hidden_procptr_result): Simplify condition
> 	as we are in branch witch 'case1 || case2'.
OK.
jeff

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-24  7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
@ 2018-09-24 14:42   ` Jeff Law
  2018-09-25  7:18     ` Martin Liška
  2018-10-18 23:55   ` [PATCH 2/4] Remove unused functions and fields Ian Lance Taylor
  1 sibling, 1 reply; 25+ messages in thread
From: Jeff Law @ 2018-09-24 14:42 UTC (permalink / raw)
  To: marxin, gcc-patches

On 9/22/18 1:08 PM, marxin wrote:
> 
> gcc/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	* alias.c (set_dest_equal_p): Remove unused function.
> 	* config/i386/i386.c (def_builtin_pure2): Likewise.
> 	* diagnostic-show-locus.c (class layout): Remove
> 	unused field.
> 	(layout::layout): Likewise here.
> 	* dump-context.h (class temp_dump_context): Likewise.
> 	* dwarf2out.c (add_AT_fde_ref): Remove unused function.
> 	(add_AT_loclistsptr): Likewise.
> 	(add_AT_offset): Likewise.
> 	(get_AT_hi_pc): Likewise.
> 	(is_comdat_die): Likewise.
> 	(type_is_enum): Likewise.
> 	(ceiling): Likewise.
> 	(add_AT_vms_delta): Likewise.
> 	(is_class_die): Likewise.
> 	* edit-context.c (class line_event): Remove unused field.
> 	* graphite-sese-to-poly.c (tree_int_to_gmp): Remove
> 	unused function.
> 	* ipa-cp.c (ipa_get_vr_lat): Likewise.
> 	* lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
> 	(ok_for_base_p_nonstrict): Likewise.
> 	* tree-chrec.c (is_not_constant_evolution): Likewise.
> 	(chrec_fold_poly_cst): Likewise.
> 	* tree-if-conv.c (has_pred_critical_p): Likewise.
> 	* tree-ssa-coalesce.c (print_exprs): Likewise.
> 	* tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
> 	* tree-ssa-uninit.c (is_and_or_or_p): Likewise.
> 	* tree-vrp.c (value_ranges_intersect_p): Likewise.
> 	(value_range_nonnegative_p): Likewise.
> 
> gcc/cp/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	* name-lookup.c (namespace_scope_ht_size): Remove
> 	unused function.
> 	* parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
> 
> gcc/fortran/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	* trans.c (remove_suffix): Remove
> 	unused function.
> 
> gcc/go/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	* gofrontend/escape.cc (Gogo::analyze_escape): Remove
> 	usage of a parameter.
> 	(Gogo::assign_connectivity): Likewise.
> 	(class Escape_analysis_tag): Likewise.
> 	(Gogo::tag_function): Likewise.
> 	* gofrontend/expressions.cc (Call_expression::do_type): Likewise.
> 	* gofrontend/gogo.h (class Gogo): Likewise.
> 	* gofrontend/types.cc (class Call_multiple_result_type): Likewise.
> 	(Type::make_call_multiple_result_type): Likewise.
> 	* gofrontend/types.h (class Type): Likewise.
> 	* gofrontend/wb.cc (class Check_escape): Likewise.
> 	(Gogo::add_write_barriers): Likewise.
Note that some of these may be used inside conditional code.  For
example the add_AT_vms_delta is used by ia64-vms.  You could argue that
ia64-vms is a zombie and should be removed, but the general concern WRT
conditionally compiled code holds.

Jeff

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

* Re: [PATCH 4/4] Fix scaling of a sreal number.
  2018-09-24  7:37 ` [PATCH 4/4] Fix scaling of a sreal number marxin
@ 2018-09-24 14:42   ` Jeff Law
  0 siblings, 0 replies; 25+ messages in thread
From: Jeff Law @ 2018-09-24 14:42 UTC (permalink / raw)
  To: marxin, gcc-patches

On 9/23/18 1:08 AM, marxin wrote:
> 
> The patch is addressing following LLVM warning:
> gcc/ipa-fnsummary.c:2745:54:Value Conversion Issue: implicit conversion from 'double' to 'int64_t' (aka 'long') changes value from 0.99 to 0: -Wliteral-conversion
> 
> Taking look at GIMPLE IR we end up with:
> 
>   <bb 45> :
>   D.107433 ={v} {CLOBBER};
>   sreal::sreal (&D.107437, -1, 0);
>   sreal::sreal (&D.107434, 0, 0);
>   D.107435 = sreal::operator* (&time, &D.107434);
>   D.107436 = sreal::operator- (&nonspecialized_time, &D.107435);
>   _65 = operator>= (&D.107436, &D.107437);
>   _66 = ~_65;
>   if (_66 != 0)
>     goto <bb 46>; [INV]
>   else
>     goto <bb 47>; [INV]
> 
>   <bb 46> :
>   fancy_abort ("/home/marxin/Programming/gcc/gcc/ipa-fnsummary.c", 2745, &__FUNCTION__);
> 
> which confirms the warning.
> 
> gcc/ChangeLog:
> 
> 2018-09-23  Martin Liska  <mliska@suse.cz>
> 
> 	* ipa-fnsummary.c (estimate_node_size_and_time): Scale by two
> 	integers and not by a float value.
OK.
jeff

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

* Re: [PATCH 1/4] Add filter-rtags-warnings.py script.
  2018-09-24  7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
@ 2018-09-24 14:45   ` Jeff Law
  0 siblings, 0 replies; 25+ messages in thread
From: Jeff Law @ 2018-09-24 14:45 UTC (permalink / raw)
  To: marxin, gcc-patches

On 9/23/18 1:16 AM, marxin wrote:
> 
> contrib/ChangeLog:
> 
> 2018-09-24  Martin Liska  <mliska@suse.cz>
> 
> 	* filter-rtags-warnings.py: New file.
> ---
>  contrib/filter-rtags-warnings.py | 71 ++++++++++++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
>  create mode 100755 contrib/filter-rtags-warnings.py
> 
OK
jeff

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-24 14:42   ` Jeff Law
@ 2018-09-25  7:18     ` Martin Liška
  2018-09-25 12:31       ` Richard Biener
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-09-25  7:18 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

On 9/24/18 4:42 PM, Jeff Law wrote:
> On 9/22/18 1:08 PM, marxin wrote:
>>
>> gcc/ChangeLog:
>>
>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>
>> 	* alias.c (set_dest_equal_p): Remove unused function.
>> 	* config/i386/i386.c (def_builtin_pure2): Likewise.
>> 	* diagnostic-show-locus.c (class layout): Remove
>> 	unused field.
>> 	(layout::layout): Likewise here.
>> 	* dump-context.h (class temp_dump_context): Likewise.
>> 	* dwarf2out.c (add_AT_fde_ref): Remove unused function.
>> 	(add_AT_loclistsptr): Likewise.
>> 	(add_AT_offset): Likewise.
>> 	(get_AT_hi_pc): Likewise.
>> 	(is_comdat_die): Likewise.
>> 	(type_is_enum): Likewise.
>> 	(ceiling): Likewise.
>> 	(add_AT_vms_delta): Likewise.
>> 	(is_class_die): Likewise.
>> 	* edit-context.c (class line_event): Remove unused field.
>> 	* graphite-sese-to-poly.c (tree_int_to_gmp): Remove
>> 	unused function.
>> 	* ipa-cp.c (ipa_get_vr_lat): Likewise.
>> 	* lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
>> 	(ok_for_base_p_nonstrict): Likewise.
>> 	* tree-chrec.c (is_not_constant_evolution): Likewise.
>> 	(chrec_fold_poly_cst): Likewise.
>> 	* tree-if-conv.c (has_pred_critical_p): Likewise.
>> 	* tree-ssa-coalesce.c (print_exprs): Likewise.
>> 	* tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
>> 	* tree-ssa-uninit.c (is_and_or_or_p): Likewise.
>> 	* tree-vrp.c (value_ranges_intersect_p): Likewise.
>> 	(value_range_nonnegative_p): Likewise.
>>
>> gcc/cp/ChangeLog:
>>
>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>
>> 	* name-lookup.c (namespace_scope_ht_size): Remove
>> 	unused function.
>> 	* parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
>>
>> gcc/fortran/ChangeLog:
>>
>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>
>> 	* trans.c (remove_suffix): Remove
>> 	unused function.
>>
>> gcc/go/ChangeLog:
>>
>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>
>> 	* gofrontend/escape.cc (Gogo::analyze_escape): Remove
>> 	usage of a parameter.
>> 	(Gogo::assign_connectivity): Likewise.
>> 	(class Escape_analysis_tag): Likewise.
>> 	(Gogo::tag_function): Likewise.
>> 	* gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>> 	* gofrontend/gogo.h (class Gogo): Likewise.
>> 	* gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>> 	(Type::make_call_multiple_result_type): Likewise.
>> 	* gofrontend/types.h (class Type): Likewise.
>> 	* gofrontend/wb.cc (class Check_escape): Likewise.
>> 	(Gogo::add_write_barriers): Likewise.
> Note that some of these may be used inside conditional code.  For
> example the add_AT_vms_delta is used by ia64-vms.  You could argue that
> ia64-vms is a zombie and should be removed, but the general concern WRT
> conditionally compiled code holds.

Well, please let me install the patch as is and if somebody will need the
functionality, I would be happy to put it back.

Thanks,
Martin

> 
> Jeff
> 

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-25  7:18     ` Martin Liška
@ 2018-09-25 12:31       ` Richard Biener
  2018-09-25 13:40         ` Jeff Law
  0 siblings, 1 reply; 25+ messages in thread
From: Richard Biener @ 2018-09-25 12:31 UTC (permalink / raw)
  To: Martin Liška; +Cc: Jeff Law, GCC Patches

On Tue, Sep 25, 2018 at 9:09 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 9/24/18 4:42 PM, Jeff Law wrote:
> > On 9/22/18 1:08 PM, marxin wrote:
> >>
> >> gcc/ChangeLog:
> >>
> >> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>
> >>      * alias.c (set_dest_equal_p): Remove unused function.
> >>      * config/i386/i386.c (def_builtin_pure2): Likewise.
> >>      * diagnostic-show-locus.c (class layout): Remove
> >>      unused field.
> >>      (layout::layout): Likewise here.
> >>      * dump-context.h (class temp_dump_context): Likewise.
> >>      * dwarf2out.c (add_AT_fde_ref): Remove unused function.
> >>      (add_AT_loclistsptr): Likewise.
> >>      (add_AT_offset): Likewise.
> >>      (get_AT_hi_pc): Likewise.
> >>      (is_comdat_die): Likewise.
> >>      (type_is_enum): Likewise.
> >>      (ceiling): Likewise.
> >>      (add_AT_vms_delta): Likewise.
> >>      (is_class_die): Likewise.
> >>      * edit-context.c (class line_event): Remove unused field.
> >>      * graphite-sese-to-poly.c (tree_int_to_gmp): Remove
> >>      unused function.
> >>      * ipa-cp.c (ipa_get_vr_lat): Likewise.
> >>      * lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
> >>      (ok_for_base_p_nonstrict): Likewise.
> >>      * tree-chrec.c (is_not_constant_evolution): Likewise.
> >>      (chrec_fold_poly_cst): Likewise.
> >>      * tree-if-conv.c (has_pred_critical_p): Likewise.
> >>      * tree-ssa-coalesce.c (print_exprs): Likewise.
> >>      * tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
> >>      * tree-ssa-uninit.c (is_and_or_or_p): Likewise.
> >>      * tree-vrp.c (value_ranges_intersect_p): Likewise.
> >>      (value_range_nonnegative_p): Likewise.
> >>
> >> gcc/cp/ChangeLog:
> >>
> >> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>
> >>      * name-lookup.c (namespace_scope_ht_size): Remove
> >>      unused function.
> >>      * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
> >>
> >> gcc/fortran/ChangeLog:
> >>
> >> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>
> >>      * trans.c (remove_suffix): Remove
> >>      unused function.
> >>
> >> gcc/go/ChangeLog:
> >>
> >> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>
> >>      * gofrontend/escape.cc (Gogo::analyze_escape): Remove
> >>      usage of a parameter.
> >>      (Gogo::assign_connectivity): Likewise.
> >>      (class Escape_analysis_tag): Likewise.
> >>      (Gogo::tag_function): Likewise.
> >>      * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
> >>      * gofrontend/gogo.h (class Gogo): Likewise.
> >>      * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
> >>      (Type::make_call_multiple_result_type): Likewise.
> >>      * gofrontend/types.h (class Type): Likewise.
> >>      * gofrontend/wb.cc (class Check_escape): Likewise.
> >>      (Gogo::add_write_barriers): Likewise.
> > Note that some of these may be used inside conditional code.  For
> > example the add_AT_vms_delta is used by ia64-vms.  You could argue that
> > ia64-vms is a zombie and should be removed, but the general concern WRT
> > conditionally compiled code holds.
>
> Well, please let me install the patch as is and if somebody will need the
> functionality, I would be happy to put it back.

You could use contrib/config-list.mk to build all supported target configs.  You
shouldn't break builds for valid configs deliberately

> Thanks,
> Martin
>
> >
> > Jeff
> >
>

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-25 12:31       ` Richard Biener
@ 2018-09-25 13:40         ` Jeff Law
  2018-09-26  9:01           ` Martin Liška
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Law @ 2018-09-25 13:40 UTC (permalink / raw)
  To: Richard Biener, Martin Liška; +Cc: GCC Patches

On 9/25/18 6:19 AM, Richard Biener wrote:
> On Tue, Sep 25, 2018 at 9:09 AM Martin Liška <mliska@suse.cz> wrote:
>>
>> On 9/24/18 4:42 PM, Jeff Law wrote:
>>> On 9/22/18 1:08 PM, marxin wrote:
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>
>>>>      * alias.c (set_dest_equal_p): Remove unused function.
>>>>      * config/i386/i386.c (def_builtin_pure2): Likewise.
>>>>      * diagnostic-show-locus.c (class layout): Remove
>>>>      unused field.
>>>>      (layout::layout): Likewise here.
>>>>      * dump-context.h (class temp_dump_context): Likewise.
>>>>      * dwarf2out.c (add_AT_fde_ref): Remove unused function.
>>>>      (add_AT_loclistsptr): Likewise.
>>>>      (add_AT_offset): Likewise.
>>>>      (get_AT_hi_pc): Likewise.
>>>>      (is_comdat_die): Likewise.
>>>>      (type_is_enum): Likewise.
>>>>      (ceiling): Likewise.
>>>>      (add_AT_vms_delta): Likewise.
>>>>      (is_class_die): Likewise.
>>>>      * edit-context.c (class line_event): Remove unused field.
>>>>      * graphite-sese-to-poly.c (tree_int_to_gmp): Remove
>>>>      unused function.
>>>>      * ipa-cp.c (ipa_get_vr_lat): Likewise.
>>>>      * lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
>>>>      (ok_for_base_p_nonstrict): Likewise.
>>>>      * tree-chrec.c (is_not_constant_evolution): Likewise.
>>>>      (chrec_fold_poly_cst): Likewise.
>>>>      * tree-if-conv.c (has_pred_critical_p): Likewise.
>>>>      * tree-ssa-coalesce.c (print_exprs): Likewise.
>>>>      * tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
>>>>      * tree-ssa-uninit.c (is_and_or_or_p): Likewise.
>>>>      * tree-vrp.c (value_ranges_intersect_p): Likewise.
>>>>      (value_range_nonnegative_p): Likewise.
>>>>
>>>> gcc/cp/ChangeLog:
>>>>
>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>
>>>>      * name-lookup.c (namespace_scope_ht_size): Remove
>>>>      unused function.
>>>>      * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
>>>>
>>>> gcc/fortran/ChangeLog:
>>>>
>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>
>>>>      * trans.c (remove_suffix): Remove
>>>>      unused function.
>>>>
>>>> gcc/go/ChangeLog:
>>>>
>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>
>>>>      * gofrontend/escape.cc (Gogo::analyze_escape): Remove
>>>>      usage of a parameter.
>>>>      (Gogo::assign_connectivity): Likewise.
>>>>      (class Escape_analysis_tag): Likewise.
>>>>      (Gogo::tag_function): Likewise.
>>>>      * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>>>>      * gofrontend/gogo.h (class Gogo): Likewise.
>>>>      * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>>>>      (Type::make_call_multiple_result_type): Likewise.
>>>>      * gofrontend/types.h (class Type): Likewise.
>>>>      * gofrontend/wb.cc (class Check_escape): Likewise.
>>>>      (Gogo::add_write_barriers): Likewise.
>>> Note that some of these may be used inside conditional code.  For
>>> example the add_AT_vms_delta is used by ia64-vms.  You could argue that
>>> ia64-vms is a zombie and should be removed, but the general concern WRT
>>> conditionally compiled code holds.
>>
>> Well, please let me install the patch as is and if somebody will need the
>> functionality, I would be happy to put it back.
> 
> You could use contrib/config-list.mk to build all supported target configs.  You
> shouldn't break builds for valid configs deliberately
Right.  On a suitably large box it only takes a few hours.   Fire it off
at the end of the day and you've got results in the morning.

So how about this, if it passes config-list.mk then it's OK.   Obviously
it's OK to retain any functions that are flagged as necessary by
config-list.mk.

Alternately find + grep is your friend, but I find config-list.mk is better.

jeff

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-25 13:40         ` Jeff Law
@ 2018-09-26  9:01           ` Martin Liška
  2018-09-27 11:18             ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-09-26  9:01 UTC (permalink / raw)
  To: Jeff Law, Richard Biener; +Cc: GCC Patches

On 9/25/18 3:34 PM, Jeff Law wrote:
> On 9/25/18 6:19 AM, Richard Biener wrote:
>> On Tue, Sep 25, 2018 at 9:09 AM Martin Liška <mliska@suse.cz> wrote:
>>>
>>> On 9/24/18 4:42 PM, Jeff Law wrote:
>>>> On 9/22/18 1:08 PM, marxin wrote:
>>>>>
>>>>> gcc/ChangeLog:
>>>>>
>>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>>
>>>>>      * alias.c (set_dest_equal_p): Remove unused function.
>>>>>      * config/i386/i386.c (def_builtin_pure2): Likewise.
>>>>>      * diagnostic-show-locus.c (class layout): Remove
>>>>>      unused field.
>>>>>      (layout::layout): Likewise here.
>>>>>      * dump-context.h (class temp_dump_context): Likewise.
>>>>>      * dwarf2out.c (add_AT_fde_ref): Remove unused function.
>>>>>      (add_AT_loclistsptr): Likewise.
>>>>>      (add_AT_offset): Likewise.
>>>>>      (get_AT_hi_pc): Likewise.
>>>>>      (is_comdat_die): Likewise.
>>>>>      (type_is_enum): Likewise.
>>>>>      (ceiling): Likewise.
>>>>>      (add_AT_vms_delta): Likewise.
>>>>>      (is_class_die): Likewise.
>>>>>      * edit-context.c (class line_event): Remove unused field.
>>>>>      * graphite-sese-to-poly.c (tree_int_to_gmp): Remove
>>>>>      unused function.
>>>>>      * ipa-cp.c (ipa_get_vr_lat): Likewise.
>>>>>      * lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
>>>>>      (ok_for_base_p_nonstrict): Likewise.
>>>>>      * tree-chrec.c (is_not_constant_evolution): Likewise.
>>>>>      (chrec_fold_poly_cst): Likewise.
>>>>>      * tree-if-conv.c (has_pred_critical_p): Likewise.
>>>>>      * tree-ssa-coalesce.c (print_exprs): Likewise.
>>>>>      * tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
>>>>>      * tree-ssa-uninit.c (is_and_or_or_p): Likewise.
>>>>>      * tree-vrp.c (value_ranges_intersect_p): Likewise.
>>>>>      (value_range_nonnegative_p): Likewise.
>>>>>
>>>>> gcc/cp/ChangeLog:
>>>>>
>>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>>
>>>>>      * name-lookup.c (namespace_scope_ht_size): Remove
>>>>>      unused function.
>>>>>      * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
>>>>>
>>>>> gcc/fortran/ChangeLog:
>>>>>
>>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>>
>>>>>      * trans.c (remove_suffix): Remove
>>>>>      unused function.
>>>>>
>>>>> gcc/go/ChangeLog:
>>>>>
>>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>>>
>>>>>      * gofrontend/escape.cc (Gogo::analyze_escape): Remove
>>>>>      usage of a parameter.
>>>>>      (Gogo::assign_connectivity): Likewise.
>>>>>      (class Escape_analysis_tag): Likewise.
>>>>>      (Gogo::tag_function): Likewise.
>>>>>      * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>>>>>      * gofrontend/gogo.h (class Gogo): Likewise.
>>>>>      * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>>>>>      (Type::make_call_multiple_result_type): Likewise.
>>>>>      * gofrontend/types.h (class Type): Likewise.
>>>>>      * gofrontend/wb.cc (class Check_escape): Likewise.
>>>>>      (Gogo::add_write_barriers): Likewise.
>>>> Note that some of these may be used inside conditional code.  For
>>>> example the add_AT_vms_delta is used by ia64-vms.  You could argue that
>>>> ia64-vms is a zombie and should be removed, but the general concern WRT
>>>> conditionally compiled code holds.
>>>
>>> Well, please let me install the patch as is and if somebody will need the
>>> functionality, I would be happy to put it back.
>>
>> You could use contrib/config-list.mk to build all supported target configs.  You
>> shouldn't break builds for valid configs deliberately
> Right.  On a suitably large box it only takes a few hours.   Fire it off
> at the end of the day and you've got results in the morning.
> 
> So how about this, if it passes config-list.mk then it's OK.   Obviously
> it's OK to retain any functions that are flagged as necessary by
> config-list.mk.
> 
> Alternately find + grep is your friend, but I find config-list.mk is better.
> 
> jeff
> 

Ok, next time I would be more careful about testing of other targets.

Thanks,
Martin

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-26  9:01           ` Martin Liška
@ 2018-09-27 11:18             ` Bernhard Reutner-Fischer
  2018-10-03 16:46               ` Jeff Law
  0 siblings, 1 reply; 25+ messages in thread
From: Bernhard Reutner-Fischer @ 2018-09-27 11:18 UTC (permalink / raw)
  To: Martin Liška; +Cc: Jeff Law, Richard Biener, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 5523 bytes --]

On Wed, 26 Sep 2018 10:59:02 +0200
Martin Liška <mliska@suse.cz> wrote:

> On 9/25/18 3:34 PM, Jeff Law wrote:
> > On 9/25/18 6:19 AM, Richard Biener wrote:  
> >> On Tue, Sep 25, 2018 at 9:09 AM Martin Liška <mliska@suse.cz>
> >> wrote:  
> >>>
> >>> On 9/24/18 4:42 PM, Jeff Law wrote:  
> >>>> On 9/22/18 1:08 PM, marxin wrote:  
> >>>>>
> >>>>> gcc/ChangeLog:
> >>>>>
> >>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>>>>
> >>>>>      * alias.c (set_dest_equal_p): Remove unused function.
> >>>>>      * config/i386/i386.c (def_builtin_pure2): Likewise.
> >>>>>      * diagnostic-show-locus.c (class layout): Remove
> >>>>>      unused field.
> >>>>>      (layout::layout): Likewise here.
> >>>>>      * dump-context.h (class temp_dump_context): Likewise.
> >>>>>      * dwarf2out.c (add_AT_fde_ref): Remove unused function.
> >>>>>      (add_AT_loclistsptr): Likewise.
> >>>>>      (add_AT_offset): Likewise.
> >>>>>      (get_AT_hi_pc): Likewise.
> >>>>>      (is_comdat_die): Likewise.
> >>>>>      (type_is_enum): Likewise.
> >>>>>      (ceiling): Likewise.
> >>>>>      (add_AT_vms_delta): Likewise.
> >>>>>      (is_class_die): Likewise.
> >>>>>      * edit-context.c (class line_event): Remove unused field.
> >>>>>      * graphite-sese-to-poly.c (tree_int_to_gmp): Remove
> >>>>>      unused function.
> >>>>>      * ipa-cp.c (ipa_get_vr_lat): Likewise.
> >>>>>      * lra-constraints.c (ok_for_index_p_nonstrict): Likewise.
> >>>>>      (ok_for_base_p_nonstrict): Likewise.
> >>>>>      * tree-chrec.c (is_not_constant_evolution): Likewise.
> >>>>>      (chrec_fold_poly_cst): Likewise.
> >>>>>      * tree-if-conv.c (has_pred_critical_p): Likewise.
> >>>>>      * tree-ssa-coalesce.c (print_exprs): Likewise.
> >>>>>      * tree-ssa-pre.c (bitmap_set_contains_expr): Likewise.
> >>>>>      * tree-ssa-uninit.c (is_and_or_or_p): Likewise.
> >>>>>      * tree-vrp.c (value_ranges_intersect_p): Likewise.
> >>>>>      (value_range_nonnegative_p): Likewise.
> >>>>>
> >>>>> gcc/cp/ChangeLog:
> >>>>>
> >>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>>>>
> >>>>>      * name-lookup.c (namespace_scope_ht_size): Remove
> >>>>>      unused function.
> >>>>>      * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
> >>>>>
> >>>>> gcc/fortran/ChangeLog:
> >>>>>
> >>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>>>>
> >>>>>      * trans.c (remove_suffix): Remove
> >>>>>      unused function.
> >>>>>
> >>>>> gcc/go/ChangeLog:
> >>>>>
> >>>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
> >>>>>
> >>>>>      * gofrontend/escape.cc (Gogo::analyze_escape): Remove
> >>>>>      usage of a parameter.
> >>>>>      (Gogo::assign_connectivity): Likewise.
> >>>>>      (class Escape_analysis_tag): Likewise.
> >>>>>      (Gogo::tag_function): Likewise.
> >>>>>      * gofrontend/expressions.cc (Call_expression::do_type):
> >>>>> Likewise.
> >>>>>      * gofrontend/gogo.h (class Gogo): Likewise.
> >>>>>      * gofrontend/types.cc (class Call_multiple_result_type):
> >>>>> Likewise. (Type::make_call_multiple_result_type): Likewise.
> >>>>>      * gofrontend/types.h (class Type): Likewise.
> >>>>>      * gofrontend/wb.cc (class Check_escape): Likewise.
> >>>>>      (Gogo::add_write_barriers): Likewise.  
> >>>> Note that some of these may be used inside conditional code.  For
> >>>> example the add_AT_vms_delta is used by ia64-vms.  You could
> >>>> argue that ia64-vms is a zombie and should be removed, but the
> >>>> general concern WRT conditionally compiled code holds.  
> >>>
> >>> Well, please let me install the patch as is and if somebody will
> >>> need the functionality, I would be happy to put it back.  
> >>
> >> You could use contrib/config-list.mk to build all supported target
> >> configs.  You shouldn't break builds for valid configs
> >> deliberately  
> > Right.  On a suitably large box it only takes a few hours.   Fire
> > it off at the end of the day and you've got results in the morning.
> > 
> > So how about this, if it passes config-list.mk then it's OK.
> > Obviously it's OK to retain any functions that are flagged as
> > necessary by config-list.mk.
> > 
> > Alternately find + grep is your friend, but I find config-list.mk
> > is better.
> > 
> > jeff
> >   
> 
> Ok, next time I would be more careful about testing of other targets.
> 
> Thanks,
> Martin

Although not perfect, but may i suggest to consider putting the
attached contrib/unused_functions.py into our tree?

Just for fun i'm attaching output for fortran, c, cp as per the
"Examples" comment in the header of the script.

sample line for cp:
gcc/cp/cvt.o: Symbol 'cp_get_callee_fndecl(tree_node*)' declared extern but never referenced externally

sample for c:
gcc/c/c-decl.o: Symbol 'pending_invalid_xref_location' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'pending_invalid_xref' declared extern but never referenced externally

I may find time to take care of the fortran spots later on, fwiw.

As per the comment inline, one could add support for extracting
archive-members. This would allow to optionally put the script
near the actual linking of e.g the compilers to see unwarranted extern
symbols quickly. But OTOH maybe that's a bit too much. :)

HTH
PS: I have to admit that flagging unused fields is a nice thing. Does
somebody know of an existing gcc plugin that does that? Or a secret LTO
knob to track or flag these?

[-- Attachment #2: unused_functions.py --]
[-- Type: text/x-python, Size: 3933 bytes --]

#!/usr/bin/env python
#
# Copyright (c) 2018 Bernhard Reutner-Fischer
# Inspired by bloat-o-meter from busybox.

# This software may be used and distributed according to the terms and
# conditions of the GNU General Public License as published by the Free
# Software Foundation.

# Examples:
# unused_functions.py ./gcc/fortran
# unused_functions.py gcc/c  gcc/c-family/ gcc/*-c.o | egrep -v "'gt_"
# unused_functions.py gcc/cp gcc/c-family/ gcc/*-c.o | egrep -v "'gt_"

import sys, os

def usage():
    sys.stderr.write("usage: %s [dirs | files] [-- <readelf options>]\n"
                        % sys.argv[0])
    sys.exit(1)

(odir, sym_args) = (set(), "")

for i in range(1, len(sys.argv)):
    f = sys.argv[i]
    if f == "--": # sym_args
        sym_args = " ".join(sys.argv[i + 1:])
        break
    if not os.path.exists(f):
        sys.stderr.write("Error: No such file or directory '%s'\n" % f)
        usage()
    else:
        odir.add(f)

def get_symbols(file):
    syms = {}
    for l in os.popen("readelf -W -s %s %s | c++filt" % (sym_args, file)).readlines():
        l = l.strip()
        if not (len(l) and l[0].isdigit() and len(l.split()) == 8):
            continue
        num, value, size, typ, bind, vis, ndx, name = l.split()
        if typ == 'SECTION' or typ == 'FILE': continue
        # I don't think we have many aliases in gcc, re-instate the addr
        # lut otherwise.
        if vis != "DEFAULT": continue
        #value = int(value, 16)
        #size = int(size, 16) if size.startswith('0x') else int(size)
        defined = ndx != "UND"
        globl = bind == "GLOBAL"
        # c++ RID_FUNCTION_NAME dance. FORNOW: Handled as local use
        # Is that correct?
        if name.endswith("::__FUNCTION__") and typ == "OBJECT":
            name = name[0:(len(name) - len("::__FUNCTION__"))]
            if defined: defined = False # that can't be right...
        if defined and not globl: continue
        syms.setdefault(name, {})
        syms[name][["use","def"][defined]] = True
        syms[name][["local","global"][globl]] = True
    # Note: we could filter out e.g. debug_* symbols by looking for
    # value in the debug_macro sections.
    return syms

(oprog, nprog) = ({}, {})

def walker(paths):
    prog = {}
    for path in paths:
        if os.path.isdir(path):
            for r, dirs, files in os.walk(path):
                for f in files:
                    # TODO: maybe extract .a
                    if not f.endswith(".o"): continue
                    p = os.path.join(r, f)
                    prog[os.path.normpath(p)] = get_symbols(p)
                for d in dirs:
                    tem = prog.copy()
                    tem.update(walker([os.path.join(r, d)]))
                    prog = tem
        else:
            prog[os.path.normpath(path)] = get_symbols(path)
    return prog

def resolve(prog):
    x = prog.keys()
    use = set()
    # for each unique pair of different files
    for (f, g) in ((f,g) for f in x for g in x if f != g):
        refs = set()
        # for each defined symbol
        #for s in (s for s in prog[f] if prog[f][s] and s not in use
        #  and s in prog[g]):
        for s in (s for s in prog[f] if prog[f][s].get("def") and s in prog[g]):
            #if prog[g][s].get("def") and prog[g][s].get("global"):
            #    print("Error: Duplicate global %s in %s and %s" % (s, f, g))
            #elif prog[g][s].get("use"):
            if prog[g][s].get("use"):
                refs.add(s)
        for s in refs:
            for i in (i for i in x if s in prog[i]): del prog[i][s]
        use |= refs
    return use

oprog = walker(odir)
oused = resolve(oprog)
for (i,s) in ((i,s) for i in oprog.keys() for s in oprog[i] if oprog[i][s]):
    if oprog[i][s].get("def") and not oprog[i][s].get("use"):
        print("%s: Symbol '%s' declared extern but never referenced externally"
            % (i,s))
#print("Done.");


[-- Attachment #3: fortran.txt --]
[-- Type: text/plain, Size: 8785 bytes --]

gcc/fortran/resolve.o: Symbol 'gfc_elemental(gfc_symbol*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_lang_type(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_r_gtype_fortran_h' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_binding_level(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx(module_htab_entry&)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_hash_table_module_decl_hasher_(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_module_htab_entry(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_lang_decl(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_rs_gtype_fortran_h' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx(module_htab_entry&)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_hash_table_module_decl_hasher_(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx(module_decl_hasher&)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_r_gt_fortran_f95_lang_h' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_deletable_rtab' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_language_function(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx(module_decl_hasher&)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_scalar_rtab' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_rtab' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_language_function(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_binding_level(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_lang_decl(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_clear_caches()' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_ggc_mx_lang_type(void*)' declared extern but never referenced externally
gcc/fortran/f95-lang.o: Symbol 'gt_pch_nx_module_htab_entry(void*)' declared extern but never referenced externally
gcc/fortran/module.o: Symbol 'mio_symbol_ref(gfc_symbol**)' declared extern but never referenced externally
gcc/fortran/module.o: Symbol 'mio_interface_rest(gfc_interface**)' declared extern but never referenced externally
gcc/fortran/class.o: Symbol 'gfc_intrinsic_hash_value(gfc_typespec*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_insert_kind_parameter_exprs(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_match_old_kind_spec(gfc_typespec*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_mod_pointee_as(gfc_array_spec*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'get_bind_c_idents()' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_match_null(gfc_expr**)' declared extern but never referenced externally
gcc/fortran/expr.o: Symbol 'is_non_empty_structure_constructor(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/gfortranspec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/fortran/gfortranspec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally
gcc/fortran/trans.o: Symbol 'gfc_msg_wrong_return' declared extern but never referenced externally
gcc/fortran/symbol.o: Symbol 'gfc_get_ultimate_derived_super_type(gfc_symbol*)' declared extern but never referenced externally
gcc/fortran/primary.o: Symbol 'matching_actual_arglist' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'simplify_ieee_support(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'simplify_ieee_selected_real_kind(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'gfc_simplify_get_team(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/trans-types.o: Symbol 'gfc_check_any_c_kind(gfc_typespec*)' declared extern but never referenced externally
gcc/fortran/trans-types.o: Symbol 'gfc_get_ppc_type(gfc_component*)' declared extern but never referenced externally
gcc/fortran/trans-types.o: Symbol 'dtype_type_node' declared extern but never referenced externally
gcc/fortran/trans-types.o: Symbol 'pfunc_type_node' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'gfc_debug_code(gfc_code*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'gfc_debug_expr(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gt_ggc_mx_hash_table_module_hasher_(void*)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_args' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gt_pch_nx_hash_table_module_hasher_(void*)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_max_subrecord_length' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_convert' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gt_pch_nx(module_hasher&)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_record_marker' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gt_ggc_mx(module_hasher&)' declared extern but never referenced externally
gcc/fortran/match.o: Symbol 'type_param_spec_list' declared extern but never referenced externally
gcc/fortran/match.o: Symbol 'gfc_match_label()' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_hash_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_extends_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_deallocate_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_def_init_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_hash_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_final_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_def_init_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_copy_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_copy_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_extends_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/constructor.o: Symbol 'gfc_constructor_get_base()' declared extern but never referenced externally
gcc/fortran/scanner.o: Symbol 'file_changes_count' declared extern but never referenced externally
gcc/fortran/scanner.o: Symbol 'file_changes_allocated' declared extern but never referenced externally
gcc/fortran/scanner.o: Symbol 'file_changes_cur' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'evec' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'stack_top' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'n_vars' declared extern but never referenced externally
gcc/fortran/trans-openmp.o: Symbol 'gfc_trans_oacc_declare(gfc_code*)' declared extern but never referenced externally
gcc/fortran/cpp.o: Symbol 'gfc_cpp_register_include_paths()' declared extern but never referenced externally
gcc/fortran/cpp.o: Symbol 'gfc_cpp_option' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_free_omp_declare_simd(gfc_omp_declare_simd*)' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_free_expr_list(gfc_expr_list*)' declared extern but never referenced externally

[-- Attachment #4: c.txt --]
[-- Type: text/plain, Size: 6705 bytes --]

gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_length_modifier()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'flag_chars_t::flag_chars_t()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'flag_chars_t::add_char(char)' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_format_left_precision()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::find_format_char_info(char)' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_other_modifier()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_dollar()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::handle_alloc_chars()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_format_flags()' declared extern but never referenced externally
gcc/c-family/c-lex.o: Symbol 'c_header_level' declared extern but never referenced externally
gcc/c-family/c-lex.o: Symbol 'dump_time_statistics()' declared extern but never referenced externally
gcc/c-family/c-pch.o: Symbol 'lang_post_pch_load' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'debug_c_tree(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_complement(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_left_brace(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_exclamation(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'c_pretty_printer::initializer(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_right_brace(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_star(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_left_paren(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_ampersand(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'c_pretty_printer::declaration(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_right_bracket(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'c_pretty_printer::statement(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_dot(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_left_bracket(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_arrow(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_semicolon(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_right_paren(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/known-headers.o: Symbol 'suggest_missing_header::~suggest_missing_header()' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_generate_static_init_call(tree_node*)' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_static_init_needed_p()' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_is_id(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_is_decl_specifier(rid)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_is_type_qualifier(rid)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'registered_builtin_types' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'done_lexing' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_is_storage_class_specifier(rid)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_begins_type_specifier(rid)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'make_tree_vector_single(tree_node*)' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'objc_mark_locals_volatile(void*)' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'pending_invalid_xref_location' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'pending_invalid_xref' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'objc_get_current_scope()' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'store_parm_decls_from(c_arg_info*)' declared extern but never referenced externally
gcc/c/c-decl.o: Symbol 'c_binding_oracle' declared extern but never referenced externally
gcc/c/gccspec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/c/gccspec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally
gcc/c/c-lang.o: Symbol 'selftest::run_c_tests()' declared extern but never referenced externally
gcc/c-family/c-attribs.o: Symbol 'tm_attr_to_mask(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pragma.o: Symbol 'pop_visibility(int)' declared extern but never referenced externally
gcc/c-family/c-pragma.o: Symbol 'pragma_extern_prefix' declared extern but never referenced externally
gcc/c/c-parser.o: Symbol 'matching_paren_traits::open_gmsgid' declared extern but never referenced externally
gcc/c/c-parser.o: Symbol 'matching_paren_traits::close_gmsgid' declared extern but never referenced externally
gcc/c/c-parser.o: Symbol 'matching_brace_traits::close_gmsgid' declared extern but never referenced externally
gcc/c/c-parser.o: Symbol 'matching_brace_traits::open_gmsgid' declared extern but never referenced externally
gcc/c-family/c-opts.o: Symbol 'c_family_lang_mask' declared extern but never referenced externally
gcc/c-family/cppspec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/c-family/cppspec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally

[-- Attachment #5: cp.txt --]
[-- Type: text/plain, Size: 6476 bytes --]

gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_length_modifier()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'flag_chars_t::flag_chars_t()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'flag_chars_t::add_char(char)' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_format_left_precision()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::find_format_char_info(char)' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_other_modifier()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_any_dollar()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::handle_alloc_chars()' declared extern but never referenced externally
gcc/c-family/c-format.o: Symbol 'argument_parser::read_format_flags()' declared extern but never referenced externally
gcc/cp/constraint.o: Symbol 'constraint_thresh' declared extern but never referenced externally
gcc/cp/constraint.o: Symbol 'constraint_errors' declared extern but never referenced externally
gcc/c-family/c-lex.o: Symbol 'c_header_level' declared extern but never referenced externally
gcc/cp/g++spec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally
gcc/cp/g++spec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/cp/ptree.o: Symbol 'debug_tree(cp_expr)' declared extern but never referenced externally
gcc/cp/cvt.o: Symbol 'cp_get_callee_fndecl(tree_node*)' declared extern but never referenced externally
gcc/cp/lex.o: Symbol 'init_reswords()' declared extern but never referenced externally
gcc/c-family/known-headers.o: Symbol 'suggest_missing_header::~suggest_missing_header()' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_check_global_decl(tree_node*)' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_detect_field_duplicates(bool)' declared extern but never referenced externally
gcc/c-family/stub-objc.o: Symbol 'objc_check_decl(tree_node*)' declared extern but never referenced externally
gcc/cp/except.o: Symbol 'eh_type_info(tree_node*)' declared extern but never referenced externally
gcc/cp/parser.o: Symbol 'debug(cp_token&)' declared extern but never referenced externally
gcc/cp/parser.o: Symbol 'debug(cp_token*)' declared extern but never referenced externally
gcc/cp/parser.o: Symbol 'debug(cp_parser*)' declared extern but never referenced externally
gcc/cp/parser.o: Symbol 'no_parameters' declared extern but never referenced externally
gcc/cp/parser.o: Symbol 'debug(cp_parser&)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'c_default_pointer_mode' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'c_common_init_ts()' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_is_type_qualifier(rid)' declared extern but never referenced externally
gcc/c-family/c-common.o: Symbol 'keyword_is_storage_class_specifier(rid)' declared extern but never referenced externally
gcc/cp/decl.o: Symbol 'objc_get_current_scope()' declared extern but never referenced externally
gcc/c-family/c-pragma.o: Symbol 'pragma_extern_prefix' declared extern but never referenced externally
gcc/c-family/c-pragma.o: Symbol 'valid_location_for_stdc_pragma_p()' declared extern but never referenced externally
gcc/c-family/c-pragma.o: Symbol 'mark_valid_location_for_stdc_pragma(bool)' declared extern but never referenced externally
gcc/cp/tree.o: Symbol 'verify_stmt_tree(tree_node*)' declared extern but never referenced externally
gcc/cp/tree.o: Symbol 'count_trees(tree_node*)' declared extern but never referenced externally
gcc/cp/vtable-class-hierarchy.o: Symbol 'vtv_register_class_hierarchy_information(tree_node*)' declared extern but never referenced externally
gcc/cp/pt.o: Symbol 'tinst_level::refcount_infinity' declared extern but never referenced externally
gcc/cp/pt.o: Symbol 'spec_hasher::hash(spec_entry*)' declared extern but never referenced externally
gcc/cp/pt.o: Symbol 'depth_reached' declared extern but never referenced externally
gcc/cp/pt.o: Symbol 'tinst_level::free(tinst_level*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'debug_c_tree(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_exclamation(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'pp_c_ampersand(c_pretty_printer*)' declared extern but never referenced externally
gcc/c-family/c-pretty-print.o: Symbol 'c_pretty_printer::declaration(tree_node*)' declared extern but never referenced externally
gcc/c-family/c-opts.o: Symbol 'c_family_lang_mask' declared extern but never referenced externally
gcc/cp/constexpr.o: Symbol 'is_static_init_expression(tree_node*)' declared extern but never referenced externally
gcc/cp/constexpr.o: Symbol 'is_constant_expression(tree_node*)' declared extern but never referenced externally
gcc/cp/cxx-pretty-print.o: Symbol 'cxx_pretty_printer::declarator(tree_node*)' declared extern but never referenced externally
gcc/cp/class.o: Symbol 'debug_thunks(tree_node*)' declared extern but never referenced externally
gcc/cp/class.o: Symbol 'debug_class(tree_node*)' declared extern but never referenced externally
gcc/cp/class.o: Symbol 'declared_access(tree_node*)' declared extern but never referenced externally
gcc/c-family/cppspec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/c-family/cppspec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally
gcc/cp/name-lookup.o: Symbol 'name_lookup::shared_scopes' declared extern but never referenced externally
gcc/cp/name-lookup.o: Symbol 'debug(cp_binding_level&)' declared extern but never referenced externally
gcc/cp/name-lookup.o: Symbol 'name_lookup::active' declared extern but never referenced externally
gcc/cp/name-lookup.o: Symbol 'debug(cp_binding_level*)' declared extern but never referenced externally
gcc/cp/cp-lang.o: Symbol 'selftest::run_cp_tests()' declared extern but never referenced externally

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-27 11:18             ` Bernhard Reutner-Fischer
@ 2018-10-03 16:46               ` Jeff Law
  2018-10-03 19:35                 ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Law @ 2018-10-03 16:46 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer, Martin Liška; +Cc: Richard Biener, GCC Patches

On 9/27/18 5:13 AM, Bernhard Reutner-Fischer wrote:

> 
> Although not perfect, but may i suggest to consider putting the
> attached contrib/unused_functions.py into our tree?
Do you have commit privileges?  If so, go ahead and add it.

> 
> Just for fun i'm attaching output for fortran, c, cp as per the
> "Examples" comment in the header of the script.
> 
> sample line for cp:
> gcc/cp/cvt.o: Symbol 'cp_get_callee_fndecl(tree_node*)' declared extern but never referenced externally
Seems like it could just go away.  I'd hazard a guess the introduction
of cp_get_callee_fndecl_nofold made cp_get_callee_fndecl unused and it
just wasn't caught at the time.

> 
> sample for c:
> gcc/c/c-decl.o: Symbol 'pending_invalid_xref_location' declared extern but never referenced externally
> gcc/c/c-decl.o: Symbol 'pending_invalid_xref' declared extern but never referenced externally
I think these are used internally within c-decl.c, so I think they just
need their linkage changed to static.

Anyone who wants to tackle those should consider the patch pre-approved.


Jeff

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-10-03 16:46               ` Jeff Law
@ 2018-10-03 19:35                 ` Bernhard Reutner-Fischer
  2018-10-05  2:19                   ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 25+ messages in thread
From: Bernhard Reutner-Fischer @ 2018-10-03 19:35 UTC (permalink / raw)
  To: Jeff Law, Martin Liška; +Cc: Richard Biener, GCC Patches

On 3 October 2018 18:42:23 CEST, Jeff Law <law@redhat.com> wrote:
>On 9/27/18 5:13 AM, Bernhard Reutner-Fischer wrote:
>
>> 
>> Although not perfect, but may i suggest to consider putting the
>> attached contrib/unused_functions.py into our tree?
>Do you have commit privileges?  If so, go ahead and add it.

Yes I have and will add it.

>> Just for fun i'm attaching output for fortran, c, cp as per the
>> "Examples" comment in the header of the script.
>> 

>Anyone who wants to tackle those should consider the patch
>pre-approved.

I'm happy to leave the non-Fortran bits to whoever has time.

TIA :)

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-10-03 19:35                 ` Bernhard Reutner-Fischer
@ 2018-10-05  2:19                   ` Bernhard Reutner-Fischer
  2018-10-05 13:41                     ` Martin Liška
  0 siblings, 1 reply; 25+ messages in thread
From: Bernhard Reutner-Fischer @ 2018-10-05  2:19 UTC (permalink / raw)
  To: Jeff Law, Martin Liška; +Cc: Richard Guenther, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]

Hi!

So i just added archive handling to ease looking at more than just the
plain frontends, applied as r264856.

You can now use the exact files passed to the driver when linking e.g. cc1.
We link libcommon.a twice? Didn't look.

e.g.:
me@there:.../gcc$ /scratch/src/gcc-trunk/contrib/unused_functions.py
c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o
c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o
c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o
c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o
c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o
c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o
c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o
c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o
c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o
c-family/c-spellcheck.o i386-c.o glibc-c.o   cc1-checksum.o
libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a
../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a
../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a

results in the attached output.

This properly flags functions like e.g.: init_branch_prob (dead code),
bitwise_mode_for_mode in stor-layout.c (should be static).

Of course it also complains about cases like supports_one_only() in cc1
where that is only used in cc1plus.
Likewise constant_pool_empty_p() on i386 which is only used by ppc and spe.

HTH,

[-- Attachment #2: cc1-unused_funcs.txt.xz --]
[-- Type: application/x-xz, Size: 12460 bytes --]

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-10-05  2:19                   ` Bernhard Reutner-Fischer
@ 2018-10-05 13:41                     ` Martin Liška
  2018-10-09  8:52                       ` [PATCH] Remove dead functions and fix VMS target by moving back some functions Martin Liška
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-10-05 13:41 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer, Jeff Law; +Cc: Richard Guenther, GCC Patches

On 10/5/18 12:43 AM, Bernhard Reutner-Fischer wrote:
> Hi!
> 
> So i just added archive handling to ease looking at more than just the
> plain frontends, applied as r264856.

Running the tools for cc1 does not show anything. Please update the comment
in the script with example invocation.

> 
> You can now use the exact files passed to the driver when linking e.g. cc1.
> We link libcommon.a twice? Didn't look.
> 
> e.g.:
> me@there:.../gcc$ /scratch/src/gcc-trunk/contrib/unused_functions.py
> c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o
> c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o
> c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o
> c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o
> c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o
> c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o
> c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o
> c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o
> c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o
> c-family/c-spellcheck.o i386-c.o glibc-c.o   cc1-checksum.o
> libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a
> ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a
> ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
> ../libdecnumber/libdecnumber.a
> 
> results in the attached output.
> 
> This properly flags functions like e.g.: init_branch_prob (dead code),
> bitwise_mode_for_mode in stor-layout.c (should be static).
> 
> Of course it also complains about cases like supports_one_only() in cc1
> where that is only used in cc1plus.
> Likewise constant_pool_empty_p() on i386 which is only used by ppc and spe.
> 
> HTH,
> 

I'm not currently playing with alternative approach. As mentioned I run diagnostics
from rtags and it looks they added new functionality --find-dead-functions that
lists dead functions. It provides reasonable results, it finds also overloads of functions
and class member functions. Similarly I suggested to add --find-dead-variables:
https://github.com/Andersbakken/rtags/issues/1234
What's nice about it is that it can also find dead local variables, like:
gcc/tree-vect-loop.c:5875:34:	  widest_int ni, max_loop_value, lhs_max;
It's still WIP, needs to be done properly.

For the external symbols that can be turned into static, I created issue:
https://github.com/Andersbakken/rtags/issues/1235

I'm planning to prepare a patch that will remove the dead symbols.
Martin

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

* [PATCH] Remove dead functions and fix VMS target by moving back some functions.
  2018-10-05 13:41                     ` Martin Liška
@ 2018-10-09  8:52                       ` Martin Liška
  2018-10-09 22:53                         ` Martin Jambor
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-10-09  8:52 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer, Jeff Law; +Cc: Richard Guenther, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hi.

Utilizing rtags' --find-dead-functions I'm suggesting a removal of part
of the functions reported with the script. I built all cross compilers
defined in contrib/config-list.mk and I fixed VMS targets that I broke
in previous removal.

If the folks are happy with the removal, I can probably continue with that
at some point in stage3 or so.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Remove-dead-functions-and-fix-VMS-target-by-moving-b.patch --]
[-- Type: text/x-patch, Size: 69610 bytes --]

From f69d866da42a46783ab57181692583d2ecf30c49 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 5 Oct 2018 16:59:07 +0200
Subject: [PATCH] Remove dead functions and fix VMS target by moving back some
 functions.

gcc/ChangeLog:

2018-10-09  Martin Liska  <mliska@suse.cz>

	* attribs.c (register_attribute): Remove unused functions.
	* cfganal.c (control_dependences::clear_control_dependence_bitmap): Likewise.
	(bitmap_union_of_succs): Likewise.
	* cfganal.h (bitmap_union_of_succs): Likewise.
	* cfgloop.c (loop_exits_to_bb_p): Likewise.
	* cfgloop.h (loop_exits_to_bb_p): Likewise.
	* cgraph.h (compute_call_stmt_bb_frequency): Likewise.
	* cgraphbuild.c (compute_call_stmt_bb_frequency): Likewise.
	* cselib.c (cselib_dummy_expand_value_rtx_cb): Likewise.
	* cselib.h (cselib_dummy_expand_value_rtx_cb): Likewise.
	* df-core.c (df_reg_defined): Likewise.
	(df_reg_used): Likewise.
	* df-scan.c (df_hard_reg_used_count): Likewise.
	* df.h (df_reg_defined): Likewise.
	(df_reg_used): Likewise.
	(df_hard_reg_used_count): Likewise.
	* dojump.c (init_pending_stack_adjust): Likewise.
	* dojump.h (init_pending_stack_adjust): Likewise.
	* dwarf2out.c (add_AT_vms_delta): Move function back after
	removal.
	(dwarf2out_set_demangle_name_func): REmove unused functions.
	* dwarf2out.h (dwarf2out_set_demangle_name_func): Likewise.
	* emit-rtl.c (emit_jump_insn_before_noloc): Likewise.
	(emit_call_insn_before_noloc): Likewise.
	(emit_barrier_before): Likewise.
	(emit_call_insn_after_noloc): Likewise.
	(emit_call_insn_after_setloc): Likewise.
	(emit_jump_insn_before_setloc): Likewise.
	(emit_call_insn_before_setloc): Likewise.
	(emit_call_insn_before): Likewise.
	* except.c (remove_eh_handler): Likewise.
	(get_eh_region_from_rtx): Likewise.
	* except.h (remove_eh_handler): Likewise.
	(get_eh_region_from_rtx): Likewise.
	* fold-const.c (div_if_zero_remainder): Likewise.
	(fold_unary_to_constant): Likewise.
	* fold-const.h (fold_unary_to_constant): Likewise.
	(div_if_zero_remainder): Likewise.
	* function.c (get_hard_reg_initial_reg): Likewise.
	(get_last_funcdef_no): Likewise.
	* function.h (get_hard_reg_initial_reg): Likewise.
	(get_last_funcdef_no): Likewise.
	* ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Likewise.
	(ggc_cleared_alloc_ptr_array_two_args): Likewise.
	(ggc_splay_alloc): Likewise.
	(ggc_splay_dont_free): Likewise.
	* gimple-expr.c (is_gimple_address): Likewise.
	* gimple-expr.h (is_gimple_address): Likewise.
	* gimple-iterator.c (gsi_for_phi): Likewise.
	* gimple-iterator.h (gsi_for_phi): Likewise.
	* gimple-ssa-sprintf.c (struct format_result): Likewise.
	(format_result::operator+=): Likewise.
	(struct directive): Likewise.
	* gimple-ssa-warn-alloca.c (struct alloca_type_and_limit): Likewise.
	* gimple.c (gimple_unsigned_type): Likewise.
	(gimple_call_builtin_p): Likewise.
	* gimple.h (gimple_unsigned_type): Likewise.
	(gimple_call_builtin_p): Likewise.
	* gimplify.c (gimple_current_bind_expr): Likewise.
	* gimplify.h (gimple_current_bind_expr): Likewise.
	* haifa-sched.c (haifa_classify_insn): Likewise.
	* hsa-common.c (hsa_add_kernel_dependency): Likewise.
	(hsa_brig_function_name): Likewise.
	* hsa-common.h (hsa_add_kernel_dependency): Likewise.
	(hsa_brig_function_name): Likewise.
	* ipa-cp.c (ipcp_vr_lattice::meet_with): Likewise.
	* ipa-devirt.c (vtable_pointer_value_to_binfo): Likewise.
	* ipa-icf-gimple.c (func_checker::compare_tree_ssa_label): Likewise.
	* ipa-icf-gimple.h: Likewise.
	* ipa-icf.c (sem_item::sem_item): Likewise.
	(sem_function::sem_function): Likewise.
	(sem_function::icf_handled_component_p): Likewise.
	(sem_variable::sem_variable): Likewise.
	* ipa-icf.h: Likewise.
	* ipa-param-manipulation.c (index_in_adjustments_multiple_times_p): Likewise.
	(ipa_combine_adjustments): Likewise.
	* ipa-param-manipulation.h (ipa_combine_adjustments): Likewise.
	* ipa-prop.h (ipa_create_all_node_params): Likewise.
	(ipa_create_all_edge_args): Likewise.
	* ipa-ref.h: Likewise.
	* ipa-utils.h (vtable_pointer_value_to_binfo): Likewise.
	* lto-section-in.c (lto_delete_in_decl_state): Likewise.
	* lto-streamer-in.c (lto_input_data_block): Likewise.
	* lto-streamer.c (gate_lto_out): Likewise.
	* lto-streamer.h (lto_delete_in_decl_state): Likewise.
	(gate_lto_out): Likewise.
	(lto_input_data_block): Likewise.
	* predict.c (edge_probability_reliable_p): Likewise.
	* predict.h (edge_probability_reliable_p): Likewise.
	* read-md.c (md_reader::read_name_or_nil): Likewise.
	* read-md.h (class md_reader): Likewise.
	* rtl.h (get_first_nonnote_insn): Likewise.
	(emit_jump_insn_before_noloc): Likewise.
	(emit_jump_insn_before_setloc): Likewise.
	(emit_call_insn_before): Likewise.
	(emit_call_insn_before_noloc): Likewise.
	(emit_call_insn_before_setloc): Likewise.
	(emit_barrier_before): Likewise.
	(emit_call_insn_after_noloc): Likewise.
	(emit_call_insn_after_setloc): Likewise.
	* toplev.h: Likewise.
	* tree-inline.h: Likewise.

gcc/c-family/ChangeLog:

2018-10-09  Martin Liska  <mliska@suse.cz>

	* c-common.h (constant_expression_error): Remove unused
	functions.
	* c-pretty-print.c (pp_c_exclamation): Likewise.
	(pp_c_attributes): Likewise.
	(pp_c_function_definition): Likewise.
	* c-pretty-print.h (pp_c_exclamation): Likewise.
	(pp_c_function_definition): Likewise.
	(pp_c_attributes): Likewise.
	* c-warn.c (constant_expression_error): Likewise.
---
 gcc/attribs.c                 |   8 ---
 gcc/c-family/c-common.h       |   1 -
 gcc/c-family/c-pretty-print.c |  45 ---------------
 gcc/c-family/c-pretty-print.h |   3 -
 gcc/c-family/c-warn.c         |  13 -----
 gcc/cfganal.c                 |  46 ---------------
 gcc/cfganal.h                 |   2 -
 gcc/cfgloop.c                 |  15 -----
 gcc/cfgloop.h                 |   1 -
 gcc/cgraph.h                  |   1 -
 gcc/cgraphbuild.c             |   9 ---
 gcc/cselib.c                  |  18 ------
 gcc/cselib.h                  |   2 -
 gcc/df-core.c                 |  19 ------
 gcc/df-scan.c                 |  14 -----
 gcc/df.h                      |   3 -
 gcc/dojump.c                  |   9 ---
 gcc/dojump.h                  |   4 --
 gcc/dwarf2out.c               |  24 ++++++--
 gcc/dwarf2out.h               |   1 -
 gcc/emit-rtl.c                |  77 ------------------------
 gcc/except.c                  |  36 ------------
 gcc/except.h                  |   2 -
 gcc/fold-const.c              |  31 ----------
 gcc/fold-const.h              |   2 -
 gcc/function.c                |  26 ---------
 gcc/function.h                |   2 -
 gcc/ggc-common.c              |  31 ----------
 gcc/gimple-expr.c             |  41 -------------
 gcc/gimple-expr.h             |   1 -
 gcc/gimple-iterator.c         |  14 -----
 gcc/gimple-iterator.h         |   1 -
 gcc/gimple-ssa-sprintf.c      |  45 ---------------
 gcc/gimple-ssa-warn-alloca.c  |   1 -
 gcc/gimple.c                  |  22 -------
 gcc/gimple.h                  |   2 -
 gcc/gimplify.c                |   8 ---
 gcc/gimplify.h                |   1 -
 gcc/haifa-sched.c             |   2 +-
 gcc/hsa-common.c              |  37 ------------
 gcc/hsa-common.h              |   2 -
 gcc/ipa-cp.c                  |   7 ---
 gcc/ipa-devirt.c              |  21 -------
 gcc/ipa-icf-gimple.c          |   8 ---
 gcc/ipa-icf-gimple.h          |   7 ---
 gcc/ipa-icf.c                 |  30 ----------
 gcc/ipa-icf.h                 |  17 ------
 gcc/ipa-param-manipulation.c  | 106 ----------------------------------
 gcc/ipa-param-manipulation.h  |   2 -
 gcc/ipa-prop.h                |   2 -
 gcc/ipa-ref.h                 |  14 -----
 gcc/ipa-utils.h               |   1 -
 gcc/lto-section-in.c          |  12 ----
 gcc/lto-streamer-in.c         |  13 -----
 gcc/lto-streamer.c            |  10 ----
 gcc/lto-streamer.h            |   3 -
 gcc/predict.c                 |   7 ---
 gcc/predict.h                 |   1 -
 gcc/read-md.c                 |  16 -----
 gcc/read-md.h                 |   1 -
 gcc/rtl.h                     |  10 ----
 gcc/toplev.h                  |   5 --
 gcc/tree-inline.h             |   4 --
 63 files changed, 19 insertions(+), 900 deletions(-)

diff --git a/gcc/attribs.c b/gcc/attribs.c
index 8b721274d3b..a74b30bb7a2 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -253,14 +253,6 @@ init_attributes (void)
   attributes_initialized = true;
 }
 
-/* Insert a single ATTR into the attribute table.  */
-
-void
-register_attribute (const struct attribute_spec *attr)
-{
-  register_scoped_attribute (attr, find_attribute_namespace ("gnu"));
-}
-
 /* Insert a single attribute ATTR into a namespace of attributes.  */
 
 static void
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 9e868768d01..c9b26cac8af 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1254,7 +1254,6 @@ extern bool valid_array_size_p (location_t, tree, tree, bool = true);
 
 /* In c-warn.c.  */
 extern void constant_expression_warning (tree);
-extern void constant_expression_error (tree);
 extern void overflow_warning (location_t, tree, tree = NULL_TREE);
 extern void warn_logical_operator (location_t, enum tree_code, tree,
 				   enum tree_code, tree, enum tree_code, tree);
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index efb41c5b905..cc2933a33b1 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -156,13 +156,6 @@ pp_c_complement (c_pretty_printer *pp)
   pp->padding = pp_none;
 }
 
-void
-pp_c_exclamation (c_pretty_printer *pp)
-{
-  pp_exclamation (pp);
-  pp->padding = pp_none;
-}
-
 /* Print out the external representation of QUALIFIERS.  */
 
 void
@@ -765,30 +758,6 @@ c_pretty_printer::declaration (tree t)
   pp_c_init_declarator (this, t);
 }
 
-/* Pretty-print ATTRIBUTES using GNU C extension syntax.  */
-
-void
-pp_c_attributes (c_pretty_printer *pp, tree attributes)
-{
-  if (attributes == NULL_TREE)
-    return;
-
-  pp_c_ws_string (pp, "__attribute__");
-  pp_c_left_paren (pp);
-  pp_c_left_paren (pp);
-  for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
-    {
-      pp_tree_identifier (pp, TREE_PURPOSE (attributes));
-      if (TREE_VALUE (attributes))
-	pp_c_call_argument_list (pp, TREE_VALUE (attributes));
-
-      if (TREE_CHAIN (attributes))
-	pp_separate_with (pp, ',');
-    }
-  pp_c_right_paren (pp);
-  pp_c_right_paren (pp);
-}
-
 /* Pretty-print ATTRIBUTES using GNU C extension syntax for attributes
    marked to be displayed on disgnostic.  */
 
@@ -833,20 +802,6 @@ pp_c_attributes_display (c_pretty_printer *pp, tree a)
       pp_c_whitespace (pp);
     }
 }
-
-/* function-definition:
-      declaration-specifiers declarator compound-statement  */
-
-void
-pp_c_function_definition (c_pretty_printer *pp, tree t)
-{
-  pp->declaration_specifiers (t);
-  pp->declarator (t);
-  pp_needs_newline (pp) = true;
-  pp->statement (DECL_SAVED_TREE (t));
-  pp_newline_and_flush (pp);
-}
-
 \f
 /* Expressions.  */
 
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index c012b8cbe38..d7eb93025e9 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -111,13 +111,10 @@ void pp_c_star (c_pretty_printer *);
 void pp_c_arrow (c_pretty_printer *);
 void pp_c_semicolon (c_pretty_printer *);
 void pp_c_complement (c_pretty_printer *);
-void pp_c_exclamation (c_pretty_printer *);
 void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
 
 /* Declarations.  */
 void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
-void pp_c_function_definition (c_pretty_printer *, tree);
-void pp_c_attributes (c_pretty_printer *, tree);
 void pp_c_attributes_display (c_pretty_printer *, tree);
 void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
 void pp_c_type_qualifier_list (c_pretty_printer *, tree);
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index a1a7f935964..44e3be20fcb 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -54,19 +54,6 @@ constant_expression_warning (tree value)
     pedwarn (input_location, OPT_Woverflow, "overflow in constant expression");
 }
 
-/* The same as above but print an unconditional error.  */
-
-void
-constant_expression_error (tree value)
-{
-  if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST
-       || TREE_CODE (value) == FIXED_CST
-       || TREE_CODE (value) == VECTOR_CST
-       || TREE_CODE (value) == COMPLEX_CST)
-      && TREE_OVERFLOW (value))
-    error ("overflow in constant expression");
-}
-
 /* Print a warning if an expression result VALUE had an overflow
    in folding and its operands hadn't.  EXPR, which may be null, is
    the operand of the expression.
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 3b80758e8f2..dfa8bf7f8e2 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -365,13 +365,6 @@ control_dependences::set_control_dependence_map_bit (basic_block bb,
   bitmap_set_bit (control_dependence_map[bb->index], edge_index);
 }
 
-/* Clear all control dependences for block BB.  */
-void
-control_dependences::clear_control_dependence_bitmap (basic_block bb)
-{
-  bitmap_clear (control_dependence_map[bb->index]);
-}
-
 /* Find the immediate postdominator PDOM of the specified basic block BLOCK.
    This function is necessary because some blocks have negative numbers.  */
 
@@ -1509,45 +1502,6 @@ bitmap_intersection_of_preds (sbitmap dst, sbitmap *src, basic_block b)
       }
 }
 
-/* Set the bitmap DST to the union of SRC of successors of
-   basic block B.  */
-
-void
-bitmap_union_of_succs (sbitmap dst, sbitmap *src, basic_block b)
-{
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  for (ix = 0; ix < EDGE_COUNT (b->succs); ix++)
-    {
-      e = EDGE_SUCC (b, ix);
-      if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
-	continue;
-
-      bitmap_copy (dst, src[e->dest->index]);
-      break;
-    }
-
-  if (ix == EDGE_COUNT (b->succs))
-    bitmap_clear (dst);
-  else
-    for (ix++; ix < EDGE_COUNT (b->succs); ix++)
-      {
-	unsigned int i;
-	SBITMAP_ELT_TYPE *p, *r;
-
-	e = EDGE_SUCC (b, ix);
-	if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
-	  continue;
-
-	p = src[e->dest->index]->elms;
-	r = dst->elms;
-	for (i = 0; i < set_size; i++)
-	  *r++ |= *p++;
-      }
-}
-
 /* Set the bitmap DST to the union of SRC of predecessors of
    basic block B.  */
 
diff --git a/gcc/cfganal.h b/gcc/cfganal.h
index 122c665f7f6..e2512861e47 100644
--- a/gcc/cfganal.h
+++ b/gcc/cfganal.h
@@ -42,7 +42,6 @@ public:
 
 private:
   void set_control_dependence_map_bit (basic_block, int);
-  void clear_control_dependence_bitmap (basic_block);
   void find_control_dependence (int);
   vec<bitmap> control_dependence_map;
   vec<std::pair<int, int> > m_el;
@@ -76,7 +75,6 @@ extern void compute_dominance_frontiers (struct bitmap_head *);
 extern bitmap compute_idf (bitmap, struct bitmap_head *);
 extern void bitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block);
 extern void bitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block);
-extern void bitmap_union_of_succs (sbitmap, sbitmap *, basic_block);
 extern void bitmap_union_of_preds (sbitmap, sbitmap *, basic_block);
 extern basic_block * single_pred_before_succ_order (void);
 extern edge single_incoming_edge_ignoring_loop_edges (basic_block, bool);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 0917b716da7..2d43a3d694c 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1769,21 +1769,6 @@ single_exit (const struct loop *loop)
     return NULL;
 }
 
-/* Returns true when BB has an incoming edge exiting LOOP.  */
-
-bool
-loop_exits_to_bb_p (struct loop *loop, basic_block bb)
-{
-  edge e;
-  edge_iterator ei;
-
-  FOR_EACH_EDGE (e, ei, bb->preds)
-    if (loop_exit_edge_p (loop, e))
-      return true;
-
-  return false;
-}
-
 /* Returns true when BB has an outgoing edge exiting LOOP.  */
 
 bool
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 80a31c416ca..750939451dd 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -354,7 +354,6 @@ extern int num_loop_insns (const struct loop *);
 extern int average_num_loop_insns (const struct loop *);
 extern unsigned get_loop_level (const struct loop *);
 extern bool loop_exit_edge_p (const struct loop *, const_edge);
-extern bool loop_exits_to_bb_p (struct loop *, basic_block);
 extern bool loop_exits_from_bb_p (struct loop *, basic_block);
 extern void mark_loop_exit_edges (void);
 extern dump_user_location_t get_loop_location (struct loop *loop);
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 71c54537b93..c30ba3cdb7e 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -2395,7 +2395,6 @@ tree cgraph_build_function_type_skip_args (tree orig_type, bitmap args_to_skip,
 					   bool skip_return);
 
 /* In cgraphbuild.c  */
-int compute_call_stmt_bb_frequency (tree, basic_block bb);
 void record_references_in_initializer (tree, bool);
 
 /* In ipa.c  */
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index c2ad5cf2ef7..f1308dfdb5b 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -185,15 +185,6 @@ record_eh_tables (cgraph_node *node, function *fun)
     }
 }
 
-/* Computes the frequency of the call statement so that it can be stored in
-   cgraph_edge.  BB is the basic block of the call statement.  */
-int
-compute_call_stmt_bb_frequency (tree decl, basic_block bb)
-{
-  return bb->count.to_cgraph_frequency
-      (ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count);
-}
-
 /* Mark address taken in STMT.  */
 
 static bool
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 6d3a4078c68..f667c4e7503 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -1562,24 +1562,6 @@ cselib_expand_value_rtx_cb (rtx orig, bitmap regs_active, int max_depth,
   return cselib_expand_value_rtx_1 (orig, &evd, max_depth);
 }
 
-/* Similar to cselib_expand_value_rtx_cb, but no rtxs are actually copied
-   or simplified.  Useful to find out whether cselib_expand_value_rtx_cb
-   would return NULL or non-NULL, without allocating new rtx.  */
-
-bool
-cselib_dummy_expand_value_rtx_cb (rtx orig, bitmap regs_active, int max_depth,
-				  cselib_expand_callback cb, void *data)
-{
-  struct expand_value_data evd;
-
-  evd.regs_active = regs_active;
-  evd.callback = cb;
-  evd.callback_arg = data;
-  evd.dummy = true;
-
-  return cselib_expand_value_rtx_1 (orig, &evd, max_depth) != NULL;
-}
-
 /* Internal implementation of cselib_expand_value_rtx and
    cselib_expand_value_rtx_cb.  */
 
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 0005ad3113c..8fdbcfc6d5f 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -88,8 +88,6 @@ extern rtx cselib_expand_value_rtx (rtx, bitmap, int);
 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *);
 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int,
 				       cselib_expand_callback, void *);
-extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int,
-					      cselib_expand_callback, void *);
 extern rtx cselib_subst_to_values (rtx, machine_mode);
 extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *);
 extern void cselib_invalidate_rtx (rtx, const_rtx = NULL);
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 74ef0a14ac9..59949576f16 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1967,15 +1967,6 @@ df_find_def (rtx_insn *insn, rtx reg)
 }
 
 
-/* Return true if REG is defined in INSN, zero otherwise.  */
-
-bool
-df_reg_defined (rtx_insn *insn, rtx reg)
-{
-  return df_find_def (insn, reg) != NULL;
-}
-
-
 /* Finds the reference corresponding to the use of REG in INSN.
    DF is the dataflow object.  */
 
@@ -1998,16 +1989,6 @@ df_find_use (rtx_insn *insn, rtx reg)
 	return use;
   return NULL;
 }
-
-
-/* Return true if REG is referenced in INSN, zero otherwise.  */
-
-bool
-df_reg_used (rtx_insn *insn, rtx reg)
-{
-  return df_find_use (insn, reg) != NULL;
-}
-
 \f
 /*----------------------------------------------------------------------------
    Debugging and printing functions.
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 0b119f211ea..a891b49d78a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3868,20 +3868,6 @@ df_hard_reg_used_p (unsigned int reg)
 }
 
 
-/* A count of the number of times REG is actually used in the some
-   instruction.  There are a fair number of conditions that affect the
-   setting of this array.  See the comment in df.h for
-   df->hard_regs_live_count for the conditions that this array is
-   set. */
-
-
-unsigned int
-df_hard_reg_used_count (unsigned int reg)
-{
-  return df->hard_regs_live_count[reg];
-}
-
-
 /* Get the value of regs_ever_live[REGNO].  */
 
 bool
diff --git a/gcc/df.h b/gcc/df.h
index 6d1ff4d68ca..35a24eb7063 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -980,9 +980,7 @@ extern void df_check_cfg_clean (void);
 extern df_ref df_bb_regno_first_def_find (basic_block, unsigned int);
 extern df_ref df_bb_regno_last_def_find (basic_block, unsigned int);
 extern df_ref df_find_def (rtx_insn *, rtx);
-extern bool df_reg_defined (rtx_insn *, rtx);
 extern df_ref df_find_use (rtx_insn *, rtx);
-extern bool df_reg_used (rtx_insn *, rtx);
 extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
 extern void df_print_regset (FILE *file, bitmap r);
 extern void df_print_word_regset (FILE *file, bitmap r);
@@ -1076,7 +1074,6 @@ extern void df_update_entry_block_defs (void);
 extern void df_update_exit_block_uses (void);
 extern void df_update_entry_exit_and_calls (void);
 extern bool df_hard_reg_used_p (unsigned int);
-extern unsigned int df_hard_reg_used_count (unsigned int);
 extern bool df_regs_ever_live_p (unsigned int);
 extern void df_set_regs_ever_live (unsigned int, bool);
 extern void df_compute_regs_ever_live (bool);
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 9dccc7292a3..88d97b077b2 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -50,15 +50,6 @@ static void do_compare_and_jump	(tree, tree, enum rtx_code, enum rtx_code,
 				 rtx_code_label *, rtx_code_label *,
 				 profile_probability);
 
-/* At the start of a function, record that we have no previously-pushed
-   arguments waiting to be popped.  */
-
-void
-init_pending_stack_adjust (void)
-{
-  pending_stack_adjust = 0;
-}
-
 /* Discard any pending stack adjustment.  This avoid relying on the
    RTL optimizers to remove useless adjustments when we know the
    stack pointer value is dead.  */
diff --git a/gcc/dojump.h b/gcc/dojump.h
index f948ee916e3..8a6412be0d6 100644
--- a/gcc/dojump.h
+++ b/gcc/dojump.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_DOJUMP_H
 #define GCC_DOJUMP_H
 
-/* At the start of a function, record that we have no previously-pushed
-   arguments waiting to be popped.  */
-extern void init_pending_stack_adjust (void);
-
 /* Discard any pending stack adjustment.  */
 extern void discard_pending_stack_adjust (void);
 
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0772b364919..91f9dacec88 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3901,6 +3901,8 @@ static void prune_unused_types (void);
 static int maybe_emit_file (struct dwarf_file_data *fd);
 static inline const char *AT_vms_delta1 (dw_attr_node *);
 static inline const char *AT_vms_delta2 (dw_attr_node *);
+static inline void add_AT_vms_delta (dw_die_ref, enum dwarf_attribute,
+				     const char *, const char *);
 static void append_entry_to_tmpl_value_parm_die_table (dw_die_ref, tree);
 static void gen_remaining_tmpl_value_param_die_attribute (void);
 static bool generic_type_p (tree);
@@ -4201,12 +4203,6 @@ comp_unit_die (void)
 
 static const char *(*demangle_name_func) (const char *);
 
-void
-dwarf2out_set_demangle_name_func (const char *(*func) (const char *))
-{
-  demangle_name_func = func;
-}
-
 /* Test if rtl node points to a pseudo register.  */
 
 static inline int
@@ -5135,6 +5131,22 @@ AT_file (dw_attr_node *a)
   return a->dw_attr_val.v.val_file;
 }
 
+/* Add a vms delta attribute value to a DIE.  */
+
+static inline void
+add_AT_vms_delta (dw_die_ref die, enum dwarf_attribute attr_kind,
+		  const char *lbl1, const char *lbl2)
+{
+  dw_attr_node attr;
+
+  attr.dw_attr = attr_kind;
+  attr.dw_attr_val.val_class = dw_val_class_vms_delta;
+  attr.dw_attr_val.val_entry = NULL;
+  attr.dw_attr_val.v.val_vms_delta.lbl1 = xstrdup (lbl1);
+  attr.dw_attr_val.v.val_vms_delta.lbl2 = xstrdup (lbl2);
+  add_dwarf_attr (die, &attr);
+}
+
 /* Add a symbolic view identifier attribute value to a DIE.  */
 
 static inline void
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index a0ba414014d..e749d278708 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -312,7 +312,6 @@ extern void debug_dwarf_die (struct die_struct *);
 extern void debug_dwarf_loc_descr (dw_loc_descr_ref);
 extern void debug (die_struct &ref);
 extern void debug (die_struct *ptr);
-extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
 #ifdef VMS_DEBUGGING_INFO
 extern void dwarf2out_vms_debug_main_pointer (void);
 #endif
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 9a735fab5bf..0f98c96815f 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4566,27 +4566,6 @@ emit_insn_before_noloc (rtx x, rtx_insn *before, basic_block bb)
   return emit_pattern_before_noloc (x, before, before, bb, make_insn_raw);
 }
 
-/* Make an instruction with body X and code JUMP_INSN
-   and output it before the instruction BEFORE.  */
-
-rtx_jump_insn *
-emit_jump_insn_before_noloc (rtx x, rtx_insn *before)
-{
-  return as_a <rtx_jump_insn *> (
-		emit_pattern_before_noloc (x, before, NULL, NULL,
-					   make_jump_insn_raw));
-}
-
-/* Make an instruction with body X and code CALL_INSN
-   and output it before the instruction BEFORE.  */
-
-rtx_insn *
-emit_call_insn_before_noloc (rtx x, rtx_insn *before)
-{
-  return emit_pattern_before_noloc (x, before, NULL, NULL,
-				    make_call_insn_raw);
-}
-
 /* Make an instruction with body X and code DEBUG_INSN
    and output it before the instruction BEFORE.  */
 
@@ -4597,20 +4576,6 @@ emit_debug_insn_before_noloc (rtx x, rtx_insn *before)
 				    make_debug_insn_raw);
 }
 
-/* Make an insn of code BARRIER
-   and output it before the insn BEFORE.  */
-
-rtx_barrier *
-emit_barrier_before (rtx_insn *before)
-{
-  rtx_barrier *insn = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
-
-  INSN_UID (insn) = cur_insn_uid++;
-
-  add_insn_before (insn, before, NULL);
-  return insn;
-}
-
 /* Emit the label LABEL before the insn BEFORE.  */
 
 rtx_code_label *
@@ -4726,15 +4691,6 @@ emit_jump_insn_after_noloc (rtx x, rtx_insn *after)
 		emit_pattern_after_noloc (x, after, NULL, make_jump_insn_raw));
 }
 
-/* Make an instruction with body X and code CALL_INSN
-   and output it after the instruction AFTER.  */
-
-rtx_insn *
-emit_call_insn_after_noloc (rtx x, rtx_insn *after)
-{
-  return emit_pattern_after_noloc (x, after, NULL, make_call_insn_raw);
-}
-
 /* Make an instruction with body X and code CALL_INSN
    and output it after the instruction AFTER.  */
 
@@ -4909,13 +4865,6 @@ emit_jump_insn_after (rtx pattern, rtx_insn *after)
 	emit_pattern_after (pattern, after, true, make_jump_insn_raw));
 }
 
-/* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_insn *
-emit_call_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
-{
-  return emit_pattern_after_setloc (pattern, after, loc, make_call_insn_raw);
-}
-
 /* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_insn *
 emit_call_insn_after (rtx pattern, rtx_insn *after)
@@ -5010,15 +4959,6 @@ emit_insn_before (rtx pattern, rtx_insn *before)
   return emit_pattern_before (pattern, before, true, true, make_insn_raw);
 }
 
-/* like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_jump_insn *
-emit_jump_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
-{
-  return as_a <rtx_jump_insn *> (
-	emit_pattern_before_setloc (pattern, before, loc, false,
-				    make_jump_insn_raw));
-}
-
 /* Like emit_jump_insn_before_noloc, but set INSN_LOCATION according to BEFORE.  */
 rtx_jump_insn *
 emit_jump_insn_before (rtx pattern, rtx_insn *before)
@@ -5028,23 +4968,6 @@ emit_jump_insn_before (rtx pattern, rtx_insn *before)
 			     make_jump_insn_raw));
 }
 
-/* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_insn *
-emit_call_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
-{
-  return emit_pattern_before_setloc (pattern, before, loc, false,
-				     make_call_insn_raw);
-}
-
-/* Like emit_call_insn_before_noloc,
-   but set insn_location according to BEFORE.  */
-rtx_insn *
-emit_call_insn_before (rtx pattern, rtx_insn *before)
-{
-  return emit_pattern_before (pattern, before, true, false,
-			      make_call_insn_raw);
-}
-
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
 rtx_insn *
 emit_debug_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
diff --git a/gcc/except.c b/gcc/except.c
index 728b1e1d349..510f689a709 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1599,29 +1599,6 @@ remove_eh_handler_splicer (eh_region *pp)
   (*cfun->eh->region_array)[region->index] = NULL;
 }
 
-/* Splice a single EH region REGION from the region tree.
-
-   To unlink REGION, we need to find the pointer to it with a relatively
-   expensive search in REGION's outer region.  If you are going to
-   remove a number of handlers, using remove_unreachable_eh_regions may
-   be a better option.  */
-
-void
-remove_eh_handler (eh_region region)
-{
-  eh_region *pp, *pp_start, p, outer;
-
-  outer = region->outer;
-  if (outer)
-    pp_start = &outer->inner;
-  else
-    pp_start = &cfun->eh->region_tree;
-  for (pp = pp_start, p = *pp; p != region; pp = &p->next_peer, p = *pp)
-    continue;
-
-  remove_eh_handler_splicer (pp);
-}
-
 /* Worker for remove_unreachable_eh_regions.
    PP is a pointer to the region to start a region tree depth-first
    search from.  R_REACHABLE is the set of regions that have to be
@@ -1847,19 +1824,6 @@ get_eh_landing_pad_from_rtx (const_rtx insn)
   return lp;
 }
 
-/* Return the region to which INSN may go, or NULL if it does not
-   have a reachable region within this function.  */
-
-eh_region
-get_eh_region_from_rtx (const_rtx insn)
-{
-  eh_landing_pad lp;
-  eh_region r;
-
-  get_eh_region_and_lp_from_rtx (insn, &r, &lp);
-  return r;
-}
-
 /* Return true if INSN throws and is caught by something in this function.  */
 
 bool
diff --git a/gcc/except.h b/gcc/except.h
index caa375ef670..a5476644bfb 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -225,7 +225,6 @@ extern void for_each_eh_label (void (*) (rtx));
 extern void init_eh_for_function (void);
 
 extern void remove_eh_landing_pad (eh_landing_pad);
-extern void remove_eh_handler (eh_region);
 extern void remove_unreachable_eh_regions (sbitmap);
 
 extern bool current_function_has_exception_handlers (void);
@@ -278,7 +277,6 @@ extern void add_type_for_runtime (tree);
 extern tree lookup_type_for_runtime (tree);
 extern void assign_filter_values (void);
 
-extern eh_region get_eh_region_from_rtx (const_rtx);
 extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx);
 
 extern void finish_eh_generation (void);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 59cedeafd71..7893152fdb5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -169,22 +169,6 @@ protected_set_expr_location_unshare (tree x, location_t loc)
   return x;
 }
 \f
-/* If ARG2 divides ARG1 with zero remainder, carries out the exact
-   division and returns the quotient.  Otherwise returns
-   NULL_TREE.  */
-
-tree
-div_if_zero_remainder (const_tree arg1, const_tree arg2)
-{
-  widest_int quo;
-
-  if (wi::multiple_of_p (wi::to_widest (arg1), wi::to_widest (arg2),
-			 SIGNED, &quo))
-    return wide_int_to_tree (TREE_TYPE (arg1), quo);
-
-  return NULL_TREE; 
-}
-\f
 /* This is nonzero if we should defer warnings about undefined
    overflow.  This facility exists because these warnings are a
    special case.  The code to estimate loop iterations does not want
@@ -13731,21 +13715,6 @@ fold_binary_to_constant (enum tree_code code, tree type, tree op0, tree op1)
   return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
 }
 
-/* Given the components of a unary expression CODE, TYPE and OP0,
-   attempt to fold the expression to a constant without modifying
-   TYPE or OP0.
-
-   If the expression could be simplified to a constant, then return
-   the constant.  If the expression would not be simplified to a
-   constant, then return NULL_TREE.  */
-
-tree
-fold_unary_to_constant (enum tree_code code, tree type, tree op0)
-{
-  tree tem = fold_unary (code, type, op0);
-  return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
-}
-
 /* If EXP represents referencing an element in a constant string
    (either via pointer arithmetic or array indexing), return the
    tree representing the value accessed, otherwise return NULL.  */
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index ca6d47bba34..bda12d814da 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -94,7 +94,6 @@ extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree);
 #define invert_truthvalue(T)\
    invert_truthvalue_loc (UNKNOWN_LOCATION, T)
 extern tree invert_truthvalue_loc (location_t, tree);
-extern tree fold_unary_to_constant (enum tree_code, tree, tree);
 extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
 extern tree fold_bit_and_mask (tree, tree, enum tree_code,
 			       tree, enum tree_code, tree, tree,
@@ -123,7 +122,6 @@ extern tree build_simple_mem_ref_loc (location_t, tree);
 extern poly_offset_int mem_ref_offset (const_tree);
 extern tree build_invariant_address (tree, tree, poly_int64);
 extern tree constant_boolean_node (bool, tree);
-extern tree div_if_zero_remainder (const_tree, const_tree);
 
 extern bool tree_swap_operands_p (const_tree, const_tree);
 extern enum tree_code swap_tree_comparison (enum tree_code);
diff --git a/gcc/function.c b/gcc/function.c
index 302438323c8..c07049fd1c5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1259,25 +1259,6 @@ struct GTY(()) initial_value_struct {
   initial_value_pair * GTY ((length ("%h.num_entries"))) entries;
 };
 
-/* If a pseudo represents an initial hard reg (or expression), return
-   it, else return NULL_RTX.  */
-
-rtx
-get_hard_reg_initial_reg (rtx reg)
-{
-  struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
-  int i;
-
-  if (ivs == 0)
-    return NULL_RTX;
-
-  for (i = 0; i < ivs->num_entries; i++)
-    if (rtx_equal_p (ivs->entries[i].pseudo, reg))
-      return ivs->entries[i].hard_reg;
-
-  return NULL_RTX;
-}
-
 /* Make sure that there's a pseudo register of mode MODE that stores the
    initial value of hard register REGNO.  Return an rtx for such a pseudo.  */
 
@@ -4683,13 +4664,6 @@ get_next_funcdef_no (void)
   return funcdef_no++;
 }
 
-/* Return value of funcdef.  */
-int
-get_last_funcdef_no (void)
-{
-  return funcdef_no;
-}
-
 /* Allocate a function structure for FNDECL and set its contents
    to the defaults.  Set cfun to the newly-allocated object.
    Some of the helper functions invoked during initialization assume
diff --git a/gcc/function.h b/gcc/function.h
index 7e59050e8a6..7ce2d8c77bc 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -596,7 +596,6 @@ extern void free_temp_slots (void);
 extern void push_temp_slots (void);
 extern void pop_temp_slots (void);
 extern void init_temp_slots (void);
-extern rtx get_hard_reg_initial_reg (rtx);
 extern rtx get_hard_reg_initial_val (machine_mode, unsigned int);
 extern rtx has_hard_reg_initial_val (machine_mode, unsigned int);
 
@@ -629,7 +628,6 @@ extern void push_cfun (struct function *new_cfun);
 extern void pop_cfun (void);
 
 extern int get_next_funcdef_no (void);
-extern int get_last_funcdef_no (void);
 extern void allocate_struct_function (tree, bool);
 extern void push_struct_function (tree fndecl);
 extern void push_dummy_function (bool);
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index f83fc136d04..83f8925f9d3 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -164,37 +164,6 @@ ggc_realloc (void *x, size_t size MEM_STAT_DECL)
   return r;
 }
 
-void *
-ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
-				    size_t n ATTRIBUTE_UNUSED)
-{
-  gcc_assert (c * n == sizeof (struct htab));
-  return ggc_cleared_alloc<htab> ();
-}
-
-/* TODO: once we actually use type information in GGC, create a new tag
-   gt_gcc_ptr_array and use it for pointer arrays.  */
-void *
-ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
-{
-  gcc_assert (sizeof (PTR *) == n);
-  return ggc_cleared_vec_alloc<PTR *> (c);
-}
-
-/* These are for splay_tree_new_ggc.  */
-void *
-ggc_splay_alloc (int sz, void *nl)
-{
-  gcc_assert (!nl);
-  return ggc_internal_alloc (sz);
-}
-
-void
-ggc_splay_dont_free (void * x ATTRIBUTE_UNUSED, void *nl)
-{
-  gcc_assert (!nl);
-}
-
 /* Print statistics that are independent of the collector in use.  */
 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
 		  ? (x) \
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index d07c89bebab..9b8a0b1a375 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -613,47 +613,6 @@ is_gimple_condexpr (tree t)
 				&& is_gimple_val (TREE_OPERAND (t, 1))));
 }
 
-/* Return true if T is a gimple address.  */
-
-bool
-is_gimple_address (const_tree t)
-{
-  tree op;
-
-  if (TREE_CODE (t) != ADDR_EXPR)
-    return false;
-
-  op = TREE_OPERAND (t, 0);
-  while (handled_component_p (op))
-    {
-      if ((TREE_CODE (op) == ARRAY_REF
-	   || TREE_CODE (op) == ARRAY_RANGE_REF)
-	  && !is_gimple_val (TREE_OPERAND (op, 1)))
-	    return false;
-
-      op = TREE_OPERAND (op, 0);
-    }
-
-  if (CONSTANT_CLASS_P (op)
-      || TREE_CODE (op) == TARGET_MEM_REF
-      || TREE_CODE (op) == MEM_REF)
-    return true;
-
-  switch (TREE_CODE (op))
-    {
-    case PARM_DECL:
-    case RESULT_DECL:
-    case LABEL_DECL:
-    case FUNCTION_DECL:
-    case VAR_DECL:
-    case CONST_DECL:
-      return true;
-
-    default:
-      return false;
-    }
-}
-
 /* Return true if T is a gimple invariant address.  */
 
 bool
diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h
index 96733bdd7b4..277b55054ec 100644
--- a/gcc/gimple-expr.h
+++ b/gcc/gimple-expr.h
@@ -41,7 +41,6 @@ extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
 					   tree *);
 extern bool is_gimple_lvalue (tree);
 extern bool is_gimple_condexpr (tree);
-extern bool is_gimple_address (const_tree);
 extern bool is_gimple_invariant_address (const_tree);
 extern bool is_gimple_ip_invariant_address (const_tree);
 extern bool is_gimple_min_invariant (const_tree);
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index c0131f3654c..6b3e83e2630 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -631,20 +631,6 @@ gsi_for_stmt (gimple *stmt, gimple_seq *seq)
   return i;
 }
 
-/* Finds iterator for PHI.  */
-
-gphi_iterator
-gsi_for_phi (gphi *phi)
-{
-  gphi_iterator i;
-  basic_block bb = gimple_bb (phi);
-
-  i = gsi_start_phis (bb);
-  i.ptr = phi;
-
-  return i;
-}
-
 /* Move the statement at FROM so it comes right after the statement at TO.  */
 
 void
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index e23d4b2c47c..7b7881492f8 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -80,7 +80,6 @@ extern void gsi_insert_after (gimple_stmt_iterator *, gimple *,
 extern bool gsi_remove (gimple_stmt_iterator *, bool);
 extern gimple_stmt_iterator gsi_for_stmt (gimple *);
 extern gimple_stmt_iterator gsi_for_stmt (gimple *, gimple_seq *);
-extern gphi_iterator gsi_for_phi (gphi *);
 extern void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
 extern void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
 extern void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 471bfc45eb8..bd8a2ca21e3 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -228,45 +228,8 @@ struct format_result
      avoid issuing duplicate warnings while finishing the processing
      of a call.  WARNED also disables the return value optimization.  */
   bool warned;
-
-  /* Preincrement the number of output characters by 1.  */
-  format_result& operator++ ()
-  {
-    return *this += 1;
-  }
-
-  /* Postincrement the number of output characters by 1.  */
-  format_result operator++ (int)
-  {
-    format_result prev (*this);
-    *this += 1;
-    return prev;
-  }
-
-  /* Increment the number of output characters by N.  */
-  format_result& operator+= (unsigned HOST_WIDE_INT);
 };
 
-format_result&
-format_result::operator+= (unsigned HOST_WIDE_INT n)
-{
-  gcc_assert (n < HOST_WIDE_INT_MAX);
-
-  if (range.min < HOST_WIDE_INT_MAX)
-    range.min += n;
-
-  if (range.max < HOST_WIDE_INT_MAX)
-    range.max += n;
-
-  if (range.likely < HOST_WIDE_INT_MAX)
-    range.likely += n;
-
-  if (range.unlikely < HOST_WIDE_INT_MAX)
-    range.unlikely += n;
-
-  return *this;
-}
-
 /* Return the value of INT_MIN for the target.  */
 
 static inline HOST_WIDE_INT
@@ -727,14 +690,6 @@ struct directive
       |= (1U << (c % (CHAR_BIT * sizeof *flags)));
   }
 
-  /* Reset the format flag CHR.  */
-  void clear_flag (char chr)
-  {
-    unsigned char c = chr & 0xff;
-    flags[c / (CHAR_BIT * sizeof *flags)]
-      &= ~(1U << (c % (CHAR_BIT * sizeof *flags)));
-  }
-
   /* Set both bounds of the width range to VAL.  */
   void set_width (HOST_WIDE_INT val)
   {
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index d1b1de4a2d5..d75d4a150c3 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -125,7 +125,6 @@ struct alloca_type_and_limit {
   // integer_zero_node if unknown.  For any other alloca types, this
   // field is undefined.
   wide_int limit;
-  alloca_type_and_limit ();
   alloca_type_and_limit (enum alloca_type type,
 			 wide_int i) : type(type), limit(i) { }
   alloca_type_and_limit (enum alloca_type type) : type(type)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index e3e651b1e61..a1e6d2c6810 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2528,15 +2528,6 @@ gimple_signed_or_unsigned_type (bool unsignedp, tree type)
 }
 
 
-/* Return an unsigned type the same as TYPE in other respects.  */
-
-tree
-gimple_unsigned_type (tree type)
-{
-  return gimple_signed_or_unsigned_type (true, type);
-}
-
-
 /* Return a signed type the same as TYPE in other respects.  */
 
 tree
@@ -2647,19 +2638,6 @@ gimple_builtin_call_types_compatible_p (const gimple *stmt, tree fndecl)
   return true;
 }
 
-/* Return true when STMT is builtins call.  */
-
-bool
-gimple_call_builtin_p (const gimple *stmt)
-{
-  tree fndecl;
-  if (is_gimple_call (stmt)
-      && (fndecl = gimple_call_fndecl (stmt)) != NULL_TREE
-      && DECL_BUILT_IN_CLASS (fndecl) != NOT_BUILT_IN)
-    return gimple_builtin_call_types_compatible_p (stmt, fndecl);
-  return false;
-}
-
 /* Return true when STMT is builtins call to CLASS.  */
 
 bool
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a5dda9369bc..6d4cc0f2adf 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1509,13 +1509,11 @@ unsigned get_gimple_rhs_num_ops (enum tree_code);
 extern tree canonicalize_cond_expr_cond (tree);
 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
 extern bool gimple_compare_field_offset (tree, tree);
-extern tree gimple_unsigned_type (tree);
 extern tree gimple_signed_type (tree);
 extern alias_set_type gimple_get_alias_set (tree);
 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
 extern combined_fn gimple_call_combined_fn (const gimple *);
-extern bool gimple_call_builtin_p (const gimple *);
 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
 extern bool gimple_asm_clobbers_memory_p (const gasm *);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 509fc2f3f5b..59531d35f35 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -332,14 +332,6 @@ gimple_pop_bind_expr (void)
   gimplify_ctxp->bind_expr_stack.pop ();
 }
 
-/* Return the first element of the stack of bindings.  */
-
-gbind *
-gimple_current_bind_expr (void)
-{
-  return gimplify_ctxp->bind_expr_stack.last ();
-}
-
 /* Return the stack of bindings created during gimplification.  */
 
 vec<gbind *>
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index 62ca869083a..14abc94d9af 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -53,7 +53,6 @@ extern void free_gimplify_stack (void);
 extern void push_gimplify_context (bool in_ssa = false,
 				   bool rhs_cond_ok = false);
 extern void pop_gimplify_context (gimple *);
-extern gbind *gimple_current_bind_expr (void);
 extern vec<gbind *> gimple_bind_expr_stack (void);
 extern void gimplify_and_add (tree, gimple_seq *);
 extern tree get_formal_tmp_var (tree, gimple_seq *);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1fdc9df9fb2..f154fe092e8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -574,7 +574,7 @@ haifa_classify_insn (const_rtx insn)
    MAX_STAGES provides us with a limit
    after which we give up scheduling; the caller must have unrolled at least
    as many copies of the loop body and recorded delay_pairs for them.
-   
+
    INSNS is the number of real (non-debug) insns in one iteration of
    the loop.  MAX_UID can be used to test whether an insn belongs to
    the first iteration of the loop; all of them have a uid lower than
diff --git a/gcc/hsa-common.c b/gcc/hsa-common.c
index 0e18fa74a2c..52712dde5f2 100644
--- a/gcc/hsa-common.c
+++ b/gcc/hsa-common.c
@@ -716,27 +716,6 @@ hsa_free_decl_kernel_mapping (void)
   ggc_free (hsa_decl_kernel_mapping);
 }
 
-/* Add new kernel dependency.  */
-
-void
-hsa_add_kernel_dependency (tree caller, const char *called_function)
-{
-  if (hsa_decl_kernel_dependencies == NULL)
-    hsa_decl_kernel_dependencies = new hash_map<tree, vec<const char *> *> ();
-
-  vec <const char *> *s = NULL;
-  vec <const char *> **slot = hsa_decl_kernel_dependencies->get (caller);
-  if (slot == NULL)
-    {
-      s = new vec <const char *> ();
-      hsa_decl_kernel_dependencies->put (caller, s);
-    }
-  else
-    s = *slot;
-
-  s->safe_push (called_function);
-}
-
 /* Expansion to HSA needs a few gc roots to hold types, constructors etc.  In
    order to minimize the number of GTY roots, we'll root them all in the
    following array.  The individual elements should only be accessed by the
@@ -772,22 +751,6 @@ hsa_sanitize_name (char *p)
       *p = '_';
 }
 
-/* Clone the name P, set trailing ampersand and sanitize the name.  */
-
-char *
-hsa_brig_function_name (const char *p)
-{
-  unsigned len = strlen (p);
-  char *buf = XNEWVEC (char, len + 2);
-
-  buf[0] = '&';
-  buf[len + 1] = '\0';
-  memcpy (buf + 1, p, len);
-
-  hsa_sanitize_name (buf);
-  return buf;
-}
-
 /* Add a flatten attribute and disable vectorization for gpu implementation
    function decl GDECL.  */
 
diff --git a/gcc/hsa-common.h b/gcc/hsa-common.h
index c72343fbdab..7bfc14c8c7e 100644
--- a/gcc/hsa-common.h
+++ b/gcc/hsa-common.h
@@ -1356,9 +1356,7 @@ void hsa_free_decl_kernel_mapping (void);
 tree *hsa_get_ctor_statements (void);
 tree *hsa_get_dtor_statements (void);
 tree *hsa_get_kernel_dispatch_type (void);
-void hsa_add_kernel_dependency (tree caller, const char *called_function);
 void hsa_sanitize_name (char *p);
-char *hsa_brig_function_name (const char *p);
 const char *hsa_get_declaration_name (tree decl);
 void hsa_register_kernel (cgraph_node *host);
 void hsa_register_kernel (cgraph_node *gpu, cgraph_node *host);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 27ae8e0fe27..bf4814c7aba 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -313,7 +313,6 @@ public:
   inline bool top_p () const;
   inline bool set_to_bottom ();
   bool meet_with (const value_range *p_vr);
-  bool meet_with (const ipcp_vr_lattice &other);
   void init () { m_vr.type = VR_UNDEFINED; }
   void print (FILE * f);
 
@@ -899,12 +898,6 @@ set_agg_lats_contain_variable (struct ipcp_param_lattices *plats)
   return ret;
 }
 
-bool
-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
    lattice.  */
 
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 9564d651b2b..71a5be99bde 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2818,27 +2818,6 @@ vtable_pointer_value_to_vtable (const_tree t, tree *v,
   return true;
 }
 
-/* T is known constant value of virtual table pointer.  Return BINFO of the
-   instance type.  */
-
-tree
-vtable_pointer_value_to_binfo (const_tree t)
-{
-  tree vtable;
-  unsigned HOST_WIDE_INT offset;
-
-  if (!vtable_pointer_value_to_vtable (t, &vtable, &offset))
-    return NULL_TREE;
-
-  /* FIXME: for stores of construction vtables we return NULL,
-     because we do not have BINFO for those. Eventually we should fix
-     our representation to allow this case to be handled, too.
-     In the case we see store of BINFO we however may assume
-     that standard folding will be able to cope with it.  */
-  return subbinfo_with_vtable_at_offset (TYPE_BINFO (DECL_CONTEXT (vtable)),
-					 offset, vtable);
-}
-
 /* Walk bases of OUTER_TYPE that contain OTR_TYPE at OFFSET.
    Look up their respective virtual methods for OTR_TOKEN and OTR_TYPE
    and insert them in NODES.
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index ba39ea36574..d8d551d64ae 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -855,14 +855,6 @@ func_checker::compare_gimple_cond (gimple *s1, gimple *s2)
   return compare_operand (t1, t2);
 }
 
-/* Verifies that tree labels T1 and T2 correspond in FUNC1 and FUNC2.  */
-
-bool
-func_checker::compare_tree_ssa_label (tree t1, tree t2)
-{
-  return compare_operand (t1, t2);
-}
-
 /* Verifies for given GIMPLE_LABEL stmts S1 and S2 that
    label statements are semantically equivalent.  */
 
diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h
index 65dfe69deeb..66c36380d26 100644
--- a/gcc/ipa-icf-gimple.h
+++ b/gcc/ipa-icf-gimple.h
@@ -200,9 +200,6 @@ public:
   /* Verification function for declaration trees T1 and T2.  */
   bool compare_decl (tree t1, tree t2);
 
-  /* Verifies that tree labels T1 and T2 correspond.  */
-  bool compare_tree_ssa_label (tree t1, tree t2);
-
   /* Function compare for equality given memory operands T1 and T2.  */
   bool compare_memory_operand (tree t1, tree t2);
 
@@ -219,10 +216,6 @@ public:
      and compare both TREE_PURPOSEs and TREE_VALUEs.  */
   bool compare_asm_inputs_outputs (tree t1, tree t2);
 
-  /* Verifies that trees T1 and T2, representing function declarations
-     are equivalent from perspective of ICF.  */
-  bool compare_function_decl (tree t1, tree t2);
-
   /* Verifies that trees T1 and T2 do correspond.  */
   bool compare_variable_decl (tree t1, tree t2);
 
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 3c54f8d4b6d..59adb9459a7 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -137,12 +137,6 @@ sem_usage_pair::sem_usage_pair (sem_item *_item, unsigned int _index)
 {
 }
 
-sem_item::sem_item (sem_item_type _type, bitmap_obstack *stack)
-: type (_type), m_hash (-1), m_hash_set (false)
-{
-  setup (stack);
-}
-
 sem_item::sem_item (sem_item_type _type, symtab_node *_node,
 		    bitmap_obstack *stack)
 : type (_type), node (_node), m_hash (-1), m_hash_set (false)
@@ -229,15 +223,6 @@ void sem_item::set_hash (hashval_t hash)
 
 hash_map<const_tree, hashval_t> sem_item::m_type_hash_cache;
 
-/* Semantic function constructor that uses STACK as bitmap memory stack.  */
-
-sem_function::sem_function (bitmap_obstack *stack)
-: sem_item (FUNC, stack), m_checker (NULL), m_compared_func (NULL)
-{
-  bb_sizes.create (0);
-  bb_sorted.create (0);
-}
-
 sem_function::sem_function (cgraph_node *node, bitmap_obstack *stack)
 : sem_item (FUNC, node, stack), m_checker (NULL), m_compared_func (NULL)
 {
@@ -1791,17 +1776,6 @@ sem_function::compare_phi_node (basic_block bb1, basic_block bb2)
   return true;
 }
 
-/* Returns true if tree T can be compared as a handled component.  */
-
-bool
-sem_function::icf_handled_component_p (tree t)
-{
-  tree_code tc = TREE_CODE (t);
-
-  return (handled_component_p (t)
-	  || tc == ADDR_EXPR || tc == MEM_REF || tc == OBJ_TYPE_REF);
-}
-
 /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB
    corresponds to TARGET.  */
 
@@ -1823,10 +1797,6 @@ sem_function::bb_dict_test (vec<int> *bb_dict, int source, int target)
     return (*bb_dict)[source] == target;
 }
 
-sem_variable::sem_variable (bitmap_obstack *stack): sem_item (VAR, stack)
-{
-}
-
 sem_variable::sem_variable (varpool_node *node, bitmap_obstack *stack)
 : sem_item (VAR, node, stack)
 {
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index a64b3852efb..305b23befc4 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -148,10 +148,6 @@ typedef std::pair<symtab_node *, symtab_node *> symtab_pair;
 class sem_item
 {
 public:
-  /* Semantic item constructor for a node of _TYPE, where STACK is used
-     for bitmap memory allocation.  */
-  sem_item (sem_item_type _type, bitmap_obstack *stack);
-
   /* Semantic item constructor for a node of _TYPE, where STACK is used
      for bitmap memory allocation.  The item is based on symtab node _NODE.  */
   sem_item (sem_item_type _type, symtab_node *_node, bitmap_obstack *stack);
@@ -200,10 +196,6 @@ public:
   void update_hash_by_local_refs (hash_map <symtab_node *,
 				  sem_item *> &m_symtab_node_map);
 
-  /* Return base tree that can be used for compatible_types_p and
-     contains_polymorphic_type_p comparison.  */
-  static bool get_base_types (tree *t1, tree *t2);
-
   /* Return true if target supports alias symbols.  */
   bool target_supports_symbol_aliases_p (void);
 
@@ -289,9 +281,6 @@ private:
 class sem_function: public sem_item
 {
 public:
-  /* Semantic function constructor that uses STACK as bitmap memory stack.  */
-  sem_function (bitmap_obstack *stack);
-
   /*  Constructor based on callgraph node _NODE.
       Bitmap STACK is used for memory allocation.  */
   sem_function (cgraph_node *_node, bitmap_obstack *stack);
@@ -384,9 +373,6 @@ private:
   /* Processes function equality comparison.  */
   bool equals_private (sem_item *item);
 
-  /* Returns true if tree T can be compared as a handled component.  */
-  static bool icf_handled_component_p (tree t);
-
   /* Function checker stores binding between functions.   */
   ipa_icf_gimple::func_checker *m_checker;
 
@@ -397,9 +383,6 @@ private:
 class sem_variable: public sem_item
 {
 public:
-  /* Semantic variable constructor that uses STACK as bitmap memory stack.  */
-  sem_variable (bitmap_obstack *stack);
-
   /*  Constructor based on callgraph node _NODE.
       Bitmap STACK is used for memory allocation.  */
 
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 1e3a92a125f..9a631c093ff 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -478,112 +478,6 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
   while (gsi_stmt (gsi) != gsi_stmt (prev_gsi));
 }
 
-/* Return true iff BASE_INDEX is in ADJUSTMENTS more than once.  */
-
-static bool
-index_in_adjustments_multiple_times_p (int base_index,
-				       ipa_parm_adjustment_vec adjustments)
-{
-  int i, len = adjustments.length ();
-  bool one = false;
-
-  for (i = 0; i < len; i++)
-    {
-      struct ipa_parm_adjustment *adj;
-      adj = &adjustments[i];
-
-      if (adj->base_index == base_index)
-	{
-	  if (one)
-	    return true;
-	  else
-	    one = true;
-	}
-    }
-  return false;
-}
-
-/* Return adjustments that should have the same effect on function parameters
-   and call arguments as if they were first changed according to adjustments in
-   INNER and then by adjustments in OUTER.  */
-
-ipa_parm_adjustment_vec
-ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
-			 ipa_parm_adjustment_vec outer)
-{
-  int i, outlen = outer.length ();
-  int inlen = inner.length ();
-  int removals = 0;
-  ipa_parm_adjustment_vec adjustments, tmp;
-
-  tmp.create (inlen);
-  for (i = 0; i < inlen; i++)
-    {
-      struct ipa_parm_adjustment *n;
-      n = &inner[i];
-
-      if (n->op == IPA_PARM_OP_REMOVE)
-	removals++;
-      else
-	{
-	  /* FIXME: Handling of new arguments are not implemented yet.  */
-	  gcc_assert (n->op != IPA_PARM_OP_NEW);
-	  tmp.quick_push (*n);
-	}
-    }
-
-  adjustments.create (outlen + removals);
-  for (i = 0; i < outlen; i++)
-    {
-      struct ipa_parm_adjustment r;
-      struct ipa_parm_adjustment *out = &outer[i];
-      struct ipa_parm_adjustment *in = &tmp[out->base_index];
-
-      memset (&r, 0, sizeof (r));
-      gcc_assert (in->op != IPA_PARM_OP_REMOVE);
-      if (out->op == IPA_PARM_OP_REMOVE)
-	{
-	  if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
-	    {
-	      r.op = IPA_PARM_OP_REMOVE;
-	      adjustments.quick_push (r);
-	    }
-	  continue;
-	}
-      else
-	{
-	  /* FIXME: Handling of new arguments are not implemented yet.  */
-	  gcc_assert (out->op != IPA_PARM_OP_NEW);
-	}
-
-      r.base_index = in->base_index;
-      r.type = out->type;
-
-      /* FIXME:  Create nonlocal value too.  */
-
-      if (in->op == IPA_PARM_OP_COPY && out->op == IPA_PARM_OP_COPY)
-	r.op = IPA_PARM_OP_COPY;
-      else if (in->op == IPA_PARM_OP_COPY)
-	r.offset = out->offset;
-      else if (out->op == IPA_PARM_OP_COPY)
-	r.offset = in->offset;
-      else
-	r.offset = in->offset + out->offset;
-      adjustments.quick_push (r);
-    }
-
-  for (i = 0; i < inlen; i++)
-    {
-      struct ipa_parm_adjustment *n = &inner[i];
-
-      if (n->op == IPA_PARM_OP_REMOVE)
-	adjustments.quick_push (*n);
-    }
-
-  tmp.release ();
-  return adjustments;
-}
-
 /* If T is an SSA_NAME, return NULL if it is not a default def or
    return its base variable if it is.  If IGNORE_DEFAULT_DEF is true,
    the base variable is always returned, regardless if it is a default
diff --git a/gcc/ipa-param-manipulation.h b/gcc/ipa-param-manipulation.h
index 84bc42d5196..51c4a84ddb6 100644
--- a/gcc/ipa-param-manipulation.h
+++ b/gcc/ipa-param-manipulation.h
@@ -108,8 +108,6 @@ vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
 void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
 void ipa_modify_call_arguments (struct cgraph_edge *, gcall *,
 				ipa_parm_adjustment_vec);
-ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
-						 ipa_parm_adjustment_vec);
 void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
 
 bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 55e10cf0f27..450720db1c8 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -680,8 +680,6 @@ extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum
 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
 
 /* Creating and freeing ipa_node_params and ipa_edge_args.  */
-void ipa_create_all_node_params (void);
-void ipa_create_all_edge_args (void);
 void ipa_check_create_edge_args (void);
 void ipa_free_all_node_params (void);
 void ipa_free_all_edge_args (void);
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 4e22d85ac03..69fdf933aec 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -72,14 +72,6 @@ typedef struct ipa_ref *ipa_ref_ptr;
 struct GTY(()) ipa_ref_list
 {
 public:
-  /* Return first reference in list or NULL if empty.  */
-  struct ipa_ref *first_reference (void)
-  {
-    if (!vec_safe_length (references))
-      return NULL;
-    return &(*references)[0];
-  }
-
   /* Return first referring ref in list or NULL if empty.  */
   struct ipa_ref *first_referring (void)
   {
@@ -108,12 +100,6 @@ public:
     return i == 0 ? NULL : referring[i - 1];
   }
 
-  /* Return true if the symbol has an alias.  */
-  bool inline has_aliases_p (void)
-  {
-    return first_alias ();
-  }
-
   /* Clear reference list.  */
   void clear (void)
   {
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index 98f2a75cd81..75f39bf00ed 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -74,7 +74,6 @@ bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT,
 tree polymorphic_ctor_dtor_p (tree, bool);
 tree inlined_polymorphic_ctor_dtor_block_p (tree, bool);
 bool decl_maybe_in_construction_p (tree, tree, gimple *, tree);
-tree vtable_pointer_value_to_binfo (const_tree);
 bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT *);
 tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree);
 void compare_virtual_tables (varpool_node *, varpool_node *);
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index f4d340ff5a3..b8018bad4c7 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -375,18 +375,6 @@ lto_new_in_decl_state (void)
   return ggc_cleared_alloc<lto_in_decl_state> ();
 }
 
-/* Delete STATE and its components. */
-
-void
-lto_delete_in_decl_state (struct lto_in_decl_state *state)
-{
-  int i;
-
-  for (i = 0; i < LTO_N_DECL_STREAMS; i++)
-    vec_free (state->streams[i]);
-  ggc_free (state);
-}
-
 /* Search the in-decl state of a function FUNC contained in the file
    associated with FILE_DATA.  Return NULL if not found.  */
 
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 4ddcc8f7ddd..d0c32fa8e98 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -81,19 +81,6 @@ lto_tag_check_set (enum LTO_tags actual, int ntags, ...)
 }
 
 
-/* Read LENGTH bytes from STREAM to ADDR.  */
-
-void
-lto_input_data_block (struct lto_input_block *ib, void *addr, size_t length)
-{
-  size_t i;
-  unsigned char *const buffer = (unsigned char *) addr;
-
-  for (i = 0; i < length; i++)
-    buffer[i] = streamer_read_uchar (ib);
-}
-
-
 /* Lookup STRING in file_name_hash_table.  If found, return the existing
    string, otherwise insert STRING as the canonical version.  */
 
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index f51d6657461..93b207a97d8 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -273,16 +273,6 @@ lto_streamer_init (void)
 }
 
 
-/* Gate function for all LTO streaming passes.  */
-
-bool
-gate_lto_out (void)
-{
-  return ((flag_generate_lto || flag_generate_offload || in_lto_p)
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !seen_error ());
-}
-
 /* Check that the version MAJOR.MINOR is the correct version number.  */
 
 void
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index dd279f6762b..95fcb30b0ae 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -772,7 +772,6 @@ extern void lto_record_renamed_decl (struct lto_file_decl_data *,
 extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *,
 					      const char *);
 extern struct lto_in_decl_state *lto_new_in_decl_state (void);
-extern void lto_delete_in_decl_state (struct lto_in_decl_state *);
 extern struct lto_in_decl_state *lto_get_function_in_decl_state (
 				      struct lto_file_decl_data *, tree);
 extern void lto_free_function_in_decl_state (struct lto_in_decl_state *);
@@ -827,7 +826,6 @@ extern void lto_bitmap_free (bitmap);
 extern char *lto_get_section_name (int, const char *, struct lto_file_decl_data *);
 extern void print_lto_report (const char *);
 extern void lto_streamer_init (void);
-extern bool gate_lto_out (void);
 extern void lto_check_version (int, int, const char *);
 extern void lto_streamer_hooks_init (void);
 
@@ -848,7 +846,6 @@ extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
 				    const char *, unsigned,
 				    vec<ld_plugin_symbol_resolution_t> );
 extern void lto_data_in_delete (struct data_in *);
-extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
 void lto_input_location (location_t *, struct bitpack_d *, struct data_in *);
 location_t stream_input_location_now (struct bitpack_d *bp,
 				      struct data_in *data);
diff --git a/gcc/predict.c b/gcc/predict.c
index ab2dc8ed031..14577a21683 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -516,13 +516,6 @@ edge_predicted_by_p (edge e, enum br_predictor predictor, bool taken)
   return false;
 }
 
-/* Same predicate as above, working on edges.  */
-bool
-edge_probability_reliable_p (const_edge e)
-{
-  return e->probability.probably_reliable_p ();
-}
-
 /* Same predicate as edge_probability_reliable_p, working on notes.  */
 bool
 br_prob_note_reliable_p (const_rtx note)
diff --git a/gcc/predict.h b/gcc/predict.h
index e4d1da090ca..7a3c370e460 100644
--- a/gcc/predict.h
+++ b/gcc/predict.h
@@ -78,7 +78,6 @@ extern void rtl_profile_for_edge (edge);
 extern void default_rtl_profile (void);
 extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
 extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor);
-extern bool edge_probability_reliable_p (const_edge);
 extern bool br_prob_note_reliable_p (const_rtx);
 extern void predict_insn_def (rtx_insn *, enum br_predictor, enum prediction);
 extern void rtl_predict_edge (edge, enum br_predictor, int);
diff --git a/gcc/read-md.c b/gcc/read-md.c
index 174e471a8db..84b68f8a8be 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -531,22 +531,6 @@ md_reader::read_name (struct md_name *name)
   return loc;
 }
 
-file_location
-md_reader::read_name_or_nil (struct md_name *name)
-{
-  file_location loc;
-  if (!read_name_1 (name, &loc))
-    {
-      file_location loc = get_current_location ();
-      read_skip_construct (0, loc);
-      /* Skip the ')'.  */
-      read_char ();
-      name->buffer[0] = 0;
-      name->string = name->buffer;
-    }
-  return loc;
-}
-
 /* Subroutine of the string readers.  Handles backslash escapes.
    Caller has read the backslash, but not placed it into the obstack.  */
 
diff --git a/gcc/read-md.h b/gcc/read-md.h
index 56d54314f11..c788ac676c6 100644
--- a/gcc/read-md.h
+++ b/gcc/read-md.h
@@ -171,7 +171,6 @@ class md_reader
   int read_char (void);
   void unread_char (int ch);
   file_location read_name (struct md_name *name);
-  file_location read_name_or_nil (struct md_name *);
   void read_escape ();
   char *read_quoted_string ();
   char *read_braced_string ();
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 68d3ceab29f..58cb6b4dedb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3199,7 +3199,6 @@ extern rtx convert_memory_address_addr_space (scalar_int_mode, rtx,
 	convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
 extern const char *get_insn_name (int);
 extern rtx_insn *get_last_insn_anywhere (void);
-extern rtx_insn *get_first_nonnote_insn (void);
 extern rtx_insn *get_last_nonnote_insn (void);
 extern void start_sequence (void);
 extern void push_to_sequence (rtx_insn *);
@@ -3232,16 +3231,9 @@ extern rtx_insn *emit_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
 extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx_insn *);
-extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
-extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *,
-						    location_t);
-extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx_insn *, location_t);
-extern rtx_barrier *emit_barrier_before (rtx_insn *);
 extern rtx_code_label *emit_label_before (rtx_code_label *, rtx_insn *);
 extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
 extern rtx_insn *emit_insn_after (rtx, rtx_insn *);
@@ -3251,8 +3243,6 @@ extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_call_insn_after (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_debug_insn_after (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx_insn *, location_t);
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 98f3ceea872..4c5a89eaa61 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -93,11 +93,6 @@ extern bool set_src_pwd		       (const char *);
 extern HOST_WIDE_INT get_random_seed (bool);
 extern void set_random_seed (const char *);
 
-extern unsigned int min_align_loops_log;
-extern unsigned int min_align_jumps_log;
-extern unsigned int min_align_labels_log;
-extern unsigned int min_align_functions_log;
-
 extern void parse_alignment_opts (void);
 
 extern void initialize_rtl (void);
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 29caab71154..64f21419726 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -184,10 +184,6 @@ struct eni_weights
   bool time_based;
 };
 
-/* Weights that estimate_num_insns uses for heuristics in inlining.  */
-
-extern eni_weights eni_inlining_weights;
-
 /* Weights that estimate_num_insns uses to estimate the size of the
    produced code.  */
 
-- 
2.19.0


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

* Re: [PATCH] Remove dead functions and fix VMS target by moving back some functions.
  2018-10-09  8:52                       ` [PATCH] Remove dead functions and fix VMS target by moving back some functions Martin Liška
@ 2018-10-09 22:53                         ` Martin Jambor
  2018-10-10 11:13                           ` Martin Liška
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Jambor @ 2018-10-09 22:53 UTC (permalink / raw)
  To: Martin Liška, Bernhard Reutner-Fischer, Jeff Law
  Cc: Richard Guenther, GCC Patches

On Tue, Oct 09 2018, Martin Liška wrote:
> Hi.
>
> Utilizing rtags' --find-dead-functions I'm suggesting a removal of part
> of the functions reported with the script. I built all cross compilers
> defined in contrib/config-list.mk and I fixed VMS targets that I broke
> in previous removal.
>
> If the folks are happy with the removal, I can probably continue with that
> at some point in stage3 or so.
>
> Ready for trunk?
> Thanks,
> Martin
> From f69d866da42a46783ab57181692583d2ecf30c49 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Fri, 5 Oct 2018 16:59:07 +0200
> Subject: [PATCH] Remove dead functions and fix VMS target by moving back some
>  functions.
>
> gcc/ChangeLog:
>
> 2018-10-09  Martin Liska  <mliska@suse.cz>
>
> 	* attribs.c (register_attribute): Remove unused functions.
> 	* cfganal.c (control_dependences::clear_control_dependence_bitmap): Likewise.
> 	(bitmap_union_of_succs): Likewise.
> 	* cfganal.h (bitmap_union_of_succs): Likewise.
> 	* cfgloop.c (loop_exits_to_bb_p): Likewise.
> 	* cfgloop.h (loop_exits_to_bb_p): Likewise.
> 	* cgraph.h (compute_call_stmt_bb_frequency): Likewise.
> 	* cgraphbuild.c (compute_call_stmt_bb_frequency): Likewise.
> 	* cselib.c (cselib_dummy_expand_value_rtx_cb): Likewise.
> 	* cselib.h (cselib_dummy_expand_value_rtx_cb): Likewise.
> 	* df-core.c (df_reg_defined): Likewise.
> 	(df_reg_used): Likewise.
> 	* df-scan.c (df_hard_reg_used_count): Likewise.
> 	* df.h (df_reg_defined): Likewise.
> 	(df_reg_used): Likewise.
> 	(df_hard_reg_used_count): Likewise.
> 	* dojump.c (init_pending_stack_adjust): Likewise.
> 	* dojump.h (init_pending_stack_adjust): Likewise.
> 	* dwarf2out.c (add_AT_vms_delta): Move function back after
> 	removal.
> 	(dwarf2out_set_demangle_name_func): REmove unused functions.
> 	* dwarf2out.h (dwarf2out_set_demangle_name_func): Likewise.
> 	* emit-rtl.c (emit_jump_insn_before_noloc): Likewise.
> 	(emit_call_insn_before_noloc): Likewise.
> 	(emit_barrier_before): Likewise.
> 	(emit_call_insn_after_noloc): Likewise.
> 	(emit_call_insn_after_setloc): Likewise.
> 	(emit_jump_insn_before_setloc): Likewise.
> 	(emit_call_insn_before_setloc): Likewise.
> 	(emit_call_insn_before): Likewise.
> 	* except.c (remove_eh_handler): Likewise.
> 	(get_eh_region_from_rtx): Likewise.
> 	* except.h (remove_eh_handler): Likewise.
> 	(get_eh_region_from_rtx): Likewise.
> 	* fold-const.c (div_if_zero_remainder): Likewise.
> 	(fold_unary_to_constant): Likewise.
> 	* fold-const.h (fold_unary_to_constant): Likewise.
> 	(div_if_zero_remainder): Likewise.
> 	* function.c (get_hard_reg_initial_reg): Likewise.
> 	(get_last_funcdef_no): Likewise.
> 	* function.h (get_hard_reg_initial_reg): Likewise.
> 	(get_last_funcdef_no): Likewise.
> 	* ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Likewise.
> 	(ggc_cleared_alloc_ptr_array_two_args): Likewise.
> 	(ggc_splay_alloc): Likewise.
> 	(ggc_splay_dont_free): Likewise.
> 	* gimple-expr.c (is_gimple_address): Likewise.
> 	* gimple-expr.h (is_gimple_address): Likewise.
> 	* gimple-iterator.c (gsi_for_phi): Likewise.
> 	* gimple-iterator.h (gsi_for_phi): Likewise.
> 	* gimple-ssa-sprintf.c (struct format_result): Likewise.
> 	(format_result::operator+=): Likewise.
> 	(struct directive): Likewise.
> 	* gimple-ssa-warn-alloca.c (struct alloca_type_and_limit): Likewise.
> 	* gimple.c (gimple_unsigned_type): Likewise.
> 	(gimple_call_builtin_p): Likewise.
> 	* gimple.h (gimple_unsigned_type): Likewise.
> 	(gimple_call_builtin_p): Likewise.
> 	* gimplify.c (gimple_current_bind_expr): Likewise.
> 	* gimplify.h (gimple_current_bind_expr): Likewise.
> 	* haifa-sched.c (haifa_classify_insn): Likewise.
> 	* hsa-common.c (hsa_add_kernel_dependency): Likewise.
> 	(hsa_brig_function_name): Likewise.
> 	* hsa-common.h (hsa_add_kernel_dependency): Likewise.
> 	(hsa_brig_function_name): Likewise.
> 	* ipa-cp.c (ipcp_vr_lattice::meet_with): Likewise.

Interesting, I believe that a class representing a lattice should have a
meet function with its own type.  In this case it would mean moving the
call to ipa_vr_operation_and_type_effects from the caller into the
method to clearly describe the semantics.  But perhaps it does not
matter if we do not have the overload in the meantime.

> 	* ipa-devirt.c (vtable_pointer_value_to_binfo): Likewise.
> 	* ipa-icf-gimple.c (func_checker::compare_tree_ssa_label): Likewise.
> 	* ipa-icf-gimple.h: Likewise.
> 	* ipa-icf.c (sem_item::sem_item): Likewise.
> 	(sem_function::sem_function): Likewise.
> 	(sem_function::icf_handled_component_p): Likewise.
> 	(sem_variable::sem_variable): Likewise.
> 	* ipa-icf.h: Likewise.
> 	* ipa-param-manipulation.c (index_in_adjustments_multiple_times_p): Likewise.
> 	(ipa_combine_adjustments): Likewise.

This a known case.  I mean, also have a patch removing, actually
replacing it, but the goal has always been that we eventually combine
adjustments.

Martin


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

* Re: [PATCH] Remove dead functions and fix VMS target by moving back some functions.
  2018-10-09 22:53                         ` Martin Jambor
@ 2018-10-10 11:13                           ` Martin Liška
  2018-10-10 11:17                             ` Martin Jambor
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-10-10 11:13 UTC (permalink / raw)
  To: Martin Jambor, Bernhard Reutner-Fischer, Jeff Law
  Cc: Richard Guenther, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 5394 bytes --]

On 10/9/18 10:34 PM, Martin Jambor wrote:
> On Tue, Oct 09 2018, Martin Liška wrote:
>> Hi.
>>
>> Utilizing rtags' --find-dead-functions I'm suggesting a removal of part
>> of the functions reported with the script. I built all cross compilers
>> defined in contrib/config-list.mk and I fixed VMS targets that I broke
>> in previous removal.
>>
>> If the folks are happy with the removal, I can probably continue with that
>> at some point in stage3 or so.
>>
>> Ready for trunk?
>> Thanks,
>> Martin
>> From f69d866da42a46783ab57181692583d2ecf30c49 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Fri, 5 Oct 2018 16:59:07 +0200
>> Subject: [PATCH] Remove dead functions and fix VMS target by moving back some
>>  functions.
>>
>> gcc/ChangeLog:
>>
>> 2018-10-09  Martin Liska  <mliska@suse.cz>
>>
>> 	* attribs.c (register_attribute): Remove unused functions.
>> 	* cfganal.c (control_dependences::clear_control_dependence_bitmap): Likewise.
>> 	(bitmap_union_of_succs): Likewise.
>> 	* cfganal.h (bitmap_union_of_succs): Likewise.
>> 	* cfgloop.c (loop_exits_to_bb_p): Likewise.
>> 	* cfgloop.h (loop_exits_to_bb_p): Likewise.
>> 	* cgraph.h (compute_call_stmt_bb_frequency): Likewise.
>> 	* cgraphbuild.c (compute_call_stmt_bb_frequency): Likewise.
>> 	* cselib.c (cselib_dummy_expand_value_rtx_cb): Likewise.
>> 	* cselib.h (cselib_dummy_expand_value_rtx_cb): Likewise.
>> 	* df-core.c (df_reg_defined): Likewise.
>> 	(df_reg_used): Likewise.
>> 	* df-scan.c (df_hard_reg_used_count): Likewise.
>> 	* df.h (df_reg_defined): Likewise.
>> 	(df_reg_used): Likewise.
>> 	(df_hard_reg_used_count): Likewise.
>> 	* dojump.c (init_pending_stack_adjust): Likewise.
>> 	* dojump.h (init_pending_stack_adjust): Likewise.
>> 	* dwarf2out.c (add_AT_vms_delta): Move function back after
>> 	removal.
>> 	(dwarf2out_set_demangle_name_func): REmove unused functions.
>> 	* dwarf2out.h (dwarf2out_set_demangle_name_func): Likewise.
>> 	* emit-rtl.c (emit_jump_insn_before_noloc): Likewise.
>> 	(emit_call_insn_before_noloc): Likewise.
>> 	(emit_barrier_before): Likewise.
>> 	(emit_call_insn_after_noloc): Likewise.
>> 	(emit_call_insn_after_setloc): Likewise.
>> 	(emit_jump_insn_before_setloc): Likewise.
>> 	(emit_call_insn_before_setloc): Likewise.
>> 	(emit_call_insn_before): Likewise.
>> 	* except.c (remove_eh_handler): Likewise.
>> 	(get_eh_region_from_rtx): Likewise.
>> 	* except.h (remove_eh_handler): Likewise.
>> 	(get_eh_region_from_rtx): Likewise.
>> 	* fold-const.c (div_if_zero_remainder): Likewise.
>> 	(fold_unary_to_constant): Likewise.
>> 	* fold-const.h (fold_unary_to_constant): Likewise.
>> 	(div_if_zero_remainder): Likewise.
>> 	* function.c (get_hard_reg_initial_reg): Likewise.
>> 	(get_last_funcdef_no): Likewise.
>> 	* function.h (get_hard_reg_initial_reg): Likewise.
>> 	(get_last_funcdef_no): Likewise.
>> 	* ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Likewise.
>> 	(ggc_cleared_alloc_ptr_array_two_args): Likewise.
>> 	(ggc_splay_alloc): Likewise.
>> 	(ggc_splay_dont_free): Likewise.
>> 	* gimple-expr.c (is_gimple_address): Likewise.
>> 	* gimple-expr.h (is_gimple_address): Likewise.
>> 	* gimple-iterator.c (gsi_for_phi): Likewise.
>> 	* gimple-iterator.h (gsi_for_phi): Likewise.
>> 	* gimple-ssa-sprintf.c (struct format_result): Likewise.
>> 	(format_result::operator+=): Likewise.
>> 	(struct directive): Likewise.
>> 	* gimple-ssa-warn-alloca.c (struct alloca_type_and_limit): Likewise.
>> 	* gimple.c (gimple_unsigned_type): Likewise.
>> 	(gimple_call_builtin_p): Likewise.
>> 	* gimple.h (gimple_unsigned_type): Likewise.
>> 	(gimple_call_builtin_p): Likewise.
>> 	* gimplify.c (gimple_current_bind_expr): Likewise.
>> 	* gimplify.h (gimple_current_bind_expr): Likewise.
>> 	* haifa-sched.c (haifa_classify_insn): Likewise.
>> 	* hsa-common.c (hsa_add_kernel_dependency): Likewise.
>> 	(hsa_brig_function_name): Likewise.
>> 	* hsa-common.h (hsa_add_kernel_dependency): Likewise.
>> 	(hsa_brig_function_name): Likewise.
>> 	* ipa-cp.c (ipcp_vr_lattice::meet_with): Likewise.
> 
> Interesting, I believe that a class representing a lattice should have a
> meet function with its own type.

I've just tried to put gcc_unreachable there, but can't find anything that
would trigger an ICE.

I also run tests on x86_64-linux-gnu (with removed ipcp_vr_lattice::meet_with)
and it looks fine. I'm adding updated version of the patch where I moved back
register_attribute, it's used in attribute_plugin test.

Martin

In this case it would mean moving the
> call to ipa_vr_operation_and_type_effects from the caller into the
> method to clearly describe the semantics.  But perhaps it does not
> matter if we do not have the overload in the meantime.
> 
>> 	* ipa-devirt.c (vtable_pointer_value_to_binfo): Likewise.
>> 	* ipa-icf-gimple.c (func_checker::compare_tree_ssa_label): Likewise.
>> 	* ipa-icf-gimple.h: Likewise.
>> 	* ipa-icf.c (sem_item::sem_item): Likewise.
>> 	(sem_function::sem_function): Likewise.
>> 	(sem_function::icf_handled_component_p): Likewise.
>> 	(sem_variable::sem_variable): Likewise.
>> 	* ipa-icf.h: Likewise.
>> 	* ipa-param-manipulation.c (index_in_adjustments_multiple_times_p): Likewise.
>> 	(ipa_combine_adjustments): Likewise.
> 
> This a known case.  I mean, also have a patch removing, actually
> replacing it, but the goal has always been that we eventually combine
> adjustments.
> 
> Martin
> 
> 


[-- Attachment #2: 0001-Remove-dead-functions-and-fix-VMS-target-by-moving-b.patch --]
[-- Type: text/x-patch, Size: 69021 bytes --]

From bc4df56b2305e0053dcb20638465d278ccccec8e Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 5 Oct 2018 16:59:07 +0200
Subject: [PATCH] Remove dead functions and fix VMS target by moving back some
 functions.

gcc/ChangeLog:

2018-10-09  Martin Liska  <mliska@suse.cz>

	* cfganal.c (control_dependences::clear_control_dependence_bitmap): Likewise.
	(bitmap_union_of_succs): Likewise.
	* cfganal.h (bitmap_union_of_succs): Likewise.
	* cfgloop.c (loop_exits_to_bb_p): Likewise.
	* cfgloop.h (loop_exits_to_bb_p): Likewise.
	* cgraph.h (compute_call_stmt_bb_frequency): Likewise.
	* cgraphbuild.c (compute_call_stmt_bb_frequency): Likewise.
	* cselib.c (cselib_dummy_expand_value_rtx_cb): Likewise.
	* cselib.h (cselib_dummy_expand_value_rtx_cb): Likewise.
	* df-core.c (df_reg_defined): Likewise.
	(df_reg_used): Likewise.
	* df-scan.c (df_hard_reg_used_count): Likewise.
	* df.h (df_reg_defined): Likewise.
	(df_reg_used): Likewise.
	(df_hard_reg_used_count): Likewise.
	* dojump.c (init_pending_stack_adjust): Likewise.
	* dojump.h (init_pending_stack_adjust): Likewise.
	* dwarf2out.c (add_AT_vms_delta): Move function back after
	removal.
	(dwarf2out_set_demangle_name_func): REmove unused functions.
	* dwarf2out.h (dwarf2out_set_demangle_name_func): Likewise.
	* emit-rtl.c (emit_jump_insn_before_noloc): Likewise.
	(emit_call_insn_before_noloc): Likewise.
	(emit_barrier_before): Likewise.
	(emit_call_insn_after_noloc): Likewise.
	(emit_call_insn_after_setloc): Likewise.
	(emit_jump_insn_before_setloc): Likewise.
	(emit_call_insn_before_setloc): Likewise.
	(emit_call_insn_before): Likewise.
	* except.c (remove_eh_handler): Likewise.
	(get_eh_region_from_rtx): Likewise.
	* except.h (remove_eh_handler): Likewise.
	(get_eh_region_from_rtx): Likewise.
	* fold-const.c (div_if_zero_remainder): Likewise.
	(fold_unary_to_constant): Likewise.
	* fold-const.h (fold_unary_to_constant): Likewise.
	(div_if_zero_remainder): Likewise.
	* function.c (get_hard_reg_initial_reg): Likewise.
	(get_last_funcdef_no): Likewise.
	* function.h (get_hard_reg_initial_reg): Likewise.
	(get_last_funcdef_no): Likewise.
	* ggc-common.c (ggc_cleared_alloc_htab_ignore_args): Likewise.
	(ggc_cleared_alloc_ptr_array_two_args): Likewise.
	(ggc_splay_alloc): Likewise.
	(ggc_splay_dont_free): Likewise.
	* gimple-expr.c (is_gimple_address): Likewise.
	* gimple-expr.h (is_gimple_address): Likewise.
	* gimple-iterator.c (gsi_for_phi): Likewise.
	* gimple-iterator.h (gsi_for_phi): Likewise.
	* gimple-ssa-sprintf.c (struct format_result): Likewise.
	(format_result::operator+=): Likewise.
	(struct directive): Likewise.
	* gimple-ssa-warn-alloca.c (struct alloca_type_and_limit): Likewise.
	* gimple.c (gimple_unsigned_type): Likewise.
	(gimple_call_builtin_p): Likewise.
	* gimple.h (gimple_unsigned_type): Likewise.
	(gimple_call_builtin_p): Likewise.
	* gimplify.c (gimple_current_bind_expr): Likewise.
	* gimplify.h (gimple_current_bind_expr): Likewise.
	* haifa-sched.c (haifa_classify_insn): Likewise.
	* hsa-common.c (hsa_add_kernel_dependency): Likewise.
	(hsa_brig_function_name): Likewise.
	* hsa-common.h (hsa_add_kernel_dependency): Likewise.
	(hsa_brig_function_name): Likewise.
	* ipa-cp.c (ipcp_vr_lattice::meet_with): Likewise.
	* ipa-devirt.c (vtable_pointer_value_to_binfo): Likewise.
	* ipa-icf-gimple.c (func_checker::compare_tree_ssa_label): Likewise.
	* ipa-icf-gimple.h: Likewise.
	* ipa-icf.c (sem_item::sem_item): Likewise.
	(sem_function::sem_function): Likewise.
	(sem_function::icf_handled_component_p): Likewise.
	(sem_variable::sem_variable): Likewise.
	* ipa-icf.h: Likewise.
	* ipa-param-manipulation.c (index_in_adjustments_multiple_times_p): Likewise.
	(ipa_combine_adjustments): Likewise.
	* ipa-param-manipulation.h (ipa_combine_adjustments): Likewise.
	* ipa-prop.h (ipa_create_all_node_params): Likewise.
	(ipa_create_all_edge_args): Likewise.
	* ipa-ref.h: Likewise.
	* ipa-utils.h (vtable_pointer_value_to_binfo): Likewise.
	* lto-section-in.c (lto_delete_in_decl_state): Likewise.
	* lto-streamer-in.c (lto_input_data_block): Likewise.
	* lto-streamer.c (gate_lto_out): Likewise.
	* lto-streamer.h (lto_delete_in_decl_state): Likewise.
	(gate_lto_out): Likewise.
	(lto_input_data_block): Likewise.
	* predict.c (edge_probability_reliable_p): Likewise.
	* predict.h (edge_probability_reliable_p): Likewise.
	* read-md.c (md_reader::read_name_or_nil): Likewise.
	* read-md.h (class md_reader): Likewise.
	* rtl.h (get_first_nonnote_insn): Likewise.
	(emit_jump_insn_before_noloc): Likewise.
	(emit_jump_insn_before_setloc): Likewise.
	(emit_call_insn_before): Likewise.
	(emit_call_insn_before_noloc): Likewise.
	(emit_call_insn_before_setloc): Likewise.
	(emit_barrier_before): Likewise.
	(emit_call_insn_after_noloc): Likewise.
	(emit_call_insn_after_setloc): Likewise.
	* toplev.h: Likewise.
	* tree-inline.h: Likewise.

gcc/c-family/ChangeLog:

2018-10-09  Martin Liska  <mliska@suse.cz>

	* c-common.h (constant_expression_error): Remove unused
	functions.
	* c-pretty-print.c (pp_c_exclamation): Likewise.
	(pp_c_attributes): Likewise.
	(pp_c_function_definition): Likewise.
	* c-pretty-print.h (pp_c_exclamation): Likewise.
	(pp_c_function_definition): Likewise.
	(pp_c_attributes): Likewise.
	* c-warn.c (constant_expression_error): Likewise.
---
 gcc/c-family/c-common.h       |   1 -
 gcc/c-family/c-pretty-print.c |  45 ---------------
 gcc/c-family/c-pretty-print.h |   3 -
 gcc/c-family/c-warn.c         |  13 -----
 gcc/cfganal.c                 |  46 ---------------
 gcc/cfganal.h                 |   2 -
 gcc/cfgloop.c                 |  15 -----
 gcc/cfgloop.h                 |   1 -
 gcc/cgraph.h                  |   1 -
 gcc/cgraphbuild.c             |   9 ---
 gcc/cselib.c                  |  18 ------
 gcc/cselib.h                  |   2 -
 gcc/df-core.c                 |  19 ------
 gcc/df-scan.c                 |  14 -----
 gcc/df.h                      |   3 -
 gcc/dojump.c                  |   9 ---
 gcc/dojump.h                  |   4 --
 gcc/dwarf2out.c               |  24 ++++++--
 gcc/dwarf2out.h               |   1 -
 gcc/emit-rtl.c                |  77 ------------------------
 gcc/except.c                  |  36 ------------
 gcc/except.h                  |   2 -
 gcc/fold-const.c              |  31 ----------
 gcc/fold-const.h              |   2 -
 gcc/function.c                |  26 ---------
 gcc/function.h                |   2 -
 gcc/ggc-common.c              |  31 ----------
 gcc/gimple-expr.c             |  41 -------------
 gcc/gimple-expr.h             |   1 -
 gcc/gimple-iterator.c         |  14 -----
 gcc/gimple-iterator.h         |   1 -
 gcc/gimple-ssa-sprintf.c      |  45 ---------------
 gcc/gimple-ssa-warn-alloca.c  |   1 -
 gcc/gimple.c                  |  22 -------
 gcc/gimple.h                  |   2 -
 gcc/gimplify.c                |   8 ---
 gcc/gimplify.h                |   1 -
 gcc/haifa-sched.c             |   2 +-
 gcc/hsa-common.c              |  37 ------------
 gcc/hsa-common.h              |   2 -
 gcc/ipa-cp.c                  |   7 ---
 gcc/ipa-devirt.c              |  21 -------
 gcc/ipa-icf-gimple.c          |   8 ---
 gcc/ipa-icf-gimple.h          |   7 ---
 gcc/ipa-icf.c                 |  30 ----------
 gcc/ipa-icf.h                 |  17 ------
 gcc/ipa-param-manipulation.c  | 106 ----------------------------------
 gcc/ipa-param-manipulation.h  |   2 -
 gcc/ipa-prop.h                |   2 -
 gcc/ipa-ref.h                 |  14 -----
 gcc/ipa-utils.h               |   1 -
 gcc/lto-section-in.c          |  12 ----
 gcc/lto-streamer-in.c         |  13 -----
 gcc/lto-streamer.c            |  10 ----
 gcc/lto-streamer.h            |   3 -
 gcc/predict.c                 |   7 ---
 gcc/predict.h                 |   1 -
 gcc/read-md.c                 |  16 -----
 gcc/read-md.h                 |   1 -
 gcc/rtl.h                     |  10 ----
 gcc/toplev.h                  |   5 --
 gcc/tree-inline.h             |   4 --
 62 files changed, 19 insertions(+), 892 deletions(-)

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 9e868768d01..c9b26cac8af 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1254,7 +1254,6 @@ extern bool valid_array_size_p (location_t, tree, tree, bool = true);
 
 /* In c-warn.c.  */
 extern void constant_expression_warning (tree);
-extern void constant_expression_error (tree);
 extern void overflow_warning (location_t, tree, tree = NULL_TREE);
 extern void warn_logical_operator (location_t, enum tree_code, tree,
 				   enum tree_code, tree, enum tree_code, tree);
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index efb41c5b905..cc2933a33b1 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -156,13 +156,6 @@ pp_c_complement (c_pretty_printer *pp)
   pp->padding = pp_none;
 }
 
-void
-pp_c_exclamation (c_pretty_printer *pp)
-{
-  pp_exclamation (pp);
-  pp->padding = pp_none;
-}
-
 /* Print out the external representation of QUALIFIERS.  */
 
 void
@@ -765,30 +758,6 @@ c_pretty_printer::declaration (tree t)
   pp_c_init_declarator (this, t);
 }
 
-/* Pretty-print ATTRIBUTES using GNU C extension syntax.  */
-
-void
-pp_c_attributes (c_pretty_printer *pp, tree attributes)
-{
-  if (attributes == NULL_TREE)
-    return;
-
-  pp_c_ws_string (pp, "__attribute__");
-  pp_c_left_paren (pp);
-  pp_c_left_paren (pp);
-  for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
-    {
-      pp_tree_identifier (pp, TREE_PURPOSE (attributes));
-      if (TREE_VALUE (attributes))
-	pp_c_call_argument_list (pp, TREE_VALUE (attributes));
-
-      if (TREE_CHAIN (attributes))
-	pp_separate_with (pp, ',');
-    }
-  pp_c_right_paren (pp);
-  pp_c_right_paren (pp);
-}
-
 /* Pretty-print ATTRIBUTES using GNU C extension syntax for attributes
    marked to be displayed on disgnostic.  */
 
@@ -833,20 +802,6 @@ pp_c_attributes_display (c_pretty_printer *pp, tree a)
       pp_c_whitespace (pp);
     }
 }
-
-/* function-definition:
-      declaration-specifiers declarator compound-statement  */
-
-void
-pp_c_function_definition (c_pretty_printer *pp, tree t)
-{
-  pp->declaration_specifiers (t);
-  pp->declarator (t);
-  pp_needs_newline (pp) = true;
-  pp->statement (DECL_SAVED_TREE (t));
-  pp_newline_and_flush (pp);
-}
-
 \f
 /* Expressions.  */
 
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index c012b8cbe38..d7eb93025e9 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -111,13 +111,10 @@ void pp_c_star (c_pretty_printer *);
 void pp_c_arrow (c_pretty_printer *);
 void pp_c_semicolon (c_pretty_printer *);
 void pp_c_complement (c_pretty_printer *);
-void pp_c_exclamation (c_pretty_printer *);
 void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
 
 /* Declarations.  */
 void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
-void pp_c_function_definition (c_pretty_printer *, tree);
-void pp_c_attributes (c_pretty_printer *, tree);
 void pp_c_attributes_display (c_pretty_printer *, tree);
 void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
 void pp_c_type_qualifier_list (c_pretty_printer *, tree);
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index a1a7f935964..44e3be20fcb 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -54,19 +54,6 @@ constant_expression_warning (tree value)
     pedwarn (input_location, OPT_Woverflow, "overflow in constant expression");
 }
 
-/* The same as above but print an unconditional error.  */
-
-void
-constant_expression_error (tree value)
-{
-  if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST
-       || TREE_CODE (value) == FIXED_CST
-       || TREE_CODE (value) == VECTOR_CST
-       || TREE_CODE (value) == COMPLEX_CST)
-      && TREE_OVERFLOW (value))
-    error ("overflow in constant expression");
-}
-
 /* Print a warning if an expression result VALUE had an overflow
    in folding and its operands hadn't.  EXPR, which may be null, is
    the operand of the expression.
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 3b80758e8f2..dfa8bf7f8e2 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -365,13 +365,6 @@ control_dependences::set_control_dependence_map_bit (basic_block bb,
   bitmap_set_bit (control_dependence_map[bb->index], edge_index);
 }
 
-/* Clear all control dependences for block BB.  */
-void
-control_dependences::clear_control_dependence_bitmap (basic_block bb)
-{
-  bitmap_clear (control_dependence_map[bb->index]);
-}
-
 /* Find the immediate postdominator PDOM of the specified basic block BLOCK.
    This function is necessary because some blocks have negative numbers.  */
 
@@ -1509,45 +1502,6 @@ bitmap_intersection_of_preds (sbitmap dst, sbitmap *src, basic_block b)
       }
 }
 
-/* Set the bitmap DST to the union of SRC of successors of
-   basic block B.  */
-
-void
-bitmap_union_of_succs (sbitmap dst, sbitmap *src, basic_block b)
-{
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  for (ix = 0; ix < EDGE_COUNT (b->succs); ix++)
-    {
-      e = EDGE_SUCC (b, ix);
-      if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
-	continue;
-
-      bitmap_copy (dst, src[e->dest->index]);
-      break;
-    }
-
-  if (ix == EDGE_COUNT (b->succs))
-    bitmap_clear (dst);
-  else
-    for (ix++; ix < EDGE_COUNT (b->succs); ix++)
-      {
-	unsigned int i;
-	SBITMAP_ELT_TYPE *p, *r;
-
-	e = EDGE_SUCC (b, ix);
-	if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
-	  continue;
-
-	p = src[e->dest->index]->elms;
-	r = dst->elms;
-	for (i = 0; i < set_size; i++)
-	  *r++ |= *p++;
-      }
-}
-
 /* Set the bitmap DST to the union of SRC of predecessors of
    basic block B.  */
 
diff --git a/gcc/cfganal.h b/gcc/cfganal.h
index 122c665f7f6..e2512861e47 100644
--- a/gcc/cfganal.h
+++ b/gcc/cfganal.h
@@ -42,7 +42,6 @@ public:
 
 private:
   void set_control_dependence_map_bit (basic_block, int);
-  void clear_control_dependence_bitmap (basic_block);
   void find_control_dependence (int);
   vec<bitmap> control_dependence_map;
   vec<std::pair<int, int> > m_el;
@@ -76,7 +75,6 @@ extern void compute_dominance_frontiers (struct bitmap_head *);
 extern bitmap compute_idf (bitmap, struct bitmap_head *);
 extern void bitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block);
 extern void bitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block);
-extern void bitmap_union_of_succs (sbitmap, sbitmap *, basic_block);
 extern void bitmap_union_of_preds (sbitmap, sbitmap *, basic_block);
 extern basic_block * single_pred_before_succ_order (void);
 extern edge single_incoming_edge_ignoring_loop_edges (basic_block, bool);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 0917b716da7..2d43a3d694c 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1769,21 +1769,6 @@ single_exit (const struct loop *loop)
     return NULL;
 }
 
-/* Returns true when BB has an incoming edge exiting LOOP.  */
-
-bool
-loop_exits_to_bb_p (struct loop *loop, basic_block bb)
-{
-  edge e;
-  edge_iterator ei;
-
-  FOR_EACH_EDGE (e, ei, bb->preds)
-    if (loop_exit_edge_p (loop, e))
-      return true;
-
-  return false;
-}
-
 /* Returns true when BB has an outgoing edge exiting LOOP.  */
 
 bool
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 80a31c416ca..750939451dd 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -354,7 +354,6 @@ extern int num_loop_insns (const struct loop *);
 extern int average_num_loop_insns (const struct loop *);
 extern unsigned get_loop_level (const struct loop *);
 extern bool loop_exit_edge_p (const struct loop *, const_edge);
-extern bool loop_exits_to_bb_p (struct loop *, basic_block);
 extern bool loop_exits_from_bb_p (struct loop *, basic_block);
 extern void mark_loop_exit_edges (void);
 extern dump_user_location_t get_loop_location (struct loop *loop);
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 71c54537b93..c30ba3cdb7e 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -2395,7 +2395,6 @@ tree cgraph_build_function_type_skip_args (tree orig_type, bitmap args_to_skip,
 					   bool skip_return);
 
 /* In cgraphbuild.c  */
-int compute_call_stmt_bb_frequency (tree, basic_block bb);
 void record_references_in_initializer (tree, bool);
 
 /* In ipa.c  */
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index c2ad5cf2ef7..f1308dfdb5b 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -185,15 +185,6 @@ record_eh_tables (cgraph_node *node, function *fun)
     }
 }
 
-/* Computes the frequency of the call statement so that it can be stored in
-   cgraph_edge.  BB is the basic block of the call statement.  */
-int
-compute_call_stmt_bb_frequency (tree decl, basic_block bb)
-{
-  return bb->count.to_cgraph_frequency
-      (ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count);
-}
-
 /* Mark address taken in STMT.  */
 
 static bool
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 6d3a4078c68..f667c4e7503 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -1562,24 +1562,6 @@ cselib_expand_value_rtx_cb (rtx orig, bitmap regs_active, int max_depth,
   return cselib_expand_value_rtx_1 (orig, &evd, max_depth);
 }
 
-/* Similar to cselib_expand_value_rtx_cb, but no rtxs are actually copied
-   or simplified.  Useful to find out whether cselib_expand_value_rtx_cb
-   would return NULL or non-NULL, without allocating new rtx.  */
-
-bool
-cselib_dummy_expand_value_rtx_cb (rtx orig, bitmap regs_active, int max_depth,
-				  cselib_expand_callback cb, void *data)
-{
-  struct expand_value_data evd;
-
-  evd.regs_active = regs_active;
-  evd.callback = cb;
-  evd.callback_arg = data;
-  evd.dummy = true;
-
-  return cselib_expand_value_rtx_1 (orig, &evd, max_depth) != NULL;
-}
-
 /* Internal implementation of cselib_expand_value_rtx and
    cselib_expand_value_rtx_cb.  */
 
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 0005ad3113c..8fdbcfc6d5f 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -88,8 +88,6 @@ extern rtx cselib_expand_value_rtx (rtx, bitmap, int);
 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *);
 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int,
 				       cselib_expand_callback, void *);
-extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int,
-					      cselib_expand_callback, void *);
 extern rtx cselib_subst_to_values (rtx, machine_mode);
 extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *);
 extern void cselib_invalidate_rtx (rtx, const_rtx = NULL);
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 74ef0a14ac9..59949576f16 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1967,15 +1967,6 @@ df_find_def (rtx_insn *insn, rtx reg)
 }
 
 
-/* Return true if REG is defined in INSN, zero otherwise.  */
-
-bool
-df_reg_defined (rtx_insn *insn, rtx reg)
-{
-  return df_find_def (insn, reg) != NULL;
-}
-
-
 /* Finds the reference corresponding to the use of REG in INSN.
    DF is the dataflow object.  */
 
@@ -1998,16 +1989,6 @@ df_find_use (rtx_insn *insn, rtx reg)
 	return use;
   return NULL;
 }
-
-
-/* Return true if REG is referenced in INSN, zero otherwise.  */
-
-bool
-df_reg_used (rtx_insn *insn, rtx reg)
-{
-  return df_find_use (insn, reg) != NULL;
-}
-
 \f
 /*----------------------------------------------------------------------------
    Debugging and printing functions.
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 0b119f211ea..a891b49d78a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3868,20 +3868,6 @@ df_hard_reg_used_p (unsigned int reg)
 }
 
 
-/* A count of the number of times REG is actually used in the some
-   instruction.  There are a fair number of conditions that affect the
-   setting of this array.  See the comment in df.h for
-   df->hard_regs_live_count for the conditions that this array is
-   set. */
-
-
-unsigned int
-df_hard_reg_used_count (unsigned int reg)
-{
-  return df->hard_regs_live_count[reg];
-}
-
-
 /* Get the value of regs_ever_live[REGNO].  */
 
 bool
diff --git a/gcc/df.h b/gcc/df.h
index 6d1ff4d68ca..35a24eb7063 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -980,9 +980,7 @@ extern void df_check_cfg_clean (void);
 extern df_ref df_bb_regno_first_def_find (basic_block, unsigned int);
 extern df_ref df_bb_regno_last_def_find (basic_block, unsigned int);
 extern df_ref df_find_def (rtx_insn *, rtx);
-extern bool df_reg_defined (rtx_insn *, rtx);
 extern df_ref df_find_use (rtx_insn *, rtx);
-extern bool df_reg_used (rtx_insn *, rtx);
 extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
 extern void df_print_regset (FILE *file, bitmap r);
 extern void df_print_word_regset (FILE *file, bitmap r);
@@ -1076,7 +1074,6 @@ extern void df_update_entry_block_defs (void);
 extern void df_update_exit_block_uses (void);
 extern void df_update_entry_exit_and_calls (void);
 extern bool df_hard_reg_used_p (unsigned int);
-extern unsigned int df_hard_reg_used_count (unsigned int);
 extern bool df_regs_ever_live_p (unsigned int);
 extern void df_set_regs_ever_live (unsigned int, bool);
 extern void df_compute_regs_ever_live (bool);
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 9dccc7292a3..88d97b077b2 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -50,15 +50,6 @@ static void do_compare_and_jump	(tree, tree, enum rtx_code, enum rtx_code,
 				 rtx_code_label *, rtx_code_label *,
 				 profile_probability);
 
-/* At the start of a function, record that we have no previously-pushed
-   arguments waiting to be popped.  */
-
-void
-init_pending_stack_adjust (void)
-{
-  pending_stack_adjust = 0;
-}
-
 /* Discard any pending stack adjustment.  This avoid relying on the
    RTL optimizers to remove useless adjustments when we know the
    stack pointer value is dead.  */
diff --git a/gcc/dojump.h b/gcc/dojump.h
index f948ee916e3..8a6412be0d6 100644
--- a/gcc/dojump.h
+++ b/gcc/dojump.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_DOJUMP_H
 #define GCC_DOJUMP_H
 
-/* At the start of a function, record that we have no previously-pushed
-   arguments waiting to be popped.  */
-extern void init_pending_stack_adjust (void);
-
 /* Discard any pending stack adjustment.  */
 extern void discard_pending_stack_adjust (void);
 
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0772b364919..91f9dacec88 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3901,6 +3901,8 @@ static void prune_unused_types (void);
 static int maybe_emit_file (struct dwarf_file_data *fd);
 static inline const char *AT_vms_delta1 (dw_attr_node *);
 static inline const char *AT_vms_delta2 (dw_attr_node *);
+static inline void add_AT_vms_delta (dw_die_ref, enum dwarf_attribute,
+				     const char *, const char *);
 static void append_entry_to_tmpl_value_parm_die_table (dw_die_ref, tree);
 static void gen_remaining_tmpl_value_param_die_attribute (void);
 static bool generic_type_p (tree);
@@ -4201,12 +4203,6 @@ comp_unit_die (void)
 
 static const char *(*demangle_name_func) (const char *);
 
-void
-dwarf2out_set_demangle_name_func (const char *(*func) (const char *))
-{
-  demangle_name_func = func;
-}
-
 /* Test if rtl node points to a pseudo register.  */
 
 static inline int
@@ -5135,6 +5131,22 @@ AT_file (dw_attr_node *a)
   return a->dw_attr_val.v.val_file;
 }
 
+/* Add a vms delta attribute value to a DIE.  */
+
+static inline void
+add_AT_vms_delta (dw_die_ref die, enum dwarf_attribute attr_kind,
+		  const char *lbl1, const char *lbl2)
+{
+  dw_attr_node attr;
+
+  attr.dw_attr = attr_kind;
+  attr.dw_attr_val.val_class = dw_val_class_vms_delta;
+  attr.dw_attr_val.val_entry = NULL;
+  attr.dw_attr_val.v.val_vms_delta.lbl1 = xstrdup (lbl1);
+  attr.dw_attr_val.v.val_vms_delta.lbl2 = xstrdup (lbl2);
+  add_dwarf_attr (die, &attr);
+}
+
 /* Add a symbolic view identifier attribute value to a DIE.  */
 
 static inline void
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index a0ba414014d..e749d278708 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -312,7 +312,6 @@ extern void debug_dwarf_die (struct die_struct *);
 extern void debug_dwarf_loc_descr (dw_loc_descr_ref);
 extern void debug (die_struct &ref);
 extern void debug (die_struct *ptr);
-extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
 #ifdef VMS_DEBUGGING_INFO
 extern void dwarf2out_vms_debug_main_pointer (void);
 #endif
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 9a735fab5bf..0f98c96815f 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4566,27 +4566,6 @@ emit_insn_before_noloc (rtx x, rtx_insn *before, basic_block bb)
   return emit_pattern_before_noloc (x, before, before, bb, make_insn_raw);
 }
 
-/* Make an instruction with body X and code JUMP_INSN
-   and output it before the instruction BEFORE.  */
-
-rtx_jump_insn *
-emit_jump_insn_before_noloc (rtx x, rtx_insn *before)
-{
-  return as_a <rtx_jump_insn *> (
-		emit_pattern_before_noloc (x, before, NULL, NULL,
-					   make_jump_insn_raw));
-}
-
-/* Make an instruction with body X and code CALL_INSN
-   and output it before the instruction BEFORE.  */
-
-rtx_insn *
-emit_call_insn_before_noloc (rtx x, rtx_insn *before)
-{
-  return emit_pattern_before_noloc (x, before, NULL, NULL,
-				    make_call_insn_raw);
-}
-
 /* Make an instruction with body X and code DEBUG_INSN
    and output it before the instruction BEFORE.  */
 
@@ -4597,20 +4576,6 @@ emit_debug_insn_before_noloc (rtx x, rtx_insn *before)
 				    make_debug_insn_raw);
 }
 
-/* Make an insn of code BARRIER
-   and output it before the insn BEFORE.  */
-
-rtx_barrier *
-emit_barrier_before (rtx_insn *before)
-{
-  rtx_barrier *insn = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
-
-  INSN_UID (insn) = cur_insn_uid++;
-
-  add_insn_before (insn, before, NULL);
-  return insn;
-}
-
 /* Emit the label LABEL before the insn BEFORE.  */
 
 rtx_code_label *
@@ -4726,15 +4691,6 @@ emit_jump_insn_after_noloc (rtx x, rtx_insn *after)
 		emit_pattern_after_noloc (x, after, NULL, make_jump_insn_raw));
 }
 
-/* Make an instruction with body X and code CALL_INSN
-   and output it after the instruction AFTER.  */
-
-rtx_insn *
-emit_call_insn_after_noloc (rtx x, rtx_insn *after)
-{
-  return emit_pattern_after_noloc (x, after, NULL, make_call_insn_raw);
-}
-
 /* Make an instruction with body X and code CALL_INSN
    and output it after the instruction AFTER.  */
 
@@ -4909,13 +4865,6 @@ emit_jump_insn_after (rtx pattern, rtx_insn *after)
 	emit_pattern_after (pattern, after, true, make_jump_insn_raw));
 }
 
-/* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_insn *
-emit_call_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
-{
-  return emit_pattern_after_setloc (pattern, after, loc, make_call_insn_raw);
-}
-
 /* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_insn *
 emit_call_insn_after (rtx pattern, rtx_insn *after)
@@ -5010,15 +4959,6 @@ emit_insn_before (rtx pattern, rtx_insn *before)
   return emit_pattern_before (pattern, before, true, true, make_insn_raw);
 }
 
-/* like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_jump_insn *
-emit_jump_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
-{
-  return as_a <rtx_jump_insn *> (
-	emit_pattern_before_setloc (pattern, before, loc, false,
-				    make_jump_insn_raw));
-}
-
 /* Like emit_jump_insn_before_noloc, but set INSN_LOCATION according to BEFORE.  */
 rtx_jump_insn *
 emit_jump_insn_before (rtx pattern, rtx_insn *before)
@@ -5028,23 +4968,6 @@ emit_jump_insn_before (rtx pattern, rtx_insn *before)
 			     make_jump_insn_raw));
 }
 
-/* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx_insn *
-emit_call_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
-{
-  return emit_pattern_before_setloc (pattern, before, loc, false,
-				     make_call_insn_raw);
-}
-
-/* Like emit_call_insn_before_noloc,
-   but set insn_location according to BEFORE.  */
-rtx_insn *
-emit_call_insn_before (rtx pattern, rtx_insn *before)
-{
-  return emit_pattern_before (pattern, before, true, false,
-			      make_call_insn_raw);
-}
-
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
 rtx_insn *
 emit_debug_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
diff --git a/gcc/except.c b/gcc/except.c
index 728b1e1d349..510f689a709 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1599,29 +1599,6 @@ remove_eh_handler_splicer (eh_region *pp)
   (*cfun->eh->region_array)[region->index] = NULL;
 }
 
-/* Splice a single EH region REGION from the region tree.
-
-   To unlink REGION, we need to find the pointer to it with a relatively
-   expensive search in REGION's outer region.  If you are going to
-   remove a number of handlers, using remove_unreachable_eh_regions may
-   be a better option.  */
-
-void
-remove_eh_handler (eh_region region)
-{
-  eh_region *pp, *pp_start, p, outer;
-
-  outer = region->outer;
-  if (outer)
-    pp_start = &outer->inner;
-  else
-    pp_start = &cfun->eh->region_tree;
-  for (pp = pp_start, p = *pp; p != region; pp = &p->next_peer, p = *pp)
-    continue;
-
-  remove_eh_handler_splicer (pp);
-}
-
 /* Worker for remove_unreachable_eh_regions.
    PP is a pointer to the region to start a region tree depth-first
    search from.  R_REACHABLE is the set of regions that have to be
@@ -1847,19 +1824,6 @@ get_eh_landing_pad_from_rtx (const_rtx insn)
   return lp;
 }
 
-/* Return the region to which INSN may go, or NULL if it does not
-   have a reachable region within this function.  */
-
-eh_region
-get_eh_region_from_rtx (const_rtx insn)
-{
-  eh_landing_pad lp;
-  eh_region r;
-
-  get_eh_region_and_lp_from_rtx (insn, &r, &lp);
-  return r;
-}
-
 /* Return true if INSN throws and is caught by something in this function.  */
 
 bool
diff --git a/gcc/except.h b/gcc/except.h
index caa375ef670..a5476644bfb 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -225,7 +225,6 @@ extern void for_each_eh_label (void (*) (rtx));
 extern void init_eh_for_function (void);
 
 extern void remove_eh_landing_pad (eh_landing_pad);
-extern void remove_eh_handler (eh_region);
 extern void remove_unreachable_eh_regions (sbitmap);
 
 extern bool current_function_has_exception_handlers (void);
@@ -278,7 +277,6 @@ extern void add_type_for_runtime (tree);
 extern tree lookup_type_for_runtime (tree);
 extern void assign_filter_values (void);
 
-extern eh_region get_eh_region_from_rtx (const_rtx);
 extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx);
 
 extern void finish_eh_generation (void);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 59cedeafd71..7893152fdb5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -169,22 +169,6 @@ protected_set_expr_location_unshare (tree x, location_t loc)
   return x;
 }
 \f
-/* If ARG2 divides ARG1 with zero remainder, carries out the exact
-   division and returns the quotient.  Otherwise returns
-   NULL_TREE.  */
-
-tree
-div_if_zero_remainder (const_tree arg1, const_tree arg2)
-{
-  widest_int quo;
-
-  if (wi::multiple_of_p (wi::to_widest (arg1), wi::to_widest (arg2),
-			 SIGNED, &quo))
-    return wide_int_to_tree (TREE_TYPE (arg1), quo);
-
-  return NULL_TREE; 
-}
-\f
 /* This is nonzero if we should defer warnings about undefined
    overflow.  This facility exists because these warnings are a
    special case.  The code to estimate loop iterations does not want
@@ -13731,21 +13715,6 @@ fold_binary_to_constant (enum tree_code code, tree type, tree op0, tree op1)
   return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
 }
 
-/* Given the components of a unary expression CODE, TYPE and OP0,
-   attempt to fold the expression to a constant without modifying
-   TYPE or OP0.
-
-   If the expression could be simplified to a constant, then return
-   the constant.  If the expression would not be simplified to a
-   constant, then return NULL_TREE.  */
-
-tree
-fold_unary_to_constant (enum tree_code code, tree type, tree op0)
-{
-  tree tem = fold_unary (code, type, op0);
-  return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
-}
-
 /* If EXP represents referencing an element in a constant string
    (either via pointer arithmetic or array indexing), return the
    tree representing the value accessed, otherwise return NULL.  */
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index ca6d47bba34..bda12d814da 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -94,7 +94,6 @@ extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree);
 #define invert_truthvalue(T)\
    invert_truthvalue_loc (UNKNOWN_LOCATION, T)
 extern tree invert_truthvalue_loc (location_t, tree);
-extern tree fold_unary_to_constant (enum tree_code, tree, tree);
 extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
 extern tree fold_bit_and_mask (tree, tree, enum tree_code,
 			       tree, enum tree_code, tree, tree,
@@ -123,7 +122,6 @@ extern tree build_simple_mem_ref_loc (location_t, tree);
 extern poly_offset_int mem_ref_offset (const_tree);
 extern tree build_invariant_address (tree, tree, poly_int64);
 extern tree constant_boolean_node (bool, tree);
-extern tree div_if_zero_remainder (const_tree, const_tree);
 
 extern bool tree_swap_operands_p (const_tree, const_tree);
 extern enum tree_code swap_tree_comparison (enum tree_code);
diff --git a/gcc/function.c b/gcc/function.c
index 302438323c8..c07049fd1c5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1259,25 +1259,6 @@ struct GTY(()) initial_value_struct {
   initial_value_pair * GTY ((length ("%h.num_entries"))) entries;
 };
 
-/* If a pseudo represents an initial hard reg (or expression), return
-   it, else return NULL_RTX.  */
-
-rtx
-get_hard_reg_initial_reg (rtx reg)
-{
-  struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
-  int i;
-
-  if (ivs == 0)
-    return NULL_RTX;
-
-  for (i = 0; i < ivs->num_entries; i++)
-    if (rtx_equal_p (ivs->entries[i].pseudo, reg))
-      return ivs->entries[i].hard_reg;
-
-  return NULL_RTX;
-}
-
 /* Make sure that there's a pseudo register of mode MODE that stores the
    initial value of hard register REGNO.  Return an rtx for such a pseudo.  */
 
@@ -4683,13 +4664,6 @@ get_next_funcdef_no (void)
   return funcdef_no++;
 }
 
-/* Return value of funcdef.  */
-int
-get_last_funcdef_no (void)
-{
-  return funcdef_no;
-}
-
 /* Allocate a function structure for FNDECL and set its contents
    to the defaults.  Set cfun to the newly-allocated object.
    Some of the helper functions invoked during initialization assume
diff --git a/gcc/function.h b/gcc/function.h
index 7e59050e8a6..7ce2d8c77bc 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -596,7 +596,6 @@ extern void free_temp_slots (void);
 extern void push_temp_slots (void);
 extern void pop_temp_slots (void);
 extern void init_temp_slots (void);
-extern rtx get_hard_reg_initial_reg (rtx);
 extern rtx get_hard_reg_initial_val (machine_mode, unsigned int);
 extern rtx has_hard_reg_initial_val (machine_mode, unsigned int);
 
@@ -629,7 +628,6 @@ extern void push_cfun (struct function *new_cfun);
 extern void pop_cfun (void);
 
 extern int get_next_funcdef_no (void);
-extern int get_last_funcdef_no (void);
 extern void allocate_struct_function (tree, bool);
 extern void push_struct_function (tree fndecl);
 extern void push_dummy_function (bool);
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index f83fc136d04..83f8925f9d3 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -164,37 +164,6 @@ ggc_realloc (void *x, size_t size MEM_STAT_DECL)
   return r;
 }
 
-void *
-ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
-				    size_t n ATTRIBUTE_UNUSED)
-{
-  gcc_assert (c * n == sizeof (struct htab));
-  return ggc_cleared_alloc<htab> ();
-}
-
-/* TODO: once we actually use type information in GGC, create a new tag
-   gt_gcc_ptr_array and use it for pointer arrays.  */
-void *
-ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
-{
-  gcc_assert (sizeof (PTR *) == n);
-  return ggc_cleared_vec_alloc<PTR *> (c);
-}
-
-/* These are for splay_tree_new_ggc.  */
-void *
-ggc_splay_alloc (int sz, void *nl)
-{
-  gcc_assert (!nl);
-  return ggc_internal_alloc (sz);
-}
-
-void
-ggc_splay_dont_free (void * x ATTRIBUTE_UNUSED, void *nl)
-{
-  gcc_assert (!nl);
-}
-
 /* Print statistics that are independent of the collector in use.  */
 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
 		  ? (x) \
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index d07c89bebab..9b8a0b1a375 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -613,47 +613,6 @@ is_gimple_condexpr (tree t)
 				&& is_gimple_val (TREE_OPERAND (t, 1))));
 }
 
-/* Return true if T is a gimple address.  */
-
-bool
-is_gimple_address (const_tree t)
-{
-  tree op;
-
-  if (TREE_CODE (t) != ADDR_EXPR)
-    return false;
-
-  op = TREE_OPERAND (t, 0);
-  while (handled_component_p (op))
-    {
-      if ((TREE_CODE (op) == ARRAY_REF
-	   || TREE_CODE (op) == ARRAY_RANGE_REF)
-	  && !is_gimple_val (TREE_OPERAND (op, 1)))
-	    return false;
-
-      op = TREE_OPERAND (op, 0);
-    }
-
-  if (CONSTANT_CLASS_P (op)
-      || TREE_CODE (op) == TARGET_MEM_REF
-      || TREE_CODE (op) == MEM_REF)
-    return true;
-
-  switch (TREE_CODE (op))
-    {
-    case PARM_DECL:
-    case RESULT_DECL:
-    case LABEL_DECL:
-    case FUNCTION_DECL:
-    case VAR_DECL:
-    case CONST_DECL:
-      return true;
-
-    default:
-      return false;
-    }
-}
-
 /* Return true if T is a gimple invariant address.  */
 
 bool
diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h
index 96733bdd7b4..277b55054ec 100644
--- a/gcc/gimple-expr.h
+++ b/gcc/gimple-expr.h
@@ -41,7 +41,6 @@ extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
 					   tree *);
 extern bool is_gimple_lvalue (tree);
 extern bool is_gimple_condexpr (tree);
-extern bool is_gimple_address (const_tree);
 extern bool is_gimple_invariant_address (const_tree);
 extern bool is_gimple_ip_invariant_address (const_tree);
 extern bool is_gimple_min_invariant (const_tree);
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index c0131f3654c..6b3e83e2630 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -631,20 +631,6 @@ gsi_for_stmt (gimple *stmt, gimple_seq *seq)
   return i;
 }
 
-/* Finds iterator for PHI.  */
-
-gphi_iterator
-gsi_for_phi (gphi *phi)
-{
-  gphi_iterator i;
-  basic_block bb = gimple_bb (phi);
-
-  i = gsi_start_phis (bb);
-  i.ptr = phi;
-
-  return i;
-}
-
 /* Move the statement at FROM so it comes right after the statement at TO.  */
 
 void
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index e23d4b2c47c..7b7881492f8 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -80,7 +80,6 @@ extern void gsi_insert_after (gimple_stmt_iterator *, gimple *,
 extern bool gsi_remove (gimple_stmt_iterator *, bool);
 extern gimple_stmt_iterator gsi_for_stmt (gimple *);
 extern gimple_stmt_iterator gsi_for_stmt (gimple *, gimple_seq *);
-extern gphi_iterator gsi_for_phi (gphi *);
 extern void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
 extern void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
 extern void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 471bfc45eb8..bd8a2ca21e3 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -228,45 +228,8 @@ struct format_result
      avoid issuing duplicate warnings while finishing the processing
      of a call.  WARNED also disables the return value optimization.  */
   bool warned;
-
-  /* Preincrement the number of output characters by 1.  */
-  format_result& operator++ ()
-  {
-    return *this += 1;
-  }
-
-  /* Postincrement the number of output characters by 1.  */
-  format_result operator++ (int)
-  {
-    format_result prev (*this);
-    *this += 1;
-    return prev;
-  }
-
-  /* Increment the number of output characters by N.  */
-  format_result& operator+= (unsigned HOST_WIDE_INT);
 };
 
-format_result&
-format_result::operator+= (unsigned HOST_WIDE_INT n)
-{
-  gcc_assert (n < HOST_WIDE_INT_MAX);
-
-  if (range.min < HOST_WIDE_INT_MAX)
-    range.min += n;
-
-  if (range.max < HOST_WIDE_INT_MAX)
-    range.max += n;
-
-  if (range.likely < HOST_WIDE_INT_MAX)
-    range.likely += n;
-
-  if (range.unlikely < HOST_WIDE_INT_MAX)
-    range.unlikely += n;
-
-  return *this;
-}
-
 /* Return the value of INT_MIN for the target.  */
 
 static inline HOST_WIDE_INT
@@ -727,14 +690,6 @@ struct directive
       |= (1U << (c % (CHAR_BIT * sizeof *flags)));
   }
 
-  /* Reset the format flag CHR.  */
-  void clear_flag (char chr)
-  {
-    unsigned char c = chr & 0xff;
-    flags[c / (CHAR_BIT * sizeof *flags)]
-      &= ~(1U << (c % (CHAR_BIT * sizeof *flags)));
-  }
-
   /* Set both bounds of the width range to VAL.  */
   void set_width (HOST_WIDE_INT val)
   {
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index d1b1de4a2d5..d75d4a150c3 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -125,7 +125,6 @@ struct alloca_type_and_limit {
   // integer_zero_node if unknown.  For any other alloca types, this
   // field is undefined.
   wide_int limit;
-  alloca_type_and_limit ();
   alloca_type_and_limit (enum alloca_type type,
 			 wide_int i) : type(type), limit(i) { }
   alloca_type_and_limit (enum alloca_type type) : type(type)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index e3e651b1e61..a1e6d2c6810 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2528,15 +2528,6 @@ gimple_signed_or_unsigned_type (bool unsignedp, tree type)
 }
 
 
-/* Return an unsigned type the same as TYPE in other respects.  */
-
-tree
-gimple_unsigned_type (tree type)
-{
-  return gimple_signed_or_unsigned_type (true, type);
-}
-
-
 /* Return a signed type the same as TYPE in other respects.  */
 
 tree
@@ -2647,19 +2638,6 @@ gimple_builtin_call_types_compatible_p (const gimple *stmt, tree fndecl)
   return true;
 }
 
-/* Return true when STMT is builtins call.  */
-
-bool
-gimple_call_builtin_p (const gimple *stmt)
-{
-  tree fndecl;
-  if (is_gimple_call (stmt)
-      && (fndecl = gimple_call_fndecl (stmt)) != NULL_TREE
-      && DECL_BUILT_IN_CLASS (fndecl) != NOT_BUILT_IN)
-    return gimple_builtin_call_types_compatible_p (stmt, fndecl);
-  return false;
-}
-
 /* Return true when STMT is builtins call to CLASS.  */
 
 bool
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a5dda9369bc..6d4cc0f2adf 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1509,13 +1509,11 @@ unsigned get_gimple_rhs_num_ops (enum tree_code);
 extern tree canonicalize_cond_expr_cond (tree);
 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
 extern bool gimple_compare_field_offset (tree, tree);
-extern tree gimple_unsigned_type (tree);
 extern tree gimple_signed_type (tree);
 extern alias_set_type gimple_get_alias_set (tree);
 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
 extern combined_fn gimple_call_combined_fn (const gimple *);
-extern bool gimple_call_builtin_p (const gimple *);
 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
 extern bool gimple_asm_clobbers_memory_p (const gasm *);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 509fc2f3f5b..59531d35f35 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -332,14 +332,6 @@ gimple_pop_bind_expr (void)
   gimplify_ctxp->bind_expr_stack.pop ();
 }
 
-/* Return the first element of the stack of bindings.  */
-
-gbind *
-gimple_current_bind_expr (void)
-{
-  return gimplify_ctxp->bind_expr_stack.last ();
-}
-
 /* Return the stack of bindings created during gimplification.  */
 
 vec<gbind *>
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index 62ca869083a..14abc94d9af 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -53,7 +53,6 @@ extern void free_gimplify_stack (void);
 extern void push_gimplify_context (bool in_ssa = false,
 				   bool rhs_cond_ok = false);
 extern void pop_gimplify_context (gimple *);
-extern gbind *gimple_current_bind_expr (void);
 extern vec<gbind *> gimple_bind_expr_stack (void);
 extern void gimplify_and_add (tree, gimple_seq *);
 extern tree get_formal_tmp_var (tree, gimple_seq *);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1fdc9df9fb2..f154fe092e8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -574,7 +574,7 @@ haifa_classify_insn (const_rtx insn)
    MAX_STAGES provides us with a limit
    after which we give up scheduling; the caller must have unrolled at least
    as many copies of the loop body and recorded delay_pairs for them.
-   
+
    INSNS is the number of real (non-debug) insns in one iteration of
    the loop.  MAX_UID can be used to test whether an insn belongs to
    the first iteration of the loop; all of them have a uid lower than
diff --git a/gcc/hsa-common.c b/gcc/hsa-common.c
index 0e18fa74a2c..52712dde5f2 100644
--- a/gcc/hsa-common.c
+++ b/gcc/hsa-common.c
@@ -716,27 +716,6 @@ hsa_free_decl_kernel_mapping (void)
   ggc_free (hsa_decl_kernel_mapping);
 }
 
-/* Add new kernel dependency.  */
-
-void
-hsa_add_kernel_dependency (tree caller, const char *called_function)
-{
-  if (hsa_decl_kernel_dependencies == NULL)
-    hsa_decl_kernel_dependencies = new hash_map<tree, vec<const char *> *> ();
-
-  vec <const char *> *s = NULL;
-  vec <const char *> **slot = hsa_decl_kernel_dependencies->get (caller);
-  if (slot == NULL)
-    {
-      s = new vec <const char *> ();
-      hsa_decl_kernel_dependencies->put (caller, s);
-    }
-  else
-    s = *slot;
-
-  s->safe_push (called_function);
-}
-
 /* Expansion to HSA needs a few gc roots to hold types, constructors etc.  In
    order to minimize the number of GTY roots, we'll root them all in the
    following array.  The individual elements should only be accessed by the
@@ -772,22 +751,6 @@ hsa_sanitize_name (char *p)
       *p = '_';
 }
 
-/* Clone the name P, set trailing ampersand and sanitize the name.  */
-
-char *
-hsa_brig_function_name (const char *p)
-{
-  unsigned len = strlen (p);
-  char *buf = XNEWVEC (char, len + 2);
-
-  buf[0] = '&';
-  buf[len + 1] = '\0';
-  memcpy (buf + 1, p, len);
-
-  hsa_sanitize_name (buf);
-  return buf;
-}
-
 /* Add a flatten attribute and disable vectorization for gpu implementation
    function decl GDECL.  */
 
diff --git a/gcc/hsa-common.h b/gcc/hsa-common.h
index c72343fbdab..7bfc14c8c7e 100644
--- a/gcc/hsa-common.h
+++ b/gcc/hsa-common.h
@@ -1356,9 +1356,7 @@ void hsa_free_decl_kernel_mapping (void);
 tree *hsa_get_ctor_statements (void);
 tree *hsa_get_dtor_statements (void);
 tree *hsa_get_kernel_dispatch_type (void);
-void hsa_add_kernel_dependency (tree caller, const char *called_function);
 void hsa_sanitize_name (char *p);
-char *hsa_brig_function_name (const char *p);
 const char *hsa_get_declaration_name (tree decl);
 void hsa_register_kernel (cgraph_node *host);
 void hsa_register_kernel (cgraph_node *gpu, cgraph_node *host);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 27ae8e0fe27..bf4814c7aba 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -313,7 +313,6 @@ public:
   inline bool top_p () const;
   inline bool set_to_bottom ();
   bool meet_with (const value_range *p_vr);
-  bool meet_with (const ipcp_vr_lattice &other);
   void init () { m_vr.type = VR_UNDEFINED; }
   void print (FILE * f);
 
@@ -899,12 +898,6 @@ set_agg_lats_contain_variable (struct ipcp_param_lattices *plats)
   return ret;
 }
 
-bool
-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
    lattice.  */
 
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 9564d651b2b..71a5be99bde 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2818,27 +2818,6 @@ vtable_pointer_value_to_vtable (const_tree t, tree *v,
   return true;
 }
 
-/* T is known constant value of virtual table pointer.  Return BINFO of the
-   instance type.  */
-
-tree
-vtable_pointer_value_to_binfo (const_tree t)
-{
-  tree vtable;
-  unsigned HOST_WIDE_INT offset;
-
-  if (!vtable_pointer_value_to_vtable (t, &vtable, &offset))
-    return NULL_TREE;
-
-  /* FIXME: for stores of construction vtables we return NULL,
-     because we do not have BINFO for those. Eventually we should fix
-     our representation to allow this case to be handled, too.
-     In the case we see store of BINFO we however may assume
-     that standard folding will be able to cope with it.  */
-  return subbinfo_with_vtable_at_offset (TYPE_BINFO (DECL_CONTEXT (vtable)),
-					 offset, vtable);
-}
-
 /* Walk bases of OUTER_TYPE that contain OTR_TYPE at OFFSET.
    Look up their respective virtual methods for OTR_TOKEN and OTR_TYPE
    and insert them in NODES.
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index ba39ea36574..d8d551d64ae 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -855,14 +855,6 @@ func_checker::compare_gimple_cond (gimple *s1, gimple *s2)
   return compare_operand (t1, t2);
 }
 
-/* Verifies that tree labels T1 and T2 correspond in FUNC1 and FUNC2.  */
-
-bool
-func_checker::compare_tree_ssa_label (tree t1, tree t2)
-{
-  return compare_operand (t1, t2);
-}
-
 /* Verifies for given GIMPLE_LABEL stmts S1 and S2 that
    label statements are semantically equivalent.  */
 
diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h
index 65dfe69deeb..66c36380d26 100644
--- a/gcc/ipa-icf-gimple.h
+++ b/gcc/ipa-icf-gimple.h
@@ -200,9 +200,6 @@ public:
   /* Verification function for declaration trees T1 and T2.  */
   bool compare_decl (tree t1, tree t2);
 
-  /* Verifies that tree labels T1 and T2 correspond.  */
-  bool compare_tree_ssa_label (tree t1, tree t2);
-
   /* Function compare for equality given memory operands T1 and T2.  */
   bool compare_memory_operand (tree t1, tree t2);
 
@@ -219,10 +216,6 @@ public:
      and compare both TREE_PURPOSEs and TREE_VALUEs.  */
   bool compare_asm_inputs_outputs (tree t1, tree t2);
 
-  /* Verifies that trees T1 and T2, representing function declarations
-     are equivalent from perspective of ICF.  */
-  bool compare_function_decl (tree t1, tree t2);
-
   /* Verifies that trees T1 and T2 do correspond.  */
   bool compare_variable_decl (tree t1, tree t2);
 
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 3c54f8d4b6d..59adb9459a7 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -137,12 +137,6 @@ sem_usage_pair::sem_usage_pair (sem_item *_item, unsigned int _index)
 {
 }
 
-sem_item::sem_item (sem_item_type _type, bitmap_obstack *stack)
-: type (_type), m_hash (-1), m_hash_set (false)
-{
-  setup (stack);
-}
-
 sem_item::sem_item (sem_item_type _type, symtab_node *_node,
 		    bitmap_obstack *stack)
 : type (_type), node (_node), m_hash (-1), m_hash_set (false)
@@ -229,15 +223,6 @@ void sem_item::set_hash (hashval_t hash)
 
 hash_map<const_tree, hashval_t> sem_item::m_type_hash_cache;
 
-/* Semantic function constructor that uses STACK as bitmap memory stack.  */
-
-sem_function::sem_function (bitmap_obstack *stack)
-: sem_item (FUNC, stack), m_checker (NULL), m_compared_func (NULL)
-{
-  bb_sizes.create (0);
-  bb_sorted.create (0);
-}
-
 sem_function::sem_function (cgraph_node *node, bitmap_obstack *stack)
 : sem_item (FUNC, node, stack), m_checker (NULL), m_compared_func (NULL)
 {
@@ -1791,17 +1776,6 @@ sem_function::compare_phi_node (basic_block bb1, basic_block bb2)
   return true;
 }
 
-/* Returns true if tree T can be compared as a handled component.  */
-
-bool
-sem_function::icf_handled_component_p (tree t)
-{
-  tree_code tc = TREE_CODE (t);
-
-  return (handled_component_p (t)
-	  || tc == ADDR_EXPR || tc == MEM_REF || tc == OBJ_TYPE_REF);
-}
-
 /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB
    corresponds to TARGET.  */
 
@@ -1823,10 +1797,6 @@ sem_function::bb_dict_test (vec<int> *bb_dict, int source, int target)
     return (*bb_dict)[source] == target;
 }
 
-sem_variable::sem_variable (bitmap_obstack *stack): sem_item (VAR, stack)
-{
-}
-
 sem_variable::sem_variable (varpool_node *node, bitmap_obstack *stack)
 : sem_item (VAR, node, stack)
 {
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index a64b3852efb..305b23befc4 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -148,10 +148,6 @@ typedef std::pair<symtab_node *, symtab_node *> symtab_pair;
 class sem_item
 {
 public:
-  /* Semantic item constructor for a node of _TYPE, where STACK is used
-     for bitmap memory allocation.  */
-  sem_item (sem_item_type _type, bitmap_obstack *stack);
-
   /* Semantic item constructor for a node of _TYPE, where STACK is used
      for bitmap memory allocation.  The item is based on symtab node _NODE.  */
   sem_item (sem_item_type _type, symtab_node *_node, bitmap_obstack *stack);
@@ -200,10 +196,6 @@ public:
   void update_hash_by_local_refs (hash_map <symtab_node *,
 				  sem_item *> &m_symtab_node_map);
 
-  /* Return base tree that can be used for compatible_types_p and
-     contains_polymorphic_type_p comparison.  */
-  static bool get_base_types (tree *t1, tree *t2);
-
   /* Return true if target supports alias symbols.  */
   bool target_supports_symbol_aliases_p (void);
 
@@ -289,9 +281,6 @@ private:
 class sem_function: public sem_item
 {
 public:
-  /* Semantic function constructor that uses STACK as bitmap memory stack.  */
-  sem_function (bitmap_obstack *stack);
-
   /*  Constructor based on callgraph node _NODE.
       Bitmap STACK is used for memory allocation.  */
   sem_function (cgraph_node *_node, bitmap_obstack *stack);
@@ -384,9 +373,6 @@ private:
   /* Processes function equality comparison.  */
   bool equals_private (sem_item *item);
 
-  /* Returns true if tree T can be compared as a handled component.  */
-  static bool icf_handled_component_p (tree t);
-
   /* Function checker stores binding between functions.   */
   ipa_icf_gimple::func_checker *m_checker;
 
@@ -397,9 +383,6 @@ private:
 class sem_variable: public sem_item
 {
 public:
-  /* Semantic variable constructor that uses STACK as bitmap memory stack.  */
-  sem_variable (bitmap_obstack *stack);
-
   /*  Constructor based on callgraph node _NODE.
       Bitmap STACK is used for memory allocation.  */
 
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 1e3a92a125f..9a631c093ff 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -478,112 +478,6 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
   while (gsi_stmt (gsi) != gsi_stmt (prev_gsi));
 }
 
-/* Return true iff BASE_INDEX is in ADJUSTMENTS more than once.  */
-
-static bool
-index_in_adjustments_multiple_times_p (int base_index,
-				       ipa_parm_adjustment_vec adjustments)
-{
-  int i, len = adjustments.length ();
-  bool one = false;
-
-  for (i = 0; i < len; i++)
-    {
-      struct ipa_parm_adjustment *adj;
-      adj = &adjustments[i];
-
-      if (adj->base_index == base_index)
-	{
-	  if (one)
-	    return true;
-	  else
-	    one = true;
-	}
-    }
-  return false;
-}
-
-/* Return adjustments that should have the same effect on function parameters
-   and call arguments as if they were first changed according to adjustments in
-   INNER and then by adjustments in OUTER.  */
-
-ipa_parm_adjustment_vec
-ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
-			 ipa_parm_adjustment_vec outer)
-{
-  int i, outlen = outer.length ();
-  int inlen = inner.length ();
-  int removals = 0;
-  ipa_parm_adjustment_vec adjustments, tmp;
-
-  tmp.create (inlen);
-  for (i = 0; i < inlen; i++)
-    {
-      struct ipa_parm_adjustment *n;
-      n = &inner[i];
-
-      if (n->op == IPA_PARM_OP_REMOVE)
-	removals++;
-      else
-	{
-	  /* FIXME: Handling of new arguments are not implemented yet.  */
-	  gcc_assert (n->op != IPA_PARM_OP_NEW);
-	  tmp.quick_push (*n);
-	}
-    }
-
-  adjustments.create (outlen + removals);
-  for (i = 0; i < outlen; i++)
-    {
-      struct ipa_parm_adjustment r;
-      struct ipa_parm_adjustment *out = &outer[i];
-      struct ipa_parm_adjustment *in = &tmp[out->base_index];
-
-      memset (&r, 0, sizeof (r));
-      gcc_assert (in->op != IPA_PARM_OP_REMOVE);
-      if (out->op == IPA_PARM_OP_REMOVE)
-	{
-	  if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
-	    {
-	      r.op = IPA_PARM_OP_REMOVE;
-	      adjustments.quick_push (r);
-	    }
-	  continue;
-	}
-      else
-	{
-	  /* FIXME: Handling of new arguments are not implemented yet.  */
-	  gcc_assert (out->op != IPA_PARM_OP_NEW);
-	}
-
-      r.base_index = in->base_index;
-      r.type = out->type;
-
-      /* FIXME:  Create nonlocal value too.  */
-
-      if (in->op == IPA_PARM_OP_COPY && out->op == IPA_PARM_OP_COPY)
-	r.op = IPA_PARM_OP_COPY;
-      else if (in->op == IPA_PARM_OP_COPY)
-	r.offset = out->offset;
-      else if (out->op == IPA_PARM_OP_COPY)
-	r.offset = in->offset;
-      else
-	r.offset = in->offset + out->offset;
-      adjustments.quick_push (r);
-    }
-
-  for (i = 0; i < inlen; i++)
-    {
-      struct ipa_parm_adjustment *n = &inner[i];
-
-      if (n->op == IPA_PARM_OP_REMOVE)
-	adjustments.quick_push (*n);
-    }
-
-  tmp.release ();
-  return adjustments;
-}
-
 /* If T is an SSA_NAME, return NULL if it is not a default def or
    return its base variable if it is.  If IGNORE_DEFAULT_DEF is true,
    the base variable is always returned, regardless if it is a default
diff --git a/gcc/ipa-param-manipulation.h b/gcc/ipa-param-manipulation.h
index 84bc42d5196..51c4a84ddb6 100644
--- a/gcc/ipa-param-manipulation.h
+++ b/gcc/ipa-param-manipulation.h
@@ -108,8 +108,6 @@ vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
 void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
 void ipa_modify_call_arguments (struct cgraph_edge *, gcall *,
 				ipa_parm_adjustment_vec);
-ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
-						 ipa_parm_adjustment_vec);
 void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
 
 bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 55e10cf0f27..450720db1c8 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -680,8 +680,6 @@ extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum
 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
 
 /* Creating and freeing ipa_node_params and ipa_edge_args.  */
-void ipa_create_all_node_params (void);
-void ipa_create_all_edge_args (void);
 void ipa_check_create_edge_args (void);
 void ipa_free_all_node_params (void);
 void ipa_free_all_edge_args (void);
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 4e22d85ac03..69fdf933aec 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -72,14 +72,6 @@ typedef struct ipa_ref *ipa_ref_ptr;
 struct GTY(()) ipa_ref_list
 {
 public:
-  /* Return first reference in list or NULL if empty.  */
-  struct ipa_ref *first_reference (void)
-  {
-    if (!vec_safe_length (references))
-      return NULL;
-    return &(*references)[0];
-  }
-
   /* Return first referring ref in list or NULL if empty.  */
   struct ipa_ref *first_referring (void)
   {
@@ -108,12 +100,6 @@ public:
     return i == 0 ? NULL : referring[i - 1];
   }
 
-  /* Return true if the symbol has an alias.  */
-  bool inline has_aliases_p (void)
-  {
-    return first_alias ();
-  }
-
   /* Clear reference list.  */
   void clear (void)
   {
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index 98f2a75cd81..75f39bf00ed 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -74,7 +74,6 @@ bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT,
 tree polymorphic_ctor_dtor_p (tree, bool);
 tree inlined_polymorphic_ctor_dtor_block_p (tree, bool);
 bool decl_maybe_in_construction_p (tree, tree, gimple *, tree);
-tree vtable_pointer_value_to_binfo (const_tree);
 bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT *);
 tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree);
 void compare_virtual_tables (varpool_node *, varpool_node *);
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index f4d340ff5a3..b8018bad4c7 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -375,18 +375,6 @@ lto_new_in_decl_state (void)
   return ggc_cleared_alloc<lto_in_decl_state> ();
 }
 
-/* Delete STATE and its components. */
-
-void
-lto_delete_in_decl_state (struct lto_in_decl_state *state)
-{
-  int i;
-
-  for (i = 0; i < LTO_N_DECL_STREAMS; i++)
-    vec_free (state->streams[i]);
-  ggc_free (state);
-}
-
 /* Search the in-decl state of a function FUNC contained in the file
    associated with FILE_DATA.  Return NULL if not found.  */
 
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 4ddcc8f7ddd..d0c32fa8e98 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -81,19 +81,6 @@ lto_tag_check_set (enum LTO_tags actual, int ntags, ...)
 }
 
 
-/* Read LENGTH bytes from STREAM to ADDR.  */
-
-void
-lto_input_data_block (struct lto_input_block *ib, void *addr, size_t length)
-{
-  size_t i;
-  unsigned char *const buffer = (unsigned char *) addr;
-
-  for (i = 0; i < length; i++)
-    buffer[i] = streamer_read_uchar (ib);
-}
-
-
 /* Lookup STRING in file_name_hash_table.  If found, return the existing
    string, otherwise insert STRING as the canonical version.  */
 
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index f51d6657461..93b207a97d8 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -273,16 +273,6 @@ lto_streamer_init (void)
 }
 
 
-/* Gate function for all LTO streaming passes.  */
-
-bool
-gate_lto_out (void)
-{
-  return ((flag_generate_lto || flag_generate_offload || in_lto_p)
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !seen_error ());
-}
-
 /* Check that the version MAJOR.MINOR is the correct version number.  */
 
 void
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index dd279f6762b..95fcb30b0ae 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -772,7 +772,6 @@ extern void lto_record_renamed_decl (struct lto_file_decl_data *,
 extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *,
 					      const char *);
 extern struct lto_in_decl_state *lto_new_in_decl_state (void);
-extern void lto_delete_in_decl_state (struct lto_in_decl_state *);
 extern struct lto_in_decl_state *lto_get_function_in_decl_state (
 				      struct lto_file_decl_data *, tree);
 extern void lto_free_function_in_decl_state (struct lto_in_decl_state *);
@@ -827,7 +826,6 @@ extern void lto_bitmap_free (bitmap);
 extern char *lto_get_section_name (int, const char *, struct lto_file_decl_data *);
 extern void print_lto_report (const char *);
 extern void lto_streamer_init (void);
-extern bool gate_lto_out (void);
 extern void lto_check_version (int, int, const char *);
 extern void lto_streamer_hooks_init (void);
 
@@ -848,7 +846,6 @@ extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
 				    const char *, unsigned,
 				    vec<ld_plugin_symbol_resolution_t> );
 extern void lto_data_in_delete (struct data_in *);
-extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
 void lto_input_location (location_t *, struct bitpack_d *, struct data_in *);
 location_t stream_input_location_now (struct bitpack_d *bp,
 				      struct data_in *data);
diff --git a/gcc/predict.c b/gcc/predict.c
index ab2dc8ed031..14577a21683 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -516,13 +516,6 @@ edge_predicted_by_p (edge e, enum br_predictor predictor, bool taken)
   return false;
 }
 
-/* Same predicate as above, working on edges.  */
-bool
-edge_probability_reliable_p (const_edge e)
-{
-  return e->probability.probably_reliable_p ();
-}
-
 /* Same predicate as edge_probability_reliable_p, working on notes.  */
 bool
 br_prob_note_reliable_p (const_rtx note)
diff --git a/gcc/predict.h b/gcc/predict.h
index e4d1da090ca..7a3c370e460 100644
--- a/gcc/predict.h
+++ b/gcc/predict.h
@@ -78,7 +78,6 @@ extern void rtl_profile_for_edge (edge);
 extern void default_rtl_profile (void);
 extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
 extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor);
-extern bool edge_probability_reliable_p (const_edge);
 extern bool br_prob_note_reliable_p (const_rtx);
 extern void predict_insn_def (rtx_insn *, enum br_predictor, enum prediction);
 extern void rtl_predict_edge (edge, enum br_predictor, int);
diff --git a/gcc/read-md.c b/gcc/read-md.c
index 174e471a8db..84b68f8a8be 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -531,22 +531,6 @@ md_reader::read_name (struct md_name *name)
   return loc;
 }
 
-file_location
-md_reader::read_name_or_nil (struct md_name *name)
-{
-  file_location loc;
-  if (!read_name_1 (name, &loc))
-    {
-      file_location loc = get_current_location ();
-      read_skip_construct (0, loc);
-      /* Skip the ')'.  */
-      read_char ();
-      name->buffer[0] = 0;
-      name->string = name->buffer;
-    }
-  return loc;
-}
-
 /* Subroutine of the string readers.  Handles backslash escapes.
    Caller has read the backslash, but not placed it into the obstack.  */
 
diff --git a/gcc/read-md.h b/gcc/read-md.h
index 56d54314f11..c788ac676c6 100644
--- a/gcc/read-md.h
+++ b/gcc/read-md.h
@@ -171,7 +171,6 @@ class md_reader
   int read_char (void);
   void unread_char (int ch);
   file_location read_name (struct md_name *name);
-  file_location read_name_or_nil (struct md_name *);
   void read_escape ();
   char *read_quoted_string ();
   char *read_braced_string ();
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 68d3ceab29f..58cb6b4dedb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3199,7 +3199,6 @@ extern rtx convert_memory_address_addr_space (scalar_int_mode, rtx,
 	convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
 extern const char *get_insn_name (int);
 extern rtx_insn *get_last_insn_anywhere (void);
-extern rtx_insn *get_first_nonnote_insn (void);
 extern rtx_insn *get_last_nonnote_insn (void);
 extern void start_sequence (void);
 extern void push_to_sequence (rtx_insn *);
@@ -3232,16 +3231,9 @@ extern rtx_insn *emit_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
 extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx_insn *);
-extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
-extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *,
-						    location_t);
-extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx_insn *, location_t);
-extern rtx_barrier *emit_barrier_before (rtx_insn *);
 extern rtx_code_label *emit_label_before (rtx_code_label *, rtx_insn *);
 extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
 extern rtx_insn *emit_insn_after (rtx, rtx_insn *);
@@ -3251,8 +3243,6 @@ extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_call_insn_after (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx_insn *);
-extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_debug_insn_after (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx_insn *, location_t);
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 98f3ceea872..4c5a89eaa61 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -93,11 +93,6 @@ extern bool set_src_pwd		       (const char *);
 extern HOST_WIDE_INT get_random_seed (bool);
 extern void set_random_seed (const char *);
 
-extern unsigned int min_align_loops_log;
-extern unsigned int min_align_jumps_log;
-extern unsigned int min_align_labels_log;
-extern unsigned int min_align_functions_log;
-
 extern void parse_alignment_opts (void);
 
 extern void initialize_rtl (void);
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 29caab71154..64f21419726 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -184,10 +184,6 @@ struct eni_weights
   bool time_based;
 };
 
-/* Weights that estimate_num_insns uses for heuristics in inlining.  */
-
-extern eni_weights eni_inlining_weights;
-
 /* Weights that estimate_num_insns uses to estimate the size of the
    produced code.  */
 
-- 
2.19.0


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

* Re: [PATCH] Remove dead functions and fix VMS target by moving back some functions.
  2018-10-10 11:13                           ` Martin Liška
@ 2018-10-10 11:17                             ` Martin Jambor
  0 siblings, 0 replies; 25+ messages in thread
From: Martin Jambor @ 2018-10-10 11:17 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

Hi,

On Wed, Oct 10 2018, Martin Liška wrote:
> On 10/9/18 10:34 PM, Martin Jambor wrote:
>> On Tue, Oct 09 2018, Martin Liška wrote:
>>> 	* ipa-cp.c (ipcp_vr_lattice::meet_with): Likewise.
>> 
>> Interesting, I believe that a class representing a lattice should have a
>> meet function with its own type.
>
> I've just tried to put gcc_unreachable there, but can't find anything that
> would trigger an ICE.

Well, I was not saying it is not unused, I was just wondering how that
happened.  And after having another look, the answer is that the caller
needs to decide which data to meet according to the return value of
ipa_vr_operation_and_type_effects and so the call to
ipa_vr_operation_and_type_effects cannot be nicely moved into the meet
function, even though that's where seems to belong.

So I guess removing this meet overload is OK, even though strange.

Martin

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-09-24  7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
  2018-09-24 14:42   ` Jeff Law
@ 2018-10-18 23:55   ` Ian Lance Taylor
  2018-10-22 13:05     ` Martin Liška
  1 sibling, 1 reply; 25+ messages in thread
From: Ian Lance Taylor @ 2018-10-18 23:55 UTC (permalink / raw)
  To: marxin; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

On Sat, Sep 22, 2018 at 12:08 PM, marxin <mliska@suse.cz> wrote:
>
> gcc/go/ChangeLog:
>
> 2018-09-24  Martin Liska  <mliska@suse.cz>
>
>         * gofrontend/escape.cc (Gogo::analyze_escape): Remove
>         usage of a parameter.
>         (Gogo::assign_connectivity): Likewise.
>         (class Escape_analysis_tag): Likewise.
>         (Gogo::tag_function): Likewise.
>         * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>         * gofrontend/gogo.h (class Gogo): Likewise.
>         * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>         (Type::make_call_multiple_result_type): Likewise.
>         * gofrontend/types.h (class Type): Likewise.
>         * gofrontend/wb.cc (class Check_escape): Likewise.
>         (Gogo::add_write_barriers): Likewise.

HI, unfortunately this is wrong.  As described in
gcc/go/gofrontend/README, the files in that directory are mirrored
from a separate repository (the same is true of the files in the libgo
directory).  You should not make changes to them directly in the GCC
repository.  I have reverted these changes, as follows.  Sorry.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 5463 bytes --]

Index: gcc/go/gofrontend/escape.cc
===================================================================
--- gcc/go/gofrontend/escape.cc	(revision 265293)
+++ gcc/go/gofrontend/escape.cc	(working copy)
@@ -979,7 +979,7 @@ Gogo::analyze_escape()
       for (std::vector<Named_object*>::iterator fn = stack.begin();
            fn != stack.end();
            ++fn)
-	this->tag_function(*fn);
+        this->tag_function(context, *fn);
 
       if (this->debug_escape_level() != 0)
 	{
@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*,
 class Escape_analysis_assign : public Traverse
 {
 public:
-  Escape_analysis_assign(Escape_context* context)
+  Escape_analysis_assign(Escape_context* context, Named_object* fn)
     : Traverse(traverse_statements
 	       | traverse_expressions),
-      context_(context)
+      context_(context), fn_(fn)
   { }
 
   // Model statements within a function as assignments and flows between nodes.
@@ -1272,6 +1272,8 @@ public:
 private:
   // The escape context for this set of functions.
   Escape_context* context_;
+  // The current function being analyzed.
+  Named_object* fn_;
 };
 
 // Helper function to detect self assignment like the following.
@@ -2702,7 +2704,7 @@ Gogo::assign_connectivity(Escape_context
   int save_depth = context->loop_depth();
   context->set_loop_depth(1);
 
-  Escape_analysis_assign ea(context);
+  Escape_analysis_assign ea(context, fn);
   Function::Results* res = fn->func_value()->result_variables();
   if (res != NULL)
     {
@@ -3265,13 +3267,17 @@ Gogo::propagate_escape(Escape_context* c
 class Escape_analysis_tag
 {
  public:
-  Escape_analysis_tag()
+  Escape_analysis_tag(Escape_context* context)
+    : context_(context)
   { }
 
   // Add notes to the function's type about the escape information of its
   // input parameters.
   void
   tag(Named_object* fn);
+
+ private:
+  Escape_context* context_;
 };
 
 void
@@ -3379,9 +3385,9 @@ Escape_analysis_tag::tag(Named_object* f
 // retain analysis results across imports.
 
 void
-Gogo::tag_function(Named_object* fn)
+Gogo::tag_function(Escape_context* context, Named_object* fn)
 {
-  Escape_analysis_tag eat;
+  Escape_analysis_tag eat(context);
   eat.tag(fn);
 }
 
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 265293)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -10108,7 +10108,7 @@ Call_expression::do_type()
   else if (results->size() == 1)
     ret = results->begin()->type();
   else
-    ret = Type::make_call_multiple_result_type();
+    ret = Type::make_call_multiple_result_type(this);
 
   this->type_ = ret;
 
Index: gcc/go/gofrontend/gogo.h
===================================================================
--- gcc/go/gofrontend/gogo.h	(revision 265287)
+++ gcc/go/gofrontend/gogo.h	(working copy)
@@ -680,7 +680,7 @@ class Gogo
   // Add notes about the escape level of a function's input and output
   // parameters for exporting and importing top level functions. 
   void
-  tag_function(Named_object*);
+  tag_function(Escape_context*, Named_object*);
 
   // Reclaim memory of escape analysis Nodes.
   void
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 265293)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -5441,8 +5441,9 @@ Type::make_nil_type()
 class Call_multiple_result_type : public Type
 {
  public:
-  Call_multiple_result_type()
-    : Type(TYPE_CALL_MULTIPLE_RESULT)
+  Call_multiple_result_type(Call_expression* call)
+    : Type(TYPE_CALL_MULTIPLE_RESULT),
+      call_(call)
   { }
 
  protected:
@@ -5475,14 +5476,18 @@ class Call_multiple_result_type : public
   void
   do_mangled_name(Gogo*, std::string*) const
   { go_assert(saw_errors()); }
+
+ private:
+  // The expression being called.
+  Call_expression* call_;
 };
 
 // Make a call result type.
 
 Type*
-Type::make_call_multiple_result_type()
+Type::make_call_multiple_result_type(Call_expression* call)
 {
-  return new Call_multiple_result_type();
+  return new Call_multiple_result_type(call);
 }
 
 // Class Struct_field.
Index: gcc/go/gofrontend/types.h
===================================================================
--- gcc/go/gofrontend/types.h	(revision 265293)
+++ gcc/go/gofrontend/types.h	(working copy)
@@ -511,7 +511,7 @@ class Type
   make_nil_type();
 
   static Type*
-  make_call_multiple_result_type();
+  make_call_multiple_result_type(Call_expression*);
 
   static Struct_type*
   make_struct_type(Struct_field_list* fields, Location);
Index: gcc/go/gofrontend/wb.cc
===================================================================
--- gcc/go/gofrontend/wb.cc	(revision 265293)
+++ gcc/go/gofrontend/wb.cc	(working copy)
@@ -189,8 +189,9 @@ Mark_address_taken::expression(Expressio
 class Check_escape : public Traverse
 {
  public:
-  Check_escape()
-    : Traverse(traverse_expressions | traverse_variables)
+  Check_escape(Gogo* gogo)
+    : Traverse(traverse_expressions | traverse_variables),
+      gogo_(gogo)
   { }
 
   int
@@ -198,6 +199,9 @@ class Check_escape : public Traverse
 
   int
   variable(Named_object*);
+
+ private:
+  Gogo* gogo_;
 };
 
 int
@@ -617,7 +621,7 @@ Gogo::add_write_barriers()
     {
       this->propagate_writebarrierrec();
 
-      Check_escape chk;
+      Check_escape chk(this);
       this->traverse(&chk);
     }
 

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-10-18 23:55   ` [PATCH 2/4] Remove unused functions and fields Ian Lance Taylor
@ 2018-10-22 13:05     ` Martin Liška
  2018-10-22 17:50       ` Ian Lance Taylor
  0 siblings, 1 reply; 25+ messages in thread
From: Martin Liška @ 2018-10-22 13:05 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches

On 10/19/18 1:02 AM, Ian Lance Taylor wrote:
> On Sat, Sep 22, 2018 at 12:08 PM, marxin <mliska@suse.cz> wrote:
>>
>> gcc/go/ChangeLog:
>>
>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>
>>         * gofrontend/escape.cc (Gogo::analyze_escape): Remove
>>         usage of a parameter.
>>         (Gogo::assign_connectivity): Likewise.
>>         (class Escape_analysis_tag): Likewise.
>>         (Gogo::tag_function): Likewise.
>>         * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>>         * gofrontend/gogo.h (class Gogo): Likewise.
>>         * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>>         (Type::make_call_multiple_result_type): Likewise.
>>         * gofrontend/types.h (class Type): Likewise.
>>         * gofrontend/wb.cc (class Check_escape): Likewise.
>>         (Gogo::add_write_barriers): Likewise.
> 
> HI, unfortunately this is wrong.  As described in
> gcc/go/gofrontend/README, the files in that directory are mirrored
> from a separate repository (the same is true of the files in the libgo
> directory).  You should not make changes to them directly in the GCC
> repository.  I have reverted these changes, as follows.  Sorry.
> 
> Ian
> 

Hi Ian.

Got it. Is it possible that the removed chunks of code are somehow alive
in original repository in some conditional build?

Martin

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

* Re: [PATCH 2/4] Remove unused functions and fields.
  2018-10-22 13:05     ` Martin Liška
@ 2018-10-22 17:50       ` Ian Lance Taylor
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Lance Taylor @ 2018-10-22 17:50 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Mon, Oct 22, 2018 at 5:00 AM, Martin Liška <mliska@suse.cz> wrote:
> On 10/19/18 1:02 AM, Ian Lance Taylor wrote:
>> On Sat, Sep 22, 2018 at 12:08 PM, marxin <mliska@suse.cz> wrote:
>>>
>>> gcc/go/ChangeLog:
>>>
>>> 2018-09-24  Martin Liska  <mliska@suse.cz>
>>>
>>>         * gofrontend/escape.cc (Gogo::analyze_escape): Remove
>>>         usage of a parameter.
>>>         (Gogo::assign_connectivity): Likewise.
>>>         (class Escape_analysis_tag): Likewise.
>>>         (Gogo::tag_function): Likewise.
>>>         * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
>>>         * gofrontend/gogo.h (class Gogo): Likewise.
>>>         * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
>>>         (Type::make_call_multiple_result_type): Likewise.
>>>         * gofrontend/types.h (class Type): Likewise.
>>>         * gofrontend/wb.cc (class Check_escape): Likewise.
>>>         (Gogo::add_write_barriers): Likewise.
>>
>> HI, unfortunately this is wrong.  As described in
>> gcc/go/gofrontend/README, the files in that directory are mirrored
>> from a separate repository (the same is true of the files in the libgo
>> directory).  You should not make changes to them directly in the GCC
>> repository.  I have reverted these changes, as follows.  Sorry.
>>
>> Ian
>>
>
> Hi Ian.
>
> Got it. Is it possible that the removed chunks of code are somehow alive
> in original repository in some conditional build?

No, I doubt it, but I'd also want to consider the changes separately.
There is benefit to consistency even if it leads to unused variables.

Ian

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

end of thread, other threads:[~2018-10-22 15:36 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24  7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
2018-09-24  7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
2018-09-24 14:45   ` Jeff Law
2018-09-24  7:37 ` [PATCH 3/4] Fix small coding style issues (PR fortran/87394) marxin
2018-09-24 14:39   ` Jeff Law
2018-09-24  7:37 ` [PATCH 4/4] Fix scaling of a sreal number marxin
2018-09-24 14:42   ` Jeff Law
2018-09-24  7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
2018-09-24 14:42   ` Jeff Law
2018-09-25  7:18     ` Martin Liška
2018-09-25 12:31       ` Richard Biener
2018-09-25 13:40         ` Jeff Law
2018-09-26  9:01           ` Martin Liška
2018-09-27 11:18             ` Bernhard Reutner-Fischer
2018-10-03 16:46               ` Jeff Law
2018-10-03 19:35                 ` Bernhard Reutner-Fischer
2018-10-05  2:19                   ` Bernhard Reutner-Fischer
2018-10-05 13:41                     ` Martin Liška
2018-10-09  8:52                       ` [PATCH] Remove dead functions and fix VMS target by moving back some functions Martin Liška
2018-10-09 22:53                         ` Martin Jambor
2018-10-10 11:13                           ` Martin Liška
2018-10-10 11:17                             ` Martin Jambor
2018-10-18 23:55   ` [PATCH 2/4] Remove unused functions and fields Ian Lance Taylor
2018-10-22 13:05     ` Martin Liška
2018-10-22 17:50       ` Ian Lance Taylor

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).