[PATCH] rs6000: Save/restore r31 if frame_pointer_needed is true
luoxhu@linux.ibm.com
luoxhu@linux.ibm.com
Thu Mar 26 04:15:22 GMT 2020
From: Xionghu Luo <luoxhu@linux.vnet.ibm.com>
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.
Bootstrap and regression tested pass on Power8-LE. Backport to gcc-9
required once approved.
gcc/ChangeLog
2020-03-26 Xiong Hu Luo <luoxhu@linux.ibm.com>
PR target/91518
* config/rs6000/rs6000-logue.c (save_reg_p): Save r31 if
frame_pointer_needed.
---
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;
+
return !call_used_or_fixed_reg_p (reg) && df_regs_ever_live_p (reg);
}
--
2.21.0.777.g83232e3864
More information about the Gcc-patches
mailing list