On 9/7/26 8:43 AM, [email protected] wrote:
From: Kyrylo Tkachov <[email protected]>

noce_process_if_block estimates the cost of the branch it wants to remove
twice: once for the multiple-set candidate and once for the single-set path.
Both compute the same thing on top of the same base cost, namely the
branch-probability-weighted average of the two arms when optimising for speed
and their sum when optimising for size, but the two are written out
separately.

Move the formula into noce_original_region_cost and call it from both sites.
The local holding the base cost is renamed from old_cost to base_cost, which
describes what it holds, and the speed test both estimates need is hoisted to
sit beside it rather than being asked for twice.  The estimates are unchanged,
so this is no functional change.

gcc/ChangeLog:

        * ifcvt.cc (noce_original_region_cost): New function.
        (noce_process_if_block): Use it for the multiple-set and the
        single-set estimate.  Rename old_cost to base_cost and compute
        speed_p once.

Signed-off-by: Kyrylo Tkachov <[email protected]>
OK
jeff

Reply via email to