re PR target/70302 (crash on valid code at -O2 and -O3 in 32-bit mode on x86_64-linux...
authorIlya Enkovich <enkovich.gnu@gmail.com>
Tue, 22 Mar 2016 19:00:14 +0000 (19:00 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 22 Mar 2016 19:00:14 +0000 (13:00 -0600)
2016-03-22  Ilya Enkovich  <enkovich.gnu@gmail.com>

PR target/70302
* config/i386/i386.c (scalar_chain::convert_op): Support
uninitialized register usage case.

PR target/70302
* gcc.target/i386/pr70302.c: New test.

From-SVN: r234406

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr70302.c [new file with mode: 0644]

index 92391ef..6848496 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-22  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR target/70302
+       * config/i386/i386.c (scalar_chain::convert_op): Support
+       uninitialized register usage case.
+
 2016-03-22  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/70251
index f325831..1639704 100644 (file)
@@ -3409,6 +3409,20 @@ scalar_chain::convert_op (rtx *op, rtx_insn *insn)
        fprintf (dump_file, "  Preloading operand for insn %d into r%d\n",
                 INSN_UID (insn), REGNO (tmp));
     }
+  else if (REG_P (*op))
+    {
+      /* We may have not converted register usage in case
+        this register has no definition.  Otherwise it
+        should be converted in convert_reg.  */
+      df_ref ref;
+      FOR_EACH_INSN_USE (ref, insn)
+       if (DF_REF_REGNO (ref) == REGNO (*op))
+         {
+           gcc_assert (!DF_REF_CHAIN (ref));
+           break;
+         }
+      *op = gen_rtx_SUBREG (V2DImode, *op, 0);
+    }
   else
     {
       gcc_assert (SUBREG_P (*op));
index 00c8262..43217b8 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-22  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR target/70302
+       * gcc.target/i386/pr70302.c: New test.
+
 2016-03-22  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/70251
diff --git a/gcc/testsuite/gcc.target/i386/pr70302.c b/gcc/testsuite/gcc.target/i386/pr70302.c
new file mode 100644 (file)
index 0000000..9b82a0c
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+long a, c, e;
+int b, d;
+unsigned long long f;
+
+extern void fn2 (const char *, int, int, int);
+
+void
+fn1(long long p1)
+{
+  unsigned long long g;
+  int i;
+  for (; i;)
+    if (e)
+      g = c;
+  if (a)
+    f = p1;
+  if (!f && !g)
+    fn2("", b, d, d);
+}