On 06/21/2016 09:50 AM, James Greenhalgh wrote:

Hi,

This patch pulls the comparisons between if_info->branch_cost and a magic
number representing an instruction count to a common function. While I'm
doing it, I've documented the instructions that the magic numbers relate
to, and updated them where they were inconsistent.

If our measure of the cost of a branch is now in rtx costs units, we can
get to an estimate for the cost of an expression from the number of
instructions by multiplying through by COSTS_N_INSNS (1).

Alternatively, we could actually construct the cheap sequences and
check the sequence. But in these cases we're expecting to if-convert on
almost all targets, the transforms in this patch are almost universally
a good idea, even for targets with a very powerful branch predictor,
eliminating the branch eliminates a basic block boundary so might be
helpful for scheduling, combine, and other RTL optimizers.

Bootstrapped on x86-64 and aarch64 as part of the full sequence.

OK?

Thanks,
James

---

2016-06-21  James Greenhalgh  <james.greenha...@arm.com>

        * ifcvt.c (noce_if_info): New field: max_seq_cost.
        (noce_estimate_conversion_profitable_p): New.
        (noce_try_store_flag_constants): Use it.
        (noce_try_addcc): Likewise.
        (noce_try_store_flag_mask): Likewise.
        (noce_try_cmove): Likewise.
        (noce_try_cmove_arith): Likewise.
        (noce_find_if_block): Record targetm.max_noce_ifcvt_seq_cost.

LGTM.

jeff

Reply via email to