aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-07-29 17:34:47 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-07-29 17:34:47 -0700
commit9b2a5ef70cb61f8a91fb7268cc36172180e0d3cd (patch)
tree23026fcdcd9433b2a8685cc8e5e252e7bee82279 /gcc/cgraph.c
parent2f5164ee55b442cf588b0f8eba915e153eaf769b (diff)
downloadgcc-9b2a5ef70cb61f8a91fb7268cc36172180e0d3cd.zip
gcc-9b2a5ef70cb61f8a91fb7268cc36172180e0d3cd.tar.gz
gcc-9b2a5ef70cb61f8a91fb7268cc36172180e0d3cd.tar.bz2
cgraph.c (cgraph_set_call_stmt_including_clones): Tidy.
* cgraph.c (cgraph_set_call_stmt_including_clones): Tidy. (cgraph_create_edge_including_clones): Likewise. * tree-inline.c (copy_bb): Operate on the correct edges when updating the callgraph. From-SVN: r150234
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index ea47aa3..ded99f9 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -654,8 +654,8 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
}
}
-/* Like cgraph_set_call_stmt but walk the clone tree and update all clones sharing
- same function body. */
+/* Like cgraph_set_call_stmt but walk the clone tree and update all
+ clones sharing the same function body. */
void
cgraph_set_call_stmt_including_clones (struct cgraph_node *orig,
@@ -666,8 +666,10 @@ cgraph_set_call_stmt_including_clones (struct cgraph_node *orig,
if (edge)
cgraph_set_call_stmt (edge, new_stmt);
- if (orig->clones)
- for (node = orig->clones; node != orig;)
+
+ node = orig->clones;
+ if (node)
+ while (node != orig)
{
struct cgraph_edge *edge = cgraph_edge (node, old_stmt);
if (edge)
@@ -690,29 +692,36 @@ cgraph_set_call_stmt_including_clones (struct cgraph_node *orig,
same function body.
TODO: COUNT and LOOP_DEPTH should be properly distributed based on relative
- frequencies of the clones.
- */
+ frequencies of the clones. */
void
-cgraph_create_edge_including_clones (struct cgraph_node *orig, struct cgraph_node *callee,
- gimple stmt, gcov_type count, int freq,
- int loop_depth,
+cgraph_create_edge_including_clones (struct cgraph_node *orig,
+ struct cgraph_node *callee,
+ gimple stmt, gcov_type count,
+ int freq, int loop_depth,
cgraph_inline_failed_t reason)
{
struct cgraph_node *node;
+ struct cgraph_edge *edge;
if (!cgraph_edge (orig, stmt))
- cgraph_create_edge (orig, callee, stmt,
- count, freq, loop_depth)->inline_failed = reason;
+ {
+ edge = cgraph_create_edge (orig, callee, stmt, count, freq, loop_depth);
+ edge->inline_failed = reason;
+ }
- if (orig->clones)
- for (node = orig->clones; node != orig;)
+ node = orig->clones;
+ if (node)
+ while (node != orig)
{
/* It is possible that we already constant propagated into the clone
and turned indirect call into dirrect call. */
if (!cgraph_edge (node, stmt))
- cgraph_create_edge (node, callee, stmt, count, freq,
- loop_depth)->inline_failed = reason;
+ {
+ edge = cgraph_create_edge (node, callee, stmt, count,
+ freq, loop_depth);
+ edge->inline_failed = reason;
+ }
if (node->clones)
node = node->clones;