On 5/31/24 9:03 AM, Robin Dapp wrote:
Hi,
before noce_find_if_block processes a block it sets up an if_info
structure that holds the original costs. At that point the costs of
the then/else blocks have not been added so we only care about the
"if" cost.
The code originally used BRANCH_COST for that but was then changed
to COST_N_INSNS (2) - a compare and a jump.
This patch computes the jump costs via
insn_cost (if_info.jump, ...)
which is supposed to incorporate the branch costs and, in case of a CC
comparison,
pattern_cost (if_info.cond, ...)
which is supposed to account for the CC creation.
For compare_and_jump patterns insn_cost should have already computed
the right cost.
Does this "split" make sense, generally?
Bootstrapped and regtested on x86, aarch64 and power10. Regtested
on riscv.
Regards
Robin
gcc/ChangeLog:
* ifcvt.cc (noce_process_if_block): Subtract condition pattern
cost if applicable.
(noce_find_if_block): Use insn_cost and pattern_cost for
original cost.
OK. Obviously we'll need to be on the lookout for regressions. My bet
is on s390 since you already tested the x86, aarch64 & p10 targets :-)
jeff