From 6277a71071d0af461e0016cee626fa37c01f8e02 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Thu, 18 Aug 2011 17:06:18 +0000 Subject: [PATCH] re PR rtl-optimization/49890 (IRA spill with plenty of available registers) 2011-08-18 Vladimir Makarov PR rtl-optimization/49890 * ira-costs.c (setup_regno_cost_classes_by_aclass): Don't exclude subclasses of class which is superset of a pressure class. From-SVN: r177874 --- gcc/ChangeLog | 6 ++++++ gcc/ira-costs.c | 32 +++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e467c0c24b5..e0d22a84307 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-08-18 Vladimir Makarov + + PR rtl-optimization/49890 + * ira-costs.c (setup_regno_cost_classes_by_aclass): Don't exclude + subclasses of class which is superset of a pressure class. + 2011-08-18 H.J. Lu Igor Zamyatin diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 12d3ed67fa7..dc983fd3a70 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -232,20 +232,42 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass) int i; PTR *slot; HARD_REG_SET temp, temp2; + bool exclude_p; if ((classes_ptr = cost_classes_aclass_cache[aclass]) == NULL) { COPY_HARD_REG_SET (temp, reg_class_contents[aclass]); AND_COMPL_HARD_REG_SET (temp, ira_no_alloc_regs); + /* We exclude classes from consideration which are subsets of + ACLASS only if ACLASS is a pressure class or subset of a + pressure class. It means by the definition of pressure classes + that cost of moving between susbets of ACLASS is cheaper than + load or store. */ + for (i = 0; i < ira_pressure_classes_num; i++) + { + cl = ira_pressure_classes[i]; + if (cl == aclass) + break; + COPY_HARD_REG_SET (temp2, reg_class_contents[cl]); + AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs); + if (hard_reg_set_subset_p (temp, temp2)) + break; + } + exclude_p = i < ira_pressure_classes_num; classes.num = 0; for (i = 0; i < ira_important_classes_num; i++) { cl = ira_important_classes[i]; - COPY_HARD_REG_SET (temp2, reg_class_contents[cl]); - AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs); - if (! ira_reg_pressure_class_p[cl] - && hard_reg_set_subset_p (temp2, temp) && cl != aclass) - continue; + if (exclude_p) + { + /* Exclude no-pressure classes which are subsets of + ACLASS. */ + COPY_HARD_REG_SET (temp2, reg_class_contents[cl]); + AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs); + if (! ira_reg_pressure_class_p[cl] + && hard_reg_set_subset_p (temp2, temp) && cl != aclass) + continue; + } classes.classes[classes.num++] = cl; } slot = htab_find_slot (cost_classes_htab, &classes, INSERT); -- 2.30.2