sel-sched: update liveness in redirect_edge_and_branch hooks (PR 86928)
authorAndrey Belevantsev <abel@ispras.ru>
Mon, 1 Apr 2019 16:32:24 +0000 (19:32 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Mon, 1 Apr 2019 16:32:24 +0000 (19:32 +0300)
2019-04-01  Andrey Belevantsev  <abel@ispras.ru>

PR rtl-optimization/86928
* sel-sched-ir.c (sel_redirect_edge_and_branch_force): Invoke
compute_live if necessary.
(sel_redirect_edge_and_branch): Likewise.

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

From-SVN: r270061

gcc/ChangeLog
gcc/sel-sched-ir.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr86928.c [new file with mode: 0644]

index 5016bd26c2136d2f3413be1479046c54b6d79251..9afd09bd7d9421f6fcb10e91eee0d3c9fed8ecae 100644 (file)
@@ -1,3 +1,10 @@
+2019-04-01  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/86928
+       * sel-sched-ir.c (sel_redirect_edge_and_branch_force): Invoke
+       compute_live if necessary.
+       (sel_redirect_edge_and_branch): Likewise.
+
 2019-04-01  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/89865
index a6583017c9d49deed7928b09a71dd0007aabe9f6..6dec1beaa04632e05c70ec1251416ce0ffeae5f4 100644 (file)
@@ -5637,6 +5637,8 @@ sel_redirect_edge_and_branch_force (edge e, basic_block to)
                           recompute_dominator (CDI_DOMINATORS, to));
   set_immediate_dominator (CDI_DOMINATORS, orig_dest,
                           recompute_dominator (CDI_DOMINATORS, orig_dest));
+  if (jump && sel_bb_head_p (jump))
+    compute_live (jump);
 }
 
 /* A wrapper for redirect_edge_and_branch.  Return TRUE if blocks connected by
@@ -5697,6 +5699,8 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
       set_immediate_dominator (CDI_DOMINATORS, orig_dest,
                                recompute_dominator (CDI_DOMINATORS, orig_dest));
     }
+  if (jump && sel_bb_head_p (jump))
+    compute_live (jump);
   return recompute_toporder_p;
 }
 
index 6fd174640d3be331836dc626798daa1f0e5a8065..d194f4d88d41e5fc2cc183848971f5a4e3f16402 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-01  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/86928
+       * gcc.dg/pr86928.c: New test.
+
 2019-04-01  Andrey Belevantsev  <abel@ispras.ru>
 
        PR rtl-optimization/87273
diff --git a/gcc/testsuite/gcc.dg/pr86928.c b/gcc/testsuite/gcc.dg/pr86928.c
new file mode 100644 (file)
index 0000000..1586a36
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fnon-call-exceptions -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fselective-scheduling -fno-if-conversion -fno-tree-dce -w" } */
+/* { dg-additional-options "-m32" { target powerpc*-*-* } } */
+
+int kn;
+
+void
+gd (short int sk)
+{
+  char *as;
+
+  while (sk < 1)
+    {
+      char *ci;
+
+      if (*ci == 0)
+        *as += ci;
+
+      for (kn = 0; kn < 18; ++kn)
+        {
+        }
+
+      ++sk;
+    }
+}