diff mbox series

[committed] sel-sched: update liveness in redirect_edge_and_branch hooks (PR 86928)

Message ID alpine.LNX.2.20.13.1904011929420.10215@monopod.intra.ispras.ru
State New
Headers show
Series [committed] sel-sched: update liveness in redirect_edge_and_branch hooks (PR 86928) | expand

Commit Message

Alexander Monakov April 1, 2019, 4:32 p.m. UTC
Hi,

This patch by Andrey fixes PR 86928 by avoiding leaving basic blocks without
computed liveness info.

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.

Comments

Alexander Monakov April 2, 2019, 11:03 a.m. UTC | #1
PR 89916 points out that the new test fails when -m32 is not supported, and
I see other tests don't try to add -m32, so I'm removing it.

        PR testsuite/89916
        * gcc.dg/pr86928.c: Do not attempt to add -m32.

--- testsuite/gcc.dg/pr86928.c  (revision 270061)
+++ testsuite/gcc.dg/pr86928.c  (working copy)
@@ -1,6 +1,5 @@
 /* { 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;
diff mbox series

Patch

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index e8e508ef692..2f76e56ca8e 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -5642,6 +5642,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
@@ -5702,6 +5704,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;
 }

diff --git a/gcc/testsuite/gcc.dg/pr86928.c b/gcc/testsuite/gcc.dg/pr86928.c
new file mode 100644
index 00000000000..1586a36f945
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86928.c
@@ -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;
+    }
+}