On Wed, 2020-03-25 at 23:15 -0500, luoxhu--- via Gcc-patches wrote: > From: Xionghu Luo <luo...@linux.vnet.ibm.com> >
Hi, No real issues noted in my review. Patch is straighforward, just a couple cosmetic comments inline below. > This P1 bug is exposed by FRE refactor of r263875. Comparing the fre > dump file shows no obvious change of the segment fault function > proves > it to be a target issue. > frame_pointer_needed is set to true in reload pass > setup_can_eliminate, > but regs_ever_live[31] is false, so pro_and_epilogue doesn't > save/restore > r31 even it is used actually, causing CPU2006 465.tonto segment fault > of > loading from invalid addresses. Could also use a statement here that also reflects what the patch does. "Thus, mark the register as in-use if frame_pointer_needed is true and reg is HARD_FRAME_POINTER_REGNUM." > Bootstrap and regression tested pass on Power8-LE. Backport to gcc-9 > required once approved. > > gcc/ChangeLog > > 2020-03-26 Xiong Hu Luo <luo...@linux.ibm.com> > > PR target/91518 > * config/rs6000/rs6000-logue.c (save_reg_p): Save r31 if > frame_pointer_needed. We don't actually reference 'r31' in the code change. Maybe preferred to refer to it as HARD_FRAME_POINTER_REGNUM instead? > --- > gcc/config/rs6000/rs6000-logue.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/config/rs6000/rs6000-logue.c > b/gcc/config/rs6000/rs6000-logue.c > index 4cbf228eb79..7b62ff03afd 100644 > --- a/gcc/config/rs6000/rs6000-logue.c > +++ b/gcc/config/rs6000/rs6000-logue.c > @@ -116,6 +116,9 @@ save_reg_p (int reg) > return true; > } > > + if (reg == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) > + return true; > + Ok. > return !call_used_or_fixed_reg_p (reg) && df_regs_ever_live_p > (reg); > } Thanks -Will