This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR rtl-optimization/59311: [4.9 Regression] LRA fails to update REG_CFA_SET_VDRAP note
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Vladimir Makarov <vmakarov at redhat dot com>
- Date: Wed, 27 Nov 2013 15:12:43 -0800
- Subject: PATCH: PR rtl-optimization/59311: [4.9 Regression] LRA fails to update REG_CFA_SET_VDRAP note
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
remove_pseudos in lra-spills.c failed to handle REG_CFA_SET_VDRAP note.
This patch changes spill_pseudos to handle REG_XXX notes. It also adds
an assert that regno passed to DWARF_FRAME_REGNUM isn't a pseudo register.
Tested on Linux/x86-64 with -m64 and -m32. g++.dg/cpp1y/vla-initlist1.C
failed with -m32 when assert in dwf_regno and passed with this patch.
OK to install?
Thanks.
H.J.
---
2013-11-27 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/59311
* dwarf2cfi.c (dwf_regno): Assert reg isn't pseudo register.
* lra-spills.c (spill_pseudos): Handle REG_XXX notes.
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 19276e2..b8e25bc 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -906,6 +906,7 @@ notice_eh_throw (rtx insn)
static inline unsigned
dwf_regno (const_rtx reg)
{
+ gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
return DWARF_FRAME_REGNUM (REGNO (reg));
}
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 4ab10c2..0dd341a 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -477,9 +477,30 @@ spill_pseudos (void)
FOR_BB_INSNS (bb, insn)
if (bitmap_bit_p (&changed_insns, INSN_UID (insn)))
{
+ rtx *link_loc, link;
remove_pseudos (&PATTERN (insn), insn);
if (CALL_P (insn))
remove_pseudos (&CALL_INSN_FUNCTION_USAGE (insn), insn);
+ for (link_loc = ®_NOTES (insn);
+ (link = *link_loc) != NULL_RTX;
+ link_loc = &XEXP (link, 1))
+ {
+ switch (REG_NOTE_KIND (link))
+ {
+ case REG_FRAME_RELATED_EXPR:
+ case REG_CFA_DEF_CFA:
+ case REG_CFA_ADJUST_CFA:
+ case REG_CFA_OFFSET:
+ case REG_CFA_REGISTER:
+ case REG_CFA_EXPRESSION:
+ case REG_CFA_RESTORE:
+ case REG_CFA_SET_VDRAP:
+ remove_pseudos (&XEXP (link, 0), insn);
+ break;
+ default:
+ break;
+ }
+ }
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
"Changing spilled pseudos to memory in insn #%u\n",