public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
@ 2016-04-12 14:54 Jakub Jelinek
  2016-04-12 15:49 ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2016-04-12 14:54 UTC (permalink / raw)
  To: Martin Jambor, Richard Biener, Jason Merrill; +Cc: gcc-patches

Hi!

Even without the C++ FE changes, I believe there are occassional DECL_UID
differences (I believe the code just cares that the ordering of the uids
is stable), and the fancy DEC_IGNORED names can leak into the
-fdump-final-insns= dumps (e.g. in MEM_EXPRs or REG_EXPRs.

The following patch treats those similarly to how the various TDF_NOUID
flags handle it in the dumps.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-04-12  Jakub Jelinek  <jakub@redhat.com>

	PR c++/70594
	* tree-sra.c (make_fancy_decl_name): Don't add DECL_UID
	into the fancy names if -fdump-final-insns=.

--- gcc/tree-sra.c.jj	2016-04-12 11:08:10.000000000 +0200
+++ gcc/tree-sra.c	2016-04-12 11:15:35.519676357 +0200
@@ -1543,6 +1543,9 @@ make_fancy_decl_name (tree decl)
   if (name)
     obstack_grow (&name_obstack, IDENTIFIER_POINTER (name),
 		  IDENTIFIER_LENGTH (name));
+  /* Avoid -fcompare-debug issues on DECL_UID differences.  */
+  else if (flag_dump_final_insns != NULL)
+    obstack_grow (&name_obstack, "Dxxxx", 5);
   else
     {
       sprintf (buffer, "D%u", DECL_UID (decl));

	Jakub

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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-12 14:54 [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594) Jakub Jelinek
@ 2016-04-12 15:49 ` Richard Biener
  2016-04-12 15:55   ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2016-04-12 15:49 UTC (permalink / raw)
  To: Jakub Jelinek, Martin Jambor, Jason Merrill; +Cc: gcc-patches

On April 12, 2016 4:54:27 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>Even without the C++ FE changes, I believe there are occassional
>DECL_UID
>differences (I believe the code just cares that the ordering of the
>uids
>is stable), and the fancy DEC_IGNORED names can leak into the
>-fdump-final-insns= dumps (e.g. in MEM_EXPRs or REG_EXPRs.
>
>The following patch treats those similarly to how the various TDF_NOUID
>flags handle it in the dumps.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
>2016-04-12  Jakub Jelinek  <jakub@redhat.com>
>
>	PR c++/70594
>	* tree-sra.c (make_fancy_decl_name): Don't add DECL_UID
>	into the fancy names if -fdump-final-insns=.
>
>--- gcc/tree-sra.c.jj	2016-04-12 11:08:10.000000000 +0200
>+++ gcc/tree-sra.c	2016-04-12 11:15:35.519676357 +0200
>@@ -1543,6 +1543,9 @@ make_fancy_decl_name (tree decl)
>   if (name)
>     obstack_grow (&name_obstack, IDENTIFIER_POINTER (name),
> 		  IDENTIFIER_LENGTH (name));
>+  /* Avoid -fcompare-debug issues on DECL_UID differences.  */
>+  else if (flag_dump_final_insns != NULL)
>+    obstack_grow (&name_obstack, "Dxxxx", 5);
>   else
>     {
>       sprintf (buffer, "D%u", DECL_UID (decl));

I'd rather use a separate counter that SRA increments.  We an always dump counter to uid mapping.

Richard.

>
>	Jakub


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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-12 15:49 ` Richard Biener
@ 2016-04-12 15:55   ` Jakub Jelinek
  2016-04-12 18:20     ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2016-04-12 15:55 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On Tue, Apr 12, 2016 at 05:49:26PM +0200, Richard Biener wrote:
> On April 12, 2016 4:54:27 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
> >Hi!
> >
> >Even without the C++ FE changes, I believe there are occassional
> >DECL_UID
> >differences (I believe the code just cares that the ordering of the
> >uids
> >is stable), and the fancy DEC_IGNORED names can leak into the
> >-fdump-final-insns= dumps (e.g. in MEM_EXPRs or REG_EXPRs.
> >
> >The following patch treats those similarly to how the various TDF_NOUID
> >flags handle it in the dumps.
> >
> >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> >
> >2016-04-12  Jakub Jelinek  <jakub@redhat.com>
> >
> >	PR c++/70594
> >	* tree-sra.c (make_fancy_decl_name): Don't add DECL_UID
> >	into the fancy names if -fdump-final-insns=.
> >
> >--- gcc/tree-sra.c.jj	2016-04-12 11:08:10.000000000 +0200
> >+++ gcc/tree-sra.c	2016-04-12 11:15:35.519676357 +0200
> >@@ -1543,6 +1543,9 @@ make_fancy_decl_name (tree decl)
> >   if (name)
> >     obstack_grow (&name_obstack, IDENTIFIER_POINTER (name),
> > 		  IDENTIFIER_LENGTH (name));
> >+  /* Avoid -fcompare-debug issues on DECL_UID differences.  */
> >+  else if (flag_dump_final_insns != NULL)
> >+    obstack_grow (&name_obstack, "Dxxxx", 5);
> >   else
> >     {
> >       sprintf (buffer, "D%u", DECL_UID (decl));
> 
> I'd rather use a separate counter that SRA increments.  We an always dump counter to uid mapping.

So you mean add another hash table that maps DECL_UIDs to these SRA
counters?  Because if we dump there any number of say FIELD_DECL, it would
be desirable to use the same number on any further fancy names with that
FIELD_DECL.
Do it unconditionally, or just for flag_dump_final_insns?

	Jakub

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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-12 15:55   ` Jakub Jelinek
@ 2016-04-12 18:20     ` Richard Biener
  2016-04-12 18:48       ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2016-04-12 18:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On April 12, 2016 5:55:16 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Tue, Apr 12, 2016 at 05:49:26PM +0200, Richard Biener wrote:
>> On April 12, 2016 4:54:27 PM GMT+02:00, Jakub Jelinek
><jakub@redhat.com> wrote:
>> >Hi!
>> >
>> >Even without the C++ FE changes, I believe there are occassional
>> >DECL_UID
>> >differences (I believe the code just cares that the ordering of the
>> >uids
>> >is stable), and the fancy DEC_IGNORED names can leak into the
>> >-fdump-final-insns= dumps (e.g. in MEM_EXPRs or REG_EXPRs.
>> >
>> >The following patch treats those similarly to how the various
>TDF_NOUID
>> >flags handle it in the dumps.
>> >
>> >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>> >
>> >2016-04-12  Jakub Jelinek  <jakub@redhat.com>
>> >
>> >	PR c++/70594
>> >	* tree-sra.c (make_fancy_decl_name): Don't add DECL_UID
>> >	into the fancy names if -fdump-final-insns=.
>> >
>> >--- gcc/tree-sra.c.jj	2016-04-12 11:08:10.000000000 +0200
>> >+++ gcc/tree-sra.c	2016-04-12 11:15:35.519676357 +0200
>> >@@ -1543,6 +1543,9 @@ make_fancy_decl_name (tree decl)
>> >   if (name)
>> >     obstack_grow (&name_obstack, IDENTIFIER_POINTER (name),
>> > 		  IDENTIFIER_LENGTH (name));
>> >+  /* Avoid -fcompare-debug issues on DECL_UID differences.  */
>> >+  else if (flag_dump_final_insns != NULL)
>> >+    obstack_grow (&name_obstack, "Dxxxx", 5);
>> >   else
>> >     {
>> >       sprintf (buffer, "D%u", DECL_UID (decl));
>> 
>> I'd rather use a separate counter that SRA increments.  We an always
>dump counter to uid mapping.
>
>So you mean add another hash table that maps DECL_UIDs to these SRA
>counters?  Because if we dump there any number of say FIELD_DECL, it
>would
>be desirable to use the same number on any further fancy names with
>that
>FIELD_DECL.
>Do it unconditionally, or just for flag_dump_final_insns?

I'd have just added sth to the dumps so you can manually connect the XXX in the name with the UID.

Richard.

>	Jakub


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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-12 18:20     ` Richard Biener
@ 2016-04-12 18:48       ` Jakub Jelinek
  2016-04-13  7:26         ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2016-04-12 18:48 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On Tue, Apr 12, 2016 at 08:19:57PM +0200, Richard Biener wrote:
> >So you mean add another hash table that maps DECL_UIDs to these SRA
> >counters?  Because if we dump there any number of say FIELD_DECL, it
> >would
> >be desirable to use the same number on any further fancy names with
> >that
> >FIELD_DECL.
> >Do it unconditionally, or just for flag_dump_final_insns?
> 
> I'd have just added sth to the dumps so you can manually connect the XXX in the name with the UID.

But the names appear in all the gimple, ipa? and rtl dumps after that, so
if it e.g. just printed a SRA uid -> DECL uid mapping in tree-sra*-details
dump, then one would not have it easily accessible when looking all the
other dumps.
If it is just guarded with flag_dump_final_insns != NULL, then we have the
previous behavior almost all the time, just for -fcompare-debug effectively
force -nouid flag into all the dumps for the fancy names.  But it is easy
to just remove that flag from the command line to have more details, IMHO
that is better than just looking up some mapping dump somewhere.

	Jakub

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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-12 18:48       ` Jakub Jelinek
@ 2016-04-13  7:26         ` Richard Biener
  2016-04-13 14:32           ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2016-04-13  7:26 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On Tue, 12 Apr 2016, Jakub Jelinek wrote:

> On Tue, Apr 12, 2016 at 08:19:57PM +0200, Richard Biener wrote:
> > >So you mean add another hash table that maps DECL_UIDs to these SRA
> > >counters?  Because if we dump there any number of say FIELD_DECL, it
> > >would
> > >be desirable to use the same number on any further fancy names with
> > >that
> > >FIELD_DECL.
> > >Do it unconditionally, or just for flag_dump_final_insns?
> > 
> > I'd have just added sth to the dumps so you can manually connect the XXX in the name with the UID.
> 
> But the names appear in all the gimple, ipa? and rtl dumps after that, so
> if it e.g. just printed a SRA uid -> DECL uid mapping in tree-sra*-details
> dump, then one would not have it easily accessible when looking all the
> other dumps.

Sure - but does it really matter?  Usually decls also have names.

> If it is just guarded with flag_dump_final_insns != NULL, then we have the
> previous behavior almost all the time, just for -fcompare-debug effectively
> force -nouid flag into all the dumps for the fancy names.  But it is easy
> to just remove that flag from the command line to have more details, IMHO
> that is better than just looking up some mapping dump somewhere.

I hate to change behavior of passes based on unrelated flags.  
Over-engineering things just in case you need to debug sth is also bad.

So if you think it's not acceptable to drop the relation between
the artificial number used by SRA and the original UID then go
with a hash-map unconditionally.  You still have to dump and lookup
the actual relation though - there's no way around this unless you
hack dump-final-insns to filter DECL names (maybe just make it
strip all DECL_ARTIFICIAL names completely?)

Richard.

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-13  7:26         ` Richard Biener
@ 2016-04-13 14:32           ` Jakub Jelinek
  2016-04-13 19:18             ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2016-04-13 14:32 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On Wed, Apr 13, 2016 at 09:25:56AM +0200, Richard Biener wrote:
> So if you think it's not acceptable to drop the relation between
> the artificial number used by SRA and the original UID then go
> with a hash-map unconditionally.  You still have to dump and lookup
> the actual relation though - there's no way around this unless you
> hack dump-final-insns to filter DECL names (maybe just make it
> strip all DECL_ARTIFICIAL names completely?)

Here is an alternative patch, keep the fancy names as before,
but in TDF_NOUID dumps sanitize them.  Most of the DECL_NAMELESS
decls other than ones with the SRA fancy names should not contain
anything that would be tweaked for the printout, and doing it this
way has the advantage that one can always just use flags without TDF_NOUID
to see the real fancy names.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-04-13  Jakub Jelinek  <jakub@redhat.com>

	PR c++/70594
	* tree-sra.c (create_access_replacement,
	get_replaced_param_substitute): Set DECL_NAMELESS on repl if it
	gets fancy name.
	* tree-pretty-print.c (dump_fancy_name): New function.
	(dump_decl_name, dump_generic_node): Use it.

--- gcc/tree-sra.c.jj	2016-04-12 19:12:34.000000000 +0200
+++ gcc/tree-sra.c	2016-04-13 13:52:28.329925560 +0200
@@ -2132,6 +2132,7 @@ create_access_replacement (struct access
       bool fail = false;
 
       DECL_NAME (repl) = get_identifier (pretty_name);
+      DECL_NAMELESS (repl) = 1;
       obstack_free (&name_obstack, pretty_name);
 
       /* Get rid of any SSA_NAMEs embedded in debug_expr,
@@ -4704,6 +4705,7 @@ get_replaced_param_substitute (struct ip
 
       repl = create_tmp_reg (TREE_TYPE (adj->base), "ISR");
       DECL_NAME (repl) = get_identifier (pretty_name);
+      DECL_NAMELESS (repl) = 1;
       obstack_free (&name_obstack, pretty_name);
 
       adj->new_ssa_base = repl;
--- gcc/tree-pretty-print.c.jj	2016-03-17 16:54:44.000000000 +0100
+++ gcc/tree-pretty-print.c	2016-04-13 14:10:59.667085487 +0200
@@ -161,6 +161,85 @@ print_generic_expr (FILE *file, tree t,
   pp_flush (tree_pp);
 }
 
+/* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
+   in it are replaced with Dxxxx, as long as they are at the start or
+   preceded by $ and at the end or followed by $.  See make_fancy_name
+   in tree-sra.c.  */
+
+static void
+dump_fancy_name (pretty_printer *pp, tree name)
+{
+  int cnt = 0;
+  int length = IDENTIFIER_LENGTH (name);
+  const char *n = IDENTIFIER_POINTER (name);
+  do
+    {
+      n = strchr (n, 'D');
+      if (n == NULL)
+	break;
+      if (ISDIGIT (n[1])
+	  && (n == IDENTIFIER_POINTER (name) || n[-1] == '$'))
+	{
+	  int l = 2;
+	  while (ISDIGIT (n[l]))
+	    l++;
+	  if (n[l] == '\0' || n[l] == '$')
+	    {
+	      cnt++;
+	      length += 5 - l;
+	    }
+	  n += l;
+	}
+      else
+	n++;
+    }
+  while (1);
+  if (cnt == 0)
+    {
+      pp_tree_identifier (pp, name);
+      return;
+    }
+
+  char *str = XNEWVEC (char, length + 1);
+  char *p = str;
+  const char *q;
+  q = n = IDENTIFIER_POINTER (name);
+  do
+    {
+      q = strchr (q, 'D');
+      if (q == NULL)
+	break;
+      if (ISDIGIT (q[1])
+	  && (q == IDENTIFIER_POINTER (name) || q[-1] == '$'))
+	{
+	  int l = 2;
+	  while (ISDIGIT (q[l]))
+	    l++;
+	  if (q[l] == '\0' || q[l] == '$')
+	    {
+	      memcpy (p, n, q - n);
+	      memcpy (p + (q - n), "Dxxxx", 5);
+	      p += (q - n) + 5;
+	      n = q + l;
+	    }
+	  q += l;
+	}
+      else
+	q++;
+    }
+  while (1);
+  memcpy (p, n, IDENTIFIER_LENGTH (name) - (n - IDENTIFIER_POINTER (name)));
+  str[length] = '\0';
+  if (pp_translate_identifiers (pp))
+    {
+      const char *text = identifier_to_locale (str);
+      pp_append_text (pp, text, text + strlen (text));
+    }
+  else
+    pp_append_text (pp, str, str + length);
+  XDELETEVEC (str);
+}
+
 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
    in FLAGS.  */
 
@@ -171,6 +250,10 @@ dump_decl_name (pretty_printer *pp, tree
     {
       if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
 	pp_tree_identifier (pp, DECL_ASSEMBLER_NAME (node));
+      /* For DECL_NAMELESS names look for embedded uids in the
+	 names and sanitize them for TDF_NOUID.  */
+      else if ((flags & TDF_NOUID) && DECL_NAMELESS (node))
+	dump_fancy_name (pp, DECL_NAME (node));
       else
 	pp_tree_identifier (pp, DECL_NAME (node));
     }
@@ -2593,8 +2676,15 @@ dump_generic_node (pretty_printer *pp, t
 
     case SSA_NAME:
       if (SSA_NAME_IDENTIFIER (node))
-	dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
-			   spc, flags, false);
+	{
+	  if ((flags & TDF_NOUID)
+	      && SSA_NAME_VAR (node)
+	      && DECL_NAMELESS (SSA_NAME_VAR (node)))
+	    dump_fancy_name (pp, SSA_NAME_IDENTIFIER (node));
+	  else
+	    dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
+			       spc, flags, false);
+	}
       pp_underscore (pp);
       pp_decimal_int (pp, SSA_NAME_VERSION (node));
       if (SSA_NAME_IS_DEFAULT_DEF (node))


	Jakub

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

* Re: [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594)
  2016-04-13 14:32           ` Jakub Jelinek
@ 2016-04-13 19:18             ` Richard Biener
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Biener @ 2016-04-13 19:18 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Martin Jambor, Jason Merrill, gcc-patches

On April 13, 2016 4:32:25 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Wed, Apr 13, 2016 at 09:25:56AM +0200, Richard Biener wrote:
>> So if you think it's not acceptable to drop the relation between
>> the artificial number used by SRA and the original UID then go
>> with a hash-map unconditionally.  You still have to dump and lookup
>> the actual relation though - there's no way around this unless you
>> hack dump-final-insns to filter DECL names (maybe just make it
>> strip all DECL_ARTIFICIAL names completely?)
>
>Here is an alternative patch, keep the fancy names as before,
>but in TDF_NOUID dumps sanitize them.  Most of the DECL_NAMELESS
>decls other than ones with the SRA fancy names should not contain
>anything that would be tweaked for the printout, and doing it this
>way has the advantage that one can always just use flags without
>TDF_NOUID
>to see the real fancy names.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Richard.

>2016-04-13  Jakub Jelinek  <jakub@redhat.com>
>
>	PR c++/70594
>	* tree-sra.c (create_access_replacement,
>	get_replaced_param_substitute): Set DECL_NAMELESS on repl if it
>	gets fancy name.
>	* tree-pretty-print.c (dump_fancy_name): New function.
>	(dump_decl_name, dump_generic_node): Use it.
>
>--- gcc/tree-sra.c.jj	2016-04-12 19:12:34.000000000 +0200
>+++ gcc/tree-sra.c	2016-04-13 13:52:28.329925560 +0200
>@@ -2132,6 +2132,7 @@ create_access_replacement (struct access
>       bool fail = false;
> 
>       DECL_NAME (repl) = get_identifier (pretty_name);
>+      DECL_NAMELESS (repl) = 1;
>       obstack_free (&name_obstack, pretty_name);
> 
>       /* Get rid of any SSA_NAMEs embedded in debug_expr,
>@@ -4704,6 +4705,7 @@ get_replaced_param_substitute (struct ip
> 
>       repl = create_tmp_reg (TREE_TYPE (adj->base), "ISR");
>       DECL_NAME (repl) = get_identifier (pretty_name);
>+      DECL_NAMELESS (repl) = 1;
>       obstack_free (&name_obstack, pretty_name);
> 
>       adj->new_ssa_base = repl;
>--- gcc/tree-pretty-print.c.jj	2016-03-17 16:54:44.000000000 +0100
>+++ gcc/tree-pretty-print.c	2016-04-13 14:10:59.667085487 +0200
>@@ -161,6 +161,85 @@ print_generic_expr (FILE *file, tree t,
>   pp_flush (tree_pp);
> }
> 
>+/* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num>
>sequences
>+   in it are replaced with Dxxxx, as long as they are at the start or
>+   preceded by $ and at the end or followed by $.  See make_fancy_name
>+   in tree-sra.c.  */
>+
>+static void
>+dump_fancy_name (pretty_printer *pp, tree name)
>+{
>+  int cnt = 0;
>+  int length = IDENTIFIER_LENGTH (name);
>+  const char *n = IDENTIFIER_POINTER (name);
>+  do
>+    {
>+      n = strchr (n, 'D');
>+      if (n == NULL)
>+	break;
>+      if (ISDIGIT (n[1])
>+	  && (n == IDENTIFIER_POINTER (name) || n[-1] == '$'))
>+	{
>+	  int l = 2;
>+	  while (ISDIGIT (n[l]))
>+	    l++;
>+	  if (n[l] == '\0' || n[l] == '$')
>+	    {
>+	      cnt++;
>+	      length += 5 - l;
>+	    }
>+	  n += l;
>+	}
>+      else
>+	n++;
>+    }
>+  while (1);
>+  if (cnt == 0)
>+    {
>+      pp_tree_identifier (pp, name);
>+      return;
>+    }
>+
>+  char *str = XNEWVEC (char, length + 1);
>+  char *p = str;
>+  const char *q;
>+  q = n = IDENTIFIER_POINTER (name);
>+  do
>+    {
>+      q = strchr (q, 'D');
>+      if (q == NULL)
>+	break;
>+      if (ISDIGIT (q[1])
>+	  && (q == IDENTIFIER_POINTER (name) || q[-1] == '$'))
>+	{
>+	  int l = 2;
>+	  while (ISDIGIT (q[l]))
>+	    l++;
>+	  if (q[l] == '\0' || q[l] == '$')
>+	    {
>+	      memcpy (p, n, q - n);
>+	      memcpy (p + (q - n), "Dxxxx", 5);
>+	      p += (q - n) + 5;
>+	      n = q + l;
>+	    }
>+	  q += l;
>+	}
>+      else
>+	q++;
>+    }
>+  while (1);
>+  memcpy (p, n, IDENTIFIER_LENGTH (name) - (n - IDENTIFIER_POINTER
>(name)));
>+  str[length] = '\0';
>+  if (pp_translate_identifiers (pp))
>+    {
>+      const char *text = identifier_to_locale (str);
>+      pp_append_text (pp, text, text + strlen (text));
>+    }
>+  else
>+    pp_append_text (pp, str, str + length);
>+  XDELETEVEC (str);
>+}
>+
> /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
>    in FLAGS.  */
> 
>@@ -171,6 +250,10 @@ dump_decl_name (pretty_printer *pp, tree
>     {
>       if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
> 	pp_tree_identifier (pp, DECL_ASSEMBLER_NAME (node));
>+      /* For DECL_NAMELESS names look for embedded uids in the
>+	 names and sanitize them for TDF_NOUID.  */
>+      else if ((flags & TDF_NOUID) && DECL_NAMELESS (node))
>+	dump_fancy_name (pp, DECL_NAME (node));
>       else
> 	pp_tree_identifier (pp, DECL_NAME (node));
>     }
>@@ -2593,8 +2676,15 @@ dump_generic_node (pretty_printer *pp, t
> 
>     case SSA_NAME:
>       if (SSA_NAME_IDENTIFIER (node))
>-	dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
>-			   spc, flags, false);
>+	{
>+	  if ((flags & TDF_NOUID)
>+	      && SSA_NAME_VAR (node)
>+	      && DECL_NAMELESS (SSA_NAME_VAR (node)))
>+	    dump_fancy_name (pp, SSA_NAME_IDENTIFIER (node));
>+	  else
>+	    dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
>+			       spc, flags, false);
>+	}
>       pp_underscore (pp);
>       pp_decimal_int (pp, SSA_NAME_VERSION (node));
>       if (SSA_NAME_IS_DEFAULT_DEF (node))
>
>
>	Jakub


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

end of thread, other threads:[~2016-04-13 19:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 14:54 [PATCH] Don't include DECL_UIDs in tree-sra fancy names for -fdump-final-insns= (PR c++/70594) Jakub Jelinek
2016-04-12 15:49 ` Richard Biener
2016-04-12 15:55   ` Jakub Jelinek
2016-04-12 18:20     ` Richard Biener
2016-04-12 18:48       ` Jakub Jelinek
2016-04-13  7:26         ` Richard Biener
2016-04-13 14:32           ` Jakub Jelinek
2016-04-13 19:18             ` Richard Biener

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