From 8bad0ced9fad845ef61bb3e27c38d004e0ab6d0f Mon Sep 17 00:00:00 2001 From: Andrey Belevantsev Date: Mon, 1 Apr 2019 19:32:24 +0300 Subject: [PATCH] sel-sched: update liveness in redirect_edge_and_branch hooks (PR 86928) 2019-04-01 Andrey Belevantsev 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 | 7 +++++++ gcc/sel-sched-ir.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr86928.c | 25 +++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr86928.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5016bd26c21..9afd09bd7d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-04-01 Andrey Belevantsev + + 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 PR rtl-optimization/89865 diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index a6583017c9d..6dec1beaa04 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6fd174640d3..d194f4d88d4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-01 Andrey Belevantsev + + PR rtl-optimization/86928 + * gcc.dg/pr86928.c: New test. + 2019-04-01 Andrey Belevantsev PR rtl-optimization/87273 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; + } +} -- 2.30.2