diff mbox

[lto-partition.c] move assignment to refs_node, last_visited_node outside if-else

Message ID CAAgBjMn2USb3vJ5GDghKQ2bJM4M1Oe+P=K6JjVxWRXJDiVzq1g@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni April 7, 2016, 1:35 p.m. UTC
Hi,
This is a silly patch that moves the following assignments outside
if-else conditionals,
refs_node = node;
last_visited_node++;
resulting in empty else block.
OK for trunk ?

Thanks,
Prathamesh

Comments

Prathamesh Kulkarni April 7, 2016, 1:52 p.m. UTC | #1
On 7 April 2016 at 19:11, Marek Polacek <polacek@redhat.com> wrote:
> On Thu, Apr 07, 2016 at 07:05:09PM +0530, Prathamesh Kulkarni wrote:

>> Hi,

>> This is a silly patch that moves the following assignments outside

>> if-else conditionals,

>> refs_node = node;

>> last_visited_node++;

>> resulting in empty else block.

>> OK for trunk ?

>>

>> Thanks,

>> Prathamesh

>

>> diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c

>> index 9eb63c2..dca59af 100644

>> --- a/gcc/lto/lto-partition.c

>> +++ b/gcc/lto/lto-partition.c

>> @@ -568,14 +568,13 @@ lto_balanced_map (int n_lto_partitions)

>>         symtab_node *snode = lto_symtab_encoder_deref (partition->encoder,

>>                                                       last_visited_node);

>>

>> +       refs_node = snode;

>> +       last_visited_node++;

>> +

>>         if (cgraph_node *node = dyn_cast <cgraph_node *> (snode))

>>           {

>>             struct cgraph_edge *edge;

>>

>> -           refs_node = node;

>> -

>> -           last_visited_node++;

>> -

>>             gcc_assert (node->definition || node->weakref);

>>

>>             /* Compute boundary cost of callgraph edges.  */

>> @@ -614,11 +613,6 @@ lto_balanced_map (int n_lto_partitions)

>>                   cost += edge_cost;

>>               }

>>           }

>> -       else

>> -         {

>> -           refs_node = snode;

>

> But this is snode, not node.

node is snode dyn_cast to cgraph_node *.

 symtab_node *snode = lto_symtab_encoder_deref (partition->encoder,
                                                        last_visited_node);

 if (cgraph_node *node = dyn_cast <cgraph_node *> (snode))
   {
      struct cgraph_edge *edge;
      refs_node = node;
      last_visited_node++;
      ....
   }
else
  {
    refs_node = snode;
    last_visited_node++;
  }

Thanks,
Prathamesh
>

>> -           last_visited_node++;

>> -         }

>>

>>         /* Compute boundary cost of IPA REF edges and at the same time look into

>>            variables referenced from current partition and try to add them.  */

>

>         Marek
diff mbox

Patch

diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 9eb63c2..dca59af 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -568,14 +568,13 @@  lto_balanced_map (int n_lto_partitions)
 	  symtab_node *snode = lto_symtab_encoder_deref (partition->encoder,
 							last_visited_node);
 
+	  refs_node = snode;
+	  last_visited_node++;
+
 	  if (cgraph_node *node = dyn_cast <cgraph_node *> (snode))
 	    {
 	      struct cgraph_edge *edge;
 
-	      refs_node = node;
-
-	      last_visited_node++;
-
 	      gcc_assert (node->definition || node->weakref);
 
 	      /* Compute boundary cost of callgraph edges.  */
@@ -614,11 +613,6 @@  lto_balanced_map (int n_lto_partitions)
 		    cost += edge_cost;
 		}
 	    }
-	  else
-	    {
-	      refs_node = snode;
-	      last_visited_node++;
-	    }
 
 	  /* Compute boundary cost of IPA REF edges and at the same time look into
 	     variables referenced from current partition and try to add them.  */