[backport from gcc-4.8/trunk r185787 ] gcc/ 2012-03-26 Eric Botcazou PR rtl-optimization/52629 * reload1.c (count_pseudo): Short-circuit common case. (count_spilled_pseudo): Return early for pseudos without hard regs. Assert that the pseudo has got a hard reg before manipulating it. --- gcc-4.7.0/gcc/reload1.c.~1~ 2012-02-05 15:49:05.000000000 +0100 +++ gcc-4.7.0/gcc/reload1.c 2012-04-15 13:26:36.000000000 +0200 @@ -1746,11 +1746,12 @@ count_pseudo (int reg) int r = reg_renumber[reg]; int nregs; + /* Ignore spilled pseudo-registers which can be here only if IRA is used. */ + if (ira_conflicts_p && r < 0) + return; + if (REGNO_REG_SET_P (&pseudos_counted, reg) - || REGNO_REG_SET_P (&spilled_pseudos, reg) - /* Ignore spilled pseudo-registers which can be here only if IRA - is used. */ - || (ira_conflicts_p && r < 0)) + || REGNO_REG_SET_P (&spilled_pseudos, reg)) return; SET_REGNO_REG_SET (&pseudos_counted, reg); @@ -1827,12 +1828,17 @@ count_spilled_pseudo (int spilled, int s { int freq = REG_FREQ (reg); int r = reg_renumber[reg]; - int nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (reg)]; + int nregs; + + /* Ignore spilled pseudo-registers which can be here only if IRA is used. */ + if (ira_conflicts_p && r < 0) + return; + + gcc_assert (r >= 0); + + nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (reg)]; - /* Ignore spilled pseudo-registers which can be here only if IRA is - used. */ - if ((ira_conflicts_p && r < 0) - || REGNO_REG_SET_P (&spilled_pseudos, reg) + if (REGNO_REG_SET_P (&spilled_pseudos, reg) || spilled + spilled_nregs <= r || r + nregs <= spilled) return;