re PR rtl-optimization/85342 (ICE: SIGSEGV in copyprop_hardreg_forward_1 (regcprop...
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Apr 2018 08:39:50 +0000 (10:39 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 12 Apr 2018 08:39:50 +0000 (10:39 +0200)
PR rtl-optimization/85342
* regcprop.c (copyprop_hardreg_forward_1): Remove replaced array, use
a bool scalar var inside of the loop instead.  Don't try to update
recog_data.operand after failed apply_change_group.

* gcc.target/i386/pr85342.c: New test.

From-SVN: r259338

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

index c4d0882950ab0e1cd27a9bdb861226431d621a4d..469c6ff5649dd079e487c7d2109413b061aad622 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/85342
+       * regcprop.c (copyprop_hardreg_forward_1): Remove replaced array, use
+       a bool scalar var inside of the loop instead.  Don't try to update
+       recog_data.operand after failed apply_change_group.
+
 2018-04-12  Tom de Vries  <tom@codesourcery.com>
 
        PR target/85296
index e2a78a2b0e15f779599b33961c6867fdd39c1207..a664f76a8b0fe7667a63895ee79ad663b7624e9c 100644 (file)
@@ -751,7 +751,6 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
       bool is_asm, any_replacements;
       rtx set;
       rtx link;
-      bool replaced[MAX_RECOG_OPERANDS];
       bool changed = false;
       struct kill_set_value_data ksvd;
 
@@ -934,7 +933,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
         eldest live copy that's in an appropriate register class.  */
       for (i = 0; i < n_ops; i++)
        {
-         replaced[i] = false;
+         bool replaced = false;
 
          /* Don't scan match_operand here, since we've no reg class
             information to pass down.  Any operands that we could
@@ -951,26 +950,26 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
          if (recog_data.operand_type[i] == OP_IN)
            {
              if (op_alt[i].is_address)
-               replaced[i]
+               replaced
                  = replace_oldest_value_addr (recog_data.operand_loc[i],
                                               alternative_class (op_alt, i),
                                               VOIDmode, ADDR_SPACE_GENERIC,
                                               insn, vd);
              else if (REG_P (recog_data.operand[i]))
-               replaced[i]
+               replaced
                  = replace_oldest_value_reg (recog_data.operand_loc[i],
                                              alternative_class (op_alt, i),
                                              insn, vd);
              else if (MEM_P (recog_data.operand[i]))
-               replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
-                                                       insn, vd);
+               replaced = replace_oldest_value_mem (recog_data.operand[i],
+                                                    insn, vd);
            }
          else if (MEM_P (recog_data.operand[i]))
-           replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
-                                                   insn, vd);
+           replaced = replace_oldest_value_mem (recog_data.operand[i],
+                                                insn, vd);
 
          /* If we performed any replacement, update match_dups.  */
-         if (replaced[i])
+         if (replaced)
            {
              int j;
              rtx new_rtx;
@@ -989,13 +988,6 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
        {
          if (! apply_change_group ())
            {
-             for (i = 0; i < n_ops; i++)
-               if (replaced[i])
-                 {
-                   rtx old = *recog_data.operand_loc[i];
-                   recog_data.operand[i] = old;
-                 }
-
              if (dump_file)
                fprintf (dump_file,
                         "insn %u: reg replacements not verified\n",
index 578e73b15e8c46c3692aea306c3bacb49b92d94f..7d28a2b818db9037b5e1c0cbc498b6812f5a855b 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/85342
+       * gcc.target/i386/pr85342.c: New test.
+
 2018-04-11  Jason Merrill  <jason@redhat.com>
 
        * lib/asan-dg.exp (check_effective_target_fsanitize_address): False
diff --git a/gcc/testsuite/gcc.target/i386/pr85342.c b/gcc/testsuite/gcc.target/i386/pr85342.c
new file mode 100644 (file)
index 0000000..941e9d4
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR rtl-optimization/85342 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -mavx512vl" } */
+
+typedef unsigned char U __attribute__((vector_size (64)));
+typedef unsigned int V __attribute__((vector_size (64)));
+typedef unsigned __int128 W __attribute__((vector_size (64)));
+int i;
+V g, h, z, k, l, m;
+U j;
+
+W
+bar (W o, W p)
+{
+  U q;
+  o |= (W){q[0]} >= o;
+  o += 1 < o;
+  j |= (U){} == j;
+  return i + (W)q + (W)g + (W)h + (W)z + o + (W)j + (W)k + (W)l + (W)m + p;
+}
+
+W
+foo (U u)
+{
+  U q;
+  W r = bar ((W)(U){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ~0}, (W)q);
+  u += (U)bar ((W){~0}, r);
+  return (W)u;
+}