re PR lto/65130 (ICE with LTO on valid code on x86_64-linux-gnu)

PR ipa/65130
	* ipa-inline.c (check_callers): Looks for recursion.
	(inline_to_all_callers): Give up on uninlinable or recursive edges.
	* ipa-inline-analysis.c (inline_summary_t::duplicate): Do not update
	summary of inline clones.
	(do_estimate_growth_1): Fix recursion check.

	* gcc.dg/lto/pr65130_0.c: New testcase.
	* gcc.dg/lto/pr65130_1.c: New testcase.

From-SVN: r221124
This commit is contained in:
Jan Hubicka 2015-03-02 21:31:21 +01:00 committed by Jan Hubicka
parent b91b562cf2
commit 1af8bfe516
6 changed files with 69 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2015-03-02 Jan Hubicka <hubicka@ucw.cz>
PR ipa/65130
* ipa-inline.c (check_callers): Looks for recursion.
(inline_to_all_callers): Give up on uninlinable or recursive edges.
* ipa-inline-analysis.c (inline_summary_t::duplicate): Do not update
summary of inline clones.
(do_estimate_growth_1): Fix recursion check.
2015-03-02 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64988

View File

@ -1291,7 +1291,8 @@ inline_summary_t::duplicate (cgraph_node *src,
set_hint_predicate (&info->array_index, p);
}
}
inline_update_overall_summary (dst);
if (!dst->global.inlined_to)
inline_update_overall_summary (dst);
}
@ -3924,10 +3925,11 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
continue;
}
if (e->caller == d->node
|| (e->caller->global.inlined_to
&& e->caller->global.inlined_to == d->node))
d->self_recursive = true;
if (e->recursive_p ())
{
d->self_recursive = true;
continue;
}
d->growth += estimate_edge_growth (e);
}
return false;

View File

@ -952,6 +952,8 @@ check_callers (struct cgraph_node *node, void *has_hot_call)
return true;
if (!can_inline_edge_p (e, true))
return true;
if (e->recursive_p ())
return true;
if (!(*(bool *)has_hot_call) && e->maybe_hot_p ())
*(bool *)has_hot_call = true;
}
@ -2094,6 +2096,15 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
{
struct cgraph_node *caller = node->callers->caller;
if (!can_inline_edge_p (node->callers, true)
|| node->callers->recursive_p ())
{
if (dump_file)
fprintf (dump_file, "Uninlinable call found; giving up.\n");
*num_calls = 0;
return false;
}
if (dump_file)
{
fprintf (dump_file,

View File

@ -1,3 +1,9 @@
2015-03-02 Jan Hubicka <hubicka@ucw.cz>
PR ipa/65130
* gcc.dg/lto/pr65130_0.c: New testcase.
* gcc.dg/lto/pr65130_1.c: New testcase.
2015-03-02 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64988

View File

@ -0,0 +1,19 @@
/* { dg-lto-do link } */
/* { dg-lto-options { { -flto -O1 -fdevirtualize } } } */
extern void fn3 (void);
void fn2(void)
{
fn3();
}
void fn1(void)
{
fn2();
}
void fn4(void)
{
fn2();
}

View File

@ -0,0 +1,17 @@
/* { dg-options "-O2 -fdevirtualize" } */
extern void fn1(void);
extern void fn4 (void);
int a;
void fn3(void)
{
for (; a;)
fn4();
}
int main() {
fn1();
return 0;
}