On 8/6/2026 11:53 PM, wangjue wrote:
From: juewang <[email protected]>
The branch-cost based noce limit is too small for unpredictable branches on
C950 and blocks profitable Zicond sequences. Add a per-tune factor, defaulting
to one, and use five for C950.
This improves 505.mcf_r by nearly 5% on C950.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_tune_param): Add
noce_ifcvt_unpredictable_cost_factor.
(xt_c9501_tune_info): Set it to 5.
(riscv_max_noce_ifcvt_seq_cost): Scale the branch-cost based limit.
So you can't just raise BRANCH_COST to fix this? That's the traditional
big hammer solution.
It might also help if you passed along a testcase. I've found many of
the failure to if-convert problems are due to inefficiencies in the
sequences we generate; we can often get if-conversion to fire by
generating better generic sequences and fixing costing goofs elsewhere.
These tend to be more narrow fixes, but help all kinds of cases for
RISC-V as well as other targets.
In fact, I think I fixed one of these for mcf not terribly long ago.
There's a reasonable chance I've looked a the underlying test already
and have state on the problem. If you're at all concerned about posting
spec2017 sources in a public forum, you can pass the case directly along
to me or even just mentioning the function may be enough.
jeff