On Fri, Apr 13, 2018 at 03:29:47PM -0400, Vladimir Makarov wrote: > The attached patch fixes > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79916 > > The PR is about LRA cycling on some tests when SD data are used. The > problem was in that actual assigned reg to pseudo was not in the pseudo > preferred class and this resulted in wrong generated code which LRA tried to > change again and again. > > The patch was successfully bootstrapped and tested on ppc64 (gcc110). > > Is it ok to commit?
I have just formatting nits and will defer the actual review to the PowerPC maintainers. The nit is that all the lines are too long. Not sure if if (reg_renumber[regno] >= 0) regno = reg_renumber[regno]; else regno = cl == NO_REGS ? -1 : ira_class_hard_regs[cl][1]; or regno = (reg_renumber[regno] >= 0 ? reg_renumber[regno] : cl == NO_REGS ? -1 : ira_class_hard_regs[cl][1]); is better, the latter is perhaps more compact. > --- config/rs6000/rs6000.c (revision 259330) > +++ config/rs6000/rs6000.c (working copy) > @@ -10610,7 +10610,7 @@ rs6000_emit_move (rtx dest, rtx source, > if (regno >= FIRST_PSEUDO_REGISTER) > { > cl = reg_preferred_class (regno); > - regno = cl == NO_REGS ? -1 : ira_class_hard_regs[cl][1]; > + regno = reg_renumber[regno] >= 0 ? reg_renumber[regno] : cl == > NO_REGS ? -1 : ira_class_hard_regs[cl][1]; > } > if (regno >= 0 && ! FP_REGNO_P (regno)) > { > @@ -10635,7 +10635,7 @@ rs6000_emit_move (rtx dest, rtx source, > { > cl = reg_preferred_class (regno); > gcc_assert (cl != NO_REGS); > - regno = ira_class_hard_regs[cl][0]; > + regno = reg_renumber[regno] >= 0 ? reg_renumber[regno] : > ira_class_hard_regs[cl][0]; > } > if (FP_REGNO_P (regno)) > { > @@ -10664,7 +10664,7 @@ rs6000_emit_move (rtx dest, rtx source, > if (regno >= FIRST_PSEUDO_REGISTER) > { > cl = reg_preferred_class (regno); > - regno = cl == NO_REGS ? -1 : ira_class_hard_regs[cl][0]; > + regno = reg_renumber[regno] >= 0 ? reg_renumber[regno] : cl == > NO_REGS ? -1 : ira_class_hard_regs[cl][0]; > } > if (regno >= 0 && ! FP_REGNO_P (regno)) > { > @@ -10689,7 +10689,7 @@ rs6000_emit_move (rtx dest, rtx source, > { > cl = reg_preferred_class (regno); > gcc_assert (cl != NO_REGS); > - regno = ira_class_hard_regs[cl][0]; > + regno = reg_renumber[regno] >= 0 ? reg_renumber[regno] : > ira_class_hard_regs[cl][0]; > } > if (FP_REGNO_P (regno)) > { Jakub