re PR ipa/81360 (ice in estimate_edge_growth, at ipa-inline.h:86)
authorJan Hubicka <hubicka@ucw.cz>
Sun, 19 Nov 2017 19:58:12 +0000 (20:58 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 19 Nov 2017 19:58:12 +0000 (19:58 +0000)
PR ipa/81360
* ipa-inline.c (can_inline_edge_p): Also check that caller is optimized
* gcc.c-torture/compile/pr81360.c: New testcase.

From-SVN: r254937

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr81360.c [new file with mode: 0644]

index e955bece4b98f5b72b3b535551ad3853c5720469..ae05dacf791d0217b4118828b29e6ddaccc8aeb7 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-19  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/81360
+       * ipa-inline.c (can_inline_edge_p): Also check that caller is optimized
+
 2017-11-19  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/83001
index f4ce80ae2c6f1114cab9c2e82c53f884d9522ea6..4f1860fb284b8d673a723f7a0fce7abe96f5a89f 100644 (file)
@@ -324,7 +324,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
       e->inline_failed = CIF_BODY_NOT_AVAILABLE;
       inlinable = false;
     }
-  if (!early && !opt_for_fn (callee->decl, optimize))
+  if (!early && (!opt_for_fn (callee->decl, optimize)
+                || opt_for_fn (caller->decl, optimize)))
     {
       e->inline_failed = CIF_FUNCTION_NOT_OPTIMIZED;
       inlinable = false;
index ebdf42bea5f01c8e7ccae53746315644cab9d4ca..3858caa59e0d6f0baf7868b2b2fe1d7339b892f1 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-19  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/81360
+       * gcc.c-torture/compile/pr81360.c: New testcase.
+
 2017-11-19  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/78990
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81360.c b/gcc/testsuite/gcc.c-torture/compile/pr81360.c
new file mode 100644 (file)
index 0000000..ffd3f24
--- /dev/null
@@ -0,0 +1,11 @@
+typedef a;
+b(void *c, a d) {
+  if (c)
+    e(0, __PRETTY_FUNCTION__);
+}
+typedef f, g;
+__attribute__((optimize(0))) h() {
+  g i;
+  b(i, sizeof(f));
+}
+