From c1eed5a1541acfdfb1107a4400675c2407680ce8 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Feb 2015 01:16:11 +0100 Subject: [PATCH] re PR ipa/64686 (ICE: in edge_badness, at ipa-inline.c:912 during Firefox LTO build with enabled checking) 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 | 6 ++++++ gcc/ipa-inline.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr64686.C | 19 +++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr64686.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9726fcf26f..fa6a7e826ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-04 Jan Hubicka + + PR ipa/64686 + * ipa-inline.c (inline_small_functions): Fix ordering issue between + speculation resolution and key updates. + 2015-02-04 Jan Hubicka * ipa-prop.c (update_indirect_edges_after_inlining): By more careful diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index d9ab56a3e22..287a6dd1c4f 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef6201751bd..6ae0e63d8b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-04 Jan Hubicka + + PR ipa/64686 + * g++.dg/torture/pr64686.C: New testcase. + 2015-02-04 H.J. Lu 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 index 00000000000..714aa4100c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr64686.C @@ -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)); +} + -- 2.30.2