re PR ipa/83051 (ICE on valid code at -O3: in edge_badness, at ipa-inline.c:1024)
authorJan Hubicka <hubicka@ucw.cz>
Wed, 17 Jan 2018 20:40:46 +0000 (21:40 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 17 Jan 2018 20:40:46 +0000 (20:40 +0000)
PR ipa/83051
* ipa-inline.c (flatten_function): Do not overwrite final inlining
failure.
* gcc.c-torture/compile/pr83051-2.c: New testcase.

From-SVN: r256818

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

index 6f30d4cab020616022ca2e706f8eb36f231b6bd0..6091649b65df84b8c52e770d79bfec1f448d71fb 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-17  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/83051
+       * ipa-inline.c (flatten_function): Do not overwrite final inlining
+       failure.
+
 2018-01-17  Will Schmidt  <will_schmidt@vnet.ibm.com>
 
        * config/rs6000/rs6000.c (rs6000_gimple_builtin): Add gimple folding
index 145ffbb5ef0d81fa6af08c47df77c87395352179..4a7181e76a503a3d642d17a4be287136cc6e1148 100644 (file)
@@ -2083,7 +2083,8 @@ flatten_function (struct cgraph_node *node, bool early)
                     "Not inlining %s into %s to avoid cycle.\n",
                     xstrdup_for_dump (callee->name ()),
                     xstrdup_for_dump (e->caller->name ()));
-         e->inline_failed = CIF_RECURSIVE_INLINING;
+         if (cgraph_inline_failed_type (e->inline_failed) != CIF_FINAL_ERROR)
+           e->inline_failed = CIF_RECURSIVE_INLINING;
          continue;
        }
 
index a1ebfc36c27ae698f43f7d18bba2f9d9780c99ee..fb0e919913f9d4ce823d57238b67a941bba21845 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-17  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/83051
+       * gcc.c-torture/compile/pr83051-2.c: New testcase.
+
 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/81054
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83051-2.c b/gcc/testsuite/gcc.c-torture/compile/pr83051-2.c
new file mode 100644 (file)
index 0000000..2bb2eaf
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-options "-fno-early-inlining" } */
+void
+bar ()
+{
+  bar (0);
+}
+
+__attribute__ ((flatten))
+void foo ()
+{
+  bar ();
+}