summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-17 19:53:18 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-17 19:53:18 +0000
commit0ecf4b0349049dfa68e3c99135285b32e2fb0405 (patch)
tree301efc828166e84e581576aed480b1108b228812
parentd9c77450414e5500ab6c52415e7be159faa21506 (diff)
downloadgcc-0ecf4b0349049dfa68e3c99135285b32e2fb0405.tar.gz
* ipa-inline-transform.c (master_clone_with_noninline_clones_p): New.
(clone_inlined_nodes): Do not overwrite the clone if above predicate returns true. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216415 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-inline-transform.c19
2 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af39978c997..b2a8e7a2a6f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ipa-inline-transform.c (master_clone_with_noninline_clones_p): New.
+ (clone_inlined_nodes): Do not overwrite the clone if above predicate
+ returns true.
+
2014-10-17 Ilya Tocar <ilya.tocar@intel.com>
* config/i386/i386.c (MAX_VECT_LEN): Move earlier.
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 4b0fcad396f..1cb4c0520e8 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -122,6 +122,20 @@ can_remove_node_now_p (struct cgraph_node *node, struct cgraph_edge *e)
return true;
}
+/* Return true if NODE is a master clone with non-inline clones. */
+
+static bool
+master_clone_with_noninline_clones_p (struct cgraph_node *node)
+{
+ if (node->clone_of)
+ return false;
+
+ for (struct cgraph_node *n = node->clones; n; n = n->next_sibling_clone)
+ if (n->decl != node->decl)
+ return true;
+
+ return false;
+}
/* E is expected to be an edge being inlined. Clone destination node of
the edge and redirect it to the new clone.
@@ -155,7 +169,10 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
/* Recursive inlining never wants the master clone to
be overwritten. */
&& update_original
- && can_remove_node_now_p (e->callee, e))
+ && can_remove_node_now_p (e->callee, e)
+ /* We cannot overwrite a master clone with non-inline clones
+ until after these clones are materialized. */
+ && !master_clone_with_noninline_clones_p (e->callee))
{
/* TODO: When callee is in a comdat group, we could remove all of it,
including all inline clones inlined into it. That would however