ipa-inline-analysis.c (simple_edge_hints): Fix check for cross-module inlining.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 3 Feb 2015 16:57:20 +0000 (17:57 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 3 Feb 2015 16:57:20 +0000 (16:57 +0000)
* ipa-inline-analysis.c (simple_edge_hints): Fix check for
cross-module inlining.
* cgraph.h (cgraph_node): Add flag merged.
* ipa-icf.c (sem_function::merge): Maintain it.

* lto-symtab.c (lto_cgraph_replace_node): Maintain merged flag.

From-SVN: r220372

gcc/ChangeLog
gcc/cgraph.h
gcc/ipa-icf.c
gcc/ipa-inline-analysis.c
gcc/lto/ChangeLog
gcc/lto/lto-symtab.c

index 9552d334c5c9d6d417cf44c2902b2307bdb1c2ca..b5dcf0cf51bb60b7c05737a466e7cad7066e4926 100644 (file)
@@ -1,3 +1,10 @@
+2015-02-03  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline-analysis.c (simple_edge_hints): Fix check for
+       cross-module inlining.
+       * cgraph.h (cgraph_node): Add flag merged.
+       * ipa-icf.c (sem_function::merge): Maintain it.
+
 2015-02-03  Richard Sandiford  <richard.sandiford@arm.com>
 
        * config/arm/arm.c (thumb2_reorg): Test UNARY_P and BINARY_P
index 40e6c6c767c51513ff9d009d7028d9ab6cb889b0..0fdb459ab00917b483a519d1eeed3e92fac18714 100644 (file)
@@ -1296,6 +1296,8 @@ public:
      other operation that could make previously non-trapping memory
      accesses trapping.  */
   unsigned nonfreeing_fn : 1;
+  /* True if there was multiple COMDAT bodies merged by lto-symtab.  */
+  unsigned merged : 1;
 };
 
 /* A cgraph node set is a collection of cgraph nodes.  A cgraph node
index 9b2d117b9736a425e65264c65f675ad2271046d6..cf5e5d929687b0f96e73701374b59cb00a1328c3 100644 (file)
@@ -711,6 +711,10 @@ sem_function::merge (sem_item *alias_item)
        }
 
       alias->icf_merged = true;
+      if (local_original->lto_file_data
+         && alias->lto_file_data
+         && local_original->lto_file_data != alias->lto_file_data)
+      local_original->merged = true;
 
       /* The alias function is removed if symbol address
          does not matter.  */
@@ -725,6 +729,10 @@ sem_function::merge (sem_item *alias_item)
   else if (create_alias)
     {
       alias->icf_merged = true;
+      if (local_original->lto_file_data
+         && alias->lto_file_data
+         && local_original->lto_file_data != alias->lto_file_data)
+      local_original->merged = true;
 
       /* Remove the function's body.  */
       ipa_merge_profiles (original, alias);
@@ -762,6 +770,10 @@ sem_function::merge (sem_item *alias_item)
         }
 
       alias->icf_merged = true;
+      if (local_original->lto_file_data
+         && alias->lto_file_data
+         && local_original->lto_file_data != alias->lto_file_data)
+      local_original->merged = true;
       ipa_merge_profiles (local_original, alias, true);
       alias->create_wrapper (local_original);
 
index ffa559c0c5f22b74a7f179fb53af7aabe2ada8bb..a628a9e987d8b81a406ebe28a09c3fa1433437b5 100644 (file)
@@ -3702,13 +3702,16 @@ simple_edge_hints (struct cgraph_edge *edge)
   int hints = 0;
   struct cgraph_node *to = (edge->caller->global.inlined_to
                            ? edge->caller->global.inlined_to : edge->caller);
+  struct cgraph_node *callee = edge->callee->ultimate_alias_target ();
   if (inline_summaries->get (to)->scc_no
-      && inline_summaries->get (to)->scc_no == inline_summaries->get (edge->callee)->scc_no
+      && inline_summaries->get (to)->scc_no
+        == inline_summaries->get (callee)->scc_no
       && !edge->recursive_p ())
     hints |= INLINE_HINT_same_scc;
 
-  if (to->lto_file_data && edge->callee->lto_file_data
-      && to->lto_file_data != edge->callee->lto_file_data)
+  if (callee->lto_file_data && edge->caller->lto_file_data
+      && edge->caller->lto_file_data != callee->lto_file_data
+      && !callee->merged)
     hints |= INLINE_HINT_cross_module;
 
   return hints;
index c77e6ccae40ecd5b2a161ecff0db95cb13385945..87f1988ac0b907c23f522a43c62a9ed132298ae9 100644 (file)
@@ -1,3 +1,7 @@
+2015-02-03  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto-symtab.c (lto_cgraph_replace_node): Maintain merged flag.
+
 2015-01-30  Joseph Myers  <joseph@codesourcery.com>
 
        * lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
index 39c9257edc08379d76cd55d37ac20b3d76650be9..c00fd87483a0d9dd6dd03fc014e273ba468e9c0f 100644 (file)
@@ -88,6 +88,8 @@ lto_cgraph_replace_node (struct cgraph_node *node,
       gcc_assert (!prevailing_node->global.inlined_to);
       prevailing_node->mark_address_taken ();
     }
+  if (node->definition && prevailing_node->definition)
+    prevailing_node->merged = true;
 
   /* Redirect all incoming edges.  */
   compatible_p