re PR ipa/64686 (ICE: in edge_badness, at ipa-inline.c:912 during Firefox LTO build...
authorJan Hubicka <hubicka@ucw.cz>
Thu, 5 Feb 2015 00:16:11 +0000 (01:16 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 5 Feb 2015 00:16:11 +0000 (00:16 +0000)
PR ipa/64686
* ipa-inline.c (inline_small_functions): Fix ordering issue between
speculation resolution and key updates.
* g++.dg/torture/pr64686.C: New testcase.

From-SVN: r220429

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr64686.C [new file with mode: 0644]

index f9726fcf26f65fa70ca2ec2ffe56decfdd2df8ae..fa6a7e826ecd2895206fb33611ef990cdb1f2c33 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-04  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/64686
+       * ipa-inline.c (inline_small_functions): Fix ordering issue between
+       speculation resolution and key updates.
+
 2015-02-04  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-prop.c (update_indirect_edges_after_inlining): By more careful
index d9ab56a3e22e3229a6cad379190b66b8cf7f73f6..287a6dd1c4f41bf9e674b6e0dc46bd09a42b2157 100644 (file)
@@ -1702,6 +1702,7 @@ inline_small_functions (void)
     {
       bool update = false;
       struct cgraph_edge *next;
+      bool has_speculative = false;
 
       if (dump_file)
        fprintf (dump_file, "Enqueueing calls in %s/%i.\n",
@@ -1719,12 +1720,17 @@ inline_small_functions (void)
              gcc_assert (!edge->aux);
              update_edge_key (&edge_heap, edge);
            }
-         if (edge->speculative && !speculation_useful_p (edge, edge->aux != NULL))
+         if (edge->speculative)
+           has_speculative = true;
+       }
+      if (has_speculative)
+       for (edge = node->callees; edge; edge = next)
+         if (edge->speculative && !speculation_useful_p (edge,
+                                                         edge->aux != NULL))
            {
              edge->resolve_speculation ();
              update = true;
            }
-       }
       if (update)
        {
          struct cgraph_node *where = node->global.inlined_to
index ef6201751bdfa7d06bd62b05da1ad4c14b382fe0..6ae0e63d8b3b5d3eeeea06c7e9841375d57a2f7d 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-04  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/64686
+       * g++.dg/torture/pr64686.C: New testcase.
+
 2015-02-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR rtl-optimization/64905
diff --git a/gcc/testsuite/g++.dg/torture/pr64686.C b/gcc/testsuite/g++.dg/torture/pr64686.C
new file mode 100644 (file)
index 0000000..714aa41
--- /dev/null
@@ -0,0 +1,19 @@
+// { dg-do compile }
+class A
+{
+protected:
+  A *m_fn2 (int) const;
+public:
+  virtual A *m_fn1 (int *) const = 0;
+};
+class B : A
+{
+  B (A *, int, A *);
+  A *m_fn1 (int *) const;
+};
+A *
+B::m_fn1 (int *) const
+{
+  new B (m_fn2 (0)->m_fn1 (0), 0, m_fn2 (0)->m_fn1 (0));
+}
+