This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR rtl-optimization/59311: [4.9 Regression] LRA fails to update REG_CFA_SET_VDRAP note


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 = &REG_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",


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]