Free dominance info at the beginning of pass_jump_after_combine
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 12 Nov 2019 14:24:35 +0000 (14:24 +0000)
committerIlya Leoshkevich <iii@gcc.gnu.org>
Tue, 12 Nov 2019 14:24:35 +0000 (14:24 +0000)
try_forward_edges does not update dominance info, and merge_blocks
relies on it being up-to-date.  In PR92430 stale dominance info makes
merge_blocks produce a loop in the dominator tree, which in turn makes
delete_basic_block loop forever.

Fix by freeing dominance info at the beginning of cleanup_cfg.

gcc/ChangeLog:

2019-11-12  Ilya Leoshkevich  <iii@linux.ibm.com>

PR rtl-optimization/92430
* cfgcleanup.c (pass_jump_after_combine::execute): Free
dominance info at the beginning.

gcc/testsuite/ChangeLog:

2019-11-12  Ilya Leoshkevich  <iii@linux.ibm.com>

PR rtl-optimization/92430
* gcc.dg/pr92430.c: New test (from Arseny Solokha).

From-SVN: r278095

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr92430.c [new file with mode: 0644]

index 29641f09e7f4bac54c8c2023ecd9f24f3d06f234..7f5c00255d1bbfa9ab7dcb6ad5b862527372bf0d 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-12  Ilya Leoshkevich  <iii@linux.ibm.com>
+
+       PR rtl-optimization/92430
+       * cfgcleanup.c (pass_jump_after_combine::execute): Free
+       dominance info at the beginning.
+
 2019-11-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92460
index 6539d9364c47ec71238db020712a7277ec751174..7f388258e10cd0c7f3d73d72d5a5e5c9877b05a3 100644 (file)
@@ -3311,6 +3311,8 @@ public:
 unsigned int
 pass_jump_after_combine::execute (function *)
 {
+  /* Jump threading does not keep dominators up-to-date.  */
+  free_dominance_info (CDI_DOMINATORS);
   cleanup_cfg (flag_thread_jumps ? CLEANUP_THREADING : 0);
   return 0;
 }
index 3fa8d213b3a41598966a88c62b11805dbe9af760..f9d59b018bc3a63ca86e878df3655d87db5bae0b 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-12  Ilya Leoshkevich  <iii@linux.ibm.com>
+
+       PR rtl-optimization/92430
+       * gcc.dg/pr92430.c: New test (from Arseny Solokha).
+
 2019-11-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92461
diff --git a/gcc/testsuite/gcc.dg/pr92430.c b/gcc/testsuite/gcc.dg/pr92430.c
new file mode 100644 (file)
index 0000000..9156068
--- /dev/null
@@ -0,0 +1,25 @@
+// PR rtl-optimization/92430
+// { dg-do compile }
+// { dg-options "-Os -fno-if-conversion -fno-tree-dce -fno-tree-loop-optimize -fno-tree-vrp" }
+
+int eb, ko;
+
+void
+e9 (int pe, int lx)
+{
+  int ir;
+
+  for (ir = 0; ir < 1; ++ir)
+    {
+      for (ko = 0; ko < 1; ++ko)
+        {
+          for (eb = 0; eb < 1; ++eb)
+            ko += pe;
+
+          for (ko = 0; ko < 1; ++ko)
+            ;
+        }
+
+      pe = ir = lx;
+    }
+}