From e2d3e85c877af1cdade1dbbb95955c31932caa87 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Tue, 12 Nov 2019 14:24:35 +0000 Subject: [PATCH] Free dominance info at the beginning of pass_jump_after_combine 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 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 PR rtl-optimization/92430 * gcc.dg/pr92430.c: New test (from Arseny Solokha). From-SVN: r278095 --- gcc/ChangeLog | 6 ++++++ gcc/cfgcleanup.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr92430.c | 25 +++++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr92430.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29641f0..7f5c002 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-12 Ilya Leoshkevich + + PR rtl-optimization/92430 + * cfgcleanup.c (pass_jump_after_combine::execute): Free + dominance info at the beginning. + 2019-11-12 Richard Biener PR tree-optimization/92460 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 6539d93..7f38825 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3fa8d21..f9d59b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-12 Ilya Leoshkevich + + PR rtl-optimization/92430 + * gcc.dg/pr92430.c: New test (from Arseny Solokha). + 2019-11-12 Richard Biener PR tree-optimization/92461 diff --git a/gcc/testsuite/gcc.dg/pr92430.c b/gcc/testsuite/gcc.dg/pr92430.c new file mode 100644 index 0000000..9156068 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr92430.c @@ -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; + } +} -- 2.7.4