PR tree-optimization/34708 (too much inlining)

Jan Hubicka hubicka@ucw.cz
Tue Jan 8 13:26:00 GMT 2008


> 
> Hmm, this makes estimates consistent comparing
> 
> const char *getit(int i)
> {
>   if (i == 0)
>     return "foo";
>   else if (i == 1)
>     return "bar";
>   else
>     return "foobar";
> }
> 
> and
> 
> const char *getit(int i)
> {
>   switch (i)
>     {
>     case 0: return "foo";
>     case 1: return "bar";
>     default: return "foobar";
>     }
> }
> 
> apart from adding d->weights->switch_cost, right?  So I'd rather remove
> the addition of d->weights->switch_cost.  Does this make the testcase
> still fixed?

Hmm, good point.  I am testing patch with removing switch_cost
completely and will commit it if passes.  It still match on the
testcase.  Naturally removing comple of cases  to get overall cost down
I can still get the function inlined, question is whether on real
application the testcase is comming from we would still blow the limited
PLT table.

We still would have less chances for that due to limiting cascaded
inlining (ie for function calling ErrorType it is now harder to remain
small function).

Honza



More information about the Gcc-patches mailing list