diff mbox series

Patch to fix PR88179

Message ID 56a739a1-d66b-d249-5cb3-9414f41f86a9@redhat.com
State New
Headers show
Series Patch to fix PR88179 | expand

Commit Message

Vladimir Makarov Nov. 30, 2018, 9:39 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88179

   The patch was successfully bootstrapped and tested on x86-64.

    Committed as rev. 266682.
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 266681)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2018-11-30  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/88179
+	* lra-constraints.c (address_eliminator::address_eliminator):
+	Don't eleminate regs in illegitimate address.
+
 2018-11-30  David Malcolm  <dmalcolm@redhat.com>
 
 	PR preprocessor/88257
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 266678)
+++ lra-constraints.c	(working copy)
@@ -359,14 +359,20 @@  address_eliminator::address_eliminator (
   if (m_base_loc != NULL)
     {
       m_base_reg = *m_base_loc;
-      lra_eliminate_reg_if_possible (m_base_loc);
+      /* If we have non-legitimate address which is decomposed not in
+	 the way we expected, don't do elimination here.  In such case
+	 the address will be reloaded and elimination will be done in
+	 reload insn finally.  */
+      if (REG_P (m_base_reg))
+	lra_eliminate_reg_if_possible (m_base_loc);
       if (m_ad->base_term2 != NULL)
 	*m_ad->base_term2 = *m_ad->base_term;
     }
   if (m_index_loc != NULL)
     {
       m_index_reg = *m_index_loc;
-      lra_eliminate_reg_if_possible (m_index_loc);
+      if (REG_P (m_index_reg))
+	lra_eliminate_reg_if_possible (m_index_loc);
     }
 }