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


Reply via email to