From: Martin Jambor <mjambor@suse.cz>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/7] cgraph_node -> cgraph_get_node conversions accepting NULL results
Date: Mon, 11 Apr 2011 13:33:00 -0000 [thread overview]
Message-ID: <20110411133314.GB1659@virgil.arch.suse.de> (raw)
In-Reply-To: <20110411101824.GB32348@kam.mff.cuni.cz>
Hi,
On Mon, Apr 11, 2011 at 12:18:24PM +0200, Jan Hubicka wrote:
> > 2011-04-06 Martin Jambor <mjambor@suse.cz>
> >
> > gcc/
> > * cgraph.c (cgraph_local_info): Call cgraph_get_node instead
> > of cgraph_node, handle NULL return value.
> > (cgraph_global_info): Likewise.
> > (cgraph_rtl_info): Likewise.
> > * tree-inline.c (estimate_num_insns): Likewise.
> > * gimplify.c (unshare_body): Likewise.
> > (unvisit_body): Likewise.
> > (gimplify_body): Likewise.
> > * predict.c (optimize_function_for_size_p): Likewise.
> > * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise.
> > (call_may_clobber_ref_p_1): Likewise.
> > * varasm.c (function_section_1): Likewise.
> > (assemble_start_function): Likewise.
> >
> > gcc/java/
> > * decl.c (java_mark_decl_local): Call cgraph_get_node instead of
> > cgraph_node and handle returned NULL.
>
> OK.
Thnanks! I'm in the process of re-bootstrapping and will start
committing the patches soon.
However...
> > Index: src/gcc/predict.c
> > ===================================================================
> > --- src.orig/gcc/predict.c
> > +++ src/gcc/predict.c
> > @@ -214,10 +214,11 @@ probably_never_executed_bb_p (const_basi
> > bool
> > optimize_function_for_size_p (struct function *fun)
> > {
> > + struct cgraph_node *node;
> > return (optimize_size
> > || (fun && fun->decl
> > - && (cgraph_node (fun->decl)->frequency
> > - == NODE_FREQUENCY_UNLIKELY_EXECUTED)));
> > + && (node = cgraph_get_node (fun->decl))
> > + && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)));
>
> I guess this is because optimize_function_for_size_p is used from folder
> that in turn is called before cgraph is built.
> Please, for consistency, add same
> test into the other predicates that calls cgraph_node (fun->decl) here
...there are no such places in in predict.c, the other two calls
to cgraph_(get_)node pass current_function_decl to the function.
Or did you mean some other file?
> and also uwind the statement into series of ifs. It has grown in to
> quite a beast. This is preaproved either as this patch of followup.
OK, I've turned the body of the predicate into:
/* Return true when current function should always be optimized for size. */
bool
optimize_function_for_size_p (struct function *fun)
{
struct cgraph_node *node;
if (optimize_size)
return true;
if (!fun || !fun->decl)
return false;
node = cgraph_get_node (fun->decl);
if (node && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED))
return true;
else
return false;
}
Thanks,
Martin
next prev parent reply other threads:[~2011-04-11 13:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-06 23:25 [PATCH 0/7] Change of call graph interface - cgraph_node function removal Martin Jambor
2011-04-06 23:26 ` [PATCH 4/7] Removal of cgraph_node function Martin Jambor
2011-04-11 10:28 ` Jan Hubicka
2011-04-11 14:15 ` Martin Jambor
2011-04-06 23:26 ` [PATCH 6/7] A tweak to fortran -> call graph interface Martin Jambor
2011-04-06 23:26 ` [PATCH 2/7] cgraph_node -> cgraph_get_node conversions accepting NULL results Martin Jambor
2011-04-11 10:18 ` Jan Hubicka
2011-04-11 13:33 ` Martin Jambor [this message]
2011-04-06 23:26 ` [PATCH 7/7] Tweaks to objc -> call graph interface Martin Jambor
2011-04-06 23:26 ` [PATCH 1/7] Simple cgraph_node -> cgraph_get_node conversions Martin Jambor
2011-04-11 10:13 ` Jan Hubicka
2011-04-13 13:09 ` H.J. Lu
2011-04-06 23:26 ` [PATCH 3/7] cgraph_node -> cgraph_get_node with asserts Martin Jambor
2011-04-11 10:20 ` Jan Hubicka
2011-04-06 23:26 ` [PATCH 5/7] Tweaks to C++ -> call graph interface Martin Jambor
2011-04-11 15:30 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110411133314.GB1659@virgil.arch.suse.de \
--to=mjambor@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).