patch to fix PR88560

Message ID d3862882-8cf1-2436-68e7-750629617f5a@redhat.com
State New
Headers show
Series
  • patch to fix PR88560
Related show

Commit Message

Vladimir Makarov Feb. 8, 2019, 7:05 p.m.
The following patch fixes

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

   The patch was bootstrapped and tested on x86-64 and ppc64.  It was 
also tested on ARM by Tamar Christina.  The patch changes expected 
generated code for one test on ppc64 but in a better way.  I'll send a 
patch fixing the test later.

Committed as rev. 268705

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 268704)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2019-02-08  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR middle-end/88560
+	* lra-constraints.c (process_alt_operands): Don't increase reject
+	for memory when offset memory is required.
+
 2019-02-08  Robin Dapp  <rdapp@linux.ibm.com>
 
 	* config/s390/vector.md: Implement vector copysign.
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 268704)
+++ lra-constraints.c	(working copy)
@@ -2796,29 +2796,32 @@  process_alt_operands (int only_alternati
 			      (GET_MODE (op), this_alternative, cl)))))
 		losers++;
 
-	      /* Input reloads can be inherited more often than output
-		 reloads can be removed, so penalize output
-		 reloads.  */
-	      if (!REG_P (op) || curr_static_id->operand[nop].type != OP_IN)
-		{
-		  if (lra_dump_file != NULL)
-		    fprintf
-		      (lra_dump_file,
-		       "            %d Non input pseudo reload: reject++\n",
-		       nop);
-		  reject++;
-		}
-
 	      if (MEM_P (op) && offmemok)
 		addr_losers++;
-	      else if (curr_static_id->operand[nop].type == OP_INOUT)
+	      else
 		{
-		  if (lra_dump_file != NULL)
-		    fprintf
-		      (lra_dump_file,
-		       "            %d Input/Output reload: reject+=%d\n",
-		       nop, LRA_LOSER_COST_FACTOR);
-		  reject += LRA_LOSER_COST_FACTOR;
+		  /* Input reloads can be inherited more often than
+		     output reloads can be removed, so penalize output
+		     reloads.  */
+		  if (!REG_P (op) || curr_static_id->operand[nop].type != OP_IN)
+		    {
+		      if (lra_dump_file != NULL)
+			fprintf
+			  (lra_dump_file,
+			   "            %d Non input pseudo reload: reject++\n",
+			   nop);
+		      reject++;
+		    }
+
+		  if (curr_static_id->operand[nop].type == OP_INOUT)
+		    {
+		      if (lra_dump_file != NULL)
+			fprintf
+			  (lra_dump_file,
+			   "            %d Input/Output reload: reject+=%d\n",
+			   nop, LRA_LOSER_COST_FACTOR);
+		      reject += LRA_LOSER_COST_FACTOR;
+		    }
 		}
 	    }