re PR tree-optimization/77286 (ICE in fold_convert_loc, at fold-const.c:2248 building...
authorRichard Biener <rguenther@suse.de>
Fri, 19 Aug 2016 07:02:05 +0000 (07:02 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 19 Aug 2016 07:02:05 +0000 (07:02 +0000)
2016-08-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/77286
* tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges):
Deal with virtual PHIs being out-of-order.

* gcc.dg/torture/pr77286.c: New testcase.

From-SVN: r239605

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr77286.c [new file with mode: 0644]
gcc/tree-vect-loop-manip.c

index 65efe1e5513d8d771e36bf30de12ad6661dab043..930663a39d12c373baa89e4a66d66f5057c8747e 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77286
+       * tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges):
+       Deal with virtual PHIs being out-of-order.
+
 2016-08-18  David Malcolm  <dmalcolm@redhat.com>
 
        * doc/invoke.texi (fverbose-asm): Note that source code lines
index dd893ca414ab79f284011f748c765a5067b628ab..4567c7e1f4619b7b24c6c1e8b6fe327afe8b0c04 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77286
+       * gcc.dg/torture/pr77286.c: New testcase.
+
 2016-08-18  David Malcolm  <dmalcolm@redhat.com>
 
        * gcc.dg/verbose-asm-2.c: New test case.
diff --git a/gcc/testsuite/gcc.dg/torture/pr77286.c b/gcc/testsuite/gcc.dg/torture/pr77286.c
new file mode 100644 (file)
index 0000000..0c06100
--- /dev/null
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
+
+typedef float real;
+typedef struct
+{
+  int ngtc;
+  real *ref_t;
+  real *tau_t;
+} t_grpopts;
+typedef struct
+{
+  real T;
+  real xi;
+} t_grp_tcstat;
+typedef struct
+{
+  t_grp_tcstat *tcstat;
+} t_groups;
+extern real *save_calloc ();
+void
+nosehoover_tcoupl (t_grpopts * opts, t_groups * grps, real dt, real SAfactor)
+{
+  static real *Qinv = ((void *) 0);
+  int i;
+  real reft = 0, xit, oldxi;
+  if (Qinv == ((void *) 0))
+    {
+      (Qinv) =
+       save_calloc ("Qinv", "coupling.c", 372, (opts->ngtc),
+                    sizeof (*(Qinv)));
+      for (i = 0; i < opts->ngtc; i++)
+       if ((opts->tau_t[i] > 0))
+         Qinv[i] = 1.0 / opts->tau_t[i];
+    }
+  for (i = 0; (i < opts->ngtc); i++)
+    {
+      reft =
+       (((0.0) >
+         (opts->ref_t[i] * SAfactor)) ? (0.0) : (opts->ref_t[i] * SAfactor));
+      grps->tcstat[i].xi += dt * Qinv[i] * (grps->tcstat[i].T - reft);
+    }
+}
index 90b7df9063d47e1aa35b2a17bd56ecf45eeae6b3..01d6bb1e1bc94cab47fe305f055a6cc287a8ab98 100644 (file)
@@ -735,22 +735,33 @@ slpeel_duplicate_current_defs_from_edges (edge from, edge to)
       gimple *from_phi = gsi_stmt (gsi_from);
       gimple *to_phi = gsi_stmt (gsi_to);
       tree from_arg = PHI_ARG_DEF_FROM_EDGE (from_phi, from);
-      if (TREE_CODE (from_arg) != SSA_NAME)
-       {       
+      tree to_arg = PHI_ARG_DEF_FROM_EDGE (to_phi, to);
+      if (virtual_operand_p (from_arg))
+       {
          gsi_next (&gsi_from);
          continue;
        }
-      tree to_arg = PHI_ARG_DEF_FROM_EDGE (to_phi, to);
-      if (TREE_CODE (to_arg) != SSA_NAME)
-       {       
+      if (virtual_operand_p (to_arg))
+       {
          gsi_next (&gsi_to);
          continue;
        }
-      if (get_current_def (to_arg) == NULL_TREE)
-       set_current_def (to_arg, get_current_def (from_arg));
+      if (TREE_CODE (from_arg) != SSA_NAME)
+       gcc_assert (operand_equal_p (from_arg, to_arg, 0));
+      else
+       {
+         if (get_current_def (to_arg) == NULL_TREE)
+           set_current_def (to_arg, get_current_def (from_arg));
+       }
       gsi_next (&gsi_from);
       gsi_next (&gsi_to);
     }
+
+  gphi *from_phi = get_virtual_phi (from->dest);
+  gphi *to_phi = get_virtual_phi (to->dest);
+  if (from_phi)
+    set_current_def (PHI_ARG_DEF_FROM_EDGE (to_phi, to),
+                    get_current_def (PHI_ARG_DEF_FROM_EDGE (from_phi, from)));
 }