]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/70771 (ICE on valid code at -O3 on x86_64-linux-gnu in operat...
authorBin Cheng <bin.cheng@arm.com>
Tue, 26 Apr 2016 11:10:47 +0000 (11:10 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Tue, 26 Apr 2016 11:10:47 +0000 (11:10 +0000)
PR tree-optimization/70771
PR tree-optimization/70775
* tree-if-conv.c (if_convertible_phi_p): Remove check on special
virtual PHI nodes.  Delete parameter.
(if_convertible_loop_p_1): Delete argument to above function.
(predicate_all_scalar_phis): Delete code handling single-argument
PHIs.
(tree_if_conversion): Mark and update virtual SSA.

gcc/testsuite/ChangeLog
PR tree-optimization/70771
PR tree-optimization/70775
* gcc.dg/pr70771.c: New test.
* gcc.dg/pr70771.c: New test.

From-SVN: r235436

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr70771.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr70775.c [new file with mode: 0644]
gcc/tree-if-conv.c

index 1907d2b42e66c06661c203a5449cb677bb89be29..3bbdc5b69b74aea5862e961b9bd54a9f26c1ec2d 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-26  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/70771
+       PR tree-optimization/70775
+       * tree-if-conv.c (if_convertible_phi_p): Remove check on special
+       virtual PHI nodes.  Delete parameter.
+       (if_convertible_loop_p_1): Delete argument to above function.
+       (predicate_all_scalar_phis): Delete code handling single-argument
+       PHIs.
+       (tree_if_conversion): Mark and update virtual SSA.
+
 2016-04-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR target/61821
index 65fe0d0945fabcd84e0d666d7125bdada08c3616..da1838c10073c7fbaf75ea1e4d9062022bcb8687 100644 (file)
@@ -1,3 +1,10 @@
+2016-04-26  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/70771
+       PR tree-optimization/70775
+       * gcc.dg/pr70771.c: New test.
+       * gcc.dg/pr70771.c: New test.
+
 2016-04-26  Bernd Schmidt  <bschmidt@redhat.com>
 
        * gcc.target/i386/lzcnt-1.c: Allow a different lzcntw output register.
diff --git a/gcc/testsuite/gcc.dg/pr70771.c b/gcc/testsuite/gcc.dg/pr70771.c
new file mode 100644 (file)
index 0000000..fea0c5a
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b, c, d;
+
+static void
+fn1 ()
+{
+  for (b = 0; b < 1; b++)
+    for (c = 0; c < 1; c++)
+      {
+       if (a)
+         break;
+       b = 1;
+      }
+  for (;;)
+    ;
+}
+
+int
+main ()
+{
+  if (d)
+    fn1 ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr70775.c b/gcc/testsuite/gcc.dg/pr70775.c
new file mode 100644 (file)
index 0000000..290c860
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+struct S
+{
+  int f1;
+  int f2;
+} a;
+
+int b, c, d, e;
+short f;
+
+int
+fn1 (int p1, unsigned p2)
+{
+  return p1 + p2;
+}
+
+void
+fn2 ()
+{
+  struct S g;
+  int h;
+  for (; c; c++)
+    for (f = -3; f < 3; f = fn1 (f, 8))
+      {
+        a.f1 = e;
+        if (b)
+          a = g;
+        else
+          for (; h; h++)
+            d = b;
+      }
+}
index 2d14901316ef18715e569bf9f21832a137e58a6e..744d6f5b8ba62c672ee3c517d84c45ca9a6b0be8 100644 (file)
@@ -640,16 +640,11 @@ phi_convertible_by_degenerating_args (gphi *phi)
    PHI is not if-convertible if:
    - it has more than 2 arguments.
 
-   When we didn't see if-convertible stores, PHI is not
-   if-convertible if:
-   - a virtual PHI is immediately used in another PHI node,
-   - there is a virtual PHI in a BB other than the loop->header.
    When the aggressive_if_conv is set, PHI can have more than
    two arguments.  */
 
 static bool
-if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi,
-                     bool any_mask_load_store)
+if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -669,36 +664,6 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi,
         }
     }
 
-  if (any_mask_load_store)
-    return true;
-
-  /* When there were no if-convertible stores, check
-     that there are no memory writes in the branches of the loop to be
-     if-converted.  */
-  if (virtual_operand_p (gimple_phi_result (phi)))
-    {
-      imm_use_iterator imm_iter;
-      use_operand_p use_p;
-
-      if (bb != loop->header)
-       {
-         if (dump_file && (dump_flags & TDF_DETAILS))
-           fprintf (dump_file, "Virtual phi not on loop->header.\n");
-         return false;
-       }
-
-      FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_phi_result (phi))
-       {
-         if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI
-             && USE_STMT (use_p) != phi)
-           {
-             if (dump_file && (dump_flags & TDF_DETAILS))
-               fprintf (dump_file, "Difficult to handle this virtual phi.\n");
-             return false;
-           }
-       }
-    }
-
   return true;
 }
 
@@ -1405,8 +1370,7 @@ if_convertible_loop_p_1 (struct loop *loop,
       gphi_iterator itr;
 
       for (itr = gsi_start_phis (bb); !gsi_end_p (itr); gsi_next (&itr))
-       if (!if_convertible_phi_p (loop, bb, itr.phi (),
-                                  *any_mask_load_store))
+       if (!if_convertible_phi_p (loop, bb, itr.phi ()))
          return false;
     }
 
@@ -1915,27 +1879,13 @@ predicate_all_scalar_phis (struct loop *loop)
       if (gsi_end_p (phi_gsi))
        continue;
 
-      if (EDGE_COUNT (bb->preds) == 1)
+      gsi = gsi_after_labels (bb);
+      while (!gsi_end_p (phi_gsi))
        {
-         /* Propagate degenerate PHIs.  */
-         for (phi_gsi = gsi_start_phis (bb); !gsi_end_p (phi_gsi);
-              gsi_next (&phi_gsi))
-           {
-             gphi *phi = phi_gsi.phi ();
-             replace_uses_by (gimple_phi_result (phi),
-                              gimple_phi_arg_def (phi, 0));
-           }
-       }
-      else
-       {
-         gsi = gsi_after_labels (bb);
-         while (!gsi_end_p (phi_gsi))
-           {
-             phi = phi_gsi.phi ();
-             predicate_scalar_phi (phi, &gsi);
-             release_phi_node (phi);
-             gsi_next (&phi_gsi);
-           }
+         phi = phi_gsi.phi ();
+         predicate_scalar_phi (phi, &gsi);
+         release_phi_node (phi);
+         gsi_next (&phi_gsi);
        }
 
       set_phi_nodes (bb, NULL);
@@ -2808,11 +2758,8 @@ tree_if_conversion (struct loop *loop)
     }
 
   todo |= TODO_cleanup_cfg;
-  if (any_mask_load_store)
-    {
-      mark_virtual_operands_for_renaming (cfun);
-      todo |= TODO_update_ssa_only_virtuals;
-    }
+  mark_virtual_operands_for_renaming (cfun);
+  todo |= TODO_update_ssa_only_virtuals;
 
  cleanup:
   if (ifc_bbs)