diff mbox series

patch to fix PR91223

Message ID 55e7c0c1-1f46-3d89-b181-bdc48633654b@redhat.com
State New
Headers show
Series patch to fix PR91223 | expand

Commit Message

Vladimir Makarov July 25, 2019, 6:37 p.m. UTC
The following patch fixes

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

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

Committed as rev. 273810.
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 273809)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2019-07-25  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/91223
+	* lra-constraints.c (process_alt_operands): Fail for unsuccessful
+	matching with INOUT operand.
+
 2019-07-25  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* stmt.c (expand_case): Try to narrow the index type if it's larger
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 273809)
+++ lra-constraints.c	(working copy)
@@ -2171,6 +2171,14 @@  process_alt_operands (int only_alternati
 		      }
 		    else
 		      {
+			/* If the operands do not match and one
+			   operand is INOUT, we can not match them.
+			   Try other possibilities, e.g. other
+			   alternatives or commutative operand
+			   exchange.  */
+			if (curr_static_id->operand[nop].type == OP_INOUT
+			    || curr_static_id->operand[m].type == OP_INOUT)
+			  break;
 			/* Operands don't match.  If the operands are
 			   different user defined explicit hard
 			   registers, then we cannot make them match
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 273809)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2019-07-25  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/91223
+	* gcc.target/i386/pr91223.c: New test.
+
 2019-07-25  Iain Sandoe  <iain@sandoe.co.uk>
 
 	PR gcov-profile/91087
Index: testsuite/gcc.target/i386/pr91223.c
===================================================================
--- testsuite/gcc.target/i386/pr91223.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr91223.c	(working copy)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Og -fno-tree-fre" } */
+int a;
+void fn2(short, short);
+
+void fn1(void) {
+  short b[8];
+  b[0] |= a & 3;
+  b[1] = a;
+  fn2(b[0], b[1]);
+}