This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Adjust call stmt cost for tailcalls
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Jan Hubicka <jh at suse dot de>
- Date: Sat, 23 Jun 2012 00:54:50 +0200
- Subject: Re: [PATCH] Adjust call stmt cost for tailcalls
- References: <alpine.LNX.2.00.1206201148060.5191@zhemvz.fhfr.qr>
>
> Tailcalls have no argument setup cost and no return value cost.
> This patch adjusts estminate_num_insns to reflect that.
>
> Honza, does this look correct?
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> Thanks,
> Richard.
>
> 2012-06-20 Richard Guenther <rguenther@suse.de>
>
> * tree-inline.c (estimate_num_insns): Estimate call cost for
> tailcalls properly.
Well, as discussed offline, this change should currently be no-op since
we discover tail calls only very late in the game.
I am not sure I agree that the argument costs are zeroed out. I.e. the
arguments are generally passed the same way as they would be for normal call,
just they are homed at different place of the stack frame.
(note that we mark by the tail call flag far more calls than those that
are really expanded to tailcall because target limitations are checked only
in calls.c).
Finally ipa-cp use estimate_move cost to estimate savings for propagating
and I think there is risk in arriving to negative numbers when costs
are not accounted at all calls.
So I am not sure we want to keep the patch in mainline in the current form...
Honza