re PR middle-end/50823 (ICE in inline_small_functions, at ipa-inline.c:1407)

2011-12-07  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/50823
	* ipa-inline.c (edge_badness): Do not account for the number of
	remaining calls.

	* gcc.dg/torture/pr50823.c: New testcase.

From-SVN: r182077
This commit is contained in:
Richard Guenther 2011-12-07 11:55:16 +00:00 committed by Richard Biener
parent df0227c425
commit f867f13406
4 changed files with 56 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2011-12-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50823
* ipa-inline.c (edge_badness): Do not account for the number of
remaining calls.
2011-12-07 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50744

View file

@ -808,7 +808,6 @@ edge_badness (struct cgraph_edge *edge, bool dump)
else if (flag_guess_branch_prob)
{
int div = edge->frequency * (1<<10) / CGRAPH_FREQ_MAX;
int growth_for_all;
div = MAX (div, 1);
gcc_checking_assert (edge->frequency <= CGRAPH_FREQ_MAX);
@ -846,14 +845,12 @@ edge_badness (struct cgraph_edge *edge, bool dump)
if (dump)
fprintf (dump_file, "Badness overflow\n");
}
growth_for_all = estimate_growth (callee);
badness += growth_for_all;
if (dump)
{
fprintf (dump_file,
" %i: guessed profile. frequency %f, overall growth %i,"
" %i: guessed profile. frequency %f,"
" benefit %f%%, divisor %i\n",
(int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE, growth_for_all,
(int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE,
relative_time_benefit (callee_info, edge, time_growth) * 100 / 256.0, div);
}
}

View file

@ -1,3 +1,8 @@
2011-12-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50823
* gcc.dg/torture/pr50823.c: New testcase.
2011-12-07 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50744

View file

@ -0,0 +1,43 @@
/* { dg-do compile } */
/* { dg-options "-finline-functions" } */
int k1, k2, k3, k4, k5, k6, k7, k8;
void set_first_insn (int);
void set_last_insn (void);
static int make_insn_raw (void)
{
set_first_insn (0);
set_last_insn ();
return k1;
}
static void add_insn_after (void)
{
if (k2)
k3 = k4;
if (k5)
k6 = k7;
}
void emit_pattern_after_noloc (int (make_raw) (void))
{
if (k8)
{
make_raw ();
add_insn_after ();
}
}
void emit_insn_after_noloc (void)
{
emit_pattern_after_noloc (make_insn_raw);
}
void emit_debug_insn_before_setloc (int k9)
{
if (k9)
make_insn_raw ();
}