summaryrefslogtreecommitdiff
path: root/gcc/ipa-pure-const.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-01 23:20:15 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-01 23:20:15 +0000
commita1e880328b19d607aeef6885338b2d5df8fe86bb (patch)
tree851bbe5f7a341f0badf18bf5a177dfbf5e290e5c /gcc/ipa-pure-const.c
parent272bcfefaeeb36604f125789a64469983c76f9b5 (diff)
downloadgcc-a1e880328b19d607aeef6885338b2d5df8fe86bb.tar.gz
* cgraph.c (cgraph_clone_node): Add redirect_callers parameter.
(cgraph_create_virtual_clone): Just pass redirect_callers around. * cgraph.h (cgraph_clone_node): Update prototype. * ipa-pure-const.c (self_recursive_p): New function. (propagate): Use it. * ipa-inline.c (cgraph_clone_inlined_nodes, * cgraph_decide_recursive_inlining): Update. * gcc.dg/tree-ssa/ipa-cp-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152388 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r--gcc/ipa-pure-const.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index e5ff3a77253..04d4e112ed3 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -688,6 +688,18 @@ ignore_edge (struct cgraph_edge *e)
return (!e->can_throw_external);
}
+/* Return true if NODE is self recursive function. */
+
+static bool
+self_recursive_p (struct cgraph_node *node)
+{
+ struct cgraph_edge *e;
+ for (e = node->callees; e; e = e->next_callee)
+ if (e->callee == node)
+ return true;
+ return false;
+}
+
/* Produce the global information by preforming a transitive closure
on the local information that was produced by generate_summary.
Note that there is no function_transform pass since this only
@@ -776,6 +788,8 @@ propagate (void)
if (w_l->state_previously_known != IPA_NEITHER
&& this_state > w_l->state_previously_known)
this_state = w_l->state_previously_known;
+ if (!this_looping && self_recursive_p (w))
+ this_looping = true;
if (!w_l->looping_previously_known)
this_looping = false;