The following patch has been committed to gcc 5 branch as rev. 228256.

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


Index: ChangeLog
===================================================================
--- ChangeLog	(revision 228250)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2015-09-29  Vladimir Makarov  <vmaka...@redhat.com>
+
+	Backport from mainline
+	2015-07-21  Vladimir Makarov  <vmaka...@redhat.com>
+
+	PR ipa/66424.
+	* lra-remat.c (operand_to_remat): Prevent using insns with input
+	subregs processed separately by IRA.
+
 2015-09-29  Andreas Krebbel  <kreb...@linux.vnet.ibm.com>
 
 	Backport from mainline
@@ -31,7 +40,7 @@
 	("vec_scatter_element<V_HW_64:mode>_SI"): Replace gf mode
 	attribute with bhfgq.
 
-2015-09-29  Andrew Pinski  <apin...@cavium.com>    
+2015-09-29  Andrew Pinski  <apin...@cavium.com>
 
 	* config/aarch64/aarch64.md (prefetch):
 	Change the predicate of operand 0 to register_operand.
Index: lra-remat.c
===================================================================
--- lra-remat.c	(revision 228250)
+++ lra-remat.c	(working copy)
@@ -432,6 +432,16 @@ operand_to_remat (rtx_insn *insn)
 	  return -1;
 	found_reg = reg;
       }
+    /* IRA calculates conflicts separately for subregs of two words
+       pseudo.  Even if the pseudo lives, e.g. one its subreg can be
+       used lately, another subreg hard register can be already used
+       for something else.  In such case, it is not safe to
+       rematerialize the insn.  */
+    else if (reg->type == OP_IN && reg->subreg_p
+	     && reg->regno >= FIRST_PSEUDO_REGISTER
+	     && (GET_MODE_SIZE (PSEUDO_REGNO_MODE (reg->regno))
+		 == 2 * UNITS_PER_WORD))
+      return -1;
   if (found_reg == NULL)
     return -1;
   if (found_reg->regno < FIRST_PSEUDO_REGISTER)
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 228250)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2015-09-29  Vladimir Makarov  <vmaka...@redhat.com>
+
+	Backport from mainline
+	2015-07-21  Vladimir Makarov  <vmaka...@redhat.com>
+
+	PR ipa/66424.
+	* gcc.target/i386/pr66424.c: New.
+
 2015-09-29  Andreas Krebbel  <kreb...@linux.vnet.ibm.com>
 
 	Backport from mainline

Reply via email to