From 50f78bded40cb2b7d44480d8ac6d0e483631ade7 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Wed, 11 Apr 2018 13:40:07 +0300 Subject: [PATCH] sel-sched: run cleanup_cfg just before loop_optimizer_init (PR 84659) PR rtl-optimization/85659 * sel-sched-ir.c (sel_init_pipelining): Invoke cleanup_cfg. testsuite/ * gcc.dg/pr84659.c: New test. From-SVN: r259313 --- gcc/ChangeLog | 5 +++++ gcc/sel-sched-ir.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr84659.c | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr84659.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed58fc2afc9..d70b106ade4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-11 Alexander Monakov + + PR rtl-optimization/85659 + * sel-sched-ir.c (sel_init_pipelining): Invoke cleanup_cfg. + 2018-04-11 Jakub Jelinek PR debug/85302 diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index ee970522890..50a7daafba6 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgrtl.h" #include "cfganal.h" #include "cfgbuild.h" +#include "cfgcleanup.h" #include "insn-config.h" #include "insn-attr.h" #include "recog.h" @@ -6121,6 +6122,9 @@ make_regions_from_loop_nest (struct loop *loop) void sel_init_pipelining (void) { + /* Remove empty blocks: their presence can break assumptions elsewhere, + e.g. the logic to invoke update_liveness_on_insn in sel_region_init. */ + cleanup_cfg (0); /* Collect loop information to be used in outer loops pipelining. */ loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_FALLTHRU_PREHEADERS diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f8b16a2023..999ce0969f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-11 Alexander Monakov + + PR rtl-optimization/85659 + * gcc.dg/pr84659.c: New test. + 2018-04-11 Jakub Jelinek PR debug/85302 diff --git a/gcc/testsuite/gcc.dg/pr84659.c b/gcc/testsuite/gcc.dg/pr84659.c new file mode 100644 index 00000000000..94c885f3869 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84659.c @@ -0,0 +1,19 @@ +/* PR rtl-optimization/84659 */ +/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fselective-scheduling -fsel-sched-pipelining -fno-split-wide-types -fno-strict-aliasing -fno-tree-dce" } */ + +void +jk (int **lq, int *k4, long long int qv, int od) +{ + while (**lq < 1) + { + int uo; + + uo = ((od == 0) ? qv : *k4) != 1; + ++**lq; + } + + for (;;) + { + } +} -- 2.30.2