lto-cgraph.c: Include ipa-utils.h.
authorJan Hubicka <jh@suse.cz>
Tue, 10 Sep 2013 13:50:43 +0000 (15:50 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 10 Sep 2013 13:50:43 +0000 (13:50 +0000)
* lto-cgraph.c: Include ipa-utils.h.
(compute_ltrans_boundary): Also add possible targets into the boundary.

From-SVN: r202447

gcc/ChangeLog
gcc/Makefile.in
gcc/lto-cgraph.c

index f98817a8ff67eafe8e760ab76ebcf09a2da2d517..5979c51ed8e4857ecf5a1e3e3b1d15d14768f6dd 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-10  Jan Hubicka  <jh@suse.cz>
+
+       * lto-cgraph.c: Include ipa-utils.h.
+       (compute_ltrans_boundary): Also add possible targets into the boundary.
+
 2013-09-10  Jan Hubicka  <jh@suse.cz>
 
        * gimple-fold.c (gimple_get_virt_method_for_binfo): Pass real
index a72b75302bd1dbaeb4f7260593de471243fe3898..7a3daece1a9d7edd440b49207258e4c4986e8d63 100644 (file)
@@ -2194,7 +2194,7 @@ lto-cgraph.o: lto-cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h   \
    $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_CORE_H) \
    $(EXCEPT_H) $(TIMEVAR_H) pointer-set.h $(LTO_STREAMER_H) \
    $(GCOV_IO_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) $(TREE_PASS_H) \
-   profile.h $(CONTEXT_H) $(PASS_MANAGER_H)
+   profile.h $(CONTEXT_H) $(PASS_MANAGER_H) ipa-utils.h
 lto-streamer-in.o: lto-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) \
    input.h $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
index fcba1b92acd0b9dbbd697164b7fafc09b042275f..4eb443bc8df3f373d8cdeeee2f439bde6ef28662 100644 (file)
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "profile.h"
 #include "context.h"
 #include "pass_manager.h"
+#include "ipa-utils.h"
 
 static void output_cgraph_opt_summary (void);
 static void input_cgraph_opt_summary (vec<symtab_node>  nodes);
@@ -766,6 +767,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
   int i;
   lto_symtab_encoder_t encoder;
   lto_symtab_encoder_iterator lsei;
+  struct pointer_set_t *reachable_call_targets = pointer_set_create ();
 
   encoder = lto_symtab_encoder_new (false);
 
@@ -837,9 +839,40 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
              add_node_to (encoder, callee, false);
            }
        }
+      /* Add all possible targets for late devirtualization.  */
+      if (flag_devirtualize)
+       for (edge = node->indirect_calls; edge; edge = edge->next_callee)
+         if (edge->indirect_info->polymorphic)
+           {
+             unsigned int i;
+             void *cache_token;
+             bool final;
+             vec <cgraph_node *>targets
+               = possible_polymorphic_call_targets
+                   (edge, &final, &cache_token);
+             if (!pointer_set_insert (reachable_call_targets,
+                                      cache_token))
+               {
+                 for (i = 0; i < targets.length(); i++)
+                   {
+                     struct cgraph_node *callee = targets[i];
+
+                     /* Adding an external declarations into the unit serves
+                        no purpose and just increases its boundary.  */
+                     if (callee->symbol.definition
+                         && !lto_symtab_encoder_in_partition_p
+                              (encoder, (symtab_node)callee))
+                       {
+                         gcc_assert (!callee->global.inlined_to);
+                         add_node_to (encoder, callee, false);
+                       }
+                   }
+               }
+           }
     }
- lto_symtab_encoder_delete (in_encoder);
- return encoder;
+  lto_symtab_encoder_delete (in_encoder);
+  pointer_set_destroy (reachable_call_targets);
+  return encoder;
 }
 
 /* Output the part of the symtab in SET and VSET.  */