* question on find_if_case_2 in ifcvt.c
@ 2011-09-09 2:20 Amker.Cheng
2011-09-09 17:46 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Amker.Cheng @ 2011-09-09 2:20 UTC (permalink / raw)
To: gcc
Hi,
In ifcvt.c's function find_if_case_2, it uses cheap_bb_rtx_cost_p to
judge the conversion.
Function cheap_bb_rtx_cost_p checks whether the total insn_rtx_cost on
non-jump insns in
basic block BB is less than MAX_COST.
So the question is why uses cheap_bb_rtx_cost_p, even when we know the
ELSE is predicted,
which means there is benefit from this conversion anyway.
Second, should cheap_bb_rtx_cost_p be tuned as "checks whether the
total insn_rtx_cost on
non-jump insns in basic block BB is no larger than MAX_COST." to
prefer normal instructions
than branch even there have same costs.
Any suggestions? Thanks in advance.
--
Best Regards.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: question on find_if_case_2 in ifcvt.c
2011-09-09 2:20 question on find_if_case_2 in ifcvt.c Amker.Cheng
@ 2011-09-09 17:46 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2011-09-09 17:46 UTC (permalink / raw)
To: Amker.Cheng; +Cc: gcc
On 09/08/2011 08:20 PM, Amker.Cheng wrote:
> Hi,
> In ifcvt.c's function find_if_case_2, it uses cheap_bb_rtx_cost_p to
> judge the conversion.
>
> Function cheap_bb_rtx_cost_p checks whether the total insn_rtx_cost on
> non-jump insns in
> basic block BB is less than MAX_COST.
>
> So the question is why uses cheap_bb_rtx_cost_p, even when we know the
> ELSE is predicted,
> which means there is benefit from this conversion anyway.
Not necessarily. This transformation is speculating insns from the
ELSE path. So there's a cost every time we mispredict the branch.
> Second, should cheap_bb_rtx_cost_p be tuned as "checks whether the
> total insn_rtx_cost on
> non-jump insns in basic block BB is no larger than MAX_COST." to
> prefer normal instructions
> than branch even there have same costs.
Perhaps, it's a corner case and I doubt it matters too much.
I have a pending patch which twiddles this code so that it takes into
account the weight of the prediction. This is important, particularly
in the case where the ELSE is not predicted -- we're paying an awful
cost for the speculation in that case.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-09 17:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-09 2:20 question on find_if_case_2 in ifcvt.c Amker.Cheng
2011-09-09 17:46 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).