https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70961
Stefan "Bebbo" Franke <stefan at franke dot ms> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stefan at franke dot ms --- Comment #6 from Stefan "Bebbo" Franke <stefan at franke dot ms> --- Simply remove the outer loop and iterate only once: has_preferred_class = (preferred_class != NO_REGS); for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++) { if (has_preferred_class && !TEST_HARD_REG_BIT(reg_class_contents[preferred_class], new_reg)) continue; if (!check_new_reg_p (old_reg, new_reg, this_head, *unavailable)) continue; if (!best_rename) return new_reg; /* In the first pass, we force the renaming of registers that don't belong to PREFERRED_CLASS to registers that do, even though the latters were used not very long ago. Also use a register if no best_new_reg was found till now */ if ((tick[best_new_reg] > tick[new_reg] || (old_reg == best_new_reg && new_reg < old_reg))) best_new_reg = new_reg; } The last "if" is my experimental version. I am also testing (with m68k) an extended preferred_rename_class2 method, which uses the register to return a maybe better class: preferred_class = (enum reg_class) targetm.preferred_rename_class2 ( super_class, old_reg); And yes, the code is smaller and faster.