This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]