cse.c (cse_main): Free dominance info.
authorIlya Enkovich <ilya.enkovich@intel.com>
Thu, 19 May 2016 13:50:22 +0000 (13:50 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Thu, 19 May 2016 13:50:22 +0000 (13:50 +0000)
gcc/

* cse.c (cse_main): Free dominance info.
(rest_of_handle_cse): Don't free dominance info.
(rest_of_handle_cse2): Likewise.
(rest_of_handle_cse_after_global_opts): Likewise.

gcc/testsuite/

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

From-SVN: r236460

gcc/ChangeLog
gcc/cse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr71148.c [new file with mode: 0644]

index 11c0dc2ec8135df0ee12fa05ac33bf34fba33547..4771d5ae1c7dbd941bfcb668680736e9c09eee91 100644 (file)
@@ -1,3 +1,11 @@
+2016-05-19  Ilya Enkovich  <ilya.enkovich@intel.com>
+
+       PR rtl-optimization/71148
+       * cse.c (cse_main): Free dominance info.
+       (rest_of_handle_cse): Don't free dominance info.
+       (rest_of_handle_cse2): Likewise.
+       (rest_of_handle_cse_after_global_opts): Likewise.
+
 2016-05-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/71056
index 322e35270d816d695871df07e023525078b0f7ab..bce4fb0262e602bc14f8ad77e52224ed30872f98 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6669,6 +6669,10 @@ cse_main (rtx_insn *f ATTRIBUTE_UNUSED, int nregs)
   int *rc_order = XNEWVEC (int, last_basic_block_for_fn (cfun));
   int i, n_blocks;
 
+  /* CSE doesn't use dominane info but can invalidate it in different ways.
+     For simplicity free dominance info here.  */
+  free_dominance_info (CDI_DOMINATORS);
+
   df_set_flags (DF_LR_RUN_DCE);
   df_note_add_problem ();
   df_analyze ();
@@ -7568,9 +7572,6 @@ rest_of_handle_cse (void)
   else if (tem == 1 || optimize > 1)
     cse_cfg_altered |= cleanup_cfg (0);
 
-  if (cse_cfg_altered && dom_info_available_p (CDI_DOMINATORS))
-    free_dominance_info (CDI_DOMINATORS);
-
   return 0;
 }
 
@@ -7640,9 +7641,6 @@ rest_of_handle_cse2 (void)
   else if (tem == 1)
     cse_cfg_altered |= cleanup_cfg (0);
 
-  if (cse_cfg_altered && dom_info_available_p (CDI_DOMINATORS))
-    free_dominance_info (CDI_DOMINATORS);
-
   cse_not_expected = 1;
   return 0;
 }
@@ -7717,9 +7715,6 @@ rest_of_handle_cse_after_global_opts (void)
   else if (tem == 1)
     cse_cfg_altered |= cleanup_cfg (0);
 
-  if (cse_cfg_altered && dom_info_available_p (CDI_DOMINATORS))
-    free_dominance_info (CDI_DOMINATORS);
-
   flag_cse_follow_jumps = save_cfj;
   return 0;
 }
index e8bf513d41f36eb733ef2305e6c1067296c760ef..b071e9f5a05f2180967899e65a57474a041b8ecc 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-19  Ilya Enkovich  <ilya.enkovich@intel.com>
+
+       PR rtl-optimization/71148
+       * gcc.dg/pr71148.c: New test.
+
 2016-05-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/71056
diff --git a/gcc/testsuite/gcc.dg/pr71148.c b/gcc/testsuite/gcc.dg/pr71148.c
new file mode 100644 (file)
index 0000000..6aa4920
--- /dev/null
@@ -0,0 +1,46 @@
+/* PR rtl-optimization/71148 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -funroll-loops" } */
+
+int rh, ok, kq, fu;
+
+void
+js (int cs)
+{
+  rh = fu;
+  if (fu != 0)
+    {
+      cs /= 3;
+      if (cs <= 0)
+        {
+          int z9;
+          for (z9 = 0; z9 < 2; ++z9)
+            {
+              z9 += cs;
+              ok += z9;
+              fu += ok;
+            }
+        }
+    }
+}
+
+void
+vy (int s3)
+{
+  int yo, g2 = 0;
+ sd:
+  js (g2);
+  for (yo = 0; yo < 2; ++yo)
+    {
+      if (fu != 0)
+        goto sd;
+      kq += (s3 != (g2 ? s3 : 0));
+      for (s3 = 0; s3 < 72; ++s3)
+        g2 *= (~0 - 1);
+      g2 -= yo;
+    }
+  for (fu = 0; fu < 18; ++fu)
+    for (yo = 0; yo < 17; ++yo)
+      if (g2 < 0)
+        goto sd;
+}