This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto-partition.c] move assignment to refs_node, last_visited_node outside if-else
- From: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Apr 2016 19:22:54 +0530
- Subject: Re: [lto-partition.c] move assignment to refs_node, last_visited_node outside if-else
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMn2USb3vJ5GDghKQ2bJM4M1Oe+P=K6JjVxWRXJDiVzq1g at mail dot gmail dot com> <20160407134153 dot GE28445 at redhat dot com>
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