diff mbox series

Fix incorrect merge of conflictant names in `dump_graphviz`

Message ID 20191021230020.7jv4duuonpz5vb2y@smtp.gmail.com
State New
Headers show
Series Fix incorrect merge of conflictant names in `dump_graphviz` | expand

Commit Message

Giuliano Belinassi Oct. 21, 2019, 11 p.m. UTC
Hi,

When using lto-dump -callgraph with two or more .o files containing distinct
functions with the same name, dump_graphviz incorrectly merged those functions
into a single node. This patch fixes this issue by calling `dump_name` instead of
`name`, therefore concat'ing the function name with the node's id.

To understeand what was the issue, let's say you have two files:

a.c:
static void foo (void) { do_something (); }

b.c:
static void foo (void) { do_something_else (); }

There are distinct functions and should be represented as distinct nodes in
the callgraph dump.



Is it ok for me to commit it in trunk as trivial? And is there something
special that I should know before doing a commit into trunk?



gcc/ChangeLog:
2019-07-22  Giuliano Belinassi  <giuliano.belinassi@usp.br>

	* cgraph.c (dump_graphviz): Change name to dump_name


Giuliano.

Comments

Richard Biener Oct. 22, 2019, 8:06 a.m. UTC | #1
On Tue, Oct 22, 2019 at 1:00 AM Giuliano Belinassi
<giuliano.belinassi@usp.br> wrote:
>
> Hi,
>
> When using lto-dump -callgraph with two or more .o files containing distinct
> functions with the same name, dump_graphviz incorrectly merged those functions
> into a single node. This patch fixes this issue by calling `dump_name` instead of
> `name`, therefore concat'ing the function name with the node's id.
>
> To understeand what was the issue, let's say you have two files:
>
> a.c:
> static void foo (void) { do_something (); }
>
> b.c:
> static void foo (void) { do_something_else (); }
>
> There are distinct functions and should be represented as distinct nodes in
> the callgraph dump.
>
>
>
> Is it ok for me to commit it in trunk as trivial? And is there something
> special that I should know before doing a commit into trunk?

The patch is OK.  Patches to trunk require bootstrap and regtesting,
for patches like this that do not affect code-generation a bootstrap
is enough (it's often subtle how patches break that).

Thanks,
Richard.

>
>
> gcc/ChangeLog:
> 2019-07-22  Giuliano Belinassi  <giuliano.belinassi@usp.br>
>
>         * cgraph.c (dump_graphviz): Change name to dump_name
>
>
> Giuliano.
diff mbox series

Patch

diff --git gcc/cgraph.c gcc/cgraph.c
index 8b752d83809..671306db5ca 100644
--- gcc/cgraph.c
+++ gcc/cgraph.c
@@ -2155,7 +2155,7 @@  cgraph_node::dump_graphviz (FILE *f)
     {
       cgraph_node *callee = edge->callee;
 
-      fprintf (f, "\t\"%s\" -> \"%s\"\n", name (), callee->name ());
+      fprintf (f, "\t\"%s\" -> \"%s\"\n", dump_name (), callee->dump_name ());
     }
 }