Hello.

We repeat all over following patterns:

              fprintf (dump_file, "Removing speculative call %s/%i => %s/%i\n",
                       xstrdup_for_dump (edge->caller->name ()),
                       edge->caller->order,
                       xstrdup_for_dump (e2->callee->name ()),
                       e2->callee->order);

As we already wrap name() and asm_name() with xstrdup_for_dump and the pattern
of 'name/order' is very common, I suggest to come up with helper functions that
do that.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin
>From 42a746e3db58e24cbd3a4b45ab3f9150fad44928 Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Fri, 19 May 2017 14:09:25 +0200
Subject: [PATCH] Introduce symtab_node::dump_{asm_,}name functions.

gcc/ChangeLog:

2017-05-19  Martin Liska  <mli...@suse.cz>

	* cgraph.c (cgraph_node::get_create): Use symtab_node::dump_{asm_,}name
	functions.
	(cgraph_edge::make_speculative): Likewise.
	(cgraph_edge::resolve_speculation): Likewise.
	(cgraph_edge::redirect_call_stmt_to_callee): Likewise.
	(cgraph_node::dump): Likewise.
	* cgraph.h: Likewise.
	* cgraphunit.c (analyze_functions): Likewise.
	(symbol_table::compile): Likewise.
	* ipa-cp.c (print_all_lattices): Likewise.
	(determine_versionability): Likewise.
	(initialize_node_lattices): Likewise.
	(ipcp_verify_propagated_values): Likewise.
	(estimate_local_effects): Likewise.
	(update_profiling_info): Likewise.
	(create_specialized_node): Likewise.
	(perhaps_add_new_callers): Likewise.
	(decide_about_value): Likewise.
	(decide_whether_version_node): Likewise.
	(identify_dead_nodes): Likewise.
	(ipcp_store_bits_results): Likewise.
	* ipa-devirt.c (dump_targets): Likewise.
	(ipa_devirt): Likewise.
	* ipa-icf.c (sem_item::dump): Likewise.
	(sem_function::equals): Likewise.
	(sem_variable::equals): Likewise.
	(sem_item_optimizer::read_section): Likewise.
	(sem_item_optimizer::execute): Likewise.
	(congruence_class::dump): Likewise.
	* ipa-inline-analysis.c (dump_ipa_call_summary): Likewise.
	(dump_inline_summary): Likewise.
	(estimate_node_size_and_time): Likewise.
	(inline_analyze_function): Likewise.
	* ipa-inline-transform.c (inline_call): Likewise.
	* ipa-inline.c (report_inline_failed_reason): Likewise.
	(want_early_inline_function_p): Likewise.
	(edge_badness): Likewise.
	(update_edge_key): Likewise.
	(inline_small_functions): Likewise.
	* ipa-profile.c (ipa_profile): Likewise.
	* ipa-prop.c (ipa_print_node_jump_functions): Likewise.
	(ipa_make_edge_direct_to_target): Likewise.
	(remove_described_reference): Likewise.
	(ipa_impossible_devirt_target): Likewise.
	(propagate_controlled_uses): Likewise.
	(ipa_print_node_params): Likewise.
	(ipcp_transform_function): Likewise.
	* ipa-pure-const.c (pure_const_read_summary): Likewise.
	(propagate_pure_const): Likewise.
	* ipa-reference.c (generate_summary): Likewise.
	(read_write_all_from_decl): Likewise.
	(propagate): Likewise.
	(ipa_reference_read_optimization_summary): Likewise.
	* ipa-utils.c (ipa_merge_profiles): Likewise.
	* ipa.c (walk_polymorphic_call_targets): Likewise.
	(symbol_table::remove_unreachable_nodes): Likewise.
	(ipa_single_use): Likewise.
	* passes.c (execute_todo): Likewise.
	* predict.c (drop_profile): Likewise.
	* symtab.c (symtab_node::get_dump_name): New function.
	(symtab_node::dump_name): Likewise.
	(symtab_node::dump_asm_name): Likewise.
	(symtab_node::dump_references): Likewise.
	(symtab_node::dump_referring): Likewise.
	(symtab_node::dump_base): Likewise.
	(symtab_node::debug_symtab): Likewise.
	* tree-sra.c (convert_callers_for_node): Likewise.
	* tree-ssa-structalias.c (ipa_pta_execute): Likewise.
	* value-prof.c (init_node_map): Likewise.

gcc/lto/ChangeLog:

2017-05-19  Martin Liska  <mli...@suse.cz>

	* lto-symtab.c (lto_cgraph_replace_node): Use
	symtab_node::dump_{asm_,}name functions.
	* lto.c (read_cgraph_and_symbols): Likewise.
	(do_whole_program_analysis): Likewise.
---
 gcc/cgraph.c               | 75 ++++++++++++++------------------------
 gcc/cgraph.h               | 11 +++++-
 gcc/ipa-cp.c               | 51 +++++++++++---------------
 gcc/ipa-devirt.c           | 15 ++++----
 gcc/ipa-icf.c              | 31 ++++++----------
 gcc/ipa-inline-analysis.c  | 15 ++++----
 gcc/ipa-inline-transform.c |  8 ++---
 gcc/ipa-inline.c           | 63 ++++++++++++++------------------
 gcc/ipa-profile.c          |  6 ++--
 gcc/ipa-prop.c             | 90 +++++++++++++++++++---------------------------
 gcc/ipa-pure-const.c       | 15 +++-----
 gcc/ipa-reference.c        | 27 ++++++--------
 gcc/ipa-utils.c            |  5 ++-
 gcc/ipa.c                  | 20 +++++------
 gcc/lto/lto-symtab.c       |  7 ++--
 gcc/predict.c              | 14 ++++----
 gcc/symtab.c               | 42 ++++++++++++++++------
 gcc/tree-sra.c             |  7 ++--
 gcc/value-prof.c           | 19 ++++------
 19 files changed, 229 insertions(+), 292 deletions(-)

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 10ba987701c..a1831db9f36 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -539,12 +539,12 @@ cgraph_node::get_create (tree decl)
       node->decl->decl_with_vis.symtab_node = node;
       if (dump_file)
 	fprintf (dump_file, "Introduced new external node "
-		 "(%s/%i) and turned into root of the clone tree.\n",
-		 node->name (), node->order);
+		 "(%s) and turned into root of the clone tree.\n",
+		 node->dump_name ());
     }
   else if (dump_file)
     fprintf (dump_file, "Introduced new external node "
-	     "(%s/%i).\n", node->name (), node->order);
+	     "(%s).\n", node->dump_name ());
   return node;
 }
 
@@ -1055,12 +1055,8 @@ cgraph_edge::make_speculative (cgraph_node *n2, gcov_type direct_count,
   cgraph_edge *e2;
 
   if (dump_file)
-    {
-      fprintf (dump_file, "Indirect call -> speculative call"
-	       " %s/%i => %s/%i\n",
-	       xstrdup_for_dump (n->name ()), n->order,
-	       xstrdup_for_dump (n2->name ()), n2->order);
-    }
+    fprintf (dump_file, "Indirect call -> speculative call %s => %s\n",
+	     n->dump_name (), n2->dump_name ());
   speculative = true;
   e2 = n->create_edge (n2, call_stmt, direct_count, direct_frequency);
   initialize_inline_failed (e2);
@@ -1163,22 +1159,18 @@ cgraph_edge::resolve_speculation (tree callee_decl)
 	{
 	  if (callee_decl)
 	    {
-	      fprintf (dump_file, "Speculative indirect call %s/%i => %s/%i has "
+	      fprintf (dump_file, "Speculative indirect call %s => %s has "
 		       "turned out to have contradicting known target ",
-		       xstrdup_for_dump (edge->caller->name ()),
-		       edge->caller->order,
-		       xstrdup_for_dump (e2->callee->name ()),
-		       e2->callee->order);
+		       edge->caller->dump_name (),
+		       e2->callee->dump_name ());
 	      print_generic_expr (dump_file, callee_decl);
 	      fprintf (dump_file, "\n");
 	    }
 	  else
 	    {
-	      fprintf (dump_file, "Removing speculative call %s/%i => %s/%i\n",
-		       xstrdup_for_dump (edge->caller->name ()),
-		       edge->caller->order,
-		       xstrdup_for_dump (e2->callee->name ()),
-		       e2->callee->order);
+	      fprintf (dump_file, "Removing speculative call %s => %s\n",
+		       edge->caller->dump_name (),
+		       e2->callee->dump_name ());
 	    }
 	}
     }
@@ -1295,12 +1287,10 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
 						  true))
 	{
 	  if (dump_file)
-	    fprintf (dump_file, "Not expanding speculative call of %s/%i -> %s/%i\n"
+	    fprintf (dump_file, "Not expanding speculative call of %s -> %s\n"
 		     "Type mismatch.\n",
-		     xstrdup_for_dump (e->caller->name ()),
-		     e->caller->order,
-		     xstrdup_for_dump (e->callee->name ()),
-		     e->callee->order);
+		     e->caller->dump_name (),
+		     e->callee->dump_name ());
 	  e = e->resolve_speculation ();
 	  /* We are producing the final function body and will throw away the
 	     callgraph edges really soon.  Reset the counts/frequencies to
@@ -1314,12 +1304,10 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
 	{
 	  if (dump_file)
 	    fprintf (dump_file,
-		     "Expanding speculative call of %s/%i -> %s/%i count: "
+		     "Expanding speculative call of %s -> %s count: "
 		     "%" PRId64"\n",
-		     xstrdup_for_dump (e->caller->name ()),
-		     e->caller->order,
-		     xstrdup_for_dump (e->callee->name ()),
-		     e->callee->order,
+		     e->caller->dump_name (),
+		     e->callee->dump_name (),
 		     (int64_t)e->count);
 	  gcc_assert (e2->speculative);
 	  push_cfun (DECL_STRUCT_FUNCTION (e->caller->decl));
@@ -1399,9 +1387,8 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
 
   if (symtab->dump_file)
     {
-      fprintf (symtab->dump_file, "updating call of %s/%i -> %s/%i: ",
-	       xstrdup_for_dump (e->caller->name ()), e->caller->order,
-	       xstrdup_for_dump (e->callee->name ()), e->callee->order);
+      fprintf (symtab->dump_file, "updating call of %s -> %s: ",
+	       e->caller->dump_name (), e->callee->dump_name ());
       print_gimple_stmt (symtab->dump_file, e->call_stmt, 0, dump_flags);
       if (e->callee->clone.combined_args_to_skip)
 	{
@@ -2064,15 +2051,11 @@ cgraph_node::dump (FILE *f)
   dump_base (f);
 
   if (global.inlined_to)
-    fprintf (f, "  Function %s/%i is inline copy in %s/%i\n",
-	     xstrdup_for_dump (name ()),
-	     order,
-	     xstrdup_for_dump (global.inlined_to->name ()),
-	     global.inlined_to->order);
+    fprintf (f, "  Function %s is inline copy in %s\n",
+	     dump_name (),
+	     global.inlined_to->dump_name ());
   if (clone_of)
-    fprintf (f, "  Clone of %s/%i\n",
-	     clone_of->asm_name (),
-	     clone_of->order);
+    fprintf (f, "  Clone of %s\n", clone_of->dump_asm_name ());
   if (symtab->function_flags_ready)
     fprintf (f, "  Availability: %s\n",
 	     cgraph_availability_names [get_availability ()]);
@@ -2088,14 +2071,12 @@ cgraph_node::dump (FILE *f)
       if (vi->prev != NULL)
 	{
 	  fprintf (f, "prev: ");
-	  fprintf (f, "%s/%i ", vi->prev->this_node->asm_name (),
-		   vi->prev->this_node->order);
+	  fprintf (f, "%s ", vi->prev->this_node->dump_asm_name ());
 	}
       if (vi->next != NULL)
 	{
 	  fprintf (f, "next: ");
-	  fprintf (f, "%s/%i ", vi->next->this_node->asm_name (),
-		   vi->next->this_node->order);
+	  fprintf (f, "%s ", vi->next->this_node->dump_asm_name ());
 	}
       if (vi->dispatcher_resolver != NULL_TREE)
 	fprintf (f, "dispatcher: %s",
@@ -2184,16 +2165,14 @@ cgraph_node::dump (FILE *f)
 
   for (edge = callers; edge; edge = edge->next_caller)
     {
-      fprintf (f, "%s/%i ", edge->caller->asm_name (),
-	       edge->caller->order);
+      fprintf (f, "%s ", edge->caller->dump_name ());
       edge->dump_edge_flags (f);
     }
 
   fprintf (f, "\n  Calls: ");
   for (edge = callees; edge; edge = edge->next_callee)
     {
-      fprintf (f, "%s/%i ", edge->callee->asm_name (),
-	       edge->callee->order);
+      fprintf (f, "%s ", edge->callee->dump_name ());
       edge->dump_edge_flags (f);
     }
   fprintf (f, "\n");
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index c630b9e623a..5fc4b308e30 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -99,8 +99,14 @@ public:
   /* Return name.  */
   const char *name () const;
 
+  /* Return dump name.  */
+  const char *dump_name () const;
+
   /* Return asm name.  */
-  const char * asm_name () const;
+  const char *asm_name () const;
+
+  /* Return dump name with assembler name.  */
+  const char *dump_asm_name () const;
 
   /* Add node into symbol table.  This function is not used directly, but via
      cgraph/varpool node creation routines.  */
@@ -598,6 +604,9 @@ private:
   /* Worker for ultimate_alias_target.  */
   symtab_node *ultimate_alias_target_1 (enum availability *avail = NULL,
 					symtab_node *ref = NULL);
+
+  /* Get dump name with normal or assembly name.  */
+  const char *get_dump_name (bool asm_name_p) const;
 };
 
 inline void
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 676f555718e..e74063ff983 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -539,8 +539,7 @@ print_all_lattices (FILE * f, bool dump_sources, bool dump_benefits)
       struct ipa_node_params *info;
 
       info = IPA_NODE_REF (node);
-      fprintf (f, "  Node: %s/%i:\n", node->name (),
-	       node->order);
+      fprintf (f, "  Node: %s:\n", node->dump_name ());
       count = ipa_get_param_count (info);
       for (i = 0; i < count; i++)
 	{
@@ -622,8 +621,8 @@ determine_versionability (struct cgraph_node *node,
     }
 
   if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
-    fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n",
-	     node->name (), node->order, reason);
+    fprintf (dump_file, "Function %s is not versionable, reason: %s.\n",
+	     node->dump_name (), reason);
 
   info->versionable = (reason == NULL);
 }
@@ -1195,9 +1194,8 @@ initialize_node_lattices (struct cgraph_node *node)
 	}
       if (dump_file && (dump_flags & TDF_DETAILS)
 	  && !node->alias && !node->thunk.thunk_p)
-	fprintf (dump_file, "Marking all lattices of %s/%i as %s\n",
-		 node->name (), node->order,
-		 disable ? "BOTTOM" : "VARIABLE");
+	fprintf (dump_file, "Marking all lattices of %s as %s\n",
+		 node->dump_name (), disable ? "BOTTOM" : "VARIABLE");
     }
 
   for (ie = node->indirect_calls; ie; ie = ie->next_callee)
@@ -2842,8 +2840,7 @@ estimate_local_effects (struct cgraph_node *node)
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
-    fprintf (dump_file, "\nEstimating effects for %s/%i.\n",
-	     node->name (), node->order);
+    fprintf (dump_file, "\nEstimating effects for %s.\n", node->dump_name ());
 
   always_const = gather_context_independent_values (info, &known_csts,
 						    &known_contexts, &known_aggs,
@@ -3656,10 +3653,10 @@ update_profiling_info (struct cgraph_node *orig_node,
   if (orig_node_count < orig_sum + new_sum)
     {
       if (dump_file)
-	fprintf (dump_file, "    Problem: node %s/%i has too low count "
+	fprintf (dump_file, "    Problem: node %s has too low count "
 		 HOST_WIDE_INT_PRINT_DEC " while the sum of incoming "
 		 "counts is " HOST_WIDE_INT_PRINT_DEC "\n",
-		 orig_node->name (), orig_node->order,
+		 orig_node->dump_name (),
 		 (HOST_WIDE_INT) orig_node_count,
 		 (HOST_WIDE_INT) (orig_sum + new_sum));
 
@@ -3798,8 +3795,7 @@ create_specialized_node (struct cgraph_node *node,
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      fprintf (dump_file, "     the new node is %s/%i.\n",
-	       new_node->name (), new_node->order);
+      fprintf (dump_file, "     the new node is %s.\n", new_node->dump_name ());
       if (known_contexts.exists ())
 	{
 	  for (i = 0; i < count; i++)
@@ -4439,12 +4435,9 @@ perhaps_add_new_callers (cgraph_node *node, ipcp_value<valtype> *val)
 	      && cgraph_edge_brings_all_agg_vals_for_node (cs, val->spec_node))
 	    {
 	      if (dump_file)
-		fprintf (dump_file, " - adding an extra caller %s/%i"
-			 " of %s/%i\n",
-			 xstrdup_for_dump (cs->caller->name ()),
-			 cs->caller->order,
-			 xstrdup_for_dump (val->spec_node->name ()),
-			 val->spec_node->order);
+		fprintf (dump_file, " - adding an extra caller %s of %s\n",
+			 cs->caller->dump_name (),
+			 val->spec_node->dump_name ());
 
 	      cs->redirect_callee_duplicating_thunks (val->spec_node);
 	      val->spec_node->expand_all_artificial_thunks ();
@@ -4600,8 +4593,8 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
     return false;
 
   if (dump_file)
-    fprintf (dump_file, "  Creating a specialized node of %s/%i.\n",
-	     node->name (), node->order);
+    fprintf (dump_file, "  Creating a specialized node of %s.\n",
+	     node->dump_name ());
 
   callers = gather_edges_for_value (val, node, caller_count);
   if (offset == -1)
@@ -4642,8 +4635,8 @@ decide_whether_version_node (struct cgraph_node *node)
     return false;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
-    fprintf (dump_file, "\nEvaluating opportunities for %s/%i.\n",
-	     node->name (), node->order);
+    fprintf (dump_file, "\nEvaluating opportunities for %s.\n",
+	     node->dump_name ());
 
   gather_context_independent_values (info, &known_csts, &known_contexts,
 				  info->do_clone_for_all_contexts ? &known_aggs
@@ -4697,9 +4690,8 @@ decide_whether_version_node (struct cgraph_node *node)
       vec<cgraph_edge *> callers;
 
       if (dump_file)
-	fprintf (dump_file, " - Creating a specialized node of %s/%i "
-		 "for all known contexts.\n", node->name (),
-		 node->order);
+	fprintf (dump_file, " - Creating a specialized node of %s "
+		 "for all known contexts.\n", node->dump_name ());
 
       callers = node->collect_callers ();
 
@@ -4794,8 +4786,7 @@ identify_dead_nodes (struct cgraph_node *node)
     {
       for (v = node; v; v = ((struct ipa_dfs_info *) v->aux)->next_cycle)
 	if (IPA_NODE_REF (v)->node_dead)
-	  fprintf (dump_file, "  Marking node as dead: %s/%i.\n",
-		   v->name (), v->order);
+	  fprintf (dump_file, "  Marking node as dead: %s.\n", v->dump_name ());
     }
 }
 
@@ -4892,8 +4883,8 @@ ipcp_store_bits_results (void)
 	    continue;
 	  if (!dumped_sth)
 	    {
-	      fprintf (dump_file, "Propagated bits info for function %s/%i:\n",
-		       node->name (), node->order);
+	      fprintf (dump_file, "Propagated bits info for function %s:\n",
+		       node->dump_name ());
 	      dumped_sth = true;
 	    }
 	  fprintf (dump_file, " param %i: value = ", i);
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index aa3a236dd91..eafd0182a45 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -3316,7 +3316,8 @@ dump_targets (FILE *f, vec <cgraph_node *> targets)
       char *name = NULL;
       if (in_lto_p)
 	name = cplus_demangle_v3 (targets[i]->asm_name (), 0);
-      fprintf (f, " %s/%i", name ? name : targets[i]->name (), targets[i]->order);
+      fprintf (f, " %s/%i", name ? name : targets[i]->name (),
+	       targets[i]->order);
       if (in_lto_p)
 	free (name);
       if (!targets[i]->definition)
@@ -3596,8 +3597,8 @@ ipa_devirt (void)
       if (!opt_for_fn (n->decl, flag_devirtualize))
 	continue;
       if (dump_file && n->indirect_calls)
-	fprintf (dump_file, "\n\nProcesing function %s/%i\n",
-		 n->name (), n->order);
+	fprintf (dump_file, "\n\nProcesing function %s\n",
+		 n->dump_name ());
       for (e = n->indirect_calls; e; e = e->next_callee)
 	if (e->indirect_info->polymorphic)
 	  {
@@ -3752,10 +3753,10 @@ ipa_devirt (void)
                   {
                     location_t locus = gimple_location_safe (e->call_stmt);
                     dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus,
-                                     "speculatively devirtualizing call in %s/%i to %s/%i\n",
-                                     n->name (), n->order,
-                                     likely_target->name (),
-                                     likely_target->order);
+				     "speculatively devirtualizing call "
+				     "in %s to %s\n",
+				     n->dump_name (),
+				     likely_target->dump_name ());
                   }
 		if (!likely_target->can_be_discarded_p ())
 		  {
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 92b93b53b85..88f732a3cb8 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -195,8 +195,8 @@ sem_item::dump (void)
 {
   if (dump_file)
     {
-      fprintf (dump_file, "[%s] %s (%u) (tree:%p)\n", type == FUNC ? "func" : "var",
-	       node->name(), node->order, (void *) node->decl);
+      fprintf (dump_file, "[%s] %s (tree:%p)\n", type == FUNC ? "func" : "var",
+	       node->dump_name (), (void *) node->decl);
       fprintf (dump_file, "  hash: %u\n", get_hash ());
       fprintf (dump_file, "  references: ");
 
@@ -869,13 +869,9 @@ sem_function::equals (sem_item *item,
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file,
-	     "Equals called for:%s:%s (%u:%u) (%s:%s) with result: %s\n\n",
-	     xstrdup_for_dump (node->name()),
-	     xstrdup_for_dump (item->node->name ()),
-	     node->order,
-	     item->node->order,
-	     xstrdup_for_dump (node->asm_name ()),
-	     xstrdup_for_dump (item->node->asm_name ()),
+	     "Equals called for: %s:%s with result: %s\n\n",
+	     node->dump_name (),
+	     item->node->dump_name (),
 	     eq ? "true" : "false");
 
   return eq;
@@ -1887,12 +1883,9 @@ sem_variable::equals (sem_item *item,
 			      DECL_INITIAL (item->node->decl));
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file,
-	     "Equals called for vars:%s:%s (%u:%u) (%s:%s) with result: %s\n\n",
-	     xstrdup_for_dump (node->name()),
-	     xstrdup_for_dump (item->node->name ()),
-	     node->order, item->node->order,
-	     xstrdup_for_dump (node->asm_name ()),
-	     xstrdup_for_dump (item->node->asm_name ()), ret ? "true" : "false");
+	     "Equals called for vars: %s:%s with result: %s\n\n",
+	     node->dump_name (), item->node->dump_name (),
+	     ret ? "true" : "false");
 
   return ret;
 }
@@ -2398,8 +2391,8 @@ sem_item_optimizer::read_section (lto_file_decl_data *file_data,
       gcc_assert (node->definition);
 
       if (dump_file)
-	fprintf (dump_file, "Symbol added:%s (tree: %p, uid:%u)\n",
-		 node->asm_name (), (void *) node->decl, node->order);
+	fprintf (dump_file, "Symbol added: %s (tree: %p)\n",
+		 node->dump_asm_name (), (void *) node->decl);
 
       if (is_a<cgraph_node *> (node))
 	{
@@ -3577,9 +3570,7 @@ congruence_class::dump (FILE *file, unsigned int indent) const
 
   FPUTS_SPACES (file, indent + 2, "");
   for (unsigned i = 0; i < members.length (); i++)
-    fprintf (file, "%s(%p/%u) ", members[i]->node->asm_name (),
-	     (void *) members[i]->decl,
-	     members[i]->node->order);
+    fprintf (file, "%s ", members[i]->node->dump_asm_name ());
 
   fprintf (file, "\n");
 }
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index bda704a9473..7b6914c06f3 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -846,9 +846,9 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node,
       int i;
 
       fprintf (f,
-	       "%*s%s/%i %s\n%*s  loop depth:%2i freq:%4i size:%2i"
+	       "%*s%s %s\n%*s  loop depth:%2i freq:%4i size:%2i"
 	       " time: %2i callee size:%2i stack:%2i",
-	       indent, "", callee->name (), callee->order,
+	       indent, "", callee->dump_name (),
 	       !edge->inline_failed
 	       ? "inlined" : cgraph_inline_failed_string (edge-> inline_failed),
 	       indent, "", es->loop_depth, edge->frequency,
@@ -913,8 +913,7 @@ dump_inline_summary (FILE *f, struct cgraph_node *node)
       struct inline_summary *s = inline_summaries->get (node);
       size_time_entry *e;
       int i;
-      fprintf (f, "Inline summary for %s/%i", node->name (),
-	       node->order);
+      fprintf (f, "Inline summary for %s", node->dump_name ());
       if (DECL_DISREGARD_INLINE_LIMITS (node->decl))
 	fprintf (f, " always_inline");
       if (s->inlinable)
@@ -2779,9 +2778,8 @@ estimate_node_size_and_time (struct cgraph_node *node,
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       bool found = false;
-      fprintf (dump_file, "   Estimating body: %s/%i\n"
-	       "   Known to be false: ", node->name (),
-	       node->order);
+      fprintf (dump_file, "   Estimating body: %s\n"
+	       "   Known to be false: ", node->dump_name ());
 
       for (i = predicate::not_inlined_condition;
 	   i < (predicate::first_dynamic_condition
@@ -3578,8 +3576,7 @@ inline_analyze_function (struct cgraph_node *node)
   push_cfun (DECL_STRUCT_FUNCTION (node->decl));
 
   if (dump_file)
-    fprintf (dump_file, "\nAnalyzing function: %s/%u\n",
-	     node->name (), node->order);
+    fprintf (dump_file, "\nAnalyzing function: %s\n", node->dump_name ());
   if (opt_for_fn (node->decl, optimize) && !node->thunk.thunk_p)
     inline_indirect_intraprocedural_analysis (node);
   compute_inline_parameters (node, false);
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index a8e73cd6967..f21a50ae3bf 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -350,8 +350,8 @@ inline_call (struct cgraph_edge *e, bool update_original,
       cl_optimization_restore (&opts, opts_for_fn (to->decl));
       opts.x_flag_strict_aliasing = false;
       if (dump_file)
-	fprintf (dump_file, "Dropping flag_strict_aliasing on %s:%i\n",
-		 to->name (), to->order);
+	fprintf (dump_file, "Dropping flag_strict_aliasing on %s\n",
+		 to->dump_name ());
       DECL_FUNCTION_SPECIFIC_OPTIMIZATION (to->decl)
 	 = build_optimization_node (&opts);
       reload_optimization_node = true;
@@ -411,8 +411,8 @@ inline_call (struct cgraph_edge *e, bool update_original,
 	  opts.x_flag_errno_math
 	    = opt_for_fn (callee->decl, flag_errno_math);
 	  if (dump_file)
-	    fprintf (dump_file, "Copying FP flags from %s:%i to %s:%i\n",
-		     callee->name (), callee->order, to->name (), to->order);
+	    fprintf (dump_file, "Copying FP flags from %s to %s\n",
+		     callee->dump_name (), to->dump_name ());
 	  DECL_FUNCTION_SPECIFIC_OPTIMIZATION (to->decl)
 	     = build_optimization_node (&opts);
 	  reload_optimization_node = true;
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index b0d589081d8..40ea9019671 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -227,9 +227,9 @@ report_inline_failed_reason (struct cgraph_edge *e)
 {
   if (dump_file)
     {
-      fprintf (dump_file, "  not inlinable: %s/%i -> %s/%i, %s\n",
-	       xstrdup_for_dump (e->caller->name ()), e->caller->order,
-	       xstrdup_for_dump (e->callee->name ()), e->callee->order,
+      fprintf (dump_file, "  not inlinable: %s -> %s, %s\n",
+	       e->caller->dump_name (),
+	       e->callee->dump_name (),
 	       cgraph_inline_failed_string (e->inline_failed));
       if ((e->inline_failed == CIF_TARGET_OPTION_MISMATCH
 	   || e->inline_failed == CIF_OPTIMIZATION_MISMATCH)
@@ -592,22 +592,20 @@ want_early_inline_function_p (struct cgraph_edge *e)
 	       && growth > 0)
 	{
 	  if (dump_file)
-	    fprintf (dump_file, "  will not early inline: %s/%i->%s/%i, "
+	    fprintf (dump_file, "  will not early inline: %s->%s, "
 		     "call is cold and code would grow by %i\n",
-		     xstrdup_for_dump (e->caller->name ()),
-		     e->caller->order,
-		     xstrdup_for_dump (callee->name ()), callee->order,
+		     e->caller->dump_name (),
+		     callee->dump_name (),
 		     growth);
 	  want_inline = false;
 	}
       else if (growth > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
 	{
 	  if (dump_file)
-	    fprintf (dump_file, "  will not early inline: %s/%i->%s/%i, "
+	    fprintf (dump_file, "  will not early inline: %s->%s, "
 		     "growth %i exceeds --param early-inlining-insns\n",
-		     xstrdup_for_dump (e->caller->name ()),
-		     e->caller->order,
-		     xstrdup_for_dump (callee->name ()), callee->order,
+		     e->caller->dump_name (),
+		     callee->dump_name (),
 		     growth);
 	  want_inline = false;
 	}
@@ -615,12 +613,11 @@ want_early_inline_function_p (struct cgraph_edge *e)
 	       && growth * (n + 1) > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
 	{
 	  if (dump_file)
-	    fprintf (dump_file, "  will not early inline: %s/%i->%s/%i, "
+	    fprintf (dump_file, "  will not early inline: %s->%s, "
 		     "growth %i exceeds --param early-inlining-insns "
 		     "divided by number of calls\n",
-		     xstrdup_for_dump (e->caller->name ()),
-		     e->caller->order,
-		     xstrdup_for_dump (callee->name ()), callee->order,
+		     e->caller->dump_name (),
+		     callee->dump_name (),
 		     growth);
 	  want_inline = false;
 	}
@@ -1020,11 +1017,9 @@ edge_badness (struct cgraph_edge *edge, bool dump)
 
   if (dump)
     {
-      fprintf (dump_file, "    Badness calculation for %s/%i -> %s/%i\n",
-	       xstrdup_for_dump (edge->caller->name ()),
-	       edge->caller->order,
-	       xstrdup_for_dump (callee->name ()),
-	       edge->callee->order);
+      fprintf (dump_file, "    Badness calculation for %s -> %s\n",
+	       edge->caller->dump_name (),
+	       edge->callee->dump_name ());
       fprintf (dump_file, "      size growth %i, time %f unspec %f ",
 	       growth,
 	       edge_time.to_double (),
@@ -1229,12 +1224,9 @@ update_edge_key (edge_heap_t *heap, struct cgraph_edge *edge)
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 	      fprintf (dump_file,
-		       "  decreasing badness %s/%i -> %s/%i, %f"
-		       " to %f\n",
-		       xstrdup_for_dump (edge->caller->name ()),
-		       edge->caller->order,
-		       xstrdup_for_dump (edge->callee->name ()),
-		       edge->callee->order,
+		       "  decreasing badness %s -> %s, %f to %f\n",
+		       edge->caller->dump_name (),
+		       edge->callee->dump_name (),
 		       n->get_key ().to_double (),
 		       badness.to_double ());
 	    }
@@ -1246,11 +1238,9 @@ update_edge_key (edge_heap_t *heap, struct cgraph_edge *edge)
        if (dump_file && (dump_flags & TDF_DETAILS))
 	 {
 	   fprintf (dump_file,
-		    "  enqueuing call %s/%i -> %s/%i, badness %f\n",
-		    xstrdup_for_dump (edge->caller->name ()),
-		    edge->caller->order,
-		    xstrdup_for_dump (edge->callee->name ()),
-		    edge->callee->order,
+		    "  enqueuing call %s -> %s, badness %f\n",
+		    edge->caller->dump_name (),
+		    edge->callee->dump_name (),
 		    badness.to_double ());
 	 }
       edge->aux = heap->insert (badness, edge);
@@ -1803,8 +1793,7 @@ inline_small_functions (void)
       bool has_speculative = false;
 
       if (dump_file)
-	fprintf (dump_file, "Enqueueing calls in %s/%i.\n",
-		 node->name (), node->order);
+	fprintf (dump_file, "Enqueueing calls in %s.\n", node->dump_name ());
 
       for (edge = node->callees; edge; edge = next)
 	{
@@ -1918,13 +1907,13 @@ inline_small_functions (void)
       if (dump_file)
 	{
 	  fprintf (dump_file,
-		   "\nConsidering %s/%i with %i size\n",
-		   callee->name (), callee->order,
+		   "\nConsidering %s with %i size\n",
+		   callee->dump_name (),
 		   inline_summaries->get (callee)->size);
 	  fprintf (dump_file,
-		   " to be inlined into %s/%i in %s:%i\n"
+		   " to be inlined into %s in %s:%i\n"
 		   " Estimated badness is %f, frequency %.2f.\n",
-		   edge->caller->name (), edge->caller->order,
+		   edge->caller->dump_name (),
 		   edge->call_stmt
 		   && (LOCATION_LOCUS (gimple_location ((const gimple *)
 							edge->call_stmt))
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index c60e05d8454..359f47a6df9 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -590,9 +590,9 @@ ipa_profile (void)
 		  if (dump_file)
 		    {
 		      fprintf (dump_file, "Indirect call -> direct call from"
-			       " other module %s/%i => %s/%i, prob %3.2f\n",
-			       xstrdup_for_dump (n->name ()), n->order,
-			       xstrdup_for_dump (n2->name ()), n2->order,
+			       " other module %s => %s, prob %3.2f\n",
+			       n->dump_name (),
+			       n2->dump_name (),
 			       e->indirect_info->common_target_probability
 			       / (float)REG_BR_PROB_BASE);
 		    }
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 10741a2b7bd..2b1a8854e7a 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -416,17 +416,15 @@ ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
 {
   struct cgraph_edge *cs;
 
-  fprintf (f, "  Jump functions of caller  %s/%i:\n", node->name (),
-	   node->order);
+  fprintf (f, "  Jump functions of caller  %s:\n", node->dump_name ());
   for (cs = node->callees; cs; cs = cs->next_callee)
     {
       if (!ipa_edge_args_info_available_for_edge_p (cs))
 	continue;
 
-      fprintf (f, "    callsite  %s/%i -> %s/%i : \n",
-	       xstrdup_for_dump (node->name ()), node->order,
-	       xstrdup_for_dump (cs->callee->name ()),
-	       cs->callee->order);
+      fprintf (f, "    callsite  %s -> %s : \n",
+	       node->dump_name (),
+	       cs->callee->dump_name ());
       ipa_print_node_jump_functions_for_edge (f, cs);
     }
 
@@ -2854,9 +2852,8 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
 		{
 		  location_t loc = gimple_location_safe (ie->call_stmt);
 		  dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
-				   "discovered direct call non-invariant "
-				   "%s/%i\n",
-				   ie->caller->name (), ie->caller->order);
+				   "discovered direct call non-invariant %s\n",
+				   ie->caller->dump_name ());
 		}
 	      return NULL;
 	    }
@@ -2866,9 +2863,9 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
 	    {
 	      location_t loc = gimple_location_safe (ie->call_stmt);
 	      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
-			       "discovered direct call to non-function in %s/%i, "
+			       "discovered direct call to non-function in %s, "
 			       "making it __builtin_unreachable\n",
-			       ie->caller->name (), ie->caller->order);
+			       ie->caller->dump_name ());
 	    }
 
 	  target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
@@ -2895,11 +2892,9 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
 	{
 	  if (dump_file)
 	    fprintf (dump_file, "ipa-prop: Discovered call to a known target "
-		     "(%s/%i -> %s/%i) but can not refer to it. Giving up.\n",
-		     xstrdup_for_dump (ie->caller->name ()),
-		     ie->caller->order,
-		     xstrdup_for_dump (ie->callee->name ()),
-		     ie->callee->order);
+		     "(%s -> %s) but can not refer to it. Giving up.\n",
+		     ie->caller->dump_name (),
+		     ie->callee->dump_name ());
 	  return NULL;
 	}
       callee = cgraph_node::get_create (target);
@@ -2915,24 +2910,18 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
 	  != callee->ultimate_alias_target ())
 	{
 	  if (dump_file)
-	    fprintf (dump_file, "ipa-prop: Discovered call to a speculative target "
-		     "(%s/%i -> %s/%i) but the call is already speculated to %s/%i. Giving up.\n",
-		     xstrdup_for_dump (ie->caller->name ()),
-		     ie->caller->order,
-		     xstrdup_for_dump (callee->name ()),
-		     callee->order,
-		     xstrdup_for_dump (e2->callee->name ()),
-		     e2->callee->order);
+	    fprintf (dump_file, "ipa-prop: Discovered call to a speculative "
+		     "target (%s -> %s) but the call is already "
+		     "speculated to %s. Giving up.\n",
+		     ie->caller->dump_name (), callee->dump_name (),
+		     e2->callee->dump_name ());
 	}
       else
 	{
 	  if (dump_file)
 	    fprintf (dump_file, "ipa-prop: Discovered call to a speculative target "
-		     "(%s/%i -> %s/%i) this agree with previous speculation.\n",
-		     xstrdup_for_dump (ie->caller->name ()),
-		     ie->caller->order,
-		     xstrdup_for_dump (callee->name ()),
-		     callee->order);
+		     "(%s -> %s) this agree with previous speculation.\n",
+		     ie->caller->dump_name (), callee->dump_name ());
 	}
       return NULL;
     }
@@ -2949,13 +2938,11 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
   if (dump_file && !unreachable)
     {
       fprintf (dump_file, "ipa-prop: Discovered %s call to a %s target "
-	       "(%s/%i -> %s/%i), for stmt ",
+	       "(%s -> %s), for stmt ",
 	       ie->indirect_info->polymorphic ? "a virtual" : "an indirect",
 	       speculative ? "speculative" : "known",
-	       xstrdup_for_dump (ie->caller->name ()),
-	       ie->caller->order,
-	       xstrdup_for_dump (callee->name ()),
-	       callee->order);
+	       ie->caller->dump_name (),
+	       callee->dump_name ());
       if (ie->call_stmt)
 	print_gimple_stmt (dump_file, ie->call_stmt, 2, TDF_SLIM);
       else
@@ -3155,9 +3142,8 @@ remove_described_reference (symtab_node *symbol, struct ipa_cst_ref_desc *rdesc)
 
   to_del->remove_reference ();
   if (dump_file)
-    fprintf (dump_file, "ipa-prop: Removed a reference from %s/%i to %s.\n",
-	     xstrdup_for_dump (origin->caller->name ()),
-	     origin->caller->order, xstrdup_for_dump (symbol->name ()));
+    fprintf (dump_file, "ipa-prop: Removed a reference from %s to %s.\n",
+	     origin->caller->dump_name (), xstrdup_for_dump (symbol->name ()));
   return true;
 }
 
@@ -3272,13 +3258,13 @@ ipa_impossible_devirt_target (struct cgraph_edge *ie, tree target)
     {
       if (target)
 	fprintf (dump_file,
-		 "Type inconsistent devirtualization: %s/%i->%s\n",
-		 ie->caller->name (), ie->caller->order,
+		 "Type inconsistent devirtualization: %s->%s\n",
+		 ie->caller->dump_name (),
 		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
       else
 	fprintf (dump_file,
-		 "No devirtualization target in %s/%i\n",
-		 ie->caller->name (), ie->caller->order);
+		 "No devirtualization target in %s\n",
+		 ie->caller->dump_name ());
     }
   tree new_target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
   cgraph_node::get_create (new_target);
@@ -3607,10 +3593,9 @@ propagate_controlled_uses (struct cgraph_edge *cs)
 		{
 		  if (dump_file)
 		    fprintf (dump_file, "ipa-prop: Removing cloning-created "
-			     "reference from %s/%i to %s/%i.\n",
-			     xstrdup_for_dump (new_root->name ()),
-			     new_root->order,
-			     xstrdup_for_dump (n->name ()), n->order);
+			     "reference from %s to %s.\n",
+			     new_root->dump_name (),
+			     n->dump_name ());
 		  ref->remove_reference ();
 		}
 	    }
@@ -3648,11 +3633,9 @@ propagate_controlled_uses (struct cgraph_edge *cs)
 			  if (dump_file)
 			    fprintf (dump_file, "ipa-prop: Removing "
 				     "cloning-created reference "
-				     "from %s/%i to %s/%i.\n",
-				     xstrdup_for_dump (clone->name ()),
-				     clone->order,
-				     xstrdup_for_dump (n->name ()),
-				     n->order);
+				     "from %s to %s.\n",
+				     clone->dump_name (),
+				     n->dump_name ());
 			  ref->remove_reference ();
 			}
 		      clone = clone->callers->caller;
@@ -4030,8 +4013,7 @@ ipa_print_node_params (FILE *f, struct cgraph_node *node)
   if (!node->definition)
     return;
   info = IPA_NODE_REF (node);
-  fprintf (f, "  function  %s/%i parameter descriptors:\n",
-	   node->name (), node->order);
+  fprintf (f, "  function  %s parameter descriptors:\n", node->dump_name ());
   count = ipa_get_param_count (info);
   for (i = 0; i < count; i++)
     {
@@ -5849,8 +5831,8 @@ ipcp_transform_function (struct cgraph_node *node)
   gcc_checking_assert (current_function_decl);
 
   if (dump_file)
-    fprintf (dump_file, "Modification phase of node %s/%i\n",
-	     node->name (), node->order);
+    fprintf (dump_file, "Modification phase of node %s\n",
+	     node->dump_name ());
 
   ipcp_update_bits (node);
   ipcp_update_vr (node);
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 2379ec88e13..dac8f0d5f21 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1130,9 +1130,7 @@ pure_const_read_summary (void)
 	      if (dump_file)
 		{
 		  int flags = flags_from_decl_or_type (node->decl);
-		  fprintf (dump_file, "Read info for %s/%i ",
-			   node->name (),
-			   node->order);
+		  fprintf (dump_file, "Read info for %s ", node->dump_name ());
 		  if (flags & ECF_CONST)
 		    fprintf (dump_file, " const");
 		  if (flags & ECF_PURE)
@@ -1269,9 +1267,8 @@ propagate_pure_const (void)
 
 	  funct_state w_l = get_function_state (w);
 	  if (dump_file && (dump_flags & TDF_DETAILS))
-	    fprintf (dump_file, "  Visiting %s/%i state:%s looping %i\n",
-		     w->name (),
-		     w->order,
+	    fprintf (dump_file, "  Visiting %s state:%s looping %i\n",
+		     w->dump_name (),
 		     pure_const_names[w_l->pure_const_state],
 		     w_l->looping);
 
@@ -1305,10 +1302,8 @@ propagate_pure_const (void)
 
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{
-		  fprintf (dump_file,
-			   "    Call to %s/%i",
-			   e->callee->name (),
-			   e->callee->order);
+		  fprintf (dump_file, "    Call to %s",
+			   e->callee->dump_name ());
 		}
 	      if (avail > AVAIL_INTERPOSABLE)
 		{
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 222253920fd..45c2e3feda2 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -599,8 +599,7 @@ generate_summary (void)
 
 	  l = &get_reference_vars_info (node)->local;
 	  fprintf (dump_file,
-		   "\nFunction name:%s/%i:",
-		   node->asm_name (), node->order);
+		   "\nFunction name:%s:", node->dump_name ());
 	  fprintf (dump_file, "\n  locals read: ");
 	  if (l->statics_read)
 	    EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
@@ -636,8 +635,7 @@ read_write_all_from_decl (struct cgraph_node *node,
     {
       read_all = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
-         fprintf (dump_file, "   %s/%i -> read all\n",
-		  node->asm_name (), node->order);
+	fprintf (dump_file, "   %s -> read all\n", node->dump_name ());
     }
   else
     {
@@ -646,8 +644,8 @@ read_write_all_from_decl (struct cgraph_node *node,
       read_all = true;
       write_all = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
-         fprintf (dump_file, "   %s/%i -> read all, write all\n",
-		  node->asm_name (), node->order);
+	fprintf (dump_file, "   %s -> read all, write all\n",
+		  node->dump_name ());
     }
 }
 
@@ -754,8 +752,7 @@ propagate (void)
       node_g = &node_info->global;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
-	fprintf (dump_file, "Starting cycle with %s/%i\n",
-		  node->asm_name (), node->order);
+	fprintf (dump_file, "Starting cycle with %s\n", node->dump_name ());
 
       vec<cgraph_node *> cycle_nodes = ipa_get_nodes_in_cycle (node);
 
@@ -763,8 +760,7 @@ propagate (void)
       FOR_EACH_VEC_ELT (cycle_nodes, x, w)
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
-	    fprintf (dump_file, "  Visiting %s/%i\n",
-		     w->asm_name (), w->order);
+	    fprintf (dump_file, "  Visiting %s\n", w->dump_asm_name ());
 	  get_read_write_all_from_node (w, read_all, write_all);
 	  if (read_all && write_all)
 	    break;
@@ -826,9 +822,7 @@ propagate (void)
           if (node->alias || !opt_for_fn (node->decl, flag_ipa_reference))
 	    continue;
 
-	  fprintf (dump_file,
-		   "\nFunction name:%s/%i:",
-		   node->asm_name (), node->order);
+	  fprintf (dump_file, "\nFunction name:%s:", node->dump_asm_name ());
 
 	  ipa_reference_vars_info_t node_info = get_reference_vars_info (node);
 	  ipa_reference_global_vars_info_t node_g = &node_info->global;
@@ -839,8 +833,7 @@ propagate (void)
 	      ipa_reference_vars_info_t w_ri = get_reference_vars_info (w);
 	      ipa_reference_local_vars_info_t w_l = &w_ri->local;
 	      if (w != node)
-		fprintf (dump_file, "\n  next cycle: %s/%i ",
-			 w->asm_name (), w->order);
+		fprintf (dump_file, "\n  next cycle: %s ", w->dump_asm_name ());
 	      fprintf (dump_file, "\n    locals read: ");
 	      dump_static_vars_set_to_file (dump_file, w_l->statics_read);
 	      fprintf (dump_file, "\n    locals written: ");
@@ -1120,8 +1113,8 @@ ipa_reference_read_optimization_summary (void)
 	      info->statics_not_written = BITMAP_ALLOC (&optimization_summary_obstack);
 	      if (dump_file)
 		fprintf (dump_file,
-			 "\nFunction name:%s/%i:\n  static not read:",
-			 node->asm_name (), node->order);
+			 "\nFunction name:%s:\n  static not read:",
+			 node->dump_asm_name ());
 
 	      /* Set the statics not read.  */
 	      v_count = streamer_read_hwi (ib);
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 959e31a68e6..affc887bf45 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -406,9 +406,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
     return;
   if (symtab->dump_file)
     {
-      fprintf (symtab->dump_file, "Merging profiles of %s/%i to %s/%i\n",
-	       xstrdup_for_dump (src->name ()), src->order,
-	       xstrdup_for_dump (dst->name ()), dst->order);
+      fprintf (symtab->dump_file, "Merging profiles of %s to %s\n",
+	       src->dump_name (), dst->dump_name ());
     }
   dst->count += src->count;
 
diff --git a/gcc/ipa.c b/gcc/ipa.c
index aa4181b6c2c..96b5f9346a2 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -230,10 +230,9 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
 	      else
 		locus = UNKNOWN_LOCATION;
 	      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus,
-                               "devirtualizing call in %s/%i to %s/%i\n",
-                               edge->caller->name (), edge->caller->order,
-                               target->name (),
-                               target->order);
+			       "devirtualizing call in %s to %s\n",
+			       edge->caller->dump_name (),
+			       target->dump_name ());
 	    }
 	  edge = edge->make_direct (target);
 	  if (inline_summaries)
@@ -529,7 +528,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
       if (!node->aux)
 	{
 	  if (file)
-	    fprintf (file, " %s/%i", node->name (), node->order);
+	    fprintf (file, " %s", node->dump_name ());
 	  node->remove ();
 	  changed = true;
 	}
@@ -549,7 +548,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
 	  if (node->definition && !node->alias && !node->thunk.thunk_p)
 	    {
 	      if (file)
-		fprintf (file, " %s/%i", node->name (), node->order);
+		fprintf (file, " %s", node->dump_name ());
 	      node->body_removed = true;
 	      node->analyzed = false;
 	      node->definition = false;
@@ -616,12 +615,11 @@ symbol_table::remove_unreachable_nodes (FILE *file)
 	  while (vnode->iterate_direct_aliases (0, ref))
 	    {
 	      if (file)
-		fprintf (file, " %s/%i", ref->referred->name (),
-			 ref->referred->order);
+		fprintf (file, " %s", ref->referred->dump_name ());
 	      ref->referring->remove ();
 	    }
 	  if (file)
-	    fprintf (file, " %s/%i", vnode->name (), vnode->order);
+	    fprintf (file, " %s", vnode->dump_name ());
           vnext = next_variable (vnode);
 	  /* Signal removal to the debug machinery.  */
 	  if (! flag_wpa)
@@ -1391,8 +1389,8 @@ ipa_single_use (void)
 
 	  if (dump_file)
 	    {
-	      fprintf (dump_file, "Variable %s/%i is used by single function\n",
-		       var->name (), var->order);
+	      fprintf (dump_file, "Variable %s is used by single function\n",
+		       var->dump_name ());
 	    }
 	  var->used_by_single_function = true;
 	}
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index f61b1f80133..9fd94861c6d 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -45,11 +45,10 @@ lto_cgraph_replace_node (struct cgraph_node *node,
 
   if (symtab->dump_file)
     {
-      fprintf (symtab->dump_file, "Replacing cgraph node %s/%i by %s/%i"
+      fprintf (symtab->dump_file, "Replacing cgraph node %s by %s"
  	       " for symbol %s\n",
-	       node->name (), node->order,
-	       prevailing_node->name (),
-	       prevailing_node->order,
+	       node->dump_name (),
+	       prevailing_node->dump_name (),
 	       IDENTIFIER_POINTER ((*targetm.asm_out.mangle_assembler_name)
 		 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)))));
     }
diff --git a/gcc/predict.c b/gcc/predict.c
index 0fc9fc5c466..ac35fa41129 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3163,9 +3163,9 @@ drop_profile (struct cgraph_node *node, gcov_type call_count)
 
   if (dump_file)
     fprintf (dump_file,
-             "Dropping 0 profile for %s/%i. %s based on calls.\n",
-             node->name (), node->order,
-             hot ? "Function is hot" : "Function is normal");
+	     "Dropping 0 profile for %s. %s based on calls.\n",
+	     node->dump_name (),
+	     hot ? "Function is hot" : "Function is normal");
   /* We only expect to miss profiles for functions that are reached
      via non-zero call edges in cases where the function may have
      been linked from another module or library (COMDATs and extern
@@ -3181,12 +3181,12 @@ drop_profile (struct cgraph_node *node, gcov_type call_count)
         {
           if (dump_file)
             fprintf (dump_file,
-                     "Missing counts for called function %s/%i\n",
-                     node->name (), node->order);
+		     "Missing counts for called function %s\n",
+		     node->dump_name ());
         }
       else
-        warning (0, "Missing counts for called function %s/%i",
-                 node->name (), node->order);
+	warning (0, "Missing counts for called function %s",
+		 node->dump_name ());
     }
 
   profile_status_for_fn (fn)
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 13dca7f0dbd..0145910023f 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -522,6 +522,31 @@ symtab_node::name () const
   return lang_hooks.decl_printable_name (decl, 2);
 }
 
+const char *
+symtab_node::get_dump_name (bool asm_name_p) const
+{
+#define EXTRA 16
+  const char *fname = asm_name_p ? asm_name () : name ();
+  unsigned l = strlen (fname);
+
+  char *s = (char *)ggc_internal_cleared_alloc (l + EXTRA);
+  snprintf (s, l + EXTRA, "%s/%d", fname, order);
+
+  return s;
+}
+
+const char *
+symtab_node::dump_name () const
+{
+  return get_dump_name (false);
+}
+
+const char *
+symtab_node::dump_asm_name () const
+{
+  return get_dump_name (true);
+}
+
 /* Return ipa reference from this symtab_node to
    REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type
    of the use.  */
@@ -751,9 +776,8 @@ symtab_node::dump_references (FILE *file)
   int i;
   for (i = 0; iterate_reference (i, ref); i++)
     {
-      fprintf (file, "%s/%i (%s)",
-               ref->referred->asm_name (),
-               ref->referred->order,
+      fprintf (file, "%s (%s)",
+	       ref->referred->dump_asm_name (),
 	       ipa_ref_use_name [ref->use]);
       if (ref->speculative)
 	fprintf (file, " (speculative)");
@@ -770,9 +794,8 @@ symtab_node::dump_referring (FILE *file)
   int i;
   for (i = 0; iterate_referring(i, ref); i++)
     {
-      fprintf (file, "%s/%i (%s)",
-               ref->referring->asm_name (),
-               ref->referring->order,
+      fprintf (file, "%s (%s)",
+	       ref->referring->dump_asm_name (),
 	       ipa_ref_use_name [ref->use]);
       if (ref->speculative)
 	fprintf (file, " (speculative)");
@@ -791,7 +814,7 @@ symtab_node::dump_base (FILE *f)
     "default", "protected", "hidden", "internal"
   };
 
-  fprintf (f, "%s/%i (%s)", asm_name (), order, name ());
+  fprintf (f, "%s (%s)", dump_asm_name (), name ());
   dump_addr (f, " @", (void *)this);
   fprintf (f, "\n  Type: %s", symtab_type_names[type]);
 
@@ -874,9 +897,8 @@ symtab_node::dump_base (FILE *f)
   fprintf (f, "\n");
   
   if (same_comdat_group)
-    fprintf (f, "  Same comdat group as: %s/%i\n",
-	     same_comdat_group->asm_name (),
-	     same_comdat_group->order);
+    fprintf (f, "  Same comdat group as: %s\n",
+	     same_comdat_group->dump_asm_name ());
   if (next_sharing_asm_name)
     fprintf (f, "  next sharing asm name: %i\n",
 	     next_sharing_asm_name->order);
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 84320642075..920950d1619 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -5190,11 +5190,8 @@ convert_callers_for_node (struct cgraph_node *node,
       push_cfun (DECL_STRUCT_FUNCTION (cs->caller->decl));
 
       if (dump_file)
-	fprintf (dump_file, "Adjusting call %s/%i -> %s/%i\n",
-		 xstrdup_for_dump (cs->caller->name ()),
-		 cs->caller->order,
-		 xstrdup_for_dump (cs->callee->name ()),
-		 cs->callee->order);
+	fprintf (dump_file, "Adjusting call %s -> %s\n",
+		 cs->caller->dump_name (), cs->callee->dump_name ());
 
       ipa_modify_call_arguments (cs, cs->call_stmt, *adjustments);
 
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 1ce0fda0ed2..7f1574af70d 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1236,12 +1236,10 @@ init_node_map (bool local)
 	      {
 		if (dump_file)
 		  fprintf (dump_file, "Local profile-id %i conflict"
-			   " with nodes %s/%i %s/%i\n",
+			   " with nodes %s %s\n",
 			   n->profile_id,
-			   n->name (),
-			   n->order,
-			   (*val)->name (),
-			   (*val)->order);
+			   n->dump_name (),
+			   (*val)->dump_name ());
 		n->profile_id = (n->profile_id + 1) & 0x7fffffff;
 	      }
 	  }
@@ -1249,21 +1247,18 @@ init_node_map (bool local)
 	  {
 	    if (dump_file)
 	      fprintf (dump_file,
-		       "Node %s/%i has no profile-id"
+		       "Node %s has no profile-id"
 		       " (profile feedback missing?)\n",
-		       n->name (),
-		       n->order);
+		       n->dump_name ());
 	    continue;
 	  }
 	else if ((val = cgraph_node_map->get (n->profile_id)))
 	  {
 	    if (dump_file)
 	      fprintf (dump_file,
-		       "Node %s/%i has IP profile-id %i conflict. "
+		       "Node %s has IP profile-id %i conflict. "
 		       "Giving up.\n",
-		       n->name (),
-		       n->order,
-		       n->profile_id);
+		       n->dump_name (), n->profile_id);
 	    *val = NULL;
 	    continue;
 	  }
-- 
2.12.2

Reply via email to