From bb7ebad1c0f641753ffb60a22d2f3c546c406e1b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 11 Aug 2016 08:49:56 +0000 Subject: [PATCH] tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove unconditional TODO_cleanup_cfg. 2016-08-11 Richard Biener * tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove unconditional TODO_cleanup_cfg. (pass_thread_jumps::execute): Initialize loops, perform a CFG cleanup only if we threaded a jump. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust. From-SVN: r239355 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c | 5 +++-- gcc/tree-ssa-threadbackward.c | 10 +++++++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 491f62d17ab..d8c65cf3e10 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-08-11 Richard Biener + + * tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove + unconditional TODO_cleanup_cfg. + (pass_thread_jumps::execute): Initialize loops, perform a CFG + cleanup only if we threaded a jump. + 2016-08-11 Alan Modra PR target/71680 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b77940bc34c..6798ff8ae48 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-08-11 Richard Biener + + * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust. + 2016-08-11 Alan Modra * gcc.target/powerpc/pr71680.c: New. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c index 1a4089fcdfd..9a9d1cb7cf7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c @@ -1,8 +1,9 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */ +/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */ /* { dg-final { scan-tree-dump "Jumps threaded: 16" "thread1" } } */ -/* { dg-final { scan-tree-dump "Jumps threaded: 6" "thread2" } } */ +/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" } } */ /* { dg-final { scan-tree-dump "Jumps threaded: 3" "thread3" } } */ +/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2" } } */ /* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" } } */ /* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp2" } } */ diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index e05669f8147..506078f2358 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -674,7 +674,7 @@ const pass_data pass_data_thread_jumps = 0, 0, 0, - ( TODO_cleanup_cfg | TODO_update_ssa ), + TODO_update_ssa, }; class pass_thread_jumps : public gimple_opt_pass @@ -699,6 +699,8 @@ pass_thread_jumps::gate (function *fun ATTRIBUTE_UNUSED) unsigned int pass_thread_jumps::execute (function *fun) { + loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES); + /* Try to thread each block with more than one successor. */ basic_block bb; FOR_EACH_BB_FN (bb, fun) @@ -706,8 +708,10 @@ pass_thread_jumps::execute (function *fun) if (EDGE_COUNT (bb->succs) > 1) find_jump_threads_backwards (bb); } - thread_through_all_blocks (true); - return 0; + bool changed = thread_through_all_blocks (true); + + loop_optimizer_finalize (); + return changed ? TODO_cleanup_cfg : 0; } } -- 2.30.2