When there are enough registers, the register pressure cost is unnecessarily bumped by adding another n_cands.
This behavior may result in register pressure costs for the case when there are enough registers being higher than for other cases. When there are enough registers, the register pressure cost should be equal to n_invs + n_cands. This used to be the case before c18101f. gcc/ChangeLog: * tree-ssa-loop-ivopts.cc (ivopts_estimate_reg_pressure): Adjust. Signed-off-by: Dimitrije Milosevic <dimitrije.milose...@syrmia.com> --- gcc/tree-ssa-loop-ivopts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 60c61dc9e49..3176482d0d9 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -6092,7 +6092,7 @@ ivopts_estimate_reg_pressure (struct ivopts_data *data, unsigned n_invs, /* If we have enough registers. */ if (regs_needed + target_res_regs < available_regs) - cost = n_new; + return n_new; /* If close to running out of registers, try to preserve them. */ else if (regs_needed <= available_regs) cost = target_reg_cost [speed] * regs_needed; -- 2.25.1