[PATCH, COMMITTED] a few cosmetic cleanups in cgraphunit.c
Bernhard Fischer
rep.dot.nop@gmail.com
Thu Jun 19 10:47:00 GMT 2008
On Tue, Jun 17, 2008 at 05:54:43PM +0200, Jan Hubicka wrote:
>> Hi,
>>
>> Please find attached some questions about eventually redundant calls in
>> cgraphunit.c
>>
>> Also, i think that the error message for "nodes with no released memory
>> found" should better read "unreleased" for clarity.
>>
>> Comments?
>
>> Index: gcc-4.4/gcc/cgraphunit.c
>> ===================================================================
>> --- gcc-4.4/gcc/cgraphunit.c (revision 136674)
>> +++ gcc-4.4/gcc/cgraphunit.c (working copy)
>> @@ -603,7 +603,7 @@ cgraph_finalize_function (tree decl, boo
>>
>> node->pid = cgraph_max_pid ++;
>> notice_global_symbol (decl);
>> - node->decl = decl;
>> + /*XXX: redundant? */node->decl = decl;
>
>This should be redundant since we moved into single declaration rule,
>yes. so it is OK to remove it.
>> node->local.finalized = true;
>> node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
>> record_cdtor_fn (node->decl);
>> @@ -1149,10 +1149,10 @@ cgraph_expand_function (struct cgraph_no
>>
>> /* Make sure that BE didn't give up on compiling. */
>> /* ??? Can happen with nested function of extern inline. */
>> - gcc_assert (TREE_ASM_WRITTEN (node->decl));
>> + gcc_assert (TREE_ASM_WRITTEN (decl));
>>
>> current_function_decl = NULL;
>> - if (!cgraph_preserve_function_body_p (node->decl))
>> + if (!cgraph_preserve_function_body_p (decl))
>> {
>> cgraph_release_function_body (node);
>> /* Eliminate all call edges. This is important so the call_expr no longer
>> @@ -1189,7 +1189,7 @@ cgraph_expand_all_functions (void)
>> {
>> struct cgraph_node *node;
>> struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
>> - int order_pos = 0, new_order_pos = 0;
>> + int order_pos, new_order_pos = 0;
>> int i;
>>
>> order_pos = cgraph_postorder (order);
>> @@ -1365,7 +1365,9 @@ cgraph_optimize (void)
>>
>> /* Frontend may output common variables after the unit has been finalized.
>> It is safe to deal with them here as they are always zero initialized. */
>> - varpool_analyze_pending_decls ();
>> +
>> +/*XXX: redundant? */ varpool_analyze_pending_decls (); /* */
>
>This call was added because wrapup_global_declaration was emitting some
>of uninitialized global vars and such, so the varpool had to be walked
>once again. Perhaps this has changed since that, but I don't remember
>seeing anything like that.
>
>If testing passes, I guess it is OK to remove the call.
It passed testing with c,fortran, but i left it in for now.
>> - internal_error ("nodes with no released memory found");
>> + internal_error ("nodes with unreleased memory found");
>
>This is definitly OK as well as the other clenaups above.
Thanks, I've committed the attached as revision 136941.
2008-06-19 Bernhard Fischer <>
* cgraphunit.c (cgraph_finalize_function): Remove redundant setting of
node->decl.
(cgraph_expand_function): Use local copy of decl.
(cgraph_expand_all_functions): Remove redundant initialization of
order_pos.
(cgraph_optimize): Reword internal_error message.
>
>Honza
>> }
>> #endif
>> }
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cgraphunit-cosmetics.patch
Type: text/x-diff
Size: 1694 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080619/50c9ac89/attachment.bin>
More information about the Gcc-patches
mailing list