This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto][patch] Don't try to ipa-cp into inlined nodes
- From: Rafael Espindola <espindola at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at google dot com>
- Date: Tue, 25 Nov 2008 14:38:18 +0000
- Subject: [lto][patch] Don't try to ipa-cp into inlined nodes
If a node has been inlined, we shouldn't try to ipa-cp into it. This
is not a problem in a normal compilation since ipa-cp runs before the
inliner, but the problem exists in lto.
gcc/
2008-11-25 Rafael Espindola <espindola@google.com>
* ipa-cp.c (ipcp_insert_stage): Skip inlined nodes.
gcc/testsuite/
2008-11-25 Rafael Espindola <espindola@google.com>
* (gcc.dg/lto/20081125_0.c, gcc.dg/lto/20081125_1.c): New.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f6864bb..5147802 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1192,7 +1192,8 @@ ipcp_insert_stage (void)
{
struct ipa_node_params *info;
/* Propagation of the constant is forbidden in certain conditions. */
- if (!node->analyzed || !ipcp_node_modifiable_p (node))
+ if (!node->analyzed || !ipcp_node_modifiable_p (node)
+ || node->global.inlined_to)
continue;
info = IPA_NODE_REF (node);
if (ipa_is_called_with_var_arguments (info))
@@ -1274,6 +1275,7 @@ ipcp_insert_stage (void)
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
VEC_quick_push (cgraph_edge_p, redirect_callers, cs);
+ gcc_assert (!node->global.inlined_to);
/* Redirecting all the callers of the node to the
new versioned node. */
node1 =
diff --git a/gcc/testsuite/gcc.dg/lto/20081125_0.c b/gcc/testsuite/gcc.dg/lto/20081125_0.c
new file mode 100644
index 0000000..b85e698
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081125_0.c
@@ -0,0 +1,8 @@
+/* { dg-do link } */
+
+int foo (int);
+
+int main()
+{
+ return foo (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081125_1.c b/gcc/testsuite/gcc.dg/lto/20081125_1.c
new file mode 100644
index 0000000..1fcf4e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081125_1.c
@@ -0,0 +1,4 @@
+int foo (int x)
+{
+ return x;
+}