ipa-inline.c (early_inliner): Skip inlining only in always_inlined...
authorJan Hubicka <hubicka@ucw.cz>
Mon, 2 Feb 2015 23:46:31 +0000 (00:46 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 2 Feb 2015 23:46:31 +0000 (23:46 +0000)
* ipa-inline.c (early_inliner): Skip inlining only in always_inlined;
if some always_inline was inlined, apply changes before inlining
heuristically.

* g++.dg/ipa/devirt-37.C: Disable early inlining.

From-SVN: r220359

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/devirt-37.C

index 467a668d64770b36c5e7e0ec434998d19c06889f..9f6e800536f1da1e029d796484b4a5c72f0ae0f8 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-02  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline.c (early_inliner): Skip inlining only in always_inlined;
+       if some always_inline was inlined, apply changes before inlining
+       heuristically.
+
 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
 
        PR jit/64810
index be2289074006da30424f179dcc78690b88d39bca..d9ab56a3e22e3229a6cad379190b66b8cf7f73f6 100644 (file)
@@ -2528,7 +2528,9 @@ early_inliner (function *fun)
         cycles of edges to be always inlined in the callgraph.
 
         We might want to be smarter and just avoid this type of inlining.  */
-      || DECL_DISREGARD_INLINE_LIMITS (node->decl))
+      || (DECL_DISREGARD_INLINE_LIMITS (node->decl)
+         && lookup_attribute ("always_inline",
+                              DECL_ATTRIBUTES (node->decl))))
     ;
   else if (lookup_attribute ("flatten",
                             DECL_ATTRIBUTES (node->decl)) != NULL)
@@ -2543,6 +2545,18 @@ early_inliner (function *fun)
     }
   else
     {
+      /* If some always_inline functions was inlined, apply the changes.
+        This way we will not account always inline into growth limits and
+        moreover we will inline calls from always inlines that we skipped
+        previously becuase of conditional above.  */
+      if (inlined)
+       {
+         timevar_push (TV_INTEGRATION);
+         todo |= optimize_inline_calls (current_function_decl);
+         inline_update_overall_summary (node);
+         inlined = false;
+         timevar_pop (TV_INTEGRATION);
+       }
       /* We iterate incremental inlining to get trivial cases of indirect
         inlining.  */
       while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
index 1bb46b341829b4e5f442276a9fbec748c924cdfc..2039b4c469764637f606ec24dae333ee6ba2ccab 100644 (file)
@@ -1,3 +1,7 @@
+2015-02-02  Jan Hubicka  <hubicka@ucw.cz>
+
+       * g++.dg/ipa/devirt-37.C: Disable early inlining.
+
 2015-02-02  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
index 0dc4d27bbe242f9813d967a3ebce19eebc67844c..7e1acdc986cbeee23e489ea67c515f0d3f2922fb 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre2-details"  } */
+/* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre2-details -fno-early-inlining"  } */
 #include <stdlib.h>
 struct A {virtual void test() {abort ();}};
 struct B:A