From 26d4492f61622491f615cbc065f9186b683e76b3 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 2 Oct 2004 02:00:51 +0000 Subject: [PATCH] tree-cfg.c (cleanup_tree_cfg): Speed up by calling delete_unrechable_blocks() only when necessary. * tree-cfg.c (cleanup_tree_cfg): Speed up by calling delete_unrechable_blocks() only when necessary. From-SVN: r88419 --- gcc/ChangeLog | 5 +++++ gcc/tree-cfg.c | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24a1034c76e..9dbb7feec0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-10-02 Kazu Hirata + + * tree-cfg.c (cleanup_tree_cfg): Speed up by calling + delete_unrechable_blocks() only when necessary. + 2004-10-02 P.J. Darcy * gthr-tpf.h (__gthread_recursive_mutex_t): New type. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e047943cb42..6919facd403 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -718,19 +718,29 @@ cleanup_tree_cfg (void) timevar_push (TV_TREE_CLEANUP_CFG); retval = cleanup_control_flow (); + retval |= delete_unreachable_blocks (); - /* These two transformations can cascade, so we iterate on them until - nothing changes. */ + /* thread_jumps() sometimes leaves further transformation + opportunities for itself, so iterate on it until nothing + changes. */ while (something_changed) { - something_changed = delete_unreachable_blocks (); - something_changed |= thread_jumps (); + something_changed = thread_jumps (); + + /* delete_unreachable_blocks() does its job only when + thread_jumps() produces more unreachable blocks. */ + if (something_changed) + delete_unreachable_blocks (); + retval |= something_changed; } #ifdef ENABLE_CHECKING if (retval) - gcc_assert (!cleanup_control_flow ()); + { + gcc_assert (!cleanup_control_flow ()); + gcc_assert (!delete_unreachable_blocks ()); + } #endif /* Merging the blocks creates no new opportunities for the other -- 2.30.2