ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic on estimating...
authorJan Hubicka <hubicka@ucw.cz>
Mon, 16 May 2016 10:10:28 +0000 (12:10 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 16 May 2016 10:10:28 +0000 (10:10 +0000)
* ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic
on estimating thunk bodies; do not set inline_failed to CIF_THUNK for
calls from thunk.
* ipa-inline-transform.c (inline_call): When inlining into thunk produce
gimple body.
(preserve_function_body_p): No need to preserve function body
* cif-codes.def (CIF_THUNK): Remove.
* cgraphclones.c (duplicate_thunk_for_node): Thunks calls are inlinable.

* g++.dg/ipa/ivinline-7.C: Do not xfail.
* g++.dg/ipa/ivinline-9.C: Do not xfail.

From-SVN: r236274

gcc/ChangeLog
gcc/cgraph.c
gcc/cgraphclones.c
gcc/cif-code.def
gcc/ipa-inline-analysis.c
gcc/ipa-inline-transform.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/ivinline-7.C
gcc/testsuite/g++.dg/ipa/ivinline-9.C

index 23f03a7df359d6610b3c4eb4f5a74300aaa7df19..7f70b9c696737aceaf6b914673e3dc52b9ebf132 100644 (file)
@@ -1,3 +1,14 @@
+2016-05-16  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic
+       on estimating thunk bodies; do not set inline_failed to CIF_THUNK for
+       calls from thunk.
+       * ipa-inline-transform.c (inline_call): When inlining into thunk produce
+       gimple body.
+       (preserve_function_body_p): No need to preserve function body
+       * cif-codes.def (CIF_THUNK): Remove.
+       * cgraphclones.c (duplicate_thunk_for_node): Thunks calls are inlinable.
+
 2016-05-16  Jan Hubicka  <hubicka@ucw.cz>
 
        * tree-inline.c (expand_call_inline): recurse after inlining thunk.
index 0c6ff93d6253928d2e5bec4d632ea27cd9e6c441..6fcdbddb7fc8395094abe9687550135223d0d06c 100644 (file)
@@ -3324,7 +3324,7 @@ cgraph_node::verify_node (void)
          error ("More than one edge out of thunk node");
           error_found = true;
        }
-      if (gimple_has_body_p (decl))
+      if (gimple_has_body_p (decl) && !global.inlined_to)
         {
          error ("Thunk is not supposed to have body");
           error_found = true;
index 43ee7352e5b09ae086672629b0352071a8947698..97eb927c01b26e6b28d7d7258631b65803bbf4a7 100644 (file)
@@ -337,8 +337,6 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
 
   cgraph_edge *e = new_thunk->create_edge (node, NULL, 0,
                                                  CGRAPH_FREQ_BASE);
-  e->call_stmt_cannot_inline_p = true;
-  e->inline_failed = CIF_THUNK;
   symtab->call_edge_duplication_hooks (thunk->callees, e);
   symtab->call_cgraph_duplication_hooks (thunk, new_thunk);
   return new_thunk;
index f112e962aadfedd8fbe23b89582247a6758d56a6..196151fe8d222f376909c8460f884b06f18971d6 100644 (file)
@@ -95,10 +95,6 @@ DEFCIFCODE(MISMATCHED_ARGUMENTS, CIF_FINAL_ERROR,
 DEFCIFCODE(LTO_MISMATCHED_DECLARATIONS, CIF_FINAL_ERROR,
           N_("mismatched declarations during linktime optimization"))
 
-/* Caller is thunk.  */
-DEFCIFCODE(THUNK, CIF_FINAL_ERROR,                                             
-          N_("thunk call"))                                                    
-
 /* Call was originally indirect.  */
 DEFCIFCODE(ORIGINALLY_INDIRECT_CALL, CIF_FINAL_NORMAL,
           N_("originally indirect function call not considered for inlining"))
index 17b21d17c5f41187712c10f04d095eefdd92618b..82d1774abcb4f7cae1096c8199a17f04b77042a7 100644 (file)
@@ -2932,11 +2932,13 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
       struct inline_edge_summary *es = inline_edge_summary (node->callees);
       struct predicate t = true_predicate ();
 
-      node->callees->inline_failed = CIF_THUNK;
       node->local.can_change_signature = false;
-      es->call_stmt_size = INLINE_SIZE_SCALE;
-      es->call_stmt_time = INLINE_TIME_SCALE;
-      account_size_time (info, INLINE_SIZE_SCALE * 2, INLINE_TIME_SCALE * 2, &t);
+      es->call_stmt_size = eni_size_weights.call_cost;
+      es->call_stmt_time = eni_time_weights.call_cost;
+      account_size_time (info, INLINE_SIZE_SCALE * 2,
+                        INLINE_TIME_SCALE * 2, &t);
+      t = not_inlined_predicate ();
+      account_size_time (info, 2 * INLINE_SIZE_SCALE, 0, &t);
       inline_update_overall_summary (node);
       info->self_size = info->size;
       info->self_time = info->time;
index 759617bb72f5b41a564b99c045db69799de86f4a..1e6e108b9dbdf2e2e4cf67cc3f78249c2f945cec 100644 (file)
@@ -314,12 +314,20 @@ inline_call (struct cgraph_edge *e, bool update_original,
   /* Don't even think of inlining inline clone.  */
   gcc_assert (!callee->global.inlined_to);
 
-  e->inline_failed = CIF_OK;
-  DECL_POSSIBLY_INLINED (callee->decl) = true;
-
   to = e->caller;
   if (to->global.inlined_to)
     to = to->global.inlined_to;
+  if (to->thunk.thunk_p)
+    {
+      if (in_lto_p)
+       to->get_untransformed_body ();
+      to->expand_thunk (false, true);
+      e = to->callees;
+    }
+
+
+  e->inline_failed = CIF_OK;
+  DECL_POSSIBLY_INLINED (callee->decl) = true;
 
   if (DECL_FUNCTION_PERSONALITY (callee->decl))
     DECL_FUNCTION_PERSONALITY (to->decl)
@@ -580,7 +588,7 @@ preserve_function_body_p (struct cgraph_node *node)
   gcc_assert (!node->alias && !node->thunk.thunk_p);
 
   /* Look if there is any clone around.  */
-  if (node->clones)
+  if (node->clones && !node->clones->thunk.thunk_p)
     return true;
   return false;
 }
index 1598857f712c193acb4e6e77c9298545f5cf1181..c5f151f7fe4dd447e295554bf216138b98c75e99 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-16  Jan Hubicka  <hubicka@ucw.cz>
+
+       * g++.dg/ipa/ivinline-7.C: Do not xfail.
+       * g++.dg/ipa/ivinline-9.C: Do not xfail.
+
 2016-05-16  Matthew Wahab  <matthew.wahab@arm.com>
 
        * g++.dg/ext/arm-fp16/fp16-param-1.c: Update expected output.  Add
index b725db5cb1d74a9e54fea351695f5f324f70be79..a7b41e7bd59af8e33fe0478e75c38c8e68eb0358 100644 (file)
@@ -76,4 +76,4 @@ int main (int argc, char *argv[])
 }
 
 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::.*foo"  "inline"  } } */
-/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main"  "inline"  { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main"  "inline"  } } */
index f6110c10076867ac22afbd77370aae8f9500461e..41b2381877a60b97b3fc39dd9183390b2be2119c 100644 (file)
@@ -90,4 +90,4 @@ int main (int argc, char *argv[])
 }
 
 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::.*foo"  "inline"  } } */
-/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main"  "inline"  { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main"  "inline"  } } */