diff mbox

Fix RTL checking ICE during LRA remove_scratches (PR middle-end/70326)

Message ID 20160321201923.GH3017@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 21, 2016, 8:19 p.m. UTC
Hi!

An instruction with scratches is deleted during LRA inheritance,
and we ICE because restore_scratches wants to query its
lra_get_insn_recog_data even when it is a NOTE, but insn_extract
doesn't work on notes.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2016-03-21  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/70326
	* lra.c (restore_scratches): Ignore deleted insns.

	* gcc.dg/pr70326.c: New test.


	Jakub

Comments

Jeff Law March 21, 2016, 8:44 p.m. UTC | #1
On 03/21/2016 02:19 PM, Jakub Jelinek wrote:
> Hi!
>
> An instruction with scratches is deleted during LRA inheritance,
> and we ICE because restore_scratches wants to query its
> lra_get_insn_recog_data even when it is a NOTE, but insn_extract
> doesn't work on notes.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2016-03-21  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR middle-end/70326
> 	* lra.c (restore_scratches): Ignore deleted insns.
>
> 	* gcc.dg/pr70326.c: New test.
OK.
jeff
diff mbox

Patch

--- gcc/lra.c.jj	2016-02-19 17:25:37.000000000 +0100
+++ gcc/lra.c	2016-03-21 17:34:54.612924167 +0100
@@ -1967,6 +1967,10 @@  restore_scratches (void)
 
   for (i = 0; scratches.iterate (i, &loc); i++)
     {
+      /* Ignore already deleted insns.  */
+      if (NOTE_P (loc->insn)
+	  && NOTE_KIND (loc->insn) == NOTE_INSN_DELETED)
+	continue;
       if (last != loc->insn)
 	{
 	  last = loc->insn;
--- gcc/testsuite/gcc.dg/pr70326.c.jj	2016-03-21 17:31:23.388761520 +0100
+++ gcc/testsuite/gcc.dg/pr70326.c	2016-03-21 17:31:07.000000000 +0100
@@ -0,0 +1,20 @@ 
+/* PR middle-end/70326 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Og -fno-dce -fno-guess-branch-probability -fschedule-insns -fno-tree-coalesce-vars -fno-tree-dce -w -Wno-psabi" } */
+
+typedef unsigned int A __attribute__ ((vector_size (32)));
+typedef unsigned __int128 B;
+typedef unsigned __int128 C __attribute__ ((vector_size (32)));
+typedef unsigned __int128 D __attribute__ ((vector_size (32)));
+
+void
+foo (B a, D b, A c, A d, C e)
+{
+  b /= (D) {11} | 1;
+  a ^= a <= 10;
+  e *= (C) d;
+  e += (C) ~b;
+  c[0] ^= c[0] <= 0x1234;
+  a = (a >> 1) | (a << 127);
+  b += (D) {45, 123};
+}