Revert "replace several uses of the anon namespace with GCC_FINAL"
[gcc.git] / gcc / ipa.c
index c14f5992ae0577bd45b1115b406d820358268017..75e367f01156182eff81a2fcd21190948064f45b 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -20,33 +20,17 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "hard-reg-set.h"
 #include "alias.h"
-#include "symtab.h"
 #include "options.h"
-#include "wide-int.h"
-#include "inchash.h"
-#include "tree.h"
 #include "fold-const.h"
 #include "calls.h"
 #include "stringpool.h"
-#include "predict.h"
-#include "basic-block.h"
-#include "hash-map.h"
-#include "is-a.h"
-#include "plugin-api.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "ipa-ref.h"
 #include "cgraph.h"
 #include "tree-pass.h"
-#include "gimple-expr.h"
 #include "gimplify.h"
 #include "flags.h"
 #include "target.h"
@@ -60,8 +44,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "profile.h"
 #include "params.h"
 #include "internal-fn.h"
-#include "tree-ssa-alias.h"
-#include "gimple.h"
 #include "dbgcnt.h"
 
 
@@ -197,7 +179,7 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
             unused.  */
          if (TREE_CODE (TREE_TYPE (n->decl)) == METHOD_TYPE
              && type_in_anonymous_namespace_p
-                   (method_class_type (TREE_TYPE (n->decl))))
+                   (TYPE_METHOD_BASETYPE (TREE_TYPE (n->decl))))
            continue;
 
           symtab_node *body = n->function_symbol ();
@@ -476,6 +458,20 @@ symbol_table::remove_unreachable_nodes (FILE *file)
              if (cnode->global.inlined_to)
                body_needed_for_clonning.add (cnode->decl);
 
+             /* For instrumentation clones we always need original
+                function node for proper LTO privatization.  */
+             if (cnode->instrumentation_clone
+                 && cnode->definition)
+               {
+                 gcc_assert (cnode->instrumented_version || in_lto_p);
+                 if (cnode->instrumented_version)
+                   {
+                     enqueue_node (cnode->instrumented_version, &first,
+                                   &reachable);
+                     reachable.add (cnode->instrumented_version);
+                   }
+               }
+
              /* For non-inline clones, force their origins to the boundary and ensure
                 that body is not removed.  */
              while (cnode->clone_of)
@@ -492,7 +488,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
            }
          else if (cnode->thunk.thunk_p)
            enqueue_node (cnode->callees->callee, &first, &reachable);
-             
+
          /* If any reachable function has simd clones, mark them as
             reachable as well.  */
          if (cnode->simd_clones)
@@ -661,7 +657,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
     if (node->address_taken
        && !node->used_from_other_partition)
       {
-       if (!node->call_for_symbol_thunks_and_aliases
+       if (!node->call_for_symbol_and_aliases
            (has_addr_references_p, NULL, true)
            && (!node->instrumentation_clone
                || !node->instrumented_version