Function ivopts_estimate_reg_pressure is taxing candidate sets
by the number of candidates included in set. This makes for an
uneven playing field, making it very difficult for larger sets
to be chosen.
In try_improve_iv_set to candidate set another candidate is added
only if the cost improves (therefore prefering fewer candidates
per set), but having reg pressure cost factor in the number of
candidates makes a disbalance when choosing the best option.
gcc/ChangeLog:
* tree-ssa-loop-ivopts.cc (ivopts_estimate_reg_pressure):
Remove n_cands bias from reg pressure cost calculation.
Co-authored-by: Radosav Krunić <[email protected]>
Signed-off-by: Djordje Todorović <[email protected]>
Signed-off-by: Chao-Ying Fu <[email protected]>
Signed-off-by: Jovan Dmitrović <[email protected]>
Signed-off-by: Radosav Krunić <[email protected]>
---
gcc/tree-ssa-loop-ivopts.cc | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 3c0ce1794c2f..72f801a6fd89 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -6111,9 +6111,7 @@ ivopts_estimate_reg_pressure (struct ivopts_data *data,
unsigned n_invs,
+ target_spill_cost [speed] * (n_cands - available_regs) * 2
+ target_spill_cost [speed] * (regs_needed - n_cands);
- /* Finally, add the number of candidates, so that we prefer eliminating
- induction variables if possible. */
- return cost + n_cands;
+ return cost;
}
/* For each size of the induction variable set determine the penalty. */
--
2.34.1