ipa-inline-transform.c: Include ipa-utils.h
authorJan Hubicka <jh@suse.cz>
Mon, 4 Nov 2019 19:39:52 +0000 (20:39 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 4 Nov 2019 19:39:52 +0000 (19:39 +0000)
* ipa-inline-transform.c: Include ipa-utils.h
(inline_call): Set thunk_expansion flag.
* ipa-utils.h (thunk_expansion): Declare.
* ipa-devirt.c (thunk_expansion): New global var.
(devirt_node_removal_hook): Do not invalidate cache while
doing thunk expansion.

From-SVN: r277789

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/ipa-inline-transform.c
gcc/ipa-utils.h

index f29939a0dd8fb2238e3088c61b6a8328392103ad..6d90105c8c369f4f047beb75e9a0637d8e5b715c 100644 (file)
@@ -1,3 +1,12 @@
+2019-11-04  Jan Hubicka  <jh@suse.cz>
+
+       * ipa-inline-transform.c: Include ipa-utils.h
+       (inline_call): Set thunk_expansion flag.
+       * ipa-utils.h (thunk_expansion): Declare.
+       * ipa-devirt.c (thunk_expansion): New global var.
+       (devirt_node_removal_hook): Do not invalidate cache while
+       doing thunk expansion.
+
 2019-11-04  Tamar Christina  <tamar.christina@arm.com>
 
        * tree-vect-slp.c (vectorize_slp_instance_root_stmt): Initialize rstmt.
index a14e79537886043727c06b4ab86c0be1ea69b3c3..4a73ba1aa76731d3c0c184ef2b90758b23452eff 100644 (file)
@@ -172,6 +172,11 @@ struct default_hash_traits <type_pair>
     }
 };
 
+/* HACK alert: this is used to communicate with ipa-inline-transform that
+   thunk is being expanded and there is no need to clear the polymorphic
+   call target cache.  */
+bool thunk_expansion;
+
 static bool odr_types_equivalent_p (tree, tree, bool, bool *,
                                    hash_set<type_pair> *,
                                    location_t, location_t);
@@ -2747,6 +2752,7 @@ static void
 devirt_node_removal_hook (struct cgraph_node *n, void *d ATTRIBUTE_UNUSED)
 {
   if (cached_polymorphic_call_targets
+      && !thunk_expansion
       && cached_polymorphic_call_targets->contains (n))
     free_polymorphic_call_targets_hash ();
 }
index 1cc78034f19111b5211041626080437134d72051..8b9588982f325431f4d6a08ea0c3e79387526da5 100644 (file)
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "cfg.h"
 #include "basic-block.h"
+#include "ipa-utils.h"
 
 int ncalls_inlined;
 int nfunctions_inlined;
@@ -352,6 +353,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
   if (to->thunk.thunk_p)
     {
       struct cgraph_node *target = to->callees->callee;
+      thunk_expansion = true;
       symtab->call_cgraph_removal_hooks (to);
       if (in_lto_p)
        to->get_untransformed_body ();
@@ -360,6 +362,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
       for (e = to->callees; e && e->callee != target; e = e->next_callee)
        ;
       symtab->call_cgraph_insertion_hooks (to);
+      thunk_expansion = false;
       gcc_assert (e);
     }
 
index 22e6970234a448d52ddcff4ef53037a1e65b7957..947307a3d66ddcd52c96b6c6325dd603dfed7ce0 100644 (file)
@@ -47,6 +47,9 @@ void ipa_merge_profiles (struct cgraph_node *dst,
                         struct cgraph_node *src, bool preserve_body = false);
 bool recursive_call_p (tree, tree);
 
+/* In ipa-prop.c  */
+void ipa_remove_useless_jump_functions ();
+
 /* In ipa-profile.c  */
 bool ipa_propagate_frequency (struct cgraph_node *node);
 
@@ -54,6 +57,7 @@ bool ipa_propagate_frequency (struct cgraph_node *node);
 
 struct odr_type_d;
 typedef odr_type_d *odr_type;
+extern bool thunk_expansion;
 void build_type_inheritance_graph (void);
 void rebuild_type_inheritance_graph (void);
 void update_type_inheritance_graph (void);