public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to fix PR55512
@ 2012-11-28 17:43 Vladimir Makarov
  2012-11-29  8:35 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Makarov @ 2012-11-28 17:43 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

   The following patch fixes

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55512

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

   Committed as rev. 193901.

2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/55512
         * lra-assigns.c (assign_by_spills): Assigned arbitrary hard regs
         to failed reload pseudos instead of changing asm pattern.
         * lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Increase
         value.

2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/55512
         * gcc.target/i386/pr55512-[1234].c: New tests.


[-- Attachment #2: pr55512.patch --]
[-- Type: text/plain, Size: 4711 bytes --]

Index: lra-assigns.c
===================================================================
--- lra-assigns.c	(revision 193871)
+++ lra-assigns.c	(working copy)
@@ -1220,8 +1220,17 @@ assign_by_spills (void)
 
 	  bitmap_initialize (&failed_reload_insns, &reg_obstack);
 	  for (i = 0; i < nfails; i++)
-	    bitmap_ior_into (&failed_reload_insns,
-			     &lra_reg_info[sorted_pseudos[i]].insn_bitmap);
+	    {
+	      regno = sorted_pseudos[i];
+	      bitmap_ior_into (&failed_reload_insns,
+			       &lra_reg_info[regno].insn_bitmap);
+	      /* Assign an arbitrary hard register of regno class to
+		 avoid further trouble with the asm insns.  */
+	      bitmap_clear_bit (&all_spilled_pseudos, regno);
+	      assign_hard_regno
+		(ira_class_hard_regs[regno_allocno_class_array[regno]][0],
+		 regno);
+	    }
 	  EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi)
 	    {
 	      insn = lra_insn_recog_data[u]->insn;
@@ -1230,9 +1239,6 @@ assign_by_spills (void)
 		  asm_p = true;
 		  error_for_asm (insn,
 				 "%<asm%> operand has impossible constraints");
-		  /* Avoid further trouble with this insn.	*/
-		  PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
-		  lra_invalidate_insn_data (insn);
 		}
 	    }
 	  lra_assert (asm_p);
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 193870)
+++ lra-constraints.c	(working copy)
@@ -3184,7 +3184,7 @@ loc_equivalence_change_p (rtx *loc)
 
 /* Maximum allowed number of constraint pass iterations after the last
    spill pass.	It is for preventing LRA cycling in a bug case.	 */
-#define MAX_CONSTRAINT_ITERATION_NUMBER 15
+#define MAX_CONSTRAINT_ITERATION_NUMBER 30
 
 /* Maximum number of generated reload insns per an insn.  It is for
    preventing this pass cycling in a bug case.	*/
Index: testsuite/gcc.target/i386/pr55512-1.c
===================================================================
--- testsuite/gcc.target/i386/pr55512-1.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55512-1.c	(working copy)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+	    "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
Index: testsuite/gcc.target/i386/pr55512-2.c
===================================================================
--- testsuite/gcc.target/i386/pr55512-2.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55512-2.c	(working copy)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define __builtin_unreachable() do { } while (0)
+
+int
+foo (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+	    "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
Index: testsuite/gcc.target/i386/pr55512-3.c
===================================================================
--- testsuite/gcc.target/i386/pr55512-3.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55512-3.c	(working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+bar (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+	    "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15),
+	    "r" (x + 16) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
Index: testsuite/gcc.target/i386/pr55512-4.c
===================================================================
--- testsuite/gcc.target/i386/pr55512-4.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55512-4.c	(working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define __builtin_unreachable() do { } while (0)
+
+int
+bar (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+	    "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15),
+	    "r" (x + 16) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patch to fix PR55512
  2012-11-28 17:43 patch to fix PR55512 Vladimir Makarov
@ 2012-11-29  8:35 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2012-11-29  8:35 UTC (permalink / raw)
  To: Vladimir Makarov; +Cc: GCC Patches

On Wed, Nov 28, 2012 at 12:43:15PM -0500, Vladimir Makarov wrote:
>   The following patch fixes
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55512
> 
>   The patch was successfully tested and bootstrapped on x86/x86-64.
> 
>   Committed as rev. 193901.
> 
> 2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>
> 
>         PR rtl-optimization/55512
>         * lra-assigns.c (assign_by_spills): Assigned arbitrary hard regs
>         to failed reload pseudos instead of changing asm pattern.
>         * lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Increase
>         value.
> 
> 2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>
> 
>         PR rtl-optimization/55512
>         * gcc.target/i386/pr55512-[1234].c: New tests.

Thanks, I've tweaked the tests slightly, the #define __builtin_unreachable()
was there just to put 4 different tests for 3 different ICEs into one test.

2012-11-29  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/55512
	* gcc.target/i386/pr55512-2.c: Remove unnecessary define.
	* gcc.target/i386/pr55512-4.c: Likewise.

--- gcc.target/i386/pr55512-2.c	(revision 193922)
+++ gcc.target/i386/pr55512-2.c	(revision 193923)
@@ -1,8 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
 
-#define __builtin_unreachable() do { } while (0)
-
 int
 foo (int x)
 {
@@ -10,7 +8,6 @@ foo (int x)
 	    "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
 	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
 	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab);
-  __builtin_unreachable ();
  lab:
   return 0;
 }
--- gcc.target/i386/pr55512-4.c	(revision 193922)
+++ gcc.target/i386/pr55512-4.c	(revision 193923)
@@ -1,8 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
 
-#define __builtin_unreachable() do { } while (0)
-
 int
 bar (int x)
 {
@@ -11,7 +9,6 @@ bar (int x)
 	    "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
 	    "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15),
 	    "r" (x + 16) : : lab);
-  __builtin_unreachable ();
  lab:
   return 0;
 }


	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-29  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-28 17:43 patch to fix PR55512 Vladimir Makarov
2012-11-29  8:35 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).